@plune-ai/cairn 0.3.5 → 0.4.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 +20 -7
- package/dist/agent/graph.d.ts +17 -530
- package/dist/agent/graph.d.ts.map +1 -1
- package/dist/agent/graph.js +144 -215
- package/dist/agent/graph.js.map +1 -1
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +205 -202
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/repair-loop.d.ts +8 -0
- package/dist/agent/repair-loop.d.ts.map +1 -1
- package/dist/agent/repair-loop.js +17 -5
- package/dist/agent/repair-loop.js.map +1 -1
- package/dist/agent/summary.d.ts +7 -0
- package/dist/agent/summary.d.ts.map +1 -1
- package/dist/agent/summary.js +11 -2
- package/dist/agent/summary.js.map +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/codegen/lint.d.ts +11 -0
- package/dist/codegen/lint.d.ts.map +1 -0
- package/dist/codegen/lint.js +37 -0
- package/dist/codegen/lint.js.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/schema.d.ts +2 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/core/modalities/explore.js +2 -2
- package/dist/core/modalities/explore.js.map +1 -1
- package/dist/design/dedup.d.ts +14 -0
- package/dist/design/dedup.d.ts.map +1 -0
- package/dist/design/dedup.js +64 -0
- package/dist/design/dedup.js.map +1 -0
- package/dist/design/index.d.ts.map +1 -1
- package/dist/design/index.js +3 -1
- package/dist/design/index.js.map +1 -1
- package/dist/eval/scorers.d.ts.map +1 -1
- package/dist/eval/scorers.js +33 -0
- package/dist/eval/scorers.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/routing.d.ts +5 -1
- package/dist/llm/routing.d.ts.map +1 -1
- package/dist/llm/routing.js +7 -2
- package/dist/llm/routing.js.map +1 -1
- package/dist/llm/structured.d.ts +1 -1
- package/dist/llm/structured.d.ts.map +1 -1
- package/dist/llm/structured.js +2 -2
- package/dist/llm/structured.js.map +1 -1
- package/dist/prompts/local/qa-playwright-ts-writer.d.ts +1 -1
- package/dist/prompts/local/qa-playwright-ts-writer.d.ts.map +1 -1
- package/dist/prompts/local/qa-playwright-ts-writer.js +1 -0
- package/dist/prompts/local/qa-playwright-ts-writer.js.map +1 -1
- package/dist/prompts/local/qa-testcase-from-ui.d.ts +1 -1
- package/dist/prompts/local/qa-testcase-from-ui.d.ts.map +1 -1
- package/dist/prompts/local/qa-testcase-from-ui.js +2 -1
- package/dist/prompts/local/qa-testcase-from-ui.js.map +1 -1
- package/dist/telemetry/index.d.ts +6 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +15 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/tui/hooks/use-runner.d.ts.map +1 -1
- package/dist/tui/hooks/use-runner.js +4 -2
- package/dist/tui/hooks/use-runner.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +18 -3
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/screens/form-screen.d.ts.map +1 -1
- package/dist/tui/screens/form-screen.js +42 -3
- package/dist/tui/screens/form-screen.js.map +1 -1
- package/dist/tui/types.d.ts +3 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/validate/index.d.ts +4 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +7 -2
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/runner.d.ts +5 -1
- package/dist/validate/runner.d.ts.map +1 -1
- package/dist/validate/runner.js +7 -4
- package/dist/validate/runner.js.map +1 -1
- package/package.json +7 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorers.d.ts","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"scorers.d.ts","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,EAAE,CAuE9D"}
|
package/dist/eval/scorers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { caseSimilarity } from "../design/dedup.js";
|
|
1
2
|
/**
|
|
2
3
|
* Deterministic (objective) scorers — computed from run data without an LLM or network.
|
|
3
4
|
* Foundation of the self-improvement loop: a measurable signal for every run (ADR-0006).
|
|
@@ -33,6 +34,38 @@ export function deterministicScores(input) {
|
|
|
33
34
|
if (total > 0)
|
|
34
35
|
scores.push({ name: "locator_quality", value: userFacing / total });
|
|
35
36
|
}
|
|
37
|
+
// technique_coverage (#58): breadth across the 6 ISO/IEC/IEEE 29119-4 techniques.
|
|
38
|
+
if (input.testCases.length > 0) {
|
|
39
|
+
const techniques = new Set(input.testCases.map((c) => c.technique));
|
|
40
|
+
scores.push({ name: "technique_coverage", value: techniques.size / 6 });
|
|
41
|
+
}
|
|
42
|
+
// case_redundancy (#58): share of cases in >=1 near-duplicate pair (shared caseSimilarity — DRY).
|
|
43
|
+
if (input.testCases.length > 1) {
|
|
44
|
+
const involved = new Set();
|
|
45
|
+
for (let i = 0; i < input.testCases.length; i += 1) {
|
|
46
|
+
for (let j = i + 1; j < input.testCases.length; j += 1) {
|
|
47
|
+
if (caseSimilarity(input.testCases[i], input.testCases[j]) !== "distinct") {
|
|
48
|
+
involved.add(i);
|
|
49
|
+
involved.add(j);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
scores.push({ name: "case_redundancy", value: involved.size / input.testCases.length });
|
|
54
|
+
}
|
|
55
|
+
// locator_robustness (#57): tiered selector strength, reconciling the DoD ranking
|
|
56
|
+
// role+name > test-id > css > text. Complements the binary locator_quality (kept as-is).
|
|
57
|
+
if (input.suite) {
|
|
58
|
+
const code = input.suite.files.map((f) => f.content).join("\n");
|
|
59
|
+
const roleName = (code.match(/getByRole\(/g) ?? []).length;
|
|
60
|
+
const labelText = (code.match(/getBy(Label|Text|Placeholder|AltText|Title)\(/g) ?? []).length;
|
|
61
|
+
const testid = (code.match(/getByTestId\(/g) ?? []).length;
|
|
62
|
+
const css = (code.match(/\.locator\(|page\.\$\(|xpath=|>>|:nth-/g) ?? []).length;
|
|
63
|
+
const total = roleName + labelText + testid + css;
|
|
64
|
+
if (total > 0) {
|
|
65
|
+
const weighted = roleName * 1 + labelText * 0.8 + testid * 0.5 + css * 0;
|
|
66
|
+
scores.push({ name: "locator_robustness", value: weighted / total });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
36
69
|
return scores;
|
|
37
70
|
}
|
|
38
71
|
//# sourceMappingURL=scorers.js.map
|
package/dist/eval/scorers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scorers.js","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scorers.js","sourceRoot":"","sources":["../../src/eval/scorers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAgBpD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,MAAM,MAAM,GAAY,EAAE,CAAC;IAE3B,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;QACxE,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM;aACrE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC3D,MAAM,CA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;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const BOT_NAME: "@plune-ai/cairn";
|
|
2
2
|
/** Read from package.json at load time — single source of truth, no manual drift. */
|
|
3
3
|
export declare const BOT_VERSION: string;
|
|
4
|
-
export { runExploration, runDesign, runAutomate,
|
|
5
|
-
export type { ExploreInput, ExploreResult, DesignResult, AutomateResult, ExploreDeps, } from "./agent/index.js";
|
|
4
|
+
export { runExploration, runDesign, runAutomate, runExploreGraph } from "./agent/index.js";
|
|
5
|
+
export type { ExploreInput, ExploreResult, DesignResult, AutomateResult, ExploreDeps, ExploreOutcome, } from "./agent/index.js";
|
|
6
6
|
export { loadConfig } from "./config/index.js";
|
|
7
|
+
export { resolveConfig } from "./core/index.js";
|
|
7
8
|
export type { AppConfig, Role, RolesConfig } from "./config/index.js";
|
|
9
|
+
export type { ConfigFlags } from "./core/index.js";
|
|
8
10
|
export type { CostReport, RoleCost } from "./llm/cost.js";
|
|
9
11
|
export { renderRunSummary } from "./agent/summary.js";
|
|
10
12
|
export type { BudgetReport, RunSummaryInput } from "./agent/summary.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,QAAQ,EAAG,iBAA0B,CAAC;AACnD,qFAAqF;AACrF,eAAO,MAAM,WAAW,EAAE,MAAoB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,QAAQ,EAAG,iBAA0B,CAAC;AACnD,qFAAqF;AACrF,eAAO,MAAM,WAAW,EAAE,MAAoB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3F,YAAY,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGxE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,10 @@ export const BOT_NAME = "@plune-ai/cairn";
|
|
|
10
10
|
/** Read from package.json at load time — single source of truth, no manual drift. */
|
|
11
11
|
export const BOT_VERSION = pkg.version;
|
|
12
12
|
// Entry points.
|
|
13
|
-
export { runExploration, runDesign, runAutomate,
|
|
13
|
+
export { runExploration, runDesign, runAutomate, runExploreGraph } from "./agent/index.js";
|
|
14
14
|
// Config.
|
|
15
15
|
export { loadConfig } from "./config/index.js";
|
|
16
|
+
export { resolveConfig } from "./core/index.js";
|
|
16
17
|
// Run summary + LLM-call budget surfacing (L1-04, Box 3/4).
|
|
17
18
|
export { renderRunSummary } from "./agent/summary.js";
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAC3C,CAAC;AAEzB,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAA0B,CAAC;AACnD,qFAAqF;AACrF,MAAM,CAAC,MAAM,WAAW,GAAW,GAAG,CAAC,OAAO,CAAC;AAE/C,gBAAgB;AAChB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAC3C,CAAC;AAEzB,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAA0B,CAAC;AACnD,qFAAqF;AACrF,MAAM,CAAC,MAAM,WAAW,GAAW,GAAG,CAAC,OAAO,CAAC;AAE/C,gBAAgB;AAChB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAU3F,UAAU;AACV,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOhD,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/llm/routing.d.ts
CHANGED
|
@@ -23,10 +23,14 @@ export declare class RoleRouter {
|
|
|
23
23
|
private readonly makeModelFn;
|
|
24
24
|
/** Fires after each successful LLM call with (used, max) — lets a run warn as it nears the budget (L1-04, Box 3). */
|
|
25
25
|
private readonly onCharge?;
|
|
26
|
+
/** LangChain callback handlers to thread into each LLM invoke (e.g. Langfuse CallbackHandler). (Task 2) */
|
|
27
|
+
private readonly callbacks?;
|
|
26
28
|
readonly ledger: CostLedger;
|
|
27
29
|
constructor(cfg: AppConfig, keys: ProviderKeys, budget: CallBudget, pricing?: Record<string, ModelPrice>, makeModelFn?: ModelFactory,
|
|
28
30
|
/** 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
|
|
31
|
+
onCharge?: ((used: number, max: number) => void) | undefined,
|
|
32
|
+
/** LangChain callback handlers to thread into each LLM invoke (e.g. Langfuse CallbackHandler). (Task 2) */
|
|
33
|
+
callbacks?: unknown[] | undefined);
|
|
30
34
|
/** Resolved tier for a role: the routing override if present, else the given fallback tier. */
|
|
31
35
|
tierFor(role: string, fallback: ModelTier): ModelTier;
|
|
32
36
|
/**
|
|
@@ -1 +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,E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acks;
|
|
24
25
|
ledger;
|
|
25
26
|
constructor(cfg, keys, budget, pricing, makeModelFn = makeModel,
|
|
26
27
|
/** 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
|
+
onCharge,
|
|
29
|
+
/** LangChain callback handlers to thread into each LLM invoke (e.g. Langfuse CallbackHandler). (Task 2) */
|
|
30
|
+
callbacks) {
|
|
28
31
|
this.cfg = cfg;
|
|
29
32
|
this.keys = keys;
|
|
30
33
|
this.budget = budget;
|
|
31
34
|
this.makeModelFn = makeModelFn;
|
|
32
35
|
this.onCharge = onCharge;
|
|
36
|
+
this.callbacks = callbacks;
|
|
33
37
|
this.ledger = new CostLedger(pricing);
|
|
34
38
|
}
|
|
35
39
|
/** Resolved tier for a role: the routing override if present, else the given fallback tier. */
|
|
@@ -45,7 +49,8 @@ export class RoleRouter {
|
|
|
45
49
|
const model = this.makeModelFn(tier, this.keys);
|
|
46
50
|
// Groq needs functionCalling (its OpenAI-compat endpoint rejects json_schema) — L1-02 fix.
|
|
47
51
|
const method = structuredMethodFor(tier.provider);
|
|
48
|
-
const
|
|
52
|
+
const config = this.callbacks ? { callbacks: this.callbacks } : undefined;
|
|
53
|
+
const metered = meteredInvoker(model, (u, m) => this.ledger.record(role, m, u), tier.model, method, config);
|
|
49
54
|
return cappedInvoke(retryInvoke(metered), this.budget, this.onCharge);
|
|
50
55
|
}
|
|
51
56
|
}
|
package/dist/llm/routing.js.map
CHANGED
|
@@ -1 +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;;;GAGG;AAC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AC,MAAM,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,+FAA+F;IAC/F,OAAO,CAAC,IAAY,EAAE,QAAmB;QACvC,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAY,EAAE,IAAe;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,2FAA2F;QAC3F,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5G,OAAO,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;CACF"}
|
package/dist/llm/structured.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function structuredInvoker(model: BaseChatModel, method?: Structu
|
|
|
21
21
|
* (via `withStructuredOutput(..., { includeRaw: true })`) and reports it to `onUsage` (L1-01).
|
|
22
22
|
* Node logic is unchanged — callers still receive the parsed result. Metering never throws.
|
|
23
23
|
*/
|
|
24
|
-
export declare function meteredInvoker(model: BaseChatModel, onUsage: (usage: TokenUsage, model: string) => void, modelId: string, method?: StructuredMethod): StructuredInvoke;
|
|
24
|
+
export declare function meteredInvoker(model: BaseChatModel, onUsage: (usage: TokenUsage, model: string) => void, modelId: string, method?: StructuredMethod, config?: Record<string, unknown>): StructuredInvoke;
|
|
25
25
|
export interface RetryOptions {
|
|
26
26
|
retries?: number;
|
|
27
27
|
baseDelayMs?: number;
|
|
@@ -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;AACnC,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAE1D;;;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;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAAC;AAE7E,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAKnG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACnD,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,gBAAgB,
|
|
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,O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,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"}
|
package/dist/llm/structured.js
CHANGED
|
@@ -11,10 +11,10 @@ export function structuredInvoker(model, method) {
|
|
|
11
11
|
* (via `withStructuredOutput(..., { includeRaw: true })`) and reports it to `onUsage` (L1-01).
|
|
12
12
|
* Node logic is unchanged — callers still receive the parsed result. Metering never throws.
|
|
13
13
|
*/
|
|
14
|
-
export function meteredInvoker(model, onUsage, modelId, method) {
|
|
14
|
+
export function meteredInvoker(model, onUsage, modelId, method, config) {
|
|
15
15
|
return async (schema, messages) => {
|
|
16
16
|
const structured = model.withStructuredOutput(schema, { includeRaw: true, ...(method ? { method } : {}) });
|
|
17
|
-
const res = (await structured.invoke(messages));
|
|
17
|
+
const res = (await structured.invoke(messages, config));
|
|
18
18
|
try {
|
|
19
19
|
onUsage(extractUsage(res.raw), modelId);
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured.js","sourceRoot":"","sources":["../../src/llm/structured.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAmB,MAAM,WAAW,CAAC;AAgB1D,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,KAAoB,EAAE,MAAyB;IAC/E,OAAO,KAAK,EAAK,MAAkB,EAAE,QAA2B,EAAc,EAAE;QAC9E,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACvF,OAAO,CAAC,MAAM,UA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,CAAQ;IAAG,CAAC;IAC5C,MAAM;QACJ,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,kCAAkC,IAAI,CAAC,GAAG,qEAAqE,CAChH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,uEAAuE;IACvE,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,CAAC,CAAC;IAChB,CAAC;IACD,qFAAqF;IACrF,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,GAAG,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,5 +2,5 @@
|
|
|
2
2
|
* Prompt for generating @playwright/test code from test cases (ADR-0005).
|
|
3
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 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>' }.";
|
|
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- Waiting (STRICT): rely on web-first auto-retrying assertions (await expect(locator).toBeVisible()/toBeEnabled()). NEVER page.waitForTimeout(...) or waitForLoadState('networkidle') \u2014 both are flaky. Playwright auto-waits for actionability; do NOT add manual sleeps.\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qa-playwright-ts-writer.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-playwright-ts-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"qa-playwright-ts-writer.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-playwright-ts-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,uBAAuB,6lFAmCuD,CAAC"}
|
|
@@ -24,6 +24,7 @@ Rules (STRICT):
|
|
|
24
24
|
- Locators ONLY user-facing by role+name: page.getByRole('button', { name: 'Sign In' }), getByLabel, getByText. NO CSS/XPath/testid.
|
|
25
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
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
|
+
- Waiting (STRICT): rely on web-first auto-retrying assertions (await expect(locator).toBeVisible()/toBeEnabled()). NEVER page.waitForTimeout(...) or waitForLoadState('networkidle') — both are flaky. Playwright auto-waits for actionability; do NOT add manual sleeps.
|
|
27
28
|
- One test case → one test('<name>', async ({ page }) => { ... }) with verifiable await expect(...).
|
|
28
29
|
- Wrap logical steps in await test.step('<step description>', async () => { ... }) — a more readable run report.
|
|
29
30
|
- Assertions must match really observable behavior; do not invent elements outside the list.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qa-playwright-ts-writer.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-playwright-ts-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG
|
|
1
|
+
{"version":3,"file":"qa-playwright-ts-writer.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-playwright-ts-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2FAmCoD,CAAC"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Main prompt for generating test cases from a page.
|
|
3
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 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).";
|
|
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 (no two cases with the same technique + same elements + same steps).\nTECHNIQUE BREADTH: apply a VARIETY of 29119-4 techniques where the page allows \u2014 equivalence-partitioning, boundary-value, decision-table, state-transition, error-guessing \u2014 not just exploratory.\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qa-testcase-from-ui.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-testcase-from-ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"qa-testcase-from-ui.d.ts","sourceRoot":"","sources":["../../../src/prompts/local/qa-testcase-from-ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,y0GA+C+U,CAAC"}
|
|
@@ -46,7 +46,8 @@ STABILITY (CRITICAL):
|
|
|
46
46
|
- Each case is INDEPENDENT and starts from a CLEAN page. Do NOT assume state left by another case.
|
|
47
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
48
|
|
|
49
|
-
Cover happy path AND negative/edge scenarios. No duplicates or trivialities.
|
|
49
|
+
Cover happy path AND negative/edge scenarios. No duplicates or trivialities (no two cases with the same technique + same elements + same steps).
|
|
50
|
+
TECHNIQUE BREADTH: apply a VARIETY of 29119-4 techniques where the page allows — equivalence-partitioning, boundary-value, decision-table, state-transition, error-guessing — not just exploratory.
|
|
50
51
|
|
|
51
52
|
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
53
|
//# sourceMappingURL=qa-testcase-from-ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qa-testcase-from-ui.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-testcase-from-ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"qa-testcase-from-ui.js","sourceRoot":"","sources":["../../../src/prompts/local/qa-testcase-from-ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+WA+C4U,CAAC"}
|
|
@@ -17,6 +17,12 @@ export interface Telemetry {
|
|
|
17
17
|
callbackHandler?: CallbackHandler;
|
|
18
18
|
client?: LangfuseClient;
|
|
19
19
|
shutdown: () => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Wraps `fn` in a root Langfuse span so that all nested LangChain callback-handler
|
|
22
|
+
* generations are collected under ONE trace (rather than N separate traces). When
|
|
23
|
+
* telemetry is disabled, `fn` is called directly (no-op path). (Task 2, ADR-0012)
|
|
24
|
+
*/
|
|
25
|
+
runInTrace: <T>(name: string, metadata: Record<string, unknown>, fn: () => Promise<T>) => Promise<T>;
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Telemetry bootstrap. Returns a no-op (so the bot works offline — ADR-0004/0006) when Langfuse is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B;;;;OAIG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACtG;AAOD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAuDtE"}
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The offline / not-configured / packages-absent result: a no-op so the bot runs without tracing. */
|
|
2
2
|
function noopTelemetry() {
|
|
3
|
-
return { enabled: false, shutdown: async () => { } };
|
|
3
|
+
return { enabled: false, shutdown: async () => { }, runInTrace: (_n, _m, fn) => fn() };
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Telemetry bootstrap. Returns a no-op (so the bot works offline — ADR-0004/0006) when Langfuse is
|
|
@@ -17,11 +17,13 @@ export async function initTelemetry(cfg) {
|
|
|
17
17
|
let lfOtel;
|
|
18
18
|
let lfLangchain;
|
|
19
19
|
let lfClient;
|
|
20
|
+
let lfTracing;
|
|
20
21
|
try {
|
|
21
22
|
otel = await import("@opentelemetry/sdk-node");
|
|
22
23
|
lfOtel = await import("@langfuse/otel");
|
|
23
24
|
lfLangchain = await import("@langfuse/langchain");
|
|
24
25
|
lfClient = await import("@langfuse/client");
|
|
26
|
+
lfTracing = await import("@langfuse/tracing");
|
|
25
27
|
}
|
|
26
28
|
catch {
|
|
27
29
|
process.stderr.write("[cairn] Langfuse is configured (LANGFUSE_* set) but the optional tracing packages are not " +
|
|
@@ -40,6 +42,17 @@ export async function initTelemetry(cfg) {
|
|
|
40
42
|
await spanProcessor.forceFlush();
|
|
41
43
|
await sdk.shutdown();
|
|
42
44
|
};
|
|
43
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Wraps `fn` in a root Langfuse span via `startActiveObservation`, so that all nested
|
|
47
|
+
* LangChain CallbackHandler generations attach to ONE trace instead of N separate traces.
|
|
48
|
+
* The span name becomes the Langfuse trace name. `metadata` is stored as span metadata.
|
|
49
|
+
* (Task 2 — real API: `startActiveObservation(name, fn)`, callback receives `LangfuseSpan`;
|
|
50
|
+
* `span.updateTrace` does NOT exist in v5.4.1 — use `span.update({ metadata })` instead.)
|
|
51
|
+
*/
|
|
52
|
+
const runInTrace = (name, metadata, fn) => lfTracing.startActiveObservation(name, async (span) => {
|
|
53
|
+
span.update({ metadata });
|
|
54
|
+
return fn();
|
|
55
|
+
});
|
|
56
|
+
return { enabled: true, callbackHandler, client, shutdown, runInTrace };
|
|
44
57
|
}
|
|
45
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AA4BA,sGAAsG;AACtG,SAAS,aAAa;IACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;AACxF,CAAC;AAED;;;;GA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AAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;CAC9C;AA6CD;;;;GAIG;AACH,wBAAgB,SAAS;;qBAKC,OAAO,UAAU,UAAU,KAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"use-runner.d.ts","sourceRoot":"","sources":["../../../src/tui/hooks/use-runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;CAC9C;AA6CD;;;;GAIG;AACH,wBAAgB,SAAS;;qBAKC,OAAO,UAAU,UAAU,KAAG,IAAI;mBA6DtC,IAAI;EAKzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useReducer, useRef } from "react";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveConfig, runExploration, runDesign, runAutomate } from "../../index.js";
|
|
4
4
|
import { nodesFor, seedNodes, parseNode, advanceNodes, completeNodes } from "../theme.js";
|
|
5
5
|
const MAX_LOG = 200;
|
|
6
6
|
const initial = { phase: "idle", nodes: [], log: [] };
|
|
@@ -55,7 +55,9 @@ export function useRunner() {
|
|
|
55
55
|
dispatch({ type: "start", nodes: seedNodes(nodesFor(command)) });
|
|
56
56
|
void (async () => {
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
// Parity with the CLI: form-chosen backend/channel/routing override env (resolveConfig only
|
|
59
|
+
// touches a SET flag), so a TUI run can match `cairn … --channel chrome` etc.
|
|
60
|
+
const config = resolveConfig({ backend: values.backend, channel: values.channel, routing: values.routing }, process.env);
|
|
59
61
|
const onProgress = (event) => {
|
|
60
62
|
if (!cancelled.current)
|
|
61
63
|
dispatch({ type: "progress", event });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-runner.js","sourceRoot":"","sources":["../../../src/tui/hooks/use-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-runner.js","sourceRoot":"","sources":["../../../src/tui/hooks/use-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEvF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAoB1F,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,OAAO,GAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAEnE,SAAS,OAAO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C;IAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/tui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB9C"}
|
package/dist/tui/index.js
CHANGED
|
@@ -4,9 +4,24 @@
|
|
|
4
4
|
* (other CLI commands and library embedders never load them).
|
|
5
5
|
*/
|
|
6
6
|
export async function mountTui() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
let React;
|
|
8
|
+
let render;
|
|
9
|
+
let App;
|
|
10
|
+
try {
|
|
11
|
+
React = (await import("react")).default;
|
|
12
|
+
({ render } = await import("ink"));
|
|
13
|
+
({ App } = await import("./App.js"));
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
const code = e.code;
|
|
17
|
+
if (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND") {
|
|
18
|
+
process.stderr.write("[cairn] The interactive TUI needs optional deps that are not installed.\n" +
|
|
19
|
+
" Install: npm i ink react ink-select-input ink-spinner ink-text-input\n" +
|
|
20
|
+
" Or use explicit commands (no TUI needed): cairn explore <url> · cairn design <url>\n");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
10
25
|
const { waitUntilExit } = render(React.createElement(App), { exitOnCtrlC: true });
|
|
11
26
|
await waitUntilExit();
|
|
12
27
|
}
|
package/dist/tui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,IAAI,KAA6B,CAAC;IAClC,IAAI,MAAsC,CAAC;IAC3C,IAAI,GAAqC,CAAC;IAC1C,IAAI,CAAC;QACH,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACxC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,GAAI,CAAuB,CAAC,IAAI,CAAC;QAC3C,IAAI,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,2EAA2E;gBACzE,2EAA2E;gBAC3E,yFAAyF,CAC5F,CAAC;YACF,OAAO;QACT,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;IACD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAClF,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-screen.d.ts","sourceRoot":"","sources":["../../../src/tui/screens/form-screen.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"form-screen.d.ts","sourceRoot":"","sources":["../../../src/tui/screens/form-screen.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAkDtE,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,+BAuKnG"}
|
|
@@ -7,11 +7,13 @@ import { stepBack } from "../keys.js";
|
|
|
7
7
|
import { Field } from "../components/field.js";
|
|
8
8
|
import { SessionPicker } from "../components/session-picker.js";
|
|
9
9
|
function stepsFor(command) {
|
|
10
|
+
// backend/channel/routing give the TUI parity with the CLI flags (--backend/--channel/--routing);
|
|
11
|
+
// observe runs no LLM, so it omits routing. "(default)" on any of them leaves the env untouched.
|
|
10
12
|
if (command === "automate")
|
|
11
|
-
return ["runDir", "session", "validate", "submit"];
|
|
13
|
+
return ["runDir", "session", "validate", "backend", "channel", "routing", "submit"];
|
|
12
14
|
if (command === "observe")
|
|
13
|
-
return ["url", "session", "headed", "submit"];
|
|
14
|
-
return ["url", "session", "checklist", "style", "headed", "submit"]; // explore / design
|
|
15
|
+
return ["url", "session", "headed", "backend", "channel", "submit"];
|
|
16
|
+
return ["url", "session", "checklist", "style", "headed", "backend", "channel", "routing", "submit"]; // explore / design
|
|
15
17
|
}
|
|
16
18
|
const STYLE_ITEMS = [
|
|
17
19
|
{ label: "all — full coverage", value: "all" },
|
|
@@ -23,6 +25,22 @@ const YESNO = [
|
|
|
23
25
|
{ label: "no", value: "no" },
|
|
24
26
|
{ label: "yes", value: "yes" },
|
|
25
27
|
];
|
|
28
|
+
// "(default)" → empty value → leave env/default untouched (resolveConfig only overrides a SET flag).
|
|
29
|
+
const BACKEND_ITEMS = [
|
|
30
|
+
{ label: "(default — lib / env)", value: "" },
|
|
31
|
+
{ label: "lib — Playwright library", value: "lib" },
|
|
32
|
+
{ label: "cli — @playwright/cli wrapper", value: "cli" },
|
|
33
|
+
];
|
|
34
|
+
const CHANNEL_ITEMS = [
|
|
35
|
+
{ label: "(default — bundled Chromium)", value: "" },
|
|
36
|
+
{ label: "chrome — system Chrome", value: "chrome" },
|
|
37
|
+
{ label: "msedge — system Edge", value: "msedge" },
|
|
38
|
+
];
|
|
39
|
+
const ROUTING_ITEMS = [
|
|
40
|
+
{ label: "(default — profile/env)", value: "" },
|
|
41
|
+
{ label: "fast — Groq worker", value: "fast" },
|
|
42
|
+
{ label: "volume — OpenRouter worker", value: "volume" },
|
|
43
|
+
];
|
|
26
44
|
/** Sequential wizard: one field per step, ⏎ advances, last step runs the command. */
|
|
27
45
|
export function FormScreen({ command, initial }) {
|
|
28
46
|
const { navigate, setInTextField, setBackHandler } = useRouter();
|
|
@@ -77,6 +95,21 @@ export function FormScreen({ command, initial }) {
|
|
|
77
95
|
set("validate", it.value === "yes");
|
|
78
96
|
advance();
|
|
79
97
|
} })] }));
|
|
98
|
+
case "backend":
|
|
99
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Browser backend:" }), _jsx(SelectInput, { items: BACKEND_ITEMS, onSelect: (it) => {
|
|
100
|
+
set("backend", (it.value || undefined));
|
|
101
|
+
advance();
|
|
102
|
+
} })] }));
|
|
103
|
+
case "channel":
|
|
104
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "Browser channel (drive a system browser):" }), _jsx(SelectInput, { items: CHANNEL_ITEMS, onSelect: (it) => {
|
|
105
|
+
set("channel", it.value || undefined);
|
|
106
|
+
advance();
|
|
107
|
+
} })] }));
|
|
108
|
+
case "routing":
|
|
109
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "LLM routing preset:" }), _jsx(SelectInput, { items: ROUTING_ITEMS, onSelect: (it) => {
|
|
110
|
+
set("routing", it.value || undefined);
|
|
111
|
+
advance();
|
|
112
|
+
} })] }));
|
|
80
113
|
case "submit":
|
|
81
114
|
return (_jsx(SubmitStep, { command: command, onRun: () => navigate({ name: "dashboard", command, values }) }));
|
|
82
115
|
}
|
|
@@ -108,6 +141,12 @@ function FormSummary({ values, command }) {
|
|
|
108
141
|
}
|
|
109
142
|
if (values.session)
|
|
110
143
|
rows.push(`session: ${values.session}`);
|
|
144
|
+
if (values.backend)
|
|
145
|
+
rows.push(`backend: ${values.backend}`);
|
|
146
|
+
if (values.channel)
|
|
147
|
+
rows.push(`channel: ${values.channel}`);
|
|
148
|
+
if (values.routing)
|
|
149
|
+
rows.push(`routing: ${values.routing}`);
|
|
111
150
|
if (rows.length === 0)
|
|
112
151
|
return null;
|
|
113
152
|
return (_jsx(Box, { flexDirection: "column", marginTop: 1, children: rows.map((r) => (_jsxs(Text, { dimColor: true, children: ["\u00B7 ", r] }, r))) }));
|