@plune-ai/cairn 0.4.2 → 0.5.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 +49 -261
- package/dist/agent/graph.d.ts +24 -0
- package/dist/agent/graph.d.ts.map +1 -1
- package/dist/agent/graph.js +74 -2
- package/dist/agent/graph.js.map +1 -1
- package/dist/agent/index.d.ts +12 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +101 -3
- package/dist/agent/index.js.map +1 -1
- package/dist/artifacts/index.d.ts +21 -0
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +58 -1
- package/dist/artifacts/index.js.map +1 -1
- package/dist/artifacts/report.d.ts +8 -0
- package/dist/artifacts/report.d.ts.map +1 -1
- package/dist/artifacts/report.js +47 -0
- package/dist/artifacts/report.js.map +1 -1
- package/dist/browser/backends/playwright-lib.d.ts +12 -0
- package/dist/browser/backends/playwright-lib.d.ts.map +1 -1
- package/dist/browser/backends/playwright-lib.js +48 -3
- package/dist/browser/backends/playwright-lib.js.map +1 -1
- package/dist/browser/recovery.d.ts +42 -0
- package/dist/browser/recovery.d.ts.map +1 -0
- package/dist/browser/recovery.js +62 -0
- package/dist/browser/recovery.js.map +1 -0
- package/dist/browser/types.d.ts +7 -0
- package/dist/browser/types.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +20 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/codegen/journey-setup.d.ts +14 -0
- package/dist/codegen/journey-setup.d.ts.map +1 -0
- package/dist/codegen/journey-setup.js +69 -0
- package/dist/codegen/journey-setup.js.map +1 -0
- package/dist/core/modalities/explore.d.ts.map +1 -1
- package/dist/core/modalities/explore.js +10 -0
- package/dist/core/modalities/explore.js.map +1 -1
- package/dist/design/critique.d.ts +86 -0
- package/dist/design/critique.d.ts.map +1 -0
- package/dist/design/critique.js +62 -0
- package/dist/design/critique.js.map +1 -0
- package/dist/design/schema.d.ts +74 -0
- package/dist/design/schema.d.ts.map +1 -1
- package/dist/design/schema.js +22 -0
- package/dist/design/schema.js.map +1 -1
- package/dist/design/style.d.ts +18 -0
- package/dist/design/style.d.ts.map +1 -0
- package/dist/design/style.js +34 -0
- package/dist/design/style.js.map +1 -0
- package/dist/eval/coverage.d.ts +49 -0
- package/dist/eval/coverage.d.ts.map +1 -0
- package/dist/eval/coverage.js +60 -0
- package/dist/eval/coverage.js.map +1 -0
- package/dist/eval/gap-cases.d.ts +21 -0
- package/dist/eval/gap-cases.d.ts.map +1 -0
- package/dist/eval/gap-cases.js +27 -0
- package/dist/eval/gap-cases.js.map +1 -0
- package/dist/eval/legend.d.ts +3 -3
- package/dist/eval/legend.js +3 -3
- package/dist/eval/pilot.d.ts +4 -1
- package/dist/eval/pilot.d.ts.map +1 -1
- package/dist/eval/pilot.js +9 -2
- package/dist/eval/pilot.js.map +1 -1
- package/dist/flow/crawl.d.ts +66 -0
- package/dist/flow/crawl.d.ts.map +1 -0
- package/dist/flow/crawl.js +0 -0
- package/dist/flow/crawl.js.map +1 -0
- package/dist/flow/journey.d.ts +25 -0
- package/dist/flow/journey.d.ts.map +1 -0
- package/dist/flow/journey.js +51 -0
- package/dist/flow/journey.js.map +1 -0
- package/dist/flow/setup.d.ts +85 -0
- package/dist/flow/setup.d.ts.map +1 -0
- package/dist/flow/setup.js +65 -0
- package/dist/flow/setup.js.map +1 -0
- package/dist/llm/schema-lint.d.ts +9 -0
- package/dist/llm/schema-lint.d.ts.map +1 -0
- package/dist/llm/schema-lint.js +42 -0
- package/dist/llm/schema-lint.js.map +1 -0
- package/dist/observe/parse-aria.d.ts.map +1 -1
- package/dist/observe/parse-aria.js +11 -2
- package/dist/observe/parse-aria.js.map +1 -1
- package/dist/prompts/local/index.d.ts.map +1 -1
- package/dist/prompts/local/index.js +8 -0
- package/dist/prompts/local/index.js.map +1 -1
- package/dist/prompts/local/pilot-review.d.ts +1 -1
- package/dist/prompts/local/pilot-review.d.ts.map +1 -1
- package/dist/prompts/local/pilot-review.js +2 -1
- package/dist/prompts/local/pilot-review.js.map +1 -1
- package/dist/prompts/local/qa-case-critique.d.ts +8 -0
- package/dist/prompts/local/qa-case-critique.d.ts.map +1 -0
- package/dist/prompts/local/qa-case-critique.js +34 -0
- package/dist/prompts/local/qa-case-critique.js.map +1 -0
- package/dist/prompts/local/qa-gap-cases.d.ts +7 -0
- package/dist/prompts/local/qa-gap-cases.d.ts.map +1 -0
- package/dist/prompts/local/qa-gap-cases.js +22 -0
- package/dist/prompts/local/qa-gap-cases.js.map +1 -0
- package/dist/prompts/local/qa-journey-from-flow.d.ts +7 -0
- package/dist/prompts/local/qa-journey-from-flow.d.ts.map +1 -0
- package/dist/prompts/local/qa-journey-from-flow.js +29 -0
- package/dist/prompts/local/qa-journey-from-flow.js.map +1 -0
- package/dist/prompts/local/qa-setup-planner.d.ts +6 -0
- package/dist/prompts/local/qa-setup-planner.d.ts.map +1 -0
- package/dist/prompts/local/qa-setup-planner.js +28 -0
- package/dist/prompts/local/qa-setup-planner.js.map +1 -0
- package/dist/safety/guardrails.d.ts +36 -0
- package/dist/safety/guardrails.d.ts.map +1 -0
- package/dist/safety/guardrails.js +60 -0
- package/dist/safety/guardrails.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { BrowserGateway } from "../browser/gateway.js";
|
|
2
|
+
import type { VerifiedElement } from "../browser/types.js";
|
|
3
|
+
import type { PageStudy } from "../observe/index.js";
|
|
4
|
+
import type { Transition } from "../probe/index.js";
|
|
5
|
+
import type { JourneyCase } from "../design/schema.js";
|
|
6
|
+
import type { SetupPlan } from "./setup.js";
|
|
7
|
+
/** One studied page in the flow graph. */
|
|
8
|
+
export interface FlowNode {
|
|
9
|
+
url: string;
|
|
10
|
+
study: PageStudy;
|
|
11
|
+
verified: VerifiedElement[];
|
|
12
|
+
/** Observed safe transitions on this page (empty for crawled nodes — kept lean for cost). */
|
|
13
|
+
transitions: Transition[];
|
|
14
|
+
}
|
|
15
|
+
/** An observed navigation between two pages (a link click that changed the URL). */
|
|
16
|
+
export interface FlowEdge {
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
via: {
|
|
20
|
+
ref: string;
|
|
21
|
+
role: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** The app's page/flow graph: studied pages + observed transitions between them. */
|
|
26
|
+
export interface FlowGraph {
|
|
27
|
+
nodes: FlowNode[];
|
|
28
|
+
edges: FlowEdge[];
|
|
29
|
+
}
|
|
30
|
+
export interface CrawlDeps {
|
|
31
|
+
gateway: BrowserGateway;
|
|
32
|
+
onProgress?: (event: string) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* #59 — follow in-app navigation from a start page to build the page/flow graph (nodes = studied
|
|
36
|
+
* pages, edges = observed transitions). No LLM — pure browser mechanics over the gateway, reusing the
|
|
37
|
+
* gateway's storageState across pages. Bounded by `maxPages`; destructive/external links are skipped.
|
|
38
|
+
*
|
|
39
|
+
* Per link: re-observe the source page (so its refs are valid again), click the link, observe where it
|
|
40
|
+
* lands. A new in-app URL becomes a node (studied + verified); a revisit only records the edge.
|
|
41
|
+
*/
|
|
42
|
+
export declare function crawlFlow(start: FlowNode, deps: CrawlDeps, opts: {
|
|
43
|
+
maxPages: number;
|
|
44
|
+
}): Promise<FlowGraph>;
|
|
45
|
+
/**
|
|
46
|
+
* Per-page snapshot directory for a flow node (#103): `snapshots/<index>-<slug>`. The index prefix keeps
|
|
47
|
+
* directories unique even when two URLs slugify the same. Single source of truth for the artifact writer
|
|
48
|
+
* and the report.json reference, so they can't drift.
|
|
49
|
+
*/
|
|
50
|
+
export declare function flowSnapshotPath(index: number, url: string): string;
|
|
51
|
+
/** Compact flow payload for report.json — pages + edges + journeys (+ setup), WITHOUT screenshots/ARIA. */
|
|
52
|
+
export interface FlowReport {
|
|
53
|
+
/** Per page: url, interactive-element count, and the dir holding its persisted aria/screenshot (#103). */
|
|
54
|
+
pages: {
|
|
55
|
+
url: string;
|
|
56
|
+
interactive: number;
|
|
57
|
+
snapshot: string;
|
|
58
|
+
}[];
|
|
59
|
+
edges: FlowEdge[];
|
|
60
|
+
journeys: JourneyCase[];
|
|
61
|
+
/** #60: per-journey structured setup plans (omitted when setup didn't run). */
|
|
62
|
+
setup?: SetupPlan[];
|
|
63
|
+
}
|
|
64
|
+
/** Build the report.json `flow` block (undefined when no crawl happened). Pure — unit-testable. */
|
|
65
|
+
export declare function flowReportPayload(graph?: FlowGraph, journeys?: JourneyCase[], setupPlans?: SetupPlan[]): FlowReport | undefined;
|
|
66
|
+
//# sourceMappingURL=crawl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../../src/flow/crawl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,0CAA0C;AAC1C,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,6FAA6F;IAC7F,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,oFAAoF;AACpF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAA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EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM;YAC3E,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC;SACrC,CAAC,CAAC;QACH,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,QAAQ,IAAI,EAAE;QACxB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StructuredInvoke } from "../llm/structured.js";
|
|
2
|
+
import type { PromptRegistry } from "../prompts/index.js";
|
|
3
|
+
import { type DesignedJourney, type JourneyCase } from "../design/schema.js";
|
|
4
|
+
import type { FlowGraph } from "./crawl.js";
|
|
5
|
+
/**
|
|
6
|
+
* Per-page grounding (anti-hallucination): each step keeps only the refs that actually exist on
|
|
7
|
+
* THAT step's page. Mirrors `designTestCases` ref filtering, but page-aware for journeys.
|
|
8
|
+
*/
|
|
9
|
+
export declare function groundJourney(j: DesignedJourney, refsByPage: Map<string, Set<string>>): DesignedJourney;
|
|
10
|
+
export interface JourneyInput {
|
|
11
|
+
graph: FlowGraph;
|
|
12
|
+
/** Case language (default "English"). */
|
|
13
|
+
language?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface JourneyDeps {
|
|
16
|
+
invoke: StructuredInvoke;
|
|
17
|
+
prompts: PromptRegistry;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* #59 — design multi-page journey cases from the flow graph (reasoner tier). Refs are grounded
|
|
21
|
+
* per page; only journeys that span ≥2 distinct pages survive. Returns [] for a single-node graph
|
|
22
|
+
* (no journey is possible) without calling the LLM.
|
|
23
|
+
*/
|
|
24
|
+
export declare function designJourneys(input: JourneyInput, deps: JourneyDeps): Promise<JourneyCase[]>;
|
|
25
|
+
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/flow/journey.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAuB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAQvG;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAiCnG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HumanMessage } from "@langchain/core/messages";
|
|
2
|
+
import { JourneyResultSchema } from "../design/schema.js";
|
|
3
|
+
/** Distinct page URLs the journey's steps touch. */
|
|
4
|
+
const distinctPages = (j) => new Set(j.steps.map((s) => s.page)).size;
|
|
5
|
+
/**
|
|
6
|
+
* Per-page grounding (anti-hallucination): each step keeps only the refs that actually exist on
|
|
7
|
+
* THAT step's page. Mirrors `designTestCases` ref filtering, but page-aware for journeys.
|
|
8
|
+
*/
|
|
9
|
+
export function groundJourney(j, refsByPage) {
|
|
10
|
+
return {
|
|
11
|
+
...j,
|
|
12
|
+
steps: j.steps.map((s) => ({
|
|
13
|
+
...s,
|
|
14
|
+
elementRefs: s.elementRefs.filter((r) => (refsByPage.get(s.page) ?? new Set()).has(r)),
|
|
15
|
+
})),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* #59 — design multi-page journey cases from the flow graph (reasoner tier). Refs are grounded
|
|
20
|
+
* per page; only journeys that span ≥2 distinct pages survive. Returns [] for a single-node graph
|
|
21
|
+
* (no journey is possible) without calling the LLM.
|
|
22
|
+
*/
|
|
23
|
+
export async function designJourneys(input, deps) {
|
|
24
|
+
const { graph } = input;
|
|
25
|
+
if (graph.nodes.length < 2)
|
|
26
|
+
return []; // a journey needs ≥2 pages
|
|
27
|
+
const refsByPage = new Map(graph.nodes.map((n) => [n.url, new Set(n.verified.filter((v) => v.count >= 1).map((v) => v.ref))]));
|
|
28
|
+
const pages = graph.nodes
|
|
29
|
+
.map((n) => {
|
|
30
|
+
const els = n.verified
|
|
31
|
+
.filter((v) => v.interactive && v.count >= 1)
|
|
32
|
+
.map((v) => ` ${v.ref} · ${v.role}${v.name ? ` "${v.name}"` : ""}`)
|
|
33
|
+
.join("\n");
|
|
34
|
+
return `PAGE ${n.url}\n${els || " (no interactive elements)"}`;
|
|
35
|
+
})
|
|
36
|
+
.join("\n\n");
|
|
37
|
+
const edges = graph.edges
|
|
38
|
+
.map((e) => `- ${e.from} --(${e.via.role}${e.via.name ? ` "${e.via.name}"` : ""})--> ${e.to}`)
|
|
39
|
+
.join("\n") || "(no observed transitions)";
|
|
40
|
+
const prompt = await deps.prompts.getPrompt("qa-journey-from-flow", {
|
|
41
|
+
pages,
|
|
42
|
+
edges,
|
|
43
|
+
language: input.language ?? "English",
|
|
44
|
+
});
|
|
45
|
+
const result = await deps.invoke(JourneyResultSchema, [new HumanMessage(prompt.text)]);
|
|
46
|
+
return result.journeys
|
|
47
|
+
.map((j) => groundJourney(j, refsByPage))
|
|
48
|
+
.filter((j) => distinctPages(j) >= 2) // enforce the cross-page invariant
|
|
49
|
+
.map((j, i) => ({ ...j, id: `journey-${i + 1}` }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=journey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/flow/journey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAE,mBAAmB,EAA0C,MAAM,qBAAqB,CAAC;AAGlG,oDAAoD;AACpD,MAAM,aAAa,GAAG,CAAC,CAAkB,EAAU,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAE/F;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,CAAkB,EAAE,UAAoC;IACpF,OAAO;QACL,GAAG,CAAC;QACJ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzB,GAAG,CAAC;YACJ,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAC/F,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAaD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAmB,EAAE,IAAiB;IACzE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC,CAAC,2B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C,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;SAC7F,IAAI,CAAC,IAAI,CAAC,IAAI,2BAA2B,CAAC;IAE/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE;QAClE,KAAK;QACL,KAAK;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,SAAS;KACtC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEvF,OAAO,MAAM,CAAC,QAAQ;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;SACxC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC;SACxE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { StructuredInvoke } from "../llm/structured.js";
|
|
3
|
+
import type { PromptRegistry } from "../prompts/index.js";
|
|
4
|
+
import type { JourneyCase } from "../design/schema.js";
|
|
5
|
+
/**
|
|
6
|
+
* How a precondition's starting state is established, in priority order:
|
|
7
|
+
* - session — already covered by the captured storageState (auth);
|
|
8
|
+
* - fixture — a Playwright `beforeEach` that drives the UI to the starting state;
|
|
9
|
+
* - api-seed — a request seed against an OBSERVED endpoint (only with a concrete endpoint);
|
|
10
|
+
* - manual — documented, human-established precondition (the safe fallback — never fabricated).
|
|
11
|
+
*/
|
|
12
|
+
export declare const SetupStrategySchema: z.ZodEnum<{
|
|
13
|
+
manual: "manual";
|
|
14
|
+
session: "session";
|
|
15
|
+
fixture: "fixture";
|
|
16
|
+
"api-seed": "api-seed";
|
|
17
|
+
}>;
|
|
18
|
+
export type SetupStrategy = z.infer<typeof SetupStrategySchema>;
|
|
19
|
+
/** A structured starting-state requirement (#60) — replaces free prose where it can be made concrete. */
|
|
20
|
+
export declare const StructuredPreconditionSchema: z.ZodObject<{
|
|
21
|
+
description: z.ZodString;
|
|
22
|
+
strategy: z.ZodEnum<{
|
|
23
|
+
manual: "manual";
|
|
24
|
+
session: "session";
|
|
25
|
+
fixture: "fixture";
|
|
26
|
+
"api-seed": "api-seed";
|
|
27
|
+
}>;
|
|
28
|
+
entity: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
endpoint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
method: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
31
|
+
GET: "GET";
|
|
32
|
+
POST: "POST";
|
|
33
|
+
PUT: "PUT";
|
|
34
|
+
PATCH: "PATCH";
|
|
35
|
+
}>>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type StructuredPrecondition = z.infer<typeof StructuredPreconditionSchema>;
|
|
38
|
+
export declare const SetupPlanSchema: z.ZodObject<{
|
|
39
|
+
preconditions: z.ZodArray<z.ZodObject<{
|
|
40
|
+
description: z.ZodString;
|
|
41
|
+
strategy: z.ZodEnum<{
|
|
42
|
+
manual: "manual";
|
|
43
|
+
session: "session";
|
|
44
|
+
fixture: "fixture";
|
|
45
|
+
"api-seed": "api-seed";
|
|
46
|
+
}>;
|
|
47
|
+
entity: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
endpoint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
method: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
|
|
50
|
+
GET: "GET";
|
|
51
|
+
POST: "POST";
|
|
52
|
+
PUT: "PUT";
|
|
53
|
+
PATCH: "PATCH";
|
|
54
|
+
}>>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type SetupPlan = z.infer<typeof SetupPlanSchema>;
|
|
58
|
+
export interface SetupInput {
|
|
59
|
+
journey: JourneyCase;
|
|
60
|
+
/** Page purpose (optional context for the planner). */
|
|
61
|
+
pageSemantics?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SetupDeps {
|
|
64
|
+
invoke: StructuredInvoke;
|
|
65
|
+
prompts: PromptRegistry;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Safety post-process: a precondition can only be satisfied by `api-seed` when a CONCRETE endpoint is
|
|
69
|
+
* named — otherwise we'd be fabricating (possibly destructive) seeding, which is forbidden. Such a
|
|
70
|
+
* precondition is downgraded to the documented `manual` fallback. Pure — unit-testable.
|
|
71
|
+
*/
|
|
72
|
+
export declare function enforceSafeStrategies(plan: SetupPlan): SetupPlan;
|
|
73
|
+
/**
|
|
74
|
+
* Data-protection guardrail (#91): a precondition that establishes its state by DELETING / clearing data
|
|
75
|
+
* is forced to the `manual` fallback — at setup time nothing is self-created yet, so any such deletion
|
|
76
|
+
* would hit pre-existing data, which is forbidden. The deletion is never auto-seeded; a human decides.
|
|
77
|
+
*/
|
|
78
|
+
export declare function enforceDataProtection(plan: SetupPlan): SetupPlan;
|
|
79
|
+
/**
|
|
80
|
+
* #60 — extract STRUCTURED preconditions from a journey's prose preconditions, on the worker tier.
|
|
81
|
+
* The planner assigns each one a satisfaction strategy (session > fixture > api-seed > manual);
|
|
82
|
+
* unsafe/unfounded seeding is forced to manual by {@link enforceSafeStrategies}.
|
|
83
|
+
*/
|
|
84
|
+
export declare function planSetup(input: SetupInput, deps: SetupDeps): Promise<SetupPlan>;
|
|
85
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set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
import { HumanMessage } from "@langchain/core/messages";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { isDeletionIntent } from "../safety/guardrails.js";
|
|
4
|
+
/**
|
|
5
|
+
* How a precondition's starting state is established, in priority order:
|
|
6
|
+
* - session — already covered by the captured storageState (auth);
|
|
7
|
+
* - fixture — a Playwright `beforeEach` that drives the UI to the starting state;
|
|
8
|
+
* - api-seed — a request seed against an OBSERVED endpoint (only with a concrete endpoint);
|
|
9
|
+
* - manual — documented, human-established precondition (the safe fallback — never fabricated).
|
|
10
|
+
*/
|
|
11
|
+
export const SetupStrategySchema = z.enum(["session", "fixture", "api-seed", "manual"]);
|
|
12
|
+
/** A structured starting-state requirement (#60) — replaces free prose where it can be made concrete. */
|
|
13
|
+
export const StructuredPreconditionSchema = z.object({
|
|
14
|
+
/** Human-readable precondition (always present — also the manual-fallback text). */
|
|
15
|
+
description: z.string(),
|
|
16
|
+
strategy: SetupStrategySchema,
|
|
17
|
+
/**
|
|
18
|
+
* Grounded entity the state is about, e.g. "item", "user on plan Pro" (null when not applicable).
|
|
19
|
+
* `.nullable().default(null)` keeps the key in `required` (provider-safe, #89) while tolerating a
|
|
20
|
+
* provider that omits it — instead of `.optional()`, which drops it from `required`.
|
|
21
|
+
*/
|
|
22
|
+
entity: z.string().nullable().default(null),
|
|
23
|
+
/** api-seed only: the endpoint to seed against — null unless the strategy is api-seed. */
|
|
24
|
+
endpoint: z.string().nullable().default(null),
|
|
25
|
+
/** api-seed only: HTTP method (null ⇒ POST when seeding). */
|
|
26
|
+
method: z.enum(["GET", "POST", "PUT", "PATCH"]).nullable().default(null),
|
|
27
|
+
});
|
|
28
|
+
export const SetupPlanSchema = z.object({ preconditions: z.array(StructuredPreconditionSchema) });
|
|
29
|
+
/**
|
|
30
|
+
* Safety post-process: a precondition can only be satisfied by `api-seed` when a CONCRETE endpoint is
|
|
31
|
+
* named — otherwise we'd be fabricating (possibly destructive) seeding, which is forbidden. Such a
|
|
32
|
+
* precondition is downgraded to the documented `manual` fallback. Pure — unit-testable.
|
|
33
|
+
*/
|
|
34
|
+
export function enforceSafeStrategies(plan) {
|
|
35
|
+
return {
|
|
36
|
+
preconditions: plan.preconditions.map((p) => p.strategy === "api-seed" && !p.endpoint ? { ...p, strategy: "manual" } : p),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Data-protection guardrail (#91): a precondition that establishes its state by DELETING / clearing data
|
|
41
|
+
* is forced to the `manual` fallback — at setup time nothing is self-created yet, so any such deletion
|
|
42
|
+
* would hit pre-existing data, which is forbidden. The deletion is never auto-seeded; a human decides.
|
|
43
|
+
*/
|
|
44
|
+
export function enforceDataProtection(plan) {
|
|
45
|
+
return {
|
|
46
|
+
preconditions: plan.preconditions.map((p) => p.strategy !== "manual" && isDeletionIntent(p.description) ? { ...p, strategy: "manual" } : p),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* #60 — extract STRUCTURED preconditions from a journey's prose preconditions, on the worker tier.
|
|
51
|
+
* The planner assigns each one a satisfaction strategy (session > fixture > api-seed > manual);
|
|
52
|
+
* unsafe/unfounded seeding is forced to manual by {@link enforceSafeStrategies}.
|
|
53
|
+
*/
|
|
54
|
+
export async function planSetup(input, deps) {
|
|
55
|
+
const { journey } = input;
|
|
56
|
+
const prompt = await deps.prompts.getPrompt("qa-setup-planner", {
|
|
57
|
+
title: journey.title,
|
|
58
|
+
preconditions: journey.preconditions.map((p) => `- ${p}`).join("\n") || "(none stated)",
|
|
59
|
+
pages: [...new Set(journey.steps.map((s) => s.page))].join(", "),
|
|
60
|
+
pageSemantics: input.pageSemantics ?? "",
|
|
61
|
+
});
|
|
62
|
+
const result = await deps.invoke(SetupPlanSchema, [new HumanMessage(prompt.text)]);
|
|
63
|
+
return enforceDataProtection(enforceSafeStrategies(result));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO,qBAAqB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ZodType } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Lint one structured-output schema. Returns the breadcrumb paths of every property that
|
|
4
|
+
* is NOT in its object's `required` set (empty array ⇒ provider-safe). Pure.
|
|
5
|
+
*/
|
|
6
|
+
export declare function lintZodSchema(schema: ZodType, name?: string): string[];
|
|
7
|
+
/** Throw if a schema is not provider-safe (any property missing from `required`). */
|
|
8
|
+
export declare function assertStrictSchema(schema: ZodType, name?: string): void;
|
|
9
|
+
//# sourceMappingURL=schema-lint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lint.d.ts","sourceRoot":"","sources":["../../src/llm/schema-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAuCtC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,SAAW,GAAG,MAAM,EAAE,CAIxE;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,SAAW,GAAG,IAAI,CASzE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
function isObj(v) {
|
|
3
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4
|
+
}
|
|
5
|
+
/** Walk a JSON-Schema tree; collect breadcrumb paths of properties missing from `required`. */
|
|
6
|
+
function walk(node, path, out) {
|
|
7
|
+
if (Array.isArray(node)) {
|
|
8
|
+
node.forEach((n, i) => walk(n, `${path}[${i}]`, out));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!isObj(node))
|
|
12
|
+
return;
|
|
13
|
+
if (isObj(node.properties)) {
|
|
14
|
+
const required = new Set(Array.isArray(node.required) ? node.required : []);
|
|
15
|
+
for (const key of Object.keys(node.properties)) {
|
|
16
|
+
if (!required.has(key))
|
|
17
|
+
out.push(path ? `${path}.${key}` : key);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Recurse into every child schema node (properties, items, $defs, anyOf/allOf/oneOf, …).
|
|
21
|
+
for (const [k, v] of Object.entries(node))
|
|
22
|
+
walk(v, path ? `${path}/${k}` : k, out);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lint one structured-output schema. Returns the breadcrumb paths of every property that
|
|
26
|
+
* is NOT in its object's `required` set (empty array ⇒ provider-safe). Pure.
|
|
27
|
+
*/
|
|
28
|
+
export function lintZodSchema(schema, name = "schema") {
|
|
29
|
+
const out = [];
|
|
30
|
+
walk(z.toJSONSchema(schema), name, out);
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/** Throw if a schema is not provider-safe (any property missing from `required`). */
|
|
34
|
+
export function assertStrictSchema(schema, name = "schema") {
|
|
35
|
+
const violations = lintZodSchema(schema, name);
|
|
36
|
+
if (violations.length > 0) {
|
|
37
|
+
throw new Error(`Schema "${name}" is not provider-safe for strict structured output — ` +
|
|
38
|
+
`these keys are not in \`required\`: ${violations.join(", ")}. ` +
|
|
39
|
+
`Use .nullable() or .default(...) instead of .optional() (#89, BORROW-01).`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=schema-lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-lint.js","sourceRoot":"","sources":["../../src/llm/schema-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAgB,MAAM,KAAK,CAAC;AAiBtC,SAAS,KAAK,CAAC,CAAU;IACvB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,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QAAQ;IAC5D,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAY,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,kBAAkB,CAAC,MAAe,EAAE,IAAI,GAAG,QAAQ;IACjE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,wDAAwD;YACrE,uCAAuC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAChE,2EAA2E,CAC9E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-aria.d.ts","sourceRoot":"","sources":["../../src/observe/parse-aria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA6CtD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"parse-aria.d.ts","sourceRoot":"","sources":["../../src/observe/parse-aria.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA6CtD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAgC5D"}
|
|
@@ -54,8 +54,17 @@ export function parseAriaSnapshot(aria) {
|
|
|
54
54
|
if (!line.startsWith("- "))
|
|
55
55
|
continue;
|
|
56
56
|
const content = line.slice(2).trim();
|
|
57
|
-
if (content.startsWith("/"))
|
|
58
|
-
|
|
57
|
+
if (content.startsWith("/")) {
|
|
58
|
+
// Property line (/url, /checked, /disabled…). Capture /url onto the preceding element (its link)
|
|
59
|
+
// so crawl can dedup links by (name, href) — #102. Other properties are skipped.
|
|
60
|
+
const last = out[out.length - 1];
|
|
61
|
+
if (content.startsWith("/url") && last) {
|
|
62
|
+
const u = content.slice(4).replace(/^:\s*/, "").replace(/^"|"$/g, "").trim();
|
|
63
|
+
if (u)
|
|
64
|
+
last.url = u;
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
59
68
|
const role = content.match(/^([a-zA-Z][\w-]*)/)?.[1];
|
|
60
69
|
if (!role || role === "text")
|
|
61
70
|
continue; // text node or unparseable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-aria.js","sourceRoot":"","sources":["../../src/observe/parse-aria.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAC/D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,UAAU;IACV,kBAAkB;IAClB,eAAe;IACf,KAAK;IACL,UAAU;IACV,UAAU;CACX,CAAC,CAAC;AAEH,uDAAuD;AACvD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,aAAa;IACb,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAEH,SAAS,OAAO,CAAC,IAAY,EAAE,WAAoB;IACjD,IAAI,WAAW;QAAE,OAAO,CAAC,CAAC;IAC1B,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,CAAC;IACjC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,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CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC,IAAI,CAAC,CAAC;QACP,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/index.ts"],"names":[],"mappings":"AAYA,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAYhD,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { QA_TESTCASE_FROM_UI } from "./qa-testcase-from-ui.js";
|
|
2
2
|
import { QA_MANUAL_TEST_DESIGNER } from "./qa-manual-test-designer.js";
|
|
3
|
+
import { QA_CASE_CRITIQUE } from "./qa-case-critique.js";
|
|
4
|
+
import { QA_JOURNEY_FROM_FLOW } from "./qa-journey-from-flow.js";
|
|
5
|
+
import { QA_SETUP_PLANNER } from "./qa-setup-planner.js";
|
|
6
|
+
import { QA_GAP_CASES } from "./qa-gap-cases.js";
|
|
3
7
|
import { QA_PLAYWRIGHT_TS_WRITER } from "./qa-playwright-ts-writer.js";
|
|
4
8
|
import { IDENTIFY_ELEMENTS } from "./identify-elements.js";
|
|
5
9
|
import { JUDGE_TEST_CASES } from "./judge-test-cases.js";
|
|
@@ -9,6 +13,10 @@ import { PILOT_REVIEW } from "./pilot-review.js";
|
|
|
9
13
|
export const LOCAL_PROMPTS = {
|
|
10
14
|
"qa-testcase-from-ui": QA_TESTCASE_FROM_UI,
|
|
11
15
|
"qa-manual-test-designer": QA_MANUAL_TEST_DESIGNER,
|
|
16
|
+
"qa-case-critique": QA_CASE_CRITIQUE,
|
|
17
|
+
"qa-journey-from-flow": QA_JOURNEY_FROM_FLOW,
|
|
18
|
+
"qa-setup-planner": QA_SETUP_PLANNER,
|
|
19
|
+
"qa-gap-cases": QA_GAP_CASES,
|
|
12
20
|
"qa-playwright-ts-writer": QA_PLAYWRIGHT_TS_WRITER,
|
|
13
21
|
"identify-elements": IDENTIFY_ELEMENTS,
|
|
14
22
|
"judge-test-cases": JUDGE_TEST_CASES,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompts/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,qBAAqB,EAAE,mBAAmB;IAC1C,yBAAyB,EAAE,uBAAuB;IAClD,yBAAyB,EAAE,uBAAuB;IAClD,mBAAmB,EAAE,iBAAiB;IACtC,kBAAkB,EAAE,gBAAgB;IACpC,0BAA0B,EAAE,wBAAwB;IACpD,cAAc,EAAE,YAAY;CAC7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prompts/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,qBAAqB,EAAE,mBAAmB;IAC1C,yBAAyB,EAAE,uBAAuB;IAClD,kBAAkB,EAAE,gBAAgB;IACpC,sBAAsB,EAAE,oBAAoB;IAC5C,kBAAkB,EAAE,gBAAgB;IACpC,cAAc,EAAE,YAAY;IAC5B,yBAAyB,EAAE,uBAAuB;IAClD,mBAAmB,EAAE,iBAAiB;IACtC,kBAAkB,EAAE,gBAAgB;IACpC,0BAA0B,EAAE,wBAAwB;IACpD,cAAc,EAAE,YAAY;CAC7B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Pilot supervisor prompt (idea from explorbot): holistic run verdict. */
|
|
2
|
-
export declare const PILOT_REVIEW = "You are the Pilot supervisor of a QA run. Review the result and issue a holistic verdict.\n\nPage: {{pageSemantics}}\nValidation: {{validation}}\nTest cases:\n{{cases}}\n\nReturn:\n- verdict: \"pass\" (run is sufficient and high-quality) | \"needs-work\" (gaps exist but not critical) | \"fail\" (serious problems);\n- reason: ONE sentence \u2014 the main basis for the verdict;\n- guidance: ONE concrete next step to improve.";
|
|
2
|
+
export declare const PILOT_REVIEW = "You are the Pilot supervisor of a QA run. Review the result and issue a holistic verdict.\n\nPage: {{pageSemantics}}\nValidation: {{validation}}\nTest cases:\n{{cases}}\n\nReturn:\n- verdict: \"pass\" (run is sufficient and high-quality) | \"needs-work\" (gaps exist but not critical) | \"fail\" (serious problems);\n- reason: ONE sentence \u2014 the main basis for the verdict;\n- guidance: ONE concrete next step to improve;\n- entity: the NAME of the entity this run created or edited (e.g. the record/item title), or \"\" if the run was read-only and created nothing. Do NOT invent a name \u2014 use only what the cases above actually reference.";
|
|
3
3
|
//# sourceMappingURL=pilot-review.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pilot-review.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/pilot-review.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"pilot-review.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/pilot-review.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,YAAY,8oBAW8L,CAAC"}
|
|
@@ -9,5 +9,6 @@ Test cases:
|
|
|
9
9
|
Return:
|
|
10
10
|
- verdict: "pass" (run is sufficient and high-quality) | "needs-work" (gaps exist but not critical) | "fail" (serious problems);
|
|
11
11
|
- reason: ONE sentence — the main basis for the verdict;
|
|
12
|
-
- guidance: ONE concrete next step to improve
|
|
12
|
+
- guidance: ONE concrete next step to improve;
|
|
13
|
+
- entity: the NAME of the entity this run created or edited (e.g. the record/item title), or "" if the run was read-only and created nothing. Do NOT invent a name — use only what the cases above actually reference.`;
|
|
13
14
|
//# sourceMappingURL=pilot-review.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pilot-review.js","sourceRoot":"","sources":["../../../src/prompts/local/pilot-review.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"pilot-review.js","sourceRoot":"","sources":["../../../src/prompts/local/pilot-review.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;uNAW2L,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #82 — design-time self-critique prompt. A SEPARATE, cheap worker-tier pass that reviews the
|
|
3
|
+
* first design set: it PRUNES weak cases and TOPS UP under-represented techniques. It does NOT
|
|
4
|
+
* redesign and does NOT touch the methodology / assertion-safety rules — those live in
|
|
5
|
+
* `qa-testcase-from-ui` and `qa-manual-test-designer` and stay fixed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const QA_CASE_CRITIQUE = "You are a senior QA reviewer doing a SECOND pass over an already-designed set of UI test cases.\nWrite everything (titles, steps, expected) in {{language}} \u2014 do not mix languages.\n\nCurrent test cases (id \u00B7 [technique/type] \u00B7 title \u2192 expected):\n{{cases}}\n\nUnder-represented 29119-4 techniques on this page (cover these if the page genuinely supports them \u2014 do NOT invent cases the page can't back):\n{{underrepresented}}\n\nReal element refs you may reference (use ONLY these \u2014 never invent refs):\n{{elements}}\n\nDo TWO things:\n1. PRUNE \u2014 list the ids of cases to DROP, each with a one-line reason. Drop a case ONLY if it is:\n - trivial (asserts nothing meaningful, e.g. \"page loads\"),\n - contradictory with another case (e.g. two cases expect opposite states of the same toggle from a clean start), or\n - not verifiable (its \"expected\" cannot be objectively checked).\n When in doubt, KEEP the case \u2014 pruning is conservative.\n2. TOP UP \u2014 add NEW cases ONLY for the under-represented techniques above, where the page supports them.\n Each new case follows the SAME rules as the original design:\n - one logical check (one expected), independent, starting from a clean page;\n - read-only by default \u2014 for destructive/irreversible controls only check visibility, never perform the action;\n - real element labels in steps; elementRefs taken ONLY from the refs listed above.\n Add nothing if the techniques cannot be honestly covered \u2014 an empty top-up is a valid answer.\n\nEach new case has: title, technique (one of the under-represented ones), kind (\"static\"|\"active\"),\ntype (\"Positive\"|\"Negative\"), execution (\"auto\"|\"manual\"), preconditions, steps, expected, priority, elementRefs.";
|
|
8
|
+
//# sourceMappingURL=qa-case-critique.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-case-critique.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-case-critique.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,8vDA0BqF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #82 — design-time self-critique prompt. A SEPARATE, cheap worker-tier pass that reviews the
|
|
3
|
+
* first design set: it PRUNES weak cases and TOPS UP under-represented techniques. It does NOT
|
|
4
|
+
* redesign and does NOT touch the methodology / assertion-safety rules — those live in
|
|
5
|
+
* `qa-testcase-from-ui` and `qa-manual-test-designer` and stay fixed.
|
|
6
|
+
*/
|
|
7
|
+
export const QA_CASE_CRITIQUE = `You are a senior QA reviewer doing a SECOND pass over an already-designed set of UI test cases.
|
|
8
|
+
Write everything (titles, steps, expected) in {{language}} — do not mix languages.
|
|
9
|
+
|
|
10
|
+
Current test cases (id · [technique/type] · title → expected):
|
|
11
|
+
{{cases}}
|
|
12
|
+
|
|
13
|
+
Under-represented 29119-4 techniques on this page (cover these if the page genuinely supports them — do NOT invent cases the page can't back):
|
|
14
|
+
{{underrepresented}}
|
|
15
|
+
|
|
16
|
+
Real element refs you may reference (use ONLY these — never invent refs):
|
|
17
|
+
{{elements}}
|
|
18
|
+
|
|
19
|
+
Do TWO things:
|
|
20
|
+
1. PRUNE — list the ids of cases to DROP, each with a one-line reason. Drop a case ONLY if it is:
|
|
21
|
+
- trivial (asserts nothing meaningful, e.g. "page loads"),
|
|
22
|
+
- contradictory with another case (e.g. two cases expect opposite states of the same toggle from a clean start), or
|
|
23
|
+
- not verifiable (its "expected" cannot be objectively checked).
|
|
24
|
+
When in doubt, KEEP the case — pruning is conservative.
|
|
25
|
+
2. TOP UP — add NEW cases ONLY for the under-represented techniques above, where the page supports them.
|
|
26
|
+
Each new case follows the SAME rules as the original design:
|
|
27
|
+
- one logical check (one expected), independent, starting from a clean page;
|
|
28
|
+
- read-only by default — for destructive/irreversible controls only check visibility, never perform the action;
|
|
29
|
+
- real element labels in steps; elementRefs taken ONLY from the refs listed above.
|
|
30
|
+
Add nothing if the techniques cannot be honestly covered — an empty top-up is a valid answer.
|
|
31
|
+
|
|
32
|
+
Each new case has: title, technique (one of the under-represented ones), kind ("static"|"active"),
|
|
33
|
+
type ("Positive"|"Negative"), execution ("auto"|"manual"), preconditions, steps, expected, priority, elementRefs.`;
|
|
34
|
+
//# sourceMappingURL=qa-case-critique.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-case-critique.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-case-critique.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;kHA0BkF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #61 — gap-case suggester. Given the observed-but-untested interactive elements, propose test cases
|
|
3
|
+
* that close the gaps. Worker-tier. Output is treated as SUGGESTIONS (gap- id prefix). Does not touch
|
|
4
|
+
* the design methodology — it reuses the same case shape, scoped to the untested surface.
|
|
5
|
+
*/
|
|
6
|
+
export declare const QA_GAP_CASES = "You are a QA engineer reviewing test COVERAGE. Below are interactive elements that were observed on the app but are NOT referenced by any existing test case \u2014 the coverage gaps.\nWrite all titles, steps, expected in {{language}} \u2014 do not mix languages.\n\nPage purpose:\n{{pageSemantics}}\n\nUntested elements (ref \u00B7 role \u00B7 name \u00B7 page \u2014 why it matters). In elementRefs use ONLY these refs:\n{{gaps}}\n\nSuggest focused test cases that close these gaps. For each case: title, technique (29119-4), kind (\"static\"|\"active\"), type (\"Positive\"|\"Negative\"), execution (\"auto\"|\"manual\"), preconditions, steps (real labels), expected (verifiable), priority, elementRefs (only from the list above).\n\nRULES:\n- Read-only by default: assert visibility/state. For destructive/irreversible controls (Delete, Submit that writes, Log out) only assert VISIBLE \u2014 never perform the action.\n- One logical check per case; independent; start from a clean page.\n- Only reference the untested refs above \u2014 do not invent elements or re-test already-covered ones.\n- These are SUGGESTIONS to fill coverage gaps; keep them concrete and runnable.";
|
|
7
|
+
//# sourceMappingURL=qa-gap-cases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-gap-cases.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-gap-cases.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY,6pCAeuD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #61 — gap-case suggester. Given the observed-but-untested interactive elements, propose test cases
|
|
3
|
+
* that close the gaps. Worker-tier. Output is treated as SUGGESTIONS (gap- id prefix). Does not touch
|
|
4
|
+
* the design methodology — it reuses the same case shape, scoped to the untested surface.
|
|
5
|
+
*/
|
|
6
|
+
export const QA_GAP_CASES = `You are a QA engineer reviewing test COVERAGE. Below are interactive elements that were observed on the app but are NOT referenced by any existing test case — the coverage gaps.
|
|
7
|
+
Write all titles, steps, expected in {{language}} — do not mix languages.
|
|
8
|
+
|
|
9
|
+
Page purpose:
|
|
10
|
+
{{pageSemantics}}
|
|
11
|
+
|
|
12
|
+
Untested elements (ref · role · name · page — why it matters). In elementRefs use ONLY these refs:
|
|
13
|
+
{{gaps}}
|
|
14
|
+
|
|
15
|
+
Suggest focused test cases that close these gaps. For each case: title, technique (29119-4), kind ("static"|"active"), type ("Positive"|"Negative"), execution ("auto"|"manual"), preconditions, steps (real labels), expected (verifiable), priority, elementRefs (only from the list above).
|
|
16
|
+
|
|
17
|
+
RULES:
|
|
18
|
+
- Read-only by default: assert visibility/state. For destructive/irreversible controls (Delete, Submit that writes, Log out) only assert VISIBLE — never perform the action.
|
|
19
|
+
- One logical check per case; independent; start from a clean page.
|
|
20
|
+
- Only reference the untested refs above — do not invent elements or re-test already-covered ones.
|
|
21
|
+
- These are SUGGESTIONS to fill coverage gaps; keep them concrete and runnable.`;
|
|
22
|
+
//# sourceMappingURL=qa-gap-cases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa-gap-cases.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-gap-cases.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;gFAeoD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #59 — journey design prompt. Generates multi-page USER JOURNEY cases from the observed page/flow
|
|
3
|
+
* graph. SEPARATE from the per-page design prompt — it does not redesign per-page cases and does not
|
|
4
|
+
* touch the methodology / assertion-safety rules in `qa-testcase-from-ui`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const QA_JOURNEY_FROM_FLOW = "You are an experienced QA engineer. From the observed page/flow GRAPH below, design end-to-end USER JOURNEY test cases that span MULTIPLE pages (e.g. login \u2192 dashboard \u2192 action).\nWrite all titles, actions, expected in {{language}} \u2014 do not mix languages.\n\nPages studied (each with its REAL interactive elements \u2014 ref \u00B7 role \u00B7 name). In a step's elementRefs use ONLY refs from THAT step's page \u2014 never invent refs and never use a ref from another page:\n{{pages}}\n\nObserved transitions between pages (act\u2192observe \u2014 these are REAL navigations you may rely on):\n{{edges}}\n\nDesign journeys that cross page boundaries. For each journey:\n- title \u2014 concise title of the end-to-end flow;\n- technique \u2014 applied 29119-4 technique (state-transition fits multi-step flows well);\n- type \u2014 \"Positive\" | \"Negative\";\n- preconditions \u2014 what must be true before the journey starts (e.g. \"a registered user\");\n- steps \u2014 an ORDERED list; each step has: page (one of the page URLs above), action (real labels), elementRefs (refs from THAT page only);\n- expected \u2014 a single verifiable end state;\n- priority \u2014 critical | high | medium | low.\n\nRULES (a journey is a TEST \u2014 keep it safe and runnable):\n- A journey MUST span at least TWO distinct pages (\u22652 different page URLs across its steps). Single-page checks are NOT journeys \u2014 omit them.\n- Read-only by default: assert visibility/state. For destructive/irreversible controls (Delete, Remove, Submit that writes, Log out) only assert the control is VISIBLE \u2014 do NOT perform the action.\n- Each step is grounded on its page's observed elements; do not assume elements the graph did not show.\n- Prefer journeys that follow the OBSERVED transitions above (they are known to work).";
|
|
7
|
+
//# sourceMappingURL=qa-journey-from-flow.d.ts.map
|