sela-core 1.0.6 → 1.0.7

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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/config/ConfigLoader.d.ts +1 -0
  3. package/dist/config/ConfigLoader.d.ts.map +1 -1
  4. package/dist/config/ConfigLoader.js +10 -0
  5. package/dist/config/DryRunGuard.d.ts +14 -0
  6. package/dist/config/DryRunGuard.d.ts.map +1 -0
  7. package/dist/config/DryRunGuard.js +79 -0
  8. package/dist/config/SelaConfig.d.ts +15 -1
  9. package/dist/config/SelaConfig.d.ts.map +1 -1
  10. package/dist/config/SelaConfig.js +27 -1
  11. package/dist/engine/SelaEngine.d.ts +12 -9
  12. package/dist/engine/SelaEngine.d.ts.map +1 -1
  13. package/dist/engine/SelaEngine.js +249 -72
  14. package/dist/errors/SelaError.d.ts +133 -0
  15. package/dist/errors/SelaError.d.ts.map +1 -0
  16. package/dist/errors/SelaError.js +155 -0
  17. package/dist/fixtures/expectProxy.d.ts.map +1 -1
  18. package/dist/fixtures/expectProxy.js +7 -0
  19. package/dist/fixtures/index.d.ts +7 -1
  20. package/dist/fixtures/index.d.ts.map +1 -1
  21. package/dist/fixtures/index.js +15 -0
  22. package/dist/fixtures/proxyTag.d.ts +12 -0
  23. package/dist/fixtures/proxyTag.d.ts.map +1 -0
  24. package/dist/fixtures/proxyTag.js +45 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +6 -1
  28. package/dist/reporter/SelaReporter.d.ts +110 -0
  29. package/dist/reporter/SelaReporter.d.ts.map +1 -0
  30. package/dist/reporter/SelaReporter.js +328 -0
  31. package/dist/services/ASTSourceUpdater.d.ts +19 -0
  32. package/dist/services/ASTSourceUpdater.d.ts.map +1 -1
  33. package/dist/services/ASTSourceUpdater.js +173 -29
  34. package/dist/services/HealReportService.d.ts +42 -0
  35. package/dist/services/HealReportService.d.ts.map +1 -1
  36. package/dist/services/HealReportService.js +80 -1
  37. package/dist/services/HealingCacheService.d.ts +135 -0
  38. package/dist/services/HealingCacheService.d.ts.map +1 -0
  39. package/dist/services/HealingCacheService.js +460 -0
  40. package/dist/services/InitializerUpdater.d.ts.map +1 -1
  41. package/dist/services/InitializerUpdater.js +20 -1
  42. package/dist/services/IntentAuditor.d.ts +18 -1
  43. package/dist/services/IntentAuditor.d.ts.map +1 -1
  44. package/dist/services/IntentAuditor.js +19 -6
  45. package/dist/services/InteractiveReview.d.ts +24 -0
  46. package/dist/services/InteractiveReview.d.ts.map +1 -0
  47. package/dist/services/InteractiveReview.js +218 -0
  48. package/dist/services/LLMService.d.ts +17 -1
  49. package/dist/services/LLMService.d.ts.map +1 -1
  50. package/dist/services/LLMService.js +18 -8
  51. package/dist/services/PRAutomationService.d.ts +14 -1
  52. package/dist/services/PRAutomationService.d.ts.map +1 -1
  53. package/dist/services/PRAutomationService.js +260 -69
  54. package/dist/services/PendingPromptLedger.d.ts +44 -0
  55. package/dist/services/PendingPromptLedger.d.ts.map +1 -0
  56. package/dist/services/PendingPromptLedger.js +180 -0
  57. package/dist/services/ReportGenerator.d.ts +70 -0
  58. package/dist/services/ReportGenerator.d.ts.map +1 -0
  59. package/dist/services/ReportGenerator.js +191 -0
  60. package/dist/services/SafetyGuard.d.ts +27 -1
  61. package/dist/services/SafetyGuard.d.ts.map +1 -1
  62. package/dist/services/SafetyGuard.js +58 -12
  63. package/dist/services/SourceUpdater.d.ts.map +1 -1
  64. package/dist/services/SourceUpdater.js +44 -13
  65. package/dist/services/WorkspaceSnapshotService.d.ts +71 -0
  66. package/dist/services/WorkspaceSnapshotService.d.ts.map +1 -0
  67. package/dist/services/WorkspaceSnapshotService.js +202 -0
  68. package/dist/utils/IsolatedDiff.d.ts +45 -0
  69. package/dist/utils/IsolatedDiff.d.ts.map +1 -0
  70. package/dist/utils/IsolatedDiff.js +379 -0
  71. package/package.json +71 -67
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fixwright
1
+ # Sela
2
2
 
3
3
 
4
4
 
@@ -7,6 +7,7 @@ export declare class ConfigLoader {
7
7
  * calls return the cached result at zero cost.
8
8
  */
9
9
  static getInstance(): ResolvedConfig;
10
+ private static logEnvBanners;
10
11
  /** Returns the detected Git branch name, or null if detection failed. */
11
12
  static getBranch(): string | null;
12
13
  /** Clears the singleton cache — useful for testing. */
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,cAAc,EAAiB,MAAM,cAAc,CAAC;AAoGzE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuB;IAE5C;;;OAGG;IACH,MAAM,CAAC,WAAW,IAAI,cAAc;IAiCpC,yEAAyE;IACzE,MAAM,CAAC,SAAS,IAAI,MAAM,GAAG,IAAI;IAMjC,uDAAuD;IACvD,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
1
+ {"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,cAAc,EAAiB,MAAM,cAAc,CAAC;AAoGzE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuB;IAE5C;;;OAGG;IACH,MAAM,CAAC,WAAW,IAAI,cAAc;IAmCpC,OAAO,CAAC,MAAM,CAAC,aAAa;IAW5B,yEAAyE;IACzE,MAAM,CAAC,SAAS,IAAI,MAAM,GAAG,IAAI;IAMjC,uDAAuD;IACvD,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
@@ -141,6 +141,7 @@ class ConfigLoader {
141
141
  if (!configPath) {
142
142
  // Zero-breaking-change guarantee: no config → pure defaults
143
143
  ConfigLoader.resolved = (0, SelaConfig_1.resolveConfig)({});
144
+ ConfigLoader.logEnvBanners(ConfigLoader.resolved);
144
145
  return ConfigLoader.resolved;
145
146
  }
146
147
  console.log(`[Sela] 📄 Loaded config from: ${path.relative(process.cwd(), configPath)}`);
@@ -156,8 +157,17 @@ class ConfigLoader {
156
157
  }
157
158
  }
158
159
  ConfigLoader.resolved = (0, SelaConfig_1.resolveConfig)(rawConfig);
160
+ ConfigLoader.logEnvBanners(ConfigLoader.resolved);
159
161
  return ConfigLoader.resolved;
160
162
  }
163
+ static logEnvBanners(resolved) {
164
+ if (resolved.dryRun) {
165
+ console.log('[Sela] 🌵 DRY RUN active (SELA_DRY_RUN) — disk writes & git commits suppressed.');
166
+ }
167
+ if (resolved.noCache) {
168
+ console.log('[Sela] 🧊 Cache disabled (SELA_NO_CACHE).');
169
+ }
170
+ }
161
171
  /** Returns the detected Git branch name, or null if detection failed. */
162
172
  static getBranch() {
163
173
  // Ensure getInstance() has been called at least once
@@ -0,0 +1,14 @@
1
+ export declare const DryRunGuard: {
2
+ /**
3
+ * Returns true when `SELA_DRY_RUN` is set to a truthy value in the current
4
+ * process environment. Throws via `parseEnvBoolean` when the value is not
5
+ * one of the accepted tokens — fail-fast keeps misconfigured CI loud.
6
+ */
7
+ active(env?: NodeJS.ProcessEnv): boolean;
8
+ /**
9
+ * Centralised log line for skipped writes so the diff between a dry run
10
+ * and a real run is auditable in test output and CI logs.
11
+ */
12
+ logSkippedWrite(label: string, target: string): void;
13
+ };
14
+ //# sourceMappingURL=DryRunGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DryRunGuard.d.ts","sourceRoot":"","sources":["../../src/config/DryRunGuard.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,WAAW;IACtB;;;;OAIG;iBACS,MAAM,CAAC,UAAU,GAAiB,OAAO;IAIrD;;;OAGG;2BACoB,MAAM,UAAU,MAAM,GAAG,IAAI;CAIrD,CAAC"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ // src/config/DryRunGuard.ts
3
+ //
4
+ // Single source of truth for the "dry run" runtime gate.
5
+ //
6
+ // The flag is sourced from the `SELA_DRY_RUN` environment variable using the
7
+ // strict parser in SelaConfig.parseEnvBoolean (no silent coercion — bad
8
+ // values throw). The variable is re-read on every call so tests and
9
+ // long-running processes can toggle it without restarting the engine.
10
+ //
11
+ // Two writer paths route through this guard:
12
+ //
13
+ // 1. SourceUpdater._coreUpdate — every `fs.writeFileSync` to a spec/source
14
+ // file. When dry-run is active the write is skipped and a console
15
+ // breadcrumb is emitted with the absolute path that *would have* been
16
+ // written.
17
+ //
18
+ // 2. ASTSourceUpdater._persistChanges — wraps ts-morph `SourceFile.saveSync`.
19
+ // When dry-run is active the in-memory AST mutation stays, but the
20
+ // `saveSync` call (which forwards to fs.writeFileSync inside ts-morph)
21
+ // is skipped so the spec on disk is identical pre/post heal.
22
+ //
23
+ // Git auto-commit operations consult `DryRunGuard.active()` directly so
24
+ // `git add` / `git commit` never fire during a dry run.
25
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ var desc = Object.getOwnPropertyDescriptor(m, k);
28
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
29
+ desc = { enumerable: true, get: function() { return m[k]; } };
30
+ }
31
+ Object.defineProperty(o, k2, desc);
32
+ }) : (function(o, m, k, k2) {
33
+ if (k2 === undefined) k2 = k;
34
+ o[k2] = m[k];
35
+ }));
36
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
37
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
38
+ }) : function(o, v) {
39
+ o["default"] = v;
40
+ });
41
+ var __importStar = (this && this.__importStar) || (function () {
42
+ var ownKeys = function(o) {
43
+ ownKeys = Object.getOwnPropertyNames || function (o) {
44
+ var ar = [];
45
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
46
+ return ar;
47
+ };
48
+ return ownKeys(o);
49
+ };
50
+ return function (mod) {
51
+ if (mod && mod.__esModule) return mod;
52
+ var result = {};
53
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
54
+ __setModuleDefault(result, mod);
55
+ return result;
56
+ };
57
+ })();
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.DryRunGuard = void 0;
60
+ const path = __importStar(require("path"));
61
+ const SelaConfig_1 = require("./SelaConfig");
62
+ exports.DryRunGuard = {
63
+ /**
64
+ * Returns true when `SELA_DRY_RUN` is set to a truthy value in the current
65
+ * process environment. Throws via `parseEnvBoolean` when the value is not
66
+ * one of the accepted tokens — fail-fast keeps misconfigured CI loud.
67
+ */
68
+ active(env = process.env) {
69
+ return (0, SelaConfig_1.parseEnvBoolean)('SELA_DRY_RUN', env.SELA_DRY_RUN);
70
+ },
71
+ /**
72
+ * Centralised log line for skipped writes so the diff between a dry run
73
+ * and a real run is auditable in test output and CI logs.
74
+ */
75
+ logSkippedWrite(label, target) {
76
+ const display = target ? path.basename(target) : '<no-path>';
77
+ console.log(`[Sela] 🌵 Dry Run — skip ${label} → ${display}`);
78
+ },
79
+ };
@@ -107,7 +107,21 @@ export interface ResolvedConfig {
107
107
  maxSteps: number;
108
108
  forbiddenSelectors: string[];
109
109
  };
110
+ /**
111
+ * When true, every disk-mutating side-effect in the heal pipeline is
112
+ * suppressed: `fs.writeFileSync`, ts-morph `saveSync`, and git auto-commits.
113
+ * The heal still runs end-to-end (LLM call, SafetyGuard, candidate diff),
114
+ * but no source files are modified and no commits are produced.
115
+ * Sourced from `SELA_DRY_RUN` env var (`1`, `true`, `yes`, `on`).
116
+ */
117
+ dryRun: boolean;
118
+ /**
119
+ * When true, the healing cache layer is bypassed — every heal request
120
+ * goes straight to the LLM. Sourced from `SELA_NO_CACHE` env var.
121
+ */
122
+ noCache: boolean;
110
123
  }
111
124
  export declare function resolveThresholds(config: SelaConfig): ResolvedThresholds;
112
- export declare function resolveConfig(config: SelaConfig): ResolvedConfig;
125
+ export declare function parseEnvBoolean(varName: string, rawValue: string | undefined): boolean;
126
+ export declare function resolveConfig(config: SelaConfig, env?: NodeJS.ProcessEnv): ResolvedConfig;
113
127
  //# sourceMappingURL=SelaConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelaConfig.d.ts","sourceRoot":"","sources":["../../src/config/SelaConfig.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,CAAC;AACxE,MAAM,MAAM,SAAS,GAAI,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,UAAU,CAAC;IAEtB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,oFAAoF;IACpF,gBAAgB,CAAC,EAAE;QACjB,sEAAsE;QACtE,4BAA4B,CAAC,EAAE,MAAM,CAAC;QACtC,oFAAoF;QACpF,8BAA8B,CAAC,EAAE,MAAM,CAAC;QACxC,oDAAoD;QACpD,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KACnD,CAAC;IAEF,qFAAqF;IACrF,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD,MAAM,WAAW,UAAU;IACz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C;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,oBAAoB,CAAC;IACnC,gBAAgB,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF;;;;;;OAMG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAgCD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,kBAAkB,CAkBxE;AA4CD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,OAAO,CAST;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,cAAc,CAgChB"}
@@ -3,6 +3,7 @@
3
3
  // Single source of truth for all Sela configuration types and preset expansion logic.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.resolveThresholds = resolveThresholds;
6
+ exports.parseEnvBoolean = parseEnvBoolean;
6
7
  exports.resolveConfig = resolveConfig;
7
8
  const PRESET_MAP = {
8
9
  conservative: { minHealerConfidence: 92, auditorStrictness: 'strict', assertionSimilarityFloor: 0.85 },
@@ -62,7 +63,28 @@ function resolvePRAutomation(config) {
62
63
  reportArtifactPath: pr.reportArtifactPath ?? 'sela-report.html',
63
64
  };
64
65
  }
65
- function resolveConfig(config) {
66
+ // ═══════════════════════════════════════════════════════════════════
67
+ // ENV FLAG PARSING — strict, fail-fast
68
+ //
69
+ // Accepted truthy values (case-insensitive): "1", "true", "yes", "on".
70
+ // Accepted falsy values (case-insensitive): "0", "false", "no", "off", "".
71
+ // Anything else → throws so misconfigured CI environments fail loudly
72
+ // instead of silently running the wrong mode.
73
+ // ═══════════════════════════════════════════════════════════════════
74
+ const ENV_TRUTHY = new Set(['1', 'true', 'yes', 'on']);
75
+ const ENV_FALSY = new Set(['0', 'false', 'no', 'off', '']);
76
+ function parseEnvBoolean(varName, rawValue) {
77
+ if (rawValue === undefined)
78
+ return false;
79
+ const normalized = rawValue.trim().toLowerCase();
80
+ if (ENV_TRUTHY.has(normalized))
81
+ return true;
82
+ if (ENV_FALSY.has(normalized))
83
+ return false;
84
+ throw new Error(`[Sela] Invalid value for env var "${varName}": "${rawValue}". ` +
85
+ `Expected one of: 1, 0, true, false, yes, no, on, off.`);
86
+ }
87
+ function resolveConfig(config, env = process.env) {
66
88
  const prAutomation = resolvePRAutomation(config);
67
89
  // When prAutomation owns the git pipeline, suppress per-heal git side-effects
68
90
  // in SourceUpdater (autoCommit + updateStrategy:'branch') to avoid double-commits.
@@ -72,6 +94,8 @@ function resolveConfig(config) {
72
94
  ? 'inPlace'
73
95
  : requestedUpdateStrategy;
74
96
  const autoCommit = suppressLegacyGit ? false : (config.autoCommit ?? false);
97
+ const dryRun = parseEnvBoolean('SELA_DRY_RUN', env.SELA_DRY_RUN);
98
+ const noCache = parseEnvBoolean('SELA_NO_CACHE', env.SELA_NO_CACHE);
75
99
  return {
76
100
  thresholds: resolveThresholds(config),
77
101
  updateStrategy,
@@ -83,5 +107,7 @@ function resolveConfig(config) {
83
107
  maxSteps: config.agenticDiscovery?.maxSteps ?? 10,
84
108
  forbiddenSelectors: config.agenticDiscovery?.forbiddenSelectors ?? [],
85
109
  },
110
+ dryRun,
111
+ noCache,
86
112
  };
87
113
  }
@@ -5,6 +5,8 @@ export declare class SelaEngine {
5
5
  private llmService;
6
6
  private snapshotService;
7
7
  private safetyGuard;
8
+ private astDirectiveScanner;
9
+ private healingCache;
8
10
  private config;
9
11
  private dnaBuffer;
10
12
  private healMetaBuffer;
@@ -15,17 +17,18 @@ export declare class SelaEngine {
15
17
  private _toReportFile;
16
18
  private _safeReadLine;
17
19
  /**
18
- * Capture the native `git diff --unified=1 HEAD -- <file>` for the file the
19
- * AST mutation just wrote to. Returns an empty string when git is not
20
- * available, the file is not tracked, or any other failure — callers must
21
- * treat empty output as "no diff captured" and fall back to a direct disk
22
- * read of the mutated line.
20
+ * Clean-Room isolated diff: render a unified diff between the file's
21
+ * pre-Sela disk snapshot (`contentBefore`) and the post-write disk state
22
+ * (`contentAfter`) captured by `WorkspaceSnapshotService`. Returns "" when
23
+ * the file was never tracked (no snapshot) or the AST mutation produced
24
+ * no net change.
23
25
  *
24
- * Path safety: the absolute path is always wrapped in double quotes after
25
- * escaping any embedded double quotes, which makes the call safe on Windows
26
- * paths containing spaces or backslashes as well as POSIX paths.
26
+ * This is what makes the HTML report immune to developer dirty edits: any
27
+ * pre-existing uncommitted changes live in BOTH buffers identically and
28
+ * are therefore filtered out by the diff. The output contains only Sela's
29
+ * selector swap.
27
30
  */
28
- private _captureGitDiff;
31
+ private _captureIsolatedDiff;
29
32
  /**
30
33
  * Walk a unified diff and pull out the first removed line and the first
31
34
  * added line so the legacy report fields (`oldCodeLine`, `newCodeLine`)
@@ -1 +1 @@
1
- {"version":3,"file":"SelaEngine.d.ts","sourceRoot":"","sources":["../../src/engine/SelaEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAOxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAe,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAyChE,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAA6C;IAC9D,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,eAAe,CAAkC;;IAanD,YAAY,CAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,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