@plune-ai/cairn 0.2.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +201 -674
  2. package/README.md +275 -181
  3. package/dist/agent/finalize.d.ts +20 -0
  4. package/dist/agent/finalize.d.ts.map +1 -0
  5. package/dist/agent/finalize.js +42 -0
  6. package/dist/agent/finalize.js.map +1 -0
  7. package/dist/agent/graph.d.ts +40 -0
  8. package/dist/agent/graph.d.ts.map +1 -1
  9. package/dist/agent/graph.js +0 -0
  10. package/dist/agent/graph.js.map +1 -1
  11. package/dist/agent/index.d.ts +18 -0
  12. package/dist/agent/index.d.ts.map +1 -1
  13. package/dist/agent/index.js +166 -64
  14. package/dist/agent/index.js.map +1 -1
  15. package/dist/agent/observe-guard.d.ts +14 -0
  16. package/dist/agent/observe-guard.d.ts.map +1 -0
  17. package/dist/agent/observe-guard.js +46 -0
  18. package/dist/agent/observe-guard.js.map +1 -0
  19. package/dist/agent/progress.d.ts +22 -0
  20. package/dist/agent/progress.d.ts.map +1 -0
  21. package/dist/agent/progress.js +25 -0
  22. package/dist/agent/progress.js.map +1 -0
  23. package/dist/agent/repair-loop.d.ts +26 -0
  24. package/dist/agent/repair-loop.d.ts.map +1 -0
  25. package/dist/agent/repair-loop.js +42 -0
  26. package/dist/agent/repair-loop.js.map +1 -0
  27. package/dist/agent/summary.d.ts +53 -0
  28. package/dist/agent/summary.d.ts.map +1 -0
  29. package/dist/agent/summary.js +103 -0
  30. package/dist/agent/summary.js.map +1 -0
  31. package/dist/agent/testcase-docs.d.ts +20 -0
  32. package/dist/agent/testcase-docs.d.ts.map +1 -0
  33. package/dist/agent/testcase-docs.js +30 -0
  34. package/dist/agent/testcase-docs.js.map +1 -0
  35. package/dist/artifacts/report.d.ts +10 -0
  36. package/dist/artifacts/report.d.ts.map +1 -1
  37. package/dist/artifacts/report.js +16 -0
  38. package/dist/artifacts/report.js.map +1 -1
  39. package/dist/browser/backends/playwright-lib.d.ts.map +1 -1
  40. package/dist/browser/backends/playwright-lib.js +17 -6
  41. package/dist/browser/backends/playwright-lib.js.map +1 -1
  42. package/dist/browser/preflight.d.ts +46 -0
  43. package/dist/browser/preflight.d.ts.map +1 -0
  44. package/dist/browser/preflight.js +73 -0
  45. package/dist/browser/preflight.js.map +1 -0
  46. package/dist/cli/index.d.ts +10 -1
  47. package/dist/cli/index.d.ts.map +1 -1
  48. package/dist/cli/index.js +327 -266
  49. package/dist/cli/index.js.map +1 -1
  50. package/dist/cli/is-main.d.ts +10 -0
  51. package/dist/cli/is-main.d.ts.map +1 -0
  52. package/dist/cli/is-main.js +21 -0
  53. package/dist/cli/is-main.js.map +1 -0
  54. package/dist/codegen/index.d.ts +3 -1
  55. package/dist/codegen/index.d.ts.map +1 -1
  56. package/dist/codegen/index.js +7 -2
  57. package/dist/codegen/index.js.map +1 -1
  58. package/dist/config/index.d.ts +1 -1
  59. package/dist/config/index.d.ts.map +1 -1
  60. package/dist/config/index.js +80 -2
  61. package/dist/config/index.js.map +1 -1
  62. package/dist/config/profiles.d.ts +14 -1
  63. package/dist/config/profiles.d.ts.map +1 -1
  64. package/dist/config/profiles.js +30 -0
  65. package/dist/config/profiles.js.map +1 -1
  66. package/dist/config/schema.d.ts +23 -1
  67. package/dist/config/schema.d.ts.map +1 -1
  68. package/dist/config/schema.js +7 -2
  69. package/dist/config/schema.js.map +1 -1
  70. package/dist/core/config.d.ts +18 -0
  71. package/dist/core/config.d.ts.map +1 -0
  72. package/dist/core/config.js +23 -0
  73. package/dist/core/config.js.map +1 -0
  74. package/dist/core/index.d.ts +15 -0
  75. package/dist/core/index.d.ts.map +1 -0
  76. package/dist/core/index.js +13 -0
  77. package/dist/core/index.js.map +1 -0
  78. package/dist/core/modalities/explore.d.ts +3 -0
  79. package/dist/core/modalities/explore.d.ts.map +1 -0
  80. package/dist/core/modalities/explore.js +82 -0
  81. package/dist/core/modalities/explore.js.map +1 -0
  82. package/dist/core/modality.d.ts +49 -0
  83. package/dist/core/modality.d.ts.map +1 -0
  84. package/dist/core/modality.js +24 -0
  85. package/dist/core/modality.js.map +1 -0
  86. package/dist/core/registry.d.ts +11 -0
  87. package/dist/core/registry.d.ts.map +1 -0
  88. package/dist/core/registry.js +43 -0
  89. package/dist/core/registry.js.map +1 -0
  90. package/dist/core/reporting.d.ts +11 -0
  91. package/dist/core/reporting.d.ts.map +1 -0
  92. package/dist/core/reporting.js +13 -0
  93. package/dist/core/reporting.js.map +1 -0
  94. package/dist/index.d.ts +6 -8
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.js +6 -1
  97. package/dist/index.js.map +1 -1
  98. package/dist/llm/cost.d.ts +53 -0
  99. package/dist/llm/cost.d.ts.map +1 -0
  100. package/dist/llm/cost.js +99 -0
  101. package/dist/llm/cost.js.map +1 -0
  102. package/dist/llm/factory.d.ts +18 -0
  103. package/dist/llm/factory.d.ts.map +1 -1
  104. package/dist/llm/factory.js +24 -0
  105. package/dist/llm/factory.js.map +1 -1
  106. package/dist/llm/index.d.ts +6 -1
  107. package/dist/llm/index.d.ts.map +1 -1
  108. package/dist/llm/index.js +5 -1
  109. package/dist/llm/index.js.map +1 -1
  110. package/dist/llm/routing.d.ts +40 -0
  111. package/dist/llm/routing.d.ts.map +1 -0
  112. package/dist/llm/routing.js +52 -0
  113. package/dist/llm/routing.js.map +1 -0
  114. package/dist/llm/structured.d.ts +28 -5
  115. package/dist/llm/structured.d.ts.map +1 -1
  116. package/dist/llm/structured.js +42 -9
  117. package/dist/llm/structured.js.map +1 -1
  118. package/dist/prompts/local/identify-elements.js +15 -15
  119. package/dist/prompts/local/judge-checklist-coverage.js +8 -8
  120. package/dist/prompts/local/judge-test-cases.js +8 -8
  121. package/dist/prompts/local/pilot-review.js +10 -10
  122. package/dist/prompts/local/qa-manual-test-designer.d.ts +1 -1
  123. package/dist/prompts/local/qa-manual-test-designer.js +7 -7
  124. package/dist/prompts/local/qa-playwright-ts-writer.d.ts +1 -1
  125. package/dist/prompts/local/qa-playwright-ts-writer.js +35 -35
  126. package/dist/prompts/local/qa-testcase-from-ui.d.ts +1 -1
  127. package/dist/prompts/local/qa-testcase-from-ui.js +47 -47
  128. package/dist/session/capture.d.ts +31 -0
  129. package/dist/session/capture.d.ts.map +1 -0
  130. package/dist/session/capture.js +84 -0
  131. package/dist/session/capture.js.map +1 -0
  132. package/dist/session/index.d.ts +16 -0
  133. package/dist/session/index.d.ts.map +1 -1
  134. package/dist/session/index.js +52 -2
  135. package/dist/session/index.js.map +1 -1
  136. package/dist/tui/screens/summary-screen.d.ts.map +1 -1
  137. package/dist/tui/screens/summary-screen.js +13 -1
  138. package/dist/tui/screens/summary-screen.js.map +1 -1
  139. package/dist/validate/runner.d.ts +6 -0
  140. package/dist/validate/runner.d.ts.map +1 -1
  141. package/dist/validate/runner.js +28 -9
  142. package/dist/validate/runner.js.map +1 -1
  143. package/package.json +98 -97
package/dist/llm/index.js CHANGED
@@ -1,3 +1,7 @@
1
- export { OPENROUTER_BASE_URL, resolveModelSpec, makeModel } from "./factory.js";
1
+ export { OPENROUTER_BASE_URL, GROQ_BASE_URL, resolveModelSpec, makeModel, structuredMethodFor } from "./factory.js";
2
2
  export { imageBlock } from "./vision.js";
3
+ // L1-01 — per-role routing + cost/token accounting (ADR-0011).
4
+ export { structuredInvoker, meteredInvoker, retryInvoke, CallBudget, cappedInvoke } from "./structured.js";
5
+ export { RoleRouter, resolveRoleTier, KNOWN_ROLES } from "./routing.js";
6
+ export { CostLedger, DEFAULT_PRICING, priceFor, extractUsage } from "./cost.js";
3
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEpH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,+DAA+D;AAC/D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE3G,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
2
+ import type { AppConfig, ModelTier, RolesConfig } from "../config/index.js";
3
+ import { type ProviderKeys } from "./factory.js";
4
+ import type { CallBudget, StructuredInvoke } from "./structured.js";
5
+ import { CostLedger, type ModelPrice } from "./cost.js";
6
+ /**
7
+ * Routable roles (L1-01, ADR-0011). The cheap LLM-as-judge scorer keeps the `judge`
8
+ * tier and is metered-only — NOT routable (it has the opposite cost intent).
9
+ */
10
+ export declare const KNOWN_ROLES: readonly ["worker", "reasoner"];
11
+ /** Pure: which tier does this role use? An explicit override (`roles[role]`) wins, else the fallback. */
12
+ export declare function resolveRoleTier(role: string, fallback: ModelTier, roles: RolesConfig | undefined): ModelTier;
13
+ type ModelFactory = (tier: ModelTier, keys: ProviderKeys) => BaseChatModel;
14
+ /**
15
+ * Builds per-step metered invokers over `makeModel(tier)` and owns the per-role
16
+ * {@link CostLedger}. One per run, a sibling of `CallBudget`. The model factory is
17
+ * injectable so the router is unit-testable without the SDK.
18
+ */
19
+ export declare class RoleRouter {
20
+ private readonly cfg;
21
+ private readonly keys;
22
+ private readonly budget;
23
+ private readonly makeModelFn;
24
+ /** Fires after each successful LLM call with (used, max) — lets a run warn as it nears the budget (L1-04, Box 3). */
25
+ private readonly onCharge?;
26
+ readonly ledger: CostLedger;
27
+ constructor(cfg: AppConfig, keys: ProviderKeys, budget: CallBudget, pricing?: Record<string, ModelPrice>, makeModelFn?: ModelFactory,
28
+ /** Fires after each successful LLM call with (used, max) — lets a run warn as it nears the budget (L1-04, Box 3). */
29
+ onCharge?: ((used: number, max: number) => void) | undefined);
30
+ /** Resolved tier for a role: the routing override if present, else the given fallback tier. */
31
+ tierFor(role: string, fallback: ModelTier): ModelTier;
32
+ /**
33
+ * A `StructuredInvoke` for an already-resolved tier, metered under `role` and wrapped
34
+ * with the existing retry + call-budget guardrails. Drop-in for the old
35
+ * `cappedInvoke(retryInvoke(structuredInvoker(makeModel(tier, keys))), budget)`.
36
+ */
37
+ invoke(role: string, tier: ModelTier): StructuredInvoke;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/llm/routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,iCAAkC,CAAC;AAE3D,yGAAyG;AACzG,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,SAAS,CAEX;AAED,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,KAAK,aAAa,CAAC;AAE3E;;;;GAIG;AACH,qBAAa,UAAU;IAInB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,qHAAqH;IACrH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAT5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAGT,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,UAAU,EACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACnB,WAAW,GAAE,YAAwB;IACtD,qHAAqH;IACpG,QAAQ,CAAC,GAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,aAAA;IAKjE,+FAA+F;IAC/F,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS;IAIrD;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB;CAOxD"}
@@ -0,0 +1,52 @@
1
+ import { makeModel, structuredMethodFor } from "./factory.js";
2
+ import { meteredInvoker, cappedInvoke, retryInvoke } from "./structured.js";
3
+ import { CostLedger } from "./cost.js";
4
+ /**
5
+ * Routable roles (L1-01, ADR-0011). The cheap LLM-as-judge scorer keeps the `judge`
6
+ * tier and is metered-only — NOT routable (it has the opposite cost intent).
7
+ */
8
+ export const KNOWN_ROLES = ["worker", "reasoner"];
9
+ /** Pure: which tier does this role use? An explicit override (`roles[role]`) wins, else the fallback. */
10
+ export function resolveRoleTier(role, fallback, roles) {
11
+ return roles?.[role] ?? fallback;
12
+ }
13
+ /**
14
+ * Builds per-step metered invokers over `makeModel(tier)` and owns the per-role
15
+ * {@link CostLedger}. One per run, a sibling of `CallBudget`. The model factory is
16
+ * injectable so the router is unit-testable without the SDK.
17
+ */
18
+ export class RoleRouter {
19
+ cfg;
20
+ keys;
21
+ budget;
22
+ makeModelFn;
23
+ onCharge;
24
+ ledger;
25
+ constructor(cfg, keys, budget, pricing, makeModelFn = makeModel,
26
+ /** Fires after each successful LLM call with (used, max) — lets a run warn as it nears the budget (L1-04, Box 3). */
27
+ onCharge) {
28
+ this.cfg = cfg;
29
+ this.keys = keys;
30
+ this.budget = budget;
31
+ this.makeModelFn = makeModelFn;
32
+ this.onCharge = onCharge;
33
+ this.ledger = new CostLedger(pricing);
34
+ }
35
+ /** Resolved tier for a role: the routing override if present, else the given fallback tier. */
36
+ tierFor(role, fallback) {
37
+ return resolveRoleTier(role, fallback, this.cfg.roles);
38
+ }
39
+ /**
40
+ * A `StructuredInvoke` for an already-resolved tier, metered under `role` and wrapped
41
+ * with the existing retry + call-budget guardrails. Drop-in for the old
42
+ * `cappedInvoke(retryInvoke(structuredInvoker(makeModel(tier, keys))), budget)`.
43
+ */
44
+ invoke(role, tier) {
45
+ const model = this.makeModelFn(tier, this.keys);
46
+ // Groq needs functionCalling (its OpenAI-compat endpoint rejects json_schema) — L1-02 fix.
47
+ const method = structuredMethodFor(tier.provider);
48
+ const metered = meteredInvoker(model, (u, m) => this.ledger.record(role, m, u), tier.model, method);
49
+ return cappedInvoke(retryInvoke(metered), this.budget, this.onCharge);
50
+ }
51
+ }
52
+ //# sourceMappingURL=routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/llm/routing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAqB,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AAExD;;;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,MAAM,CAAC,CAAC;QACpG,OAAO,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -1,13 +1,27 @@
1
1
  import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
2
2
  import type { BaseMessageLike } from "@langchain/core/messages";
3
3
  import type { ZodType } from "zod";
4
+ import { type TokenUsage } from "./cost.js";
4
5
  /**
5
6
  * Structured-call seam: (schema, messages) → typed result.
6
7
  * Decouples domain logic (design/analyze) from the concrete model — a fake is injected in tests.
7
8
  */
8
9
  export type StructuredInvoke = <T>(schema: ZodType<T>, messages: BaseMessageLike[]) => Promise<T>;
10
+ /**
11
+ * How LangChain should obtain structured output. `jsonSchema` (the ChatOpenAI default) sends
12
+ * `response_format: json_schema`, which Groq rejects for most models (e.g. llama-3.3-70b-versatile);
13
+ * `functionCalling` uses tool-calling instead, which those models DO support (L1-02 fix). Pick it per
14
+ * provider via {@link structuredMethodFor}; `undefined` leaves the LangChain default untouched.
15
+ */
16
+ export type StructuredMethod = "functionCalling" | "jsonMode" | "jsonSchema";
9
17
  /** Real implementation on top of LangChain `withStructuredOutput`. */
10
- export declare function structuredInvoker(model: BaseChatModel): StructuredInvoke;
18
+ export declare function structuredInvoker(model: BaseChatModel, method?: StructuredMethod): StructuredInvoke;
19
+ /**
20
+ * Like {@link structuredInvoker}, but captures token usage off the raw LangChain response
21
+ * (via `withStructuredOutput(..., { includeRaw: true })`) and reports it to `onUsage` (L1-01).
22
+ * Node logic is unchanged — callers still receive the parsed result. Metering never throws.
23
+ */
24
+ export declare function meteredInvoker(model: BaseChatModel, onUsage: (usage: TokenUsage, model: string) => void, modelId: string, method?: StructuredMethod): StructuredInvoke;
11
25
  export interface RetryOptions {
12
26
  retries?: number;
13
27
  baseDelayMs?: number;
@@ -19,12 +33,21 @@ export interface RetryOptions {
19
33
  export declare function retryInvoke(inner: StructuredInvoke, opts?: RetryOptions): StructuredInvoke;
20
34
  /** Cost-guardrail (Sprint 6): shared LLM-call counter per run — a safeguard against runaway cost. */
21
35
  export declare class CallBudget {
22
- private readonly max;
36
+ private readonly cap;
23
37
  private n;
24
- constructor(max: number);
38
+ constructor(cap: number);
25
39
  charge(): void;
40
+ /** Calls charged so far (counts the over-cap call that threw, too). */
26
41
  get spent(): number;
42
+ /** The configured cap — surfaced so a run can show used/remaining (L1-04, Box 3). */
43
+ get max(): number;
44
+ /** Calls left before the cap trips (never negative). */
45
+ get remaining(): number;
27
46
  }
28
- /** Cost-guardrail wrapper: counts the call against the shared CallBudget (throws when exceeded). */
29
- export declare function cappedInvoke(inner: StructuredInvoke, budget: CallBudget): StructuredInvoke;
47
+ /**
48
+ * Cost-guardrail wrapper: counts the call against the shared CallBudget (throws when exceeded).
49
+ * `onCharge` (L1-04, Box 3) fires after each *successful* charge with (used, max) — never for the
50
+ * over-cap call that throws — so a run can warn as it nears the budget.
51
+ */
52
+ export declare function cappedInvoke(inner: StructuredInvoke, budget: CallBudget, onCharge?: (used: number, max: number) => void): StructuredInvoke;
30
53
  //# sourceMappingURL=structured.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"structured.d.ts","sourceRoot":"","sources":["../../src/llm/structured.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAElG,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAKxE;AAMD,MAAM,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EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACnD,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,gBAAgB,GACxB,gBAAgB,CAWlB;AAMD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,GAAE,YAAiB,GAAG,gBAAgB,CAiB9F;AAED,qGAAqG;AACrG,qBAAa,UAAU;IAET,OAAO,CAAC,QAAQ,CAAC,GAAG;IADhC,OAAO,CAAC,CAAC,CAAK;gBACe,GAAG,EAAE,MAAM;IACxC,MAAM,IAAI,IAAI;IAQd,uEAAuE;IACvE,IAAI,KAAK,IAAI,MAAM,CAElB;IACD,qFAAqF;IACrF,IAAI,GAAG,IAAI,MAAM,CAEhB;IACD,wDAAwD;IACxD,IAAI,SAAS,IAAI,MAAM,CAEtB;CACF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,gBAAgB,EACvB,MAAM,EAAE,UAAU,EAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7C,gBAAgB,CAMlB"}
@@ -1,10 +1,29 @@
1
+ import { extractUsage } from "./cost.js";
1
2
  /** Real implementation on top of LangChain `withStructuredOutput`. */
2
- export function structuredInvoker(model) {
3
+ export function structuredInvoker(model, method) {
3
4
  return async (schema, messages) => {
4
- const structured = model.withStructuredOutput(schema);
5
+ const structured = model.withStructuredOutput(schema, method ? { method } : undefined);
5
6
  return (await structured.invoke(messages));
6
7
  };
7
8
  }
9
+ /**
10
+ * Like {@link structuredInvoker}, but captures token usage off the raw LangChain response
11
+ * (via `withStructuredOutput(..., { includeRaw: true })`) and reports it to `onUsage` (L1-01).
12
+ * Node logic is unchanged — callers still receive the parsed result. Metering never throws.
13
+ */
14
+ export function meteredInvoker(model, onUsage, modelId, method) {
15
+ return async (schema, messages) => {
16
+ const structured = model.withStructuredOutput(schema, { includeRaw: true, ...(method ? { method } : {}) });
17
+ const res = (await structured.invoke(messages));
18
+ try {
19
+ onUsage(extractUsage(res.raw), modelId);
20
+ }
21
+ catch {
22
+ // metering must never break the underlying call
23
+ }
24
+ return res.parsed;
25
+ };
26
+ }
8
27
  /** Transient provider errors worth retrying (rate limit / overload / 5xx / timeout). */
9
28
  const TRANSIENT = /\b429\b|rate.?limit|overloaded|temporarily|timeout|ETIMEDOUT|ECONNRESET|\b50\d\b|service unavailable/i;
10
29
  /**
@@ -33,25 +52,39 @@ export function retryInvoke(inner, opts = {}) {
33
52
  }
34
53
  /** Cost-guardrail (Sprint 6): shared LLM-call counter per run — a safeguard against runaway cost. */
35
54
  export class CallBudget {
36
- max;
55
+ cap;
37
56
  n = 0;
38
- constructor(max) {
39
- this.max = max;
57
+ constructor(cap) {
58
+ this.cap = cap;
40
59
  }
41
60
  charge() {
42
61
  this.n += 1;
43
- if (this.n > this.max) {
44
- throw new Error(`LLM-call limit per run exceeded (${this.max}) — cost-guardrail. Increase maxLlmCalls or check the loop.`);
62
+ if (this.n > this.cap) {
63
+ throw new Error(`LLM-call budget limit reached (${this.cap} calls) — cost-guardrail. Increase maxLlmCalls or check for a loop.`);
45
64
  }
46
65
  }
66
+ /** Calls charged so far (counts the over-cap call that threw, too). */
47
67
  get spent() {
48
68
  return this.n;
49
69
  }
70
+ /** The configured cap — surfaced so a run can show used/remaining (L1-04, Box 3). */
71
+ get max() {
72
+ return this.cap;
73
+ }
74
+ /** Calls left before the cap trips (never negative). */
75
+ get remaining() {
76
+ return Math.max(0, this.cap - this.n);
77
+ }
50
78
  }
51
- /** Cost-guardrail wrapper: counts the call against the shared CallBudget (throws when exceeded). */
52
- export function cappedInvoke(inner, budget) {
79
+ /**
80
+ * Cost-guardrail wrapper: counts the call against the shared CallBudget (throws when exceeded).
81
+ * `onCharge` (L1-04, Box 3) fires after each *successful* charge with (used, max) — never for the
82
+ * over-cap call that throws — so a run can warn as it nears the budget.
83
+ */
84
+ export function cappedInvoke(inner, budget, onCharge) {
53
85
  return async (schema, messages) => {
54
86
  budget.charge();
87
+ onCharge?.(budget.spent, budget.max);
55
88
  return inner(schema, messages);
56
89
  };
57
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"structured.js","sourceRoot":"","sources":["../../src/llm/structured.ts"],"names":[],"mappings":"AAUA,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,OAAO,KAAK,EAAK,MAAkB,EAAE,QAA2B,EAAc,EAAE;QAC9E,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACtD,OAAO,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAM,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,SAAS,GACb,uGAAuG,CAAC;AAO1G;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB,EAAE,OAAqB,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,GAAG,CAAC;IAC5C,OAAO,KAAK,EAAK,MAAkB,EAAE,QAA2B,EAAc,EAAE;QAC9E,IAAI,OAAgB,CAAC;QACrB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC;gBACH,OAAO,MAAM,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACvC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,GAAG,CAAC,CAAC;gBACZ,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,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CAAC;IAClB,CAAC;IACD,wDAAwD;IACxD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAuB,EACvB,MAAkB,EAClB,QAA8C;IAE9C,OAAO,KAAK,EAAK,MAAkB,EAAE,QAA2B,EAAc,EAAE;QAC9E,MAAM,CAAC,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC"}
@@ -2,20 +2,20 @@
2
2
  * Page analysis prompt (identifyElements). New (not from qa-skills).
3
3
  * The vision image is passed as a separate content block; this is the text part.
4
4
  */
5
- export const IDENTIFY_ELEMENTS = `You are an experienced QA engineer. Analyze the web page.
6
-
7
- ARIA snapshot:
8
- {{ariaYaml}}
9
-
10
- Detected elements (ref · role · name):
11
- {{elements}}
12
-
13
- Tasks:
14
- 1. pageSemantics — briefly (1–2 sentences) describe what this screen is and its main purpose.
15
- 2. primaryRefs — pick the refs of the most test-worthy elements. Use ONLY refs from the provided
16
- list — do not invent new ones or change them.
17
- 3. viewSwitchers — refs of view switchers: tabs, wizard steps, filter/mode toggles, form switchers —
18
- whose click OPENS DIFFERENT content (rather than performing an action). Only from the provided list; empty if none.
19
-
5
+ export const IDENTIFY_ELEMENTS = `You are an experienced QA engineer. Analyze the web page.
6
+
7
+ ARIA snapshot:
8
+ {{ariaYaml}}
9
+
10
+ Detected elements (ref · role · name):
11
+ {{elements}}
12
+
13
+ Tasks:
14
+ 1. pageSemantics — briefly (1–2 sentences) describe what this screen is and its main purpose.
15
+ 2. primaryRefs — pick the refs of the most test-worthy elements. Use ONLY refs from the provided
16
+ list — do not invent new ones or change them.
17
+ 3. viewSwitchers — refs of view switchers: tabs, wizard steps, filter/mode toggles, form switchers —
18
+ whose click OPENS DIFFERENT content (rather than performing an action). Only from the provided list; empty if none.
19
+
20
20
  Return structured output.`;
21
21
  //# sourceMappingURL=identify-elements.js.map
@@ -1,11 +1,11 @@
1
1
  /** Semantic checklist-coverage judge prompt (cross-language, ADR-0006). */
2
- export const JUDGE_CHECKLIST_COVERAGE = `Evaluate the SEMANTIC coverage of the checklist by the generated cases. The checklist and the cases may be in DIFFERENT LANGUAGES — compare by MEANING, not by words.
3
-
4
- Checklist:
5
- {{items}}
6
-
7
- Generated cases:
8
- {{cases}}
9
-
2
+ export const JUDGE_CHECKLIST_COVERAGE = `Evaluate the SEMANTIC coverage of the checklist by the generated cases. The checklist and the cases may be in DIFFERENT LANGUAGES — compare by MEANING, not by words.
3
+
4
+ Checklist:
5
+ {{items}}
6
+
7
+ Generated cases:
8
+ {{cases}}
9
+
10
10
  coverage — the fraction of checklist items covered by at least one case by meaning (0..1). uncovered — items with no coverage.`;
11
11
  //# sourceMappingURL=judge-checklist-coverage.js.map
@@ -1,11 +1,11 @@
1
1
  /** Test-case quality judge prompt (ADR-0006). Versioned like the methodology prompts. */
2
- export const JUDGE_TEST_CASES = `You are a QA test-case quality judge. Evaluate the cases for the page: {{pageSemantics}}
3
-
4
- Cases:
5
- {{cases}}
6
-
7
- Rate 0..1:
8
- - test_case_quality: clarity, completeness (happy + negative + edge), uniqueness, verifiability;
9
- - methodology_adherence: whether the cases reflect ISO/IEC/IEEE 29119-4 techniques (EP / BVA / decision-table / state-transition / error-guessing).
2
+ export const JUDGE_TEST_CASES = `You are a QA test-case quality judge. Evaluate the cases for the page: {{pageSemantics}}
3
+
4
+ Cases:
5
+ {{cases}}
6
+
7
+ Rate 0..1:
8
+ - test_case_quality: clarity, completeness (happy + negative + edge), uniqueness, verifiability;
9
+ - methodology_adherence: whether the cases reflect ISO/IEC/IEEE 29119-4 techniques (EP / BVA / decision-table / state-transition / error-guessing).
10
10
  Return numbers + a short comment.`;
11
11
  //# sourceMappingURL=judge-test-cases.js.map
@@ -1,13 +1,13 @@
1
1
  /** Pilot supervisor prompt (idea from explorbot): holistic run verdict. */
2
- export const PILOT_REVIEW = `You are the Pilot supervisor of a QA run. Review the result and issue a holistic verdict.
3
-
4
- Page: {{pageSemantics}}
5
- Validation: {{validation}}
6
- Test cases:
7
- {{cases}}
8
-
9
- Return:
10
- - verdict: "pass" (run is sufficient and high-quality) | "needs-work" (gaps exist but not critical) | "fail" (serious problems);
11
- - reason: ONE sentence — the main basis for the verdict;
2
+ export const PILOT_REVIEW = `You are the Pilot supervisor of a QA run. Review the result and issue a holistic verdict.
3
+
4
+ Page: {{pageSemantics}}
5
+ Validation: {{validation}}
6
+ Test cases:
7
+ {{cases}}
8
+
9
+ Return:
10
+ - verdict: "pass" (run is sufficient and high-quality) | "needs-work" (gaps exist but not critical) | "fail" (serious problems);
11
+ - reason: ONE sentence — the main basis for the verdict;
12
12
  - guidance: ONE concrete next step to improve.`;
13
13
  //# sourceMappingURL=pilot-review.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Methodology block for test-case design (ISO/IEC/IEEE 29119-4).
3
- * Provenance: ported from AZANIR/qa-skills → `qa-manual-test-designer` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-manual-test-designer` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  * Mixed into `qa-testcase-from-ui` via the {{methodology}} variable.
5
5
  */
6
6
  export declare const QA_MANUAL_TEST_DESIGNER = "Apply ISO/IEC/IEEE 29119-4 test design techniques where appropriate:\n- Equivalence Partitioning \u2014 equivalence classes for input fields (valid/invalid).\n- Boundary Value Analysis \u2014 boundaries of ranges, lengths, dates, numeric limits.\n- Decision Table \u2014 combinations of conditions (access rights, flags, modes).\n- State Transition \u2014 wizards, modal dialogs, status transitions.\n- Error Guessing / Exploratory \u2014 common defects, negative and edge scenarios.\nPrioritize cases by risk: critical | high | medium | low.";
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Methodology block for test-case design (ISO/IEC/IEEE 29119-4).
3
- * Provenance: ported from AZANIR/qa-skills → `qa-manual-test-designer` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-manual-test-designer` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  * Mixed into `qa-testcase-from-ui` via the {{methodology}} variable.
5
5
  */
6
- export const QA_MANUAL_TEST_DESIGNER = `Apply ISO/IEC/IEEE 29119-4 test design techniques where appropriate:
7
- - Equivalence Partitioning — equivalence classes for input fields (valid/invalid).
8
- - Boundary Value Analysis — boundaries of ranges, lengths, dates, numeric limits.
9
- - Decision Table — combinations of conditions (access rights, flags, modes).
10
- - State Transition — wizards, modal dialogs, status transitions.
11
- - Error Guessing / Exploratory — common defects, negative and edge scenarios.
6
+ export const QA_MANUAL_TEST_DESIGNER = `Apply ISO/IEC/IEEE 29119-4 test design techniques where appropriate:
7
+ - Equivalence Partitioning — equivalence classes for input fields (valid/invalid).
8
+ - Boundary Value Analysis — boundaries of ranges, lengths, dates, numeric limits.
9
+ - Decision Table — combinations of conditions (access rights, flags, modes).
10
+ - State Transition — wizards, modal dialogs, status transitions.
11
+ - Error Guessing / Exploratory — common defects, negative and edge scenarios.
12
12
  Prioritize cases by risk: critical | high | medium | low.`;
13
13
  //# sourceMappingURL=qa-manual-test-designer.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Prompt for generating @playwright/test code from test cases (ADR-0005).
3
- * Provenance: ported from AZANIR/qa-skills → `qa-playwright-ts-writer` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-playwright-ts-writer` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  */
5
5
  export declare const QA_PLAYWRIGHT_TS_WRITER = "You are an experienced Playwright test automation engineer (@playwright/test, TypeScript).\nGenerate RUNNABLE spec files covering the provided test cases.\n\nPage under test:\n- URL: {{baseUrl}}\n- Purpose: {{pageSemantics}}\n\nInteractive elements (ref \u00B7 role \u00B7 name; \u00D7N = repeated, several identical):\n{{elements}}\n\nTest cases to cover:\n{{testCases}}\n\nObserved state transitions (for state-transition assertions \u2014 use exactly these before\u2192after):\n{{transitions}}\n\nRules (STRICT):\n- Each file is complete valid TypeScript: import { test, expect } from '@playwright/test';\n- At the start of each test: await page.goto('{{baseUrl}}');\n- Locators ONLY user-facing by role+name: page.getByRole('button', { name: 'Sign In' }), getByLabel, getByText. NO CSS/XPath/testid.\n- Repeated elements (marked \u00D7N \u2014 list/table rows): the locator resolves to several \u2192 ALWAYS use .first() (or .nth(i)), e.g. page.getByRole('button', { name: 'Download PDF' }).first(). Otherwise Playwright throws a strict-mode error.\n- An element marked [first click tab \"X\"] lives behind a tab/view: first await page.getByRole(...{ name: 'X' }).click(), and ONLY then interact with it (otherwise it is not visible).\n- One test case \u2192 one test('<name>', async ({ page }) => { ... }) with verifiable await expect(...).\n- Wrap logical steps in await test.step('<step description>', async () => { ... }) \u2014 a more readable run report.\n- Assertions must match really observable behavior; do not invent elements outside the list.\n- Read-only assertions by default (toBeVisible/toBeEnabled/toBeChecked). For destructive controls (Delete, Submit, Convert, Log out, Add) \u2014 only await expect(...).toBeVisible(), do NOT click.\n- Each test() is INDEPENDENT: starts with await page.goto('{{baseUrl}}') (clean state); do NOT rely on state from another test.\n- One or two RELATED assertions per test; no brittle chains or mega-tests.\n- The code is self-contained and must parse with tsc.\n\nFILE STRUCTURE:\n- All STATIC cases (visibility/state checks, no actions) \u2192 ONE file static-checks.spec.ts (each case = a separate test() inside).\n- Each ACTIVE case (with actions) \u2192 a SEPARATE file, named after the case (e.g. add-user-flow.spec.ts).\n\nReturn files: an array of objects { path: '<name>.spec.ts', content: '<full file code>' }.";
6
6
  //# sourceMappingURL=qa-playwright-ts-writer.d.ts.map
@@ -1,40 +1,40 @@
1
1
  /**
2
2
  * Prompt for generating @playwright/test code from test cases (ADR-0005).
3
- * Provenance: ported from AZANIR/qa-skills → `qa-playwright-ts-writer` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-playwright-ts-writer` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  */
5
- export const QA_PLAYWRIGHT_TS_WRITER = `You are an experienced Playwright test automation engineer (@playwright/test, TypeScript).
6
- Generate RUNNABLE spec files covering the provided test cases.
7
-
8
- Page under test:
9
- - URL: {{baseUrl}}
10
- - Purpose: {{pageSemantics}}
11
-
12
- Interactive elements (ref · role · name; ×N = repeated, several identical):
13
- {{elements}}
14
-
15
- Test cases to cover:
16
- {{testCases}}
17
-
18
- Observed state transitions (for state-transition assertions — use exactly these before→after):
19
- {{transitions}}
20
-
21
- Rules (STRICT):
22
- - Each file is complete valid TypeScript: import { test, expect } from '@playwright/test';
23
- - At the start of each test: await page.goto('{{baseUrl}}');
24
- - Locators ONLY user-facing by role+name: page.getByRole('button', { name: 'Sign In' }), getByLabel, getByText. NO CSS/XPath/testid.
25
- - Repeated elements (marked ×N — list/table rows): the locator resolves to several → ALWAYS use .first() (or .nth(i)), e.g. page.getByRole('button', { name: 'Download PDF' }).first(). Otherwise Playwright throws a strict-mode error.
26
- - An element marked [first click tab "X"] lives behind a tab/view: first await page.getByRole(...{ name: 'X' }).click(), and ONLY then interact with it (otherwise it is not visible).
27
- - One test case → one test('<name>', async ({ page }) => { ... }) with verifiable await expect(...).
28
- - Wrap logical steps in await test.step('<step description>', async () => { ... }) — a more readable run report.
29
- - Assertions must match really observable behavior; do not invent elements outside the list.
30
- - Read-only assertions by default (toBeVisible/toBeEnabled/toBeChecked). For destructive controls (Delete, Submit, Convert, Log out, Add) — only await expect(...).toBeVisible(), do NOT click.
31
- - Each test() is INDEPENDENT: starts with await page.goto('{{baseUrl}}') (clean state); do NOT rely on state from another test.
32
- - One or two RELATED assertions per test; no brittle chains or mega-tests.
33
- - The code is self-contained and must parse with tsc.
34
-
35
- FILE STRUCTURE:
36
- - All STATIC cases (visibility/state checks, no actions) → ONE file static-checks.spec.ts (each case = a separate test() inside).
37
- - Each ACTIVE case (with actions) → a SEPARATE file, named after the case (e.g. add-user-flow.spec.ts).
38
-
5
+ export const QA_PLAYWRIGHT_TS_WRITER = `You are an experienced Playwright test automation engineer (@playwright/test, TypeScript).
6
+ Generate RUNNABLE spec files covering the provided test cases.
7
+
8
+ Page under test:
9
+ - URL: {{baseUrl}}
10
+ - Purpose: {{pageSemantics}}
11
+
12
+ Interactive elements (ref · role · name; ×N = repeated, several identical):
13
+ {{elements}}
14
+
15
+ Test cases to cover:
16
+ {{testCases}}
17
+
18
+ Observed state transitions (for state-transition assertions — use exactly these before→after):
19
+ {{transitions}}
20
+
21
+ Rules (STRICT):
22
+ - Each file is complete valid TypeScript: import { test, expect } from '@playwright/test';
23
+ - At the start of each test: await page.goto('{{baseUrl}}');
24
+ - Locators ONLY user-facing by role+name: page.getByRole('button', { name: 'Sign In' }), getByLabel, getByText. NO CSS/XPath/testid.
25
+ - Repeated elements (marked ×N — list/table rows): the locator resolves to several → ALWAYS use .first() (or .nth(i)), e.g. page.getByRole('button', { name: 'Download PDF' }).first(). Otherwise Playwright throws a strict-mode error.
26
+ - An element marked [first click tab "X"] lives behind a tab/view: first await page.getByRole(...{ name: 'X' }).click(), and ONLY then interact with it (otherwise it is not visible).
27
+ - One test case → one test('<name>', async ({ page }) => { ... }) with verifiable await expect(...).
28
+ - Wrap logical steps in await test.step('<step description>', async () => { ... }) — a more readable run report.
29
+ - Assertions must match really observable behavior; do not invent elements outside the list.
30
+ - Read-only assertions by default (toBeVisible/toBeEnabled/toBeChecked). For destructive controls (Delete, Submit, Convert, Log out, Add) — only await expect(...).toBeVisible(), do NOT click.
31
+ - Each test() is INDEPENDENT: starts with await page.goto('{{baseUrl}}') (clean state); do NOT rely on state from another test.
32
+ - One or two RELATED assertions per test; no brittle chains or mega-tests.
33
+ - The code is self-contained and must parse with tsc.
34
+
35
+ FILE STRUCTURE:
36
+ - All STATIC cases (visibility/state checks, no actions) → ONE file static-checks.spec.ts (each case = a separate test() inside).
37
+ - Each ACTIVE case (with actions) → a SEPARATE file, named after the case (e.g. add-user-flow.spec.ts).
38
+
39
39
  Return files: an array of objects { path: '<name>.spec.ts', content: '<full file code>' }.`;
40
40
  //# sourceMappingURL=qa-playwright-ts-writer.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Main prompt for generating test cases from a page.
3
- * Provenance: ported from AZANIR/qa-skills → `qa-testcase-from-ui` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-testcase-from-ui` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  */
5
5
  export declare const QA_TESTCASE_FROM_UI = "You are an experienced QA engineer. Based on the explored page, generate UI test cases.\nIMPORTANT: write all title, steps, expected in {{language}} \u2014 do not mix languages (even if the checklist/page is in another language).\n\nPage purpose:\n{{pageSemantics}}\n\nInteractive elements (ref \u00B7 role \u00B7 name; \u00D7N = repeated, several identical on the page \u2014 e.g. list rows). All REALLY present. In elementRefs use ONLY these refs \u2014 do not invent or change them:\n{{elements}}\n\nObserved state transitions (act\u2192observe). GROUND state-transition assertions ON THESE \u2014 do not invent consequences:\n{{transitions}}\n\nDomain knowledge (credentials, validation rules, nuances \u2014 account for these in the cases):\n{{knowledge}}\n\n{{experience}}\n\n{{style}}\n\n{{methodology}}\n\n{{checklist}}\n\nGenerate clear, verifiable test cases. For each:\n- title \u2014 concise title;\n- technique \u2014 applied 29119-4 technique;\n- kind \u2014 \"static\" (visibility/state check only, no actions) or \"active\" (with actions: click/fill/navigation);\n- type \u2014 \"Positive\" (valid scenario) or \"Negative\" (invalid/erroneous input);\n- execution \u2014 \"auto\" (can be RELIABLY automated: read-only checks on verified locators) or \"manual\" (full generation/submit, security/XSS, UI-UX/visual/responsiveness, irreversible actions \u2014 the bot does NOT automate these);\n- preconditions \u2014 preconditions (e.g. \"user is logged in\", \"page X is open\");\n- steps \u2014 DETAILED unambiguous steps with REAL element labels (e.g. 'Click \"Generate CV\"', 'Enter text into the \"Vacancy text\" field');\n- expected \u2014 verifiable expected result;\n- priority \u2014 critical | high | medium | low;\n- elementRefs \u2014 real refs from the list above that the case touches.\n\nASSERTION SAFETY:\n- Read-only by default: check visibility/state (toBeVisible/toBeEnabled/toBeChecked), not the consequences of actions.\n- For destructive/irreversible controls (Delete, Remove, Submit, Convert, Log out, Add \u2014 anything that writes data or signs out) \u2014 only check that the element is VISIBLE; do NOT click or perform the action.\n\nSTABILITY (CRITICAL):\n- One case = ONE logical check (one expected). Do NOT combine many assertions in one case \u2014 a mega-test fails entirely if any single part is off.\n- Each case is INDEPENDENT and starts from a CLEAN page. Do NOT assume state left by another case.\n- Do NOT generate contradictory cases (e.g. one expects toggle=on, another toggle=off from a fresh start). For a toggle take EXACTLY ONE transition from the \"Observed state transitions\" (before\u2192after).\n\nCover happy path AND negative/edge scenarios. No duplicates or trivialities.\n\nFULL CHECKLIST COVERAGE: do NOT skip checklist items. If an item cannot be reliably automated (full generation/submit flow, security/XSS, UI-UX/visual/responsiveness, irreversible actions) \u2014 STILL create a case, but set execution=\"manual\" (it will not be automated, but it is documented for manual testing). Every checklist item \u2192 at least one case (auto or manual).";
6
6
  //# sourceMappingURL=qa-testcase-from-ui.d.ts.map
@@ -1,52 +1,52 @@
1
1
  /**
2
2
  * Main prompt for generating test cases from a page.
3
- * Provenance: ported from AZANIR/qa-skills → `qa-testcase-from-ui` (GPL-3.0, author — the user). ADR-0008.
3
+ * Provenance: ported from AZANIR/qa-skills → `qa-testcase-from-ui` (authored by the maintainer; included here under Apache-2.0). ADR-0008.
4
4
  */
5
- export const QA_TESTCASE_FROM_UI = `You are an experienced QA engineer. Based on the explored page, generate UI test cases.
6
- IMPORTANT: write all title, steps, expected in {{language}} — do not mix languages (even if the checklist/page is in another language).
7
-
8
- Page purpose:
9
- {{pageSemantics}}
10
-
11
- Interactive elements (ref · role · name; ×N = repeated, several identical on the page — e.g. list rows). All REALLY present. In elementRefs use ONLY these refs — do not invent or change them:
12
- {{elements}}
13
-
14
- Observed state transitions (act→observe). GROUND state-transition assertions ON THESE — do not invent consequences:
15
- {{transitions}}
16
-
17
- Domain knowledge (credentials, validation rules, nuances — account for these in the cases):
18
- {{knowledge}}
19
-
20
- {{experience}}
21
-
22
- {{style}}
23
-
24
- {{methodology}}
25
-
26
- {{checklist}}
27
-
28
- Generate clear, verifiable test cases. For each:
29
- - title — concise title;
30
- - technique — applied 29119-4 technique;
31
- - kind — "static" (visibility/state check only, no actions) or "active" (with actions: click/fill/navigation);
32
- - type — "Positive" (valid scenario) or "Negative" (invalid/erroneous input);
33
- - execution — "auto" (can be RELIABLY automated: read-only checks on verified locators) or "manual" (full generation/submit, security/XSS, UI-UX/visual/responsiveness, irreversible actions — the bot does NOT automate these);
34
- - preconditions — preconditions (e.g. "user is logged in", "page X is open");
35
- - steps — DETAILED unambiguous steps with REAL element labels (e.g. 'Click "Generate CV"', 'Enter text into the "Vacancy text" field');
36
- - expected — verifiable expected result;
37
- - priority — critical | high | medium | low;
38
- - elementRefs — real refs from the list above that the case touches.
39
-
40
- ASSERTION SAFETY:
41
- - Read-only by default: check visibility/state (toBeVisible/toBeEnabled/toBeChecked), not the consequences of actions.
42
- - For destructive/irreversible controls (Delete, Remove, Submit, Convert, Log out, Add — anything that writes data or signs out) — only check that the element is VISIBLE; do NOT click or perform the action.
43
-
44
- STABILITY (CRITICAL):
45
- - One case = ONE logical check (one expected). Do NOT combine many assertions in one case — a mega-test fails entirely if any single part is off.
46
- - Each case is INDEPENDENT and starts from a CLEAN page. Do NOT assume state left by another case.
47
- - Do NOT generate contradictory cases (e.g. one expects toggle=on, another toggle=off from a fresh start). For a toggle take EXACTLY ONE transition from the "Observed state transitions" (before→after).
48
-
49
- Cover happy path AND negative/edge scenarios. No duplicates or trivialities.
50
-
5
+ export const QA_TESTCASE_FROM_UI = `You are an experienced QA engineer. Based on the explored page, generate UI test cases.
6
+ IMPORTANT: write all title, steps, expected in {{language}} — do not mix languages (even if the checklist/page is in another language).
7
+
8
+ Page purpose:
9
+ {{pageSemantics}}
10
+
11
+ Interactive elements (ref · role · name; ×N = repeated, several identical on the page — e.g. list rows). All REALLY present. In elementRefs use ONLY these refs — do not invent or change them:
12
+ {{elements}}
13
+
14
+ Observed state transitions (act→observe). GROUND state-transition assertions ON THESE — do not invent consequences:
15
+ {{transitions}}
16
+
17
+ Domain knowledge (credentials, validation rules, nuances — account for these in the cases):
18
+ {{knowledge}}
19
+
20
+ {{experience}}
21
+
22
+ {{style}}
23
+
24
+ {{methodology}}
25
+
26
+ {{checklist}}
27
+
28
+ Generate clear, verifiable test cases. For each:
29
+ - title — concise title;
30
+ - technique — applied 29119-4 technique;
31
+ - kind — "static" (visibility/state check only, no actions) or "active" (with actions: click/fill/navigation);
32
+ - type — "Positive" (valid scenario) or "Negative" (invalid/erroneous input);
33
+ - execution — "auto" (can be RELIABLY automated: read-only checks on verified locators) or "manual" (full generation/submit, security/XSS, UI-UX/visual/responsiveness, irreversible actions — the bot does NOT automate these);
34
+ - preconditions — preconditions (e.g. "user is logged in", "page X is open");
35
+ - steps — DETAILED unambiguous steps with REAL element labels (e.g. 'Click "Generate CV"', 'Enter text into the "Vacancy text" field');
36
+ - expected — verifiable expected result;
37
+ - priority — critical | high | medium | low;
38
+ - elementRefs — real refs from the list above that the case touches.
39
+
40
+ ASSERTION SAFETY:
41
+ - Read-only by default: check visibility/state (toBeVisible/toBeEnabled/toBeChecked), not the consequences of actions.
42
+ - For destructive/irreversible controls (Delete, Remove, Submit, Convert, Log out, Add — anything that writes data or signs out) — only check that the element is VISIBLE; do NOT click or perform the action.
43
+
44
+ STABILITY (CRITICAL):
45
+ - One case = ONE logical check (one expected). Do NOT combine many assertions in one case — a mega-test fails entirely if any single part is off.
46
+ - Each case is INDEPENDENT and starts from a CLEAN page. Do NOT assume state left by another case.
47
+ - Do NOT generate contradictory cases (e.g. one expects toggle=on, another toggle=off from a fresh start). For a toggle take EXACTLY ONE transition from the "Observed state transitions" (before→after).
48
+
49
+ Cover happy path AND negative/edge scenarios. No duplicates or trivialities.
50
+
51
51
  FULL CHECKLIST COVERAGE: do NOT skip checklist items. If an item cannot be reliably automated (full generation/submit flow, security/XSS, UI-UX/visual/responsiveness, irreversible actions) — STILL create a case, but set execution="manual" (it will not be automated, but it is documented for manual testing). Every checklist item → at least one case (auto or manual).`;
52
52
  //# sourceMappingURL=qa-testcase-from-ui.js.map