@plune-ai/cairn 0.7.0 → 0.8.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.
Files changed (101) hide show
  1. package/README.md +3 -1
  2. package/dist/agent/graph.d.ts +9 -0
  3. package/dist/agent/graph.d.ts.map +1 -1
  4. package/dist/agent/graph.js +9 -1
  5. package/dist/agent/graph.js.map +1 -1
  6. package/dist/agent/index.d.ts +9 -0
  7. package/dist/agent/index.d.ts.map +1 -1
  8. package/dist/agent/index.js +87 -34
  9. package/dist/agent/index.js.map +1 -1
  10. package/dist/agent/repair-loop.d.ts +17 -1
  11. package/dist/agent/repair-loop.d.ts.map +1 -1
  12. package/dist/agent/repair-loop.js +88 -5
  13. package/dist/agent/repair-loop.js.map +1 -1
  14. package/dist/artifacts/report.d.ts +9 -0
  15. package/dist/artifacts/report.d.ts.map +1 -1
  16. package/dist/artifacts/report.js +26 -0
  17. package/dist/artifacts/report.js.map +1 -1
  18. package/dist/cli/index.d.ts.map +1 -1
  19. package/dist/cli/index.js +35 -4
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/config/index.d.ts +10 -0
  22. package/dist/config/index.d.ts.map +1 -1
  23. package/dist/config/index.js +101 -1
  24. package/dist/config/index.js.map +1 -1
  25. package/dist/config/schema.d.ts +10 -0
  26. package/dist/config/schema.d.ts.map +1 -1
  27. package/dist/config/schema.js +2 -0
  28. package/dist/config/schema.js.map +1 -1
  29. package/dist/core/config.d.ts +7 -0
  30. package/dist/core/config.d.ts.map +1 -1
  31. package/dist/core/config.js +4 -0
  32. package/dist/core/config.js.map +1 -1
  33. package/dist/core/modalities/explore.d.ts.map +1 -1
  34. package/dist/core/modalities/explore.js +7 -1
  35. package/dist/core/modalities/explore.js.map +1 -1
  36. package/dist/decider/capabilities.d.ts +15 -0
  37. package/dist/decider/capabilities.d.ts.map +1 -0
  38. package/dist/decider/capabilities.js +87 -0
  39. package/dist/decider/capabilities.js.map +1 -0
  40. package/dist/decider/client-http.d.ts +27 -0
  41. package/dist/decider/client-http.d.ts.map +1 -0
  42. package/dist/decider/client-http.js +134 -0
  43. package/dist/decider/client-http.js.map +1 -0
  44. package/dist/decider/guarded.d.ts +18 -0
  45. package/dist/decider/guarded.d.ts.map +1 -0
  46. package/dist/decider/guarded.js +48 -0
  47. package/dist/decider/guarded.js.map +1 -0
  48. package/dist/decider/index.d.ts +61 -0
  49. package/dist/decider/index.d.ts.map +1 -0
  50. package/dist/decider/index.js +191 -0
  51. package/dist/decider/index.js.map +1 -0
  52. package/dist/decider/redact.d.ts +6 -0
  53. package/dist/decider/redact.d.ts.map +1 -0
  54. package/dist/decider/redact.js +265 -0
  55. package/dist/decider/redact.js.map +1 -0
  56. package/dist/decider/types.d.ts +139 -0
  57. package/dist/decider/types.d.ts.map +1 -0
  58. package/dist/decider/types.js +21 -0
  59. package/dist/decider/types.js.map +1 -0
  60. package/dist/decider/uses/coverage.d.ts +37 -0
  61. package/dist/decider/uses/coverage.d.ts.map +1 -0
  62. package/dist/decider/uses/coverage.js +63 -0
  63. package/dist/decider/uses/coverage.js.map +1 -0
  64. package/dist/decider/uses/locator-heal.d.ts +69 -0
  65. package/dist/decider/uses/locator-heal.d.ts.map +1 -0
  66. package/dist/decider/uses/locator-heal.js +216 -0
  67. package/dist/decider/uses/locator-heal.js.map +1 -0
  68. package/dist/decider/uses/repair-triage.d.ts +40 -0
  69. package/dist/decider/uses/repair-triage.d.ts.map +1 -0
  70. package/dist/decider/uses/repair-triage.js +94 -0
  71. package/dist/decider/uses/repair-triage.js.map +1 -0
  72. package/dist/eval/judge.d.ts +12 -0
  73. package/dist/eval/judge.d.ts.map +1 -1
  74. package/dist/eval/judge.js +51 -0
  75. package/dist/eval/judge.js.map +1 -1
  76. package/dist/flow/crawl.d.ts +5 -0
  77. package/dist/flow/crawl.d.ts.map +1 -1
  78. package/dist/flow/crawl.js +0 -0
  79. package/dist/flow/crawl.js.map +1 -1
  80. package/dist/llm/cost.d.ts +2 -1
  81. package/dist/llm/cost.d.ts.map +1 -1
  82. package/dist/llm/cost.js +3 -2
  83. package/dist/llm/cost.js.map +1 -1
  84. package/dist/mcp/server.d.ts.map +1 -1
  85. package/dist/mcp/server.js +2 -1
  86. package/dist/mcp/server.js.map +1 -1
  87. package/dist/mcp/tools.d.ts +8 -7
  88. package/dist/mcp/tools.d.ts.map +1 -1
  89. package/dist/mcp/tools.js +9 -2
  90. package/dist/mcp/tools.js.map +1 -1
  91. package/dist/telemetry/index.d.ts +23 -0
  92. package/dist/telemetry/index.d.ts.map +1 -1
  93. package/dist/telemetry/index.js +44 -1
  94. package/dist/telemetry/index.js.map +1 -1
  95. package/dist/tui/screens/summary-screen.d.ts.map +1 -1
  96. package/dist/tui/screens/summary-screen.js +10 -1
  97. package/dist/tui/screens/summary-screen.js.map +1 -1
  98. package/dist/validate/runner.d.ts.map +1 -1
  99. package/dist/validate/runner.js +19 -1
  100. package/dist/validate/runner.js.map +1 -1
  101. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/decider/redact.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,sDAAsD;AACtD,MAAM,WAAW,GACf,8OAA8O,CAAC;AAEjP,uGAAuG;AACvG,oGAAoG;AACpG,8GAA8G;AAC9G,MAAM,cAAc,GAClB,mIAAmI,CAAC;AACtI,MAAM,WAAW,GACf,gIAAgI,CAAC;AACnI,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,IAAI,WAAW,yCAAyC,WAAW,GAAG,EAAE,IAAI,CAAC,CAAC;AACpH;;;;GAIG;AACH,MAAM,WAAW,GACf,obAAob,CAAC;AAIvb;uEACuE;AACvE,MAAM,UAAU,GAAG,mHAAmH,CAAC;AACvI,mGAAmG;AACnG,MAAM,YAAY,GAAG,iDAAiD,CAAC;AACvE,MAAM,UAAU,GAAG,uCAAuC,CAAC;AAC3D,gFAAgF;AAChF,MAAM,OAAO,GACX,kN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System One model — TypeSafe Jev, Convai Laya, or any
4
+ * server speaking Jev's `POST /v1/systemone` — answers typed questions about a state; it never writes
5
+ * text. These are Cairn's own types: the wire format differs on purpose, and `client-http.ts` is the
6
+ * only place that knows it.
7
+ */
8
+ export declare const DECIDER_PROVIDERS: readonly ["jev", "laya", "compat"];
9
+ export type DeciderProvider = (typeof DECIDER_PROVIDERS)[number];
10
+ /** Use points `DECIDER_USES` accepts — nothing else (a typo must not look enabled). */
11
+ export declare const DECIDER_USES: readonly ["repair-triage", "coverage", "locator-heal"];
12
+ export type DeciderUse = (typeof DECIDER_USES)[number];
13
+ export type Question = {
14
+ type: "noul";
15
+ instructions: string;
16
+ /**
17
+ * What a yes and a no mean. Required: measured on laya 0.3.11, a bare yes/no is answered against
18
+ * the text, and these descriptions are what laya's two-option form is asked with (client-http.ts).
19
+ */
20
+ criteria: {
21
+ true: string;
22
+ false: string;
23
+ };
24
+ } | {
25
+ type: "choice";
26
+ instructions: string;
27
+ /** label → when it applies (null = the label speaks for itself). The answer is one of these labels. */
28
+ options: Record<string, string | null>;
29
+ } | {
30
+ type: "score";
31
+ instructions: string;
32
+ /** Ordered level descriptions; the answer's value is a position between 0 and levels.length − 1. */
33
+ levels: string[];
34
+ };
35
+ /**
36
+ * `confidence` describes the SHAPE of the answer's distribution, not the chance it is right, and each
37
+ * provider computes it differently — thresholds are calibrated per use and per provider (spec §8.4, §9.5).
38
+ */
39
+ export type Answer = {
40
+ type: "noul";
41
+ value: boolean;
42
+ p: number;
43
+ confidence: number;
44
+ } | {
45
+ type: "choice";
46
+ value: string;
47
+ dist: Record<string, number>;
48
+ confidence: number;
49
+ } | {
50
+ type: "score";
51
+ value: number;
52
+ dist: number[];
53
+ confidence: number;
54
+ };
55
+ export interface DeciderCaps {
56
+ /** State + its longest question, in characters: each question is encoded together with the state. */
57
+ maxInputChars: number;
58
+ /** One question's own text (instructions + options): laya cuts that part of its input separately. */
59
+ maxQuestionChars: number;
60
+ /** One option as laya renders it (`label: description`, a criterion, a level): laya cuts each at 48 tokens. */
61
+ maxOptionChars: number;
62
+ maxOptions: number;
63
+ maxQuestionsPerCall: number;
64
+ /** USD per 1M tokens; undefined → unknown, the cost line shows n/a. */
65
+ price?: {
66
+ inputPer1M: number;
67
+ outputPer1M: number;
68
+ };
69
+ }
70
+ /** Parsed `DECIDER*` configuration (config/index.ts). Absent from AppConfig unless a provider is chosen. */
71
+ export interface DeciderConfig {
72
+ provider: DeciderProvider;
73
+ baseUrl: string;
74
+ model: string;
75
+ /** jev: TYPESAFE_API_KEY · laya: LAYA_API_KEY · compat: DECIDER_API_KEY — never another provider's key. */
76
+ apiKey?: string;
77
+ uses: DeciderUse[];
78
+ minConfidence: number;
79
+ timeoutMs: number;
80
+ maxCalls: number;
81
+ /** DECIDER_SHADOW / --decider-shadow: ask, record next to the current path's decision, act on nothing. */
82
+ shadow: boolean;
83
+ }
84
+ /** One shadow-mode observation (spec §7): what the current path did and what the decider would have done. */
85
+ export interface ShadowEntry {
86
+ use: DeciderUse;
87
+ /** What the decider was shown (the state, or a compact description of it). */
88
+ input: unknown;
89
+ /** What the current path decided. */
90
+ current: unknown;
91
+ /** What the decider would have decided, or `{ unavailable: reason }`. */
92
+ decider: unknown;
93
+ confidence?: number;
94
+ latencyMs: number;
95
+ /** 1/0 when the current path makes a comparable decision; absent otherwise (repair-triage: spec §9.3). */
96
+ agreement?: 0 | 1;
97
+ }
98
+ export interface ShadowLog {
99
+ readonly entries: readonly ShadowEntry[];
100
+ record(e: ShadowEntry): void;
101
+ }
102
+ /** What a run tells about its decider: calls made, and every fallback with its reason. */
103
+ export interface DeciderSummary {
104
+ provider: DeciderProvider;
105
+ model: string;
106
+ calls: number;
107
+ fallbacks: {
108
+ use: DeciderUse;
109
+ reason: string;
110
+ }[];
111
+ /** Shadow mode only: its private ledger. An active decider prices into the run's own cost report. */
112
+ cost?: CostReport;
113
+ }
114
+ export interface Decider {
115
+ readonly provider: DeciderProvider;
116
+ readonly model: string;
117
+ readonly caps: DeciderCaps;
118
+ readonly uses: ReadonlySet<DeciderUse>;
119
+ readonly minConfidence: number;
120
+ /** The questions are independent: they share `state` and never see each other's answers. */
121
+ decide<K extends string>(use: DeciderUse, state: string, questions: Record<K, Question>): Promise<Record<K, Answer>>;
122
+ /**
123
+ * The run's secrets scrubbed out of a text, exactly as `decide` scrubs a state. A use point that cuts its state to
124
+ * fit a cap scrubs FIRST: a secret cut in half no longer matches, and half a secret is still one.
125
+ */
126
+ readonly scrub: (text: string) => string;
127
+ /** Present only in shadow mode: use points record here and act on nothing. */
128
+ readonly shadow?: ShadowLog;
129
+ summary(): DeciderSummary;
130
+ }
131
+ /** Any failure or limit. The call site catches it and takes the path it would have taken without a decider. */
132
+ export declare class DeciderUnavailable extends Error {
133
+ /** HTTP status when the server answered with an error — lets the guard retry 429/5xx once. */
134
+ readonly status?: number | undefined;
135
+ constructor(message: string,
136
+ /** HTTP status when the server answered with an error — lets the guard retry 429/5xx once. */
137
+ status?: number | undefined);
138
+ }
139
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/decider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,oCAAqC,CAAC;AACpE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,uFAAuF;AACvF,eAAO,MAAM,YAAY,wDAAyD,CAAC;AACnF,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAChB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,M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AC,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,4FAA4F;IAC5F,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACrH;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,OAAO,IAAI,cAAc,CAAC;CAC3B;AAED,+GAA+G;AAC/G,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAFxB,OAAO,EAAE,MAAM;IACf,8FAA8F;IACrF,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The decision layer's contract (ADR-0022). A System One model — TypeSafe Jev, Convai Laya, or any
3
+ * server speaking Jev's `POST /v1/systemone` — answers typed questions about a state; it never writes
4
+ * text. These are Cairn's own types: the wire format differs on purpose, and `client-http.ts` is the
5
+ * only place that knows it.
6
+ */
7
+ export const DECIDER_PROVIDERS = ["jev", "laya", "compat"];
8
+ /** Use points `DECIDER_USES` accepts — nothing else (a typo must not look enabled). */
9
+ export const DECIDER_USES = ["repair-triage", "coverage", "locator-heal"];
10
+ /** Any failure or limit. The call site catches it and takes the path it would have taken without a decider. */
11
+ export class DeciderUnavailable extends Error {
12
+ status;
13
+ constructor(message,
14
+ /** HTTP status when the server answered with an error — lets the guard retry 429/5xx once. */
15
+ status) {
16
+ super(message);
17
+ this.status = status;
18
+ this.name = "DeciderUnavailable";
19
+ }
20
+ }
21
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/decider/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,uFAAuF;AACvF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,cAAc,CAAU,CAAC;AA+GnF,+GAA+G;AAC/G,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAIhC;IAHX,YACE,OAAe;IACf,8FAA8F;IACrF,MAAe;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,WAAM,GAAN,MAAM,CAAS;QAGxB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ import type { TestCase } from "../../design/index.js";
2
+ import type { Decider } from "../types.js";
3
+ /**
4
+ * coverage (spec §6.2, ADR-0022): the checklist × case matrix as yes/no judgments. An item is covered when
5
+ * some case confidently says yes. Anything short of a confident verdict on every item is `undecided`, and
6
+ * the LLM judge decides exactly as it does without a decider.
7
+ */
8
+ export type DeciderCoverage = {
9
+ value: number;
10
+ comment: string;
11
+ perItem: {
12
+ item: string;
13
+ covered: boolean;
14
+ }[];
15
+ asked: CoverageAnswer[];
16
+ } | {
17
+ undecided: string;
18
+ asked: CoverageAnswer[];
19
+ };
20
+ /** One asked (case, item) pair as answered — the pilot tunes the threshold on these (spec §9.5). */
21
+ export interface CoverageAnswer {
22
+ case: number;
23
+ item: number;
24
+ yes: boolean;
25
+ confidence: number;
26
+ }
27
+ /** The case as the decider sees it. Not clipped: an over-long case is refused by the caps — a fallback, not a guess. */
28
+ export declare function caseState(tc: TestCase): string;
29
+ /**
30
+ * One call per case, one `noul` per still-open item (chunked by the provider's questions-per-call cap).
31
+ * Cases are asked one after another: a covered item is not asked again, the first unavailable call ends the
32
+ * pass (so a hanging server costs one timeout), and a single-worker local server is never flooded.
33
+ */
34
+ export declare function deciderChecklistCoverage(items: {
35
+ text: string;
36
+ }[], cases: TestCase[], decider: Decider): Promise<DeciderCoverage>;
37
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../../src/decider/uses/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,GAC1G;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC;AAEnD,oGAAoG;AACpG,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAQ9C;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EACzB,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,eAAe,CAAC,CAuC1B"}
@@ -0,0 +1,63 @@
1
+ const CRITERIA = {
2
+ true: "Its steps or expected result exercise this checklist item",
3
+ false: "It does not exercise this checklist item",
4
+ };
5
+ /** The case as the decider sees it. Not clipped: an over-long case is refused by the caps — a fallback, not a guess. */
6
+ export function caseState(tc) {
7
+ return [
8
+ `Test case: ${tc.title}`,
9
+ ...(tc.preconditions.length ? [`Preconditions: ${tc.preconditions.join("; ")}`] : []),
10
+ "Steps:",
11
+ ...tc.steps.map((s, i) => `${i + 1}. ${s}`),
12
+ `Expected result: ${tc.expected}`,
13
+ ].join("\n");
14
+ }
15
+ /**
16
+ * One call per case, one `noul` per still-open item (chunked by the provider's questions-per-call cap).
17
+ * Cases are asked one after another: a covered item is not asked again, the first unavailable call ends the
18
+ * pass (so a hanging server costs one timeout), and a single-worker local server is never flooded.
19
+ */
20
+ export async function deciderChecklistCoverage(items, cases, decider) {
21
+ const covered = new Set();
22
+ const unsure = new Set();
23
+ const asked = [];
24
+ for (const [c, tc] of cases.entries()) {
25
+ // Shadow mode asks the whole matrix: a pilot replaying a stricter threshold needs the answers pruning skips.
26
+ const open = items.map((_, i) => i).filter((i) => decider.shadow || !covered.has(i));
27
+ for (let at = 0; at < open.length; at += decider.caps.maxQuestionsPerCall) {
28
+ const chunk = open.slice(at, at + decider.caps.maxQuestionsPerCall);
29
+ const questions = Object.fromEntries(chunk.map((i) => [
30
+ `i${i}`,
31
+ { type: "noul", instructions: `Does this test case exercise the checklist item "${items[i].text}"?`, criteria: CRITERIA },
32
+ ]));
33
+ let answers;
34
+ try {
35
+ answers = await decider.decide("coverage", caseState(tc), questions);
36
+ }
37
+ catch (e) {
38
+ return { undecided: `unavailable: ${e instanceof Error ? e.message : String(e)}`, asked };
39
+ }
40
+ for (const i of chunk) {
41
+ const a = answers[`i${i}`];
42
+ if (a?.type !== "noul")
43
+ return { undecided: "an answer that is not a yes/no", asked };
44
+ asked.push({ case: c, item: i, yes: a.value, confidence: a.confidence });
45
+ if (a.confidence < decider.minConfidence)
46
+ unsure.add(i);
47
+ else if (a.value)
48
+ covered.add(i);
49
+ }
50
+ }
51
+ }
52
+ const doubtful = items.filter((_, i) => !covered.has(i) && unsure.has(i)).map((it) => it.text);
53
+ if (doubtful.length > 0)
54
+ return { undecided: `unsure about: ${doubtful.join("; ")}`, asked };
55
+ const uncovered = items.filter((_, i) => !covered.has(i)).map((it) => it.text);
56
+ return {
57
+ value: items.length ? covered.size / items.length : 0,
58
+ comment: uncovered.length > 0 ? `uncovered: ${uncovered.join("; ")}` : "full coverage",
59
+ perItem: items.map((it, i) => ({ item: it.text, covered: covered.has(i) })),
60
+ asked,
61
+ };
62
+ }
63
+ //# sourceMappingURL=coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../src/decider/uses/coverage.ts"],"names":[],"mappings":"AAoBA,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,2DAA2D;IACjE,KAAK,EAAE,0CAA0C;CAClD,CAAC;AAEF,wHAAwH;AACxH,MAAM,UAAU,SAAS,CAAC,EAAY;IACpC,OAAO;QACL,cAAc,EAAE,CAAC,KAAK,EAAE;QACxB,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,QAAQ;QACR,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,oBAAoB,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,KAAyB,EACzB,KAAiB,EACjB,OAAgB;IAEhB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,MAAM,KAAK,GAAqB,EA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CAAC,IAAI,CAAC,CAAC;IAC/E,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe;QACtF,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3E,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * locator-heal (spec §6.6, ADR-0022), v1: after a test fails on a locator, propose a verified replacement in the
3
+ * repair hint. The generated spec stays plain `@playwright/test` — healing happens after the failure, never inside
4
+ * the code. Code reads the broken locator out of Playwright's error and narrows the page's elements to the ones a
5
+ * healer may offer — the same or a compatible role, never a destructive one; the decider only picks among them, and
6
+ * its pick counts only when the browser finds exactly one such element.
7
+ */
8
+ import type { BrowserGateway } from "../../browser/gateway.js";
9
+ import type { ElementRef } from "../../browser/types.js";
10
+ import type { TestResult } from "../../validate/index.js";
11
+ import type { Decider } from "../types.js";
12
+ import type { TriageResult } from "./repair-triage.js";
13
+ export interface BrokenLocator {
14
+ role: string;
15
+ name?: string;
16
+ /** The `getByRole(…)` text as the error printed it — what the repair hint tells the LLM to replace. */
17
+ source: string;
18
+ }
19
+ /**
20
+ * The locator a failing test waited for. Nothing to heal from a CSS locator, a regex name, or a chained scope
21
+ * (`getByRole('dialog').getByRole(…)`): a candidate from the whole page may sit outside the scope, and `verify`
22
+ * counts matches on the whole page. A trailing `.first()`, `.last()` or `.nth(i)` is kept out of `source`.
23
+ * Only the first locator in the error counts: a strict-mode violation goes on to list each element it resolved to,
24
+ * with an `aka getByRole(…)` hint that is not the locator that failed.
25
+ */
26
+ export declare function parseBrokenLocator(error: string): BrokenLocator | undefined;
27
+ export declare function compatibleRoles(role: string): ReadonlySet<string>;
28
+ /**
29
+ * The elements a healer may offer for a broken locator: interactive, named, of a compatible role, one per role and
30
+ * name. Never one the crawler would refuse to click (`DESTRUCTIVE`) or that reads as deleting data — safety rules
31
+ * are not optional (spec §3.5), so the decider is never even asked about them.
32
+ */
33
+ export declare function healCandidates(aria: string, broken: BrokenLocator): ElementRef[];
34
+ /** The exact locator the repair hint proposes: `getByRole('button', { name: 'Save', exact: true })`. */
35
+ export declare function locatorText(el: {
36
+ role: string;
37
+ name: string;
38
+ }): string;
39
+ /** All a healer does with a browser: load the page, count matches. */
40
+ export type HealGateway = Pick<BrowserGateway, "observe" | "verify">;
41
+ /**
42
+ * A gateway opened on first use and closed with the run: `automate` has no browser of its own, and most runs never
43
+ * heal anything. A browser that fails to open fails that heal (a fallback), never the run's final `close`.
44
+ */
45
+ export declare function lazyGateway(open: () => Promise<BrowserGateway>): HealGateway & {
46
+ close(): Promise<void>;
47
+ };
48
+ /** A proposal for the repair hint: the broken locator and a replacement verified to match one element. */
49
+ export interface HealRecord {
50
+ test: string;
51
+ /** The broken `getByRole(…)`, as the error printed it. */
52
+ from: string;
53
+ to: string;
54
+ confidence: number;
55
+ }
56
+ /**
57
+ * The healer (spec §6.6). Candidates come from the page as it loads now, not as it was when the test failed: a
58
+ * locator reachable only mid-scenario finds no candidate, or none the decider picks, and goes to repair as today.
59
+ * No verdict, no parse, the cli backend, no candidate, a doubt, a pick that does not match exactly one element, or
60
+ * any failure → undefined, and repair runs as it would have without a decider. Shadow mode asks and verifies,
61
+ * records, and proposes nothing.
62
+ */
63
+ export declare function makeHeal(opts: {
64
+ decider: Decider;
65
+ /** The lib backend's. The cli one counts no matches (`count -1`), so there a heal asks nothing. */
66
+ gateway: HealGateway;
67
+ url: string;
68
+ }): (failure: TestResult, triage: TriageResult) => Promise<HealRecord | undefined>;
69
+ //# sourceMappingURL=locator-heal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locator-heal.d.ts","sourceRoot":"","sources":["../../../src/decider/uses/locator-heal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,MAAM,EAAE,MAAM,CAAC;CAChB;AAYD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAQ3E;AASD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,UAAU,EAAE,CAYhF;AAID,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEtE;AAED,sEAAsE;AACtE,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;AAErE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,GAAG,WAAW,GAAG;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAazG;AAED,0GAA0G;AAC1G,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAqBD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,mGAAmG;IACnG,OAAO,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAmHjF"}
@@ -0,0 +1,216 @@
1
+ import { DESTRUCTIVE } from "../../flow/crawl.js";
2
+ import { parseAriaSnapshot } from "../../observe/parse-aria.js";
3
+ import { isDeletionIntent } from "../../safety/guardrails.js";
4
+ import { checkCaps } from "../capabilities.js";
5
+ /** `getByRole('role')` or `getByRole('role', { name: 'Name'[, exact: true] })`, with ' or " quotes. */
6
+ const GET_BY_ROLE = /getByRole\((['"])([a-z]+)\1(?:,\s*\{\s*name:\s*(['"])((?:\\.|(?!\3)[^\\\n])*)\3(?:,\s*exact:\s*(?:true|false))?\s*\})?\)/;
7
+ /** Playwright colours its output; the codes are not part of what it says. */
8
+ const plain = (error) => error.replace(/\u001b\[[0-9;]*m/g, "");
9
+ /** A locator expression. The first one in an error is the one that failed. */
10
+ const ANY_LOCATOR = /\b(?:getBy[A-Z]\w*|locator|frameLocator)\(/;
11
+ /**
12
+ * The locator a failing test waited for. Nothing to heal from a CSS locator, a regex name, or a chained scope
13
+ * (`getByRole('dialog').getByRole(…)`): a candidate from the whole page may sit outside the scope, and `verify`
14
+ * counts matches on the whole page. A trailing `.first()`, `.last()` or `.nth(i)` is kept out of `source`.
15
+ * Only the first locator in the error counts: a strict-mode violation goes on to list each element it resolved to,
16
+ * with an `aka getByRole(…)` hint that is not the locator that failed.
17
+ */
18
+ export function parseBrokenLocator(error) {
19
+ const text = plain(error);
20
+ const m = GET_BY_ROLE.exec(text);
21
+ if (!m || ANY_LOCATOR.exec(text)?.index !== m.index)
22
+ return undefined;
23
+ const after = text.slice(m.index + m[0].length);
24
+ if (/^\.(?!first\(\)|last\(\)|nth\()/.test(after))
25
+ return undefined; // a scope before it is a first locator already
26
+ const name = m[4]?.replace(/\\(.)/g, "$1");
27
+ return { role: m[2], ...(name !== undefined ? { name } : {}), source: m[0] };
28
+ }
29
+ /** Roles one element can be swapped for without changing what the step does. */
30
+ const ROLE_FAMILIES = [
31
+ ["textbox", "searchbox", "combobox"],
32
+ ["checkbox", "switch"],
33
+ ["menuitem", "menuitemcheckbox", "menuitemradio"],
34
+ ];
35
+ export function compatibleRoles(role) {
36
+ return new Set(ROLE_FAMILIES.find((f) => f.includes(role)) ?? [role]);
37
+ }
38
+ /**
39
+ * The elements a healer may offer for a broken locator: interactive, named, of a compatible role, one per role and
40
+ * name. Never one the crawler would refuse to click (`DESTRUCTIVE`) or that reads as deleting data — safety rules
41
+ * are not optional (spec §3.5), so the decider is never even asked about them.
42
+ */
43
+ export function healCandidates(aria, broken) {
44
+ const roles = compatibleRoles(broken.role);
45
+ const seen = new Set();
46
+ return parseAriaSnapshot(aria).filter((e) => {
47
+ const name = e.name?.trim();
48
+ if (!e.interactive || !name || !roles.has(e.role))
49
+ return false;
50
+ if (DESTRUCTIVE.test(name) || isDeletionIntent(name))
51
+ return false;
52
+ const key = `${e.role}\n${name}`;
53
+ if (seen.has(key))
54
+ return false;
55
+ seen.add(key);
56
+ return true;
57
+ });
58
+ }
59
+ const quote = (s) => `'${s.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
60
+ /** The exact locator the repair hint proposes: `getByRole('button', { name: 'Save', exact: true })`. */
61
+ export function locatorText(el) {
62
+ return `getByRole(${quote(el.role)}, { name: ${quote(el.name)}, exact: true })`;
63
+ }
64
+ /**
65
+ * A gateway opened on first use and closed with the run: `automate` has no browser of its own, and most runs never
66
+ * heal anything. A browser that fails to open fails that heal (a fallback), never the run's final `close`.
67
+ */
68
+ export function lazyGateway(open) {
69
+ let gw;
70
+ const get = () => (gw ??= open());
71
+ return {
72
+ observe: async (o) => (await get()).observe(o),
73
+ verify: async (els) => (await get()).verify(els),
74
+ close: async () => {
75
+ await gw?.then((g) => g.close(), () => undefined);
76
+ },
77
+ };
78
+ }
79
+ /** Only what triage called a locator failure is healed (spec §6.6 step 1). */
80
+ const HEALABLE = new Set(["locator-missing", "locator-ambiguous"]);
81
+ const NONE = "none-of-these";
82
+ const PICK_INSTRUCTIONS = "Which element on the page did the failing locator mean?";
83
+ const SCORE_LEVELS = ["Unrelated to the failing step", "Plausible", "Clearly the element the step meant"];
84
+ /** The failure in one line. With a question of at most 400 chars (laya) it stays inside every provider's input cap. */
85
+ const MAX_STATE_CHARS = 500;
86
+ /** The two-stage path (spec §6.6, laya): at most the ten best-scored candidates go into the final choice. */
87
+ const MAX_FINALISTS = 10;
88
+ const clip = (s, n) => (s.length <= n ? s : `${s.slice(0, n - 1)}…`);
89
+ /**
90
+ * The healer (spec §6.6). Candidates come from the page as it loads now, not as it was when the test failed: a
91
+ * locator reachable only mid-scenario finds no candidate, or none the decider picks, and goes to repair as today.
92
+ * No verdict, no parse, the cli backend, no candidate, a doubt, a pick that does not match exactly one element, or
93
+ * any failure → undefined, and repair runs as it would have without a decider. Shadow mode asks and verifies,
94
+ * records, and proposes nothing.
95
+ */
96
+ export function makeHeal(opts) {
97
+ const { decider, gateway, url } = opts;
98
+ const { caps } = decider;
99
+ // ponytail: room for labels up to "c999: " — a page with more candidates would still be refused whole, by checkCaps.
100
+ const room = caps.maxOptionChars - 6;
101
+ const choice = (offered) => ({
102
+ type: "choice",
103
+ instructions: PICK_INSTRUCTIONS,
104
+ options: { ...Object.fromEntries(offered.map((o) => [o.label, o.text])), [NONE]: "the element it meant is not in this list" },
105
+ });
106
+ const fits = (state, q) => {
107
+ try {
108
+ checkCaps(caps, state, { pick: q });
109
+ return true;
110
+ }
111
+ catch {
112
+ return false;
113
+ }
114
+ };
115
+ /** Too many candidates for one choice: score each, in calls of at most `maxQuestionsPerCall`, keep the best that fit. */
116
+ const shortlist = async (state, offered) => {
117
+ const score = new Map();
118
+ for (let i = 0; i < offered.length; i += caps.maxQuestionsPerCall) {
119
+ const chunk = offered.slice(i, i + caps.maxQuestionsPerCall);
120
+ const questions = Object.fromEntries(chunk.map((o) => [
121
+ o.label,
122
+ { type: "score", instructions: `How well does ${o.text} match the element the failing locator meant?`, levels: SCORE_LEVELS },
123
+ ]));
124
+ const answers = await decider.decide("locator-heal", state, questions);
125
+ for (const o of chunk) {
126
+ const a = answers[o.label];
127
+ if (a?.type === "score")
128
+ score.set(o.label, a.value);
129
+ }
130
+ }
131
+ const ranked = [...offered].sort((a, b) => (score.get(b.label) ?? -1) - (score.get(a.label) ?? -1)); // stable: ties keep page order
132
+ const finalists = [];
133
+ for (const o of ranked) {
134
+ if (finalists.length === MAX_FINALISTS || !fits(state, choice([...finalists, o])))
135
+ break;
136
+ finalists.push(o);
137
+ }
138
+ return finalists;
139
+ };
140
+ /** One broken locator, asked about for the first test that failed on it. */
141
+ const heal = async (failure, ambiguous, broken) => {
142
+ const input = { state: "", candidates: [] };
143
+ // The decider's time alone, as the other use points record it: opening the page and the check are not in it.
144
+ let asked = 0;
145
+ let answered = 0;
146
+ // A no-op for an active decider, so every path below returns through it.
147
+ const record = (d, confidence) => {
148
+ decider.shadow?.record({
149
+ use: "locator-heal",
150
+ input,
151
+ current: "repair",
152
+ decider: d,
153
+ ...(confidence !== undefined ? { confidence } : {}),
154
+ latencyMs: asked ? (answered || Date.now()) - asked : 0,
155
+ });
156
+ return undefined;
157
+ };
158
+ try {
159
+ const what = ambiguous ? "matched several elements" : "matched no element";
160
+ // The locator first: a clip cuts the tail, and a long test name must not cut what the decider picks by.
161
+ input.state = clip(decider.scrub(`Locator ${broken.source} ${what} in Playwright test "${failure.test}".`), MAX_STATE_CHARS);
162
+ const { ariaSnapshot, capturedBy } = await gateway.observe({ url });
163
+ if (capturedBy !== "lib")
164
+ return undefined; // the cli backend counts no matches: no pick could be checked
165
+ const offered = healCandidates(ariaSnapshot, broken).map((el, i) => ({ el, label: `c${i + 1}`, text: clip(decider.scrub(`${el.role} "${el.name}"`), room) }));
166
+ if (offered.length === 0)
167
+ return undefined; // nothing to ask about
168
+ input.candidates = offered.map((o) => o.text);
169
+ asked = Date.now();
170
+ const finalists = fits(input.state, choice(offered)) ? offered : await shortlist(input.state, offered);
171
+ const a = (await decider.decide("locator-heal", input.state, { pick: choice(finalists) })).pick;
172
+ answered = Date.now();
173
+ if (a?.type !== "choice")
174
+ throw new Error("an answer of the wrong type");
175
+ if (a.value === NONE)
176
+ return record({ to: null, confidence: a.confidence }, a.confidence);
177
+ const chosen = finalists.find((o) => o.label === a.value);
178
+ if (!chosen)
179
+ throw new Error(`an answer outside the offered candidates: '${a.value}'`); // never trust an unoffered label
180
+ if (!decider.shadow && a.confidence < decider.minConfidence)
181
+ return undefined;
182
+ const [v] = await gateway.verify([chosen.el]);
183
+ const to = locatorText({ role: chosen.el.role, name: chosen.el.name ?? "" });
184
+ if (decider.shadow)
185
+ return record({ to, confidence: a.confidence, verified: v?.count === 1 }, a.confidence);
186
+ return v?.count === 1 ? { to, confidence: a.confidence } : undefined;
187
+ }
188
+ catch (e) {
189
+ return record({ unavailable: e instanceof Error ? e.message : String(e) });
190
+ }
191
+ };
192
+ // A named element that went missing (renamed, say) is the same element for every test that asked for it, so those
193
+ // tests share one heal: one question, check and answer (a renamed login button can fail every test). Which of
194
+ // several matches a test meant, or which unnamed element, depends on the test: asked per test.
195
+ // ponytail: a single heal still costs ceil(candidates / maxQuestionsPerCall) + 1 calls on a page too big for one
196
+ // choice; DECIDER_MAX_CALLS bounds the run, cap the candidates if pilots meet such pages.
197
+ const heals = new Map();
198
+ return async (failure, triage) => {
199
+ if (!HEALABLE.has(triage.category))
200
+ return undefined;
201
+ const broken = parseBrokenLocator(failure.error ?? "");
202
+ if (!broken)
203
+ return undefined;
204
+ // Several matches or none is what Playwright's error says, not what triage (a model) called it — a wrong verdict
205
+ // must not make a heal shared. The key is what the question is built from.
206
+ const ambiguous = /strict mode violation/.test(plain(failure.error ?? ""));
207
+ const shared = !ambiguous && broken.name !== undefined;
208
+ const key = `${ambiguous}\n${broken.source}${shared ? "" : `\n${failure.test}`}`;
209
+ let proposal = heals.get(key);
210
+ if (!proposal)
211
+ heals.set(key, (proposal = heal(failure, ambiguous, broken)));
212
+ const p = await proposal;
213
+ return p && { test: failure.test, from: broken.source, ...p };
214
+ };
215
+ }
216
+ //# sourceMappingURL=locator-heal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locator-heal.js","sourceRoot":"","sources":["../../../src/decider/uses/locator-heal.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAW/C,uGAAuG;AACvG,MAAM,WAAW,GACf,0HAA0H,CAAC;AAE7H,6EAA6E;AAC7E,MAAM,KAAK,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;AAEhF,8EAA8E;AAC9E,MAAM,WAAW,GAAG,4CAA4C,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CA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