pi-harness-runtime 1.1.404 → 1.1.405

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 (158) hide show
  1. package/index.ts +275 -1
  2. package/package.json +1 -1
  3. package/packages/a2a-adapter/package.json +1 -1
  4. package/packages/agent-policy/package.json +1 -1
  5. package/packages/architecture-generator/package.json +1 -1
  6. package/packages/auth/package.json +1 -1
  7. package/packages/autonomous-refactor/package.json +1 -1
  8. package/packages/autonomous-runtime/package.json +1 -1
  9. package/packages/cache-strategy/package.json +1 -1
  10. package/packages/capability-registry/package.json +1 -1
  11. package/packages/checkpoint/package.json +1 -1
  12. package/packages/cli-plugin-sdk/package.json +1 -1
  13. package/packages/clipboard/package.json +1 -1
  14. package/packages/clipboard-plugin/package.json +1 -1
  15. package/packages/code-generation/package.json +1 -1
  16. package/packages/code-review/package.json +1 -1
  17. package/packages/codex-adapter/package.json +1 -1
  18. package/packages/codex-watcher/package.json +1 -1
  19. package/packages/config-capture/package.json +1 -1
  20. package/packages/connection-runtime/package.json +1 -1
  21. package/packages/context-compiler/package.json +1 -1
  22. package/packages/context-discovery/package.json +1 -1
  23. package/packages/context-manager/package.json +1 -1
  24. package/packages/contracts/package.json +1 -1
  25. package/packages/cookie-sanitizer/package.json +1 -1
  26. package/packages/cost-optimizer/package.json +1 -1
  27. package/packages/dependency-analyzer/package.json +1 -1
  28. package/packages/django-plugin/package.json +1 -1
  29. package/packages/doc-generator/package.json +1 -1
  30. package/packages/durable-review/package.json +1 -1
  31. package/packages/e2e-tester/package.json +1 -1
  32. package/packages/evaluation-engine/package.json +1 -1
  33. package/packages/evaluation-runner/package.json +1 -1
  34. package/packages/event-bus/package.json +1 -1
  35. package/packages/event-sink/package.json +1 -1
  36. package/packages/event-store/package.json +1 -1
  37. package/packages/experience-replay/package.json +1 -1
  38. package/packages/feedback-collector/package.json +1 -1
  39. package/packages/file-copy-helper/package.json +1 -1
  40. package/packages/framework-detector/package.json +1 -1
  41. package/packages/framework-plugin-sdk/package.json +1 -1
  42. package/packages/frappe-plugin/package.json +1 -1
  43. package/packages/generic-web-plugin/package.json +1 -1
  44. package/packages/health-monitor/package.json +1 -1
  45. package/packages/intent-analyzer/package.json +1 -1
  46. package/packages/jev-judge/package.json +1 -1
  47. package/packages/knowledge-graph/package.json +1 -1
  48. package/packages/knowledge-retrieval/package.json +1 -1
  49. package/packages/laravel-plugin/package.json +1 -1
  50. package/packages/learning-engine/package.json +1 -1
  51. package/packages/logging/package.json +1 -1
  52. package/packages/mcp-adapter/package.json +1 -1
  53. package/packages/memory-engine/package.json +1 -1
  54. package/packages/milestone-manager/package.json +1 -1
  55. package/packages/model-registry/package.json +1 -1
  56. package/packages/nextjs-plugin/package.json +1 -1
  57. package/packages/notification/dist/adapters/line-adapter.d.ts.map +1 -1
  58. package/packages/notification/dist/adapters/line-adapter.js +6 -1
  59. package/packages/notification/dist/adapters/line-adapter.js.map +1 -1
  60. package/packages/notification/dist/notification-center.d.ts.map +1 -1
  61. package/packages/notification/dist/notification-center.js +32 -0
  62. package/packages/notification/dist/notification-center.js.map +1 -1
  63. package/packages/notification/dist/telegram-webhook-handler.d.ts +7 -0
  64. package/packages/notification/dist/telegram-webhook-handler.d.ts.map +1 -1
  65. package/packages/notification/dist/telegram-webhook-handler.js +7 -0
  66. package/packages/notification/dist/telegram-webhook-handler.js.map +1 -1
  67. package/packages/notification/dist/types.d.ts +1 -1
  68. package/packages/notification/dist/types.d.ts.map +1 -1
  69. package/packages/notification/package.json +1 -1
  70. package/packages/notification/src/adapters/line-adapter.ts +7 -1
  71. package/packages/notification/src/notification-center.ts +30 -0
  72. package/packages/notification/src/telegram-webhook-handler.ts +7 -0
  73. package/packages/notification/src/types.ts +1 -0
  74. package/packages/notification/test/notification.test.ts +31 -28
  75. package/packages/notification/test/tooling-proposal-payload.test.ts +212 -0
  76. package/packages/observability/package.json +1 -1
  77. package/packages/okf-indexer/package.json +1 -1
  78. package/packages/paperclip-integration/package.json +1 -1
  79. package/packages/performance-optimizer/package.json +1 -1
  80. package/packages/permission-mode/package.json +1 -1
  81. package/packages/privilege-broker/package.json +1 -1
  82. package/packages/project-analyzer/package.json +1 -1
  83. package/packages/project-bootstrap/package.json +1 -1
  84. package/packages/projection-engine/package.json +1 -1
  85. package/packages/prompt-compiler/package.json +1 -1
  86. package/packages/prompt-versioning/package.json +1 -1
  87. package/packages/provider-adapter-sdk/package.json +1 -1
  88. package/packages/provider-router/package.json +1 -1
  89. package/packages/provider-selector/package.json +1 -1
  90. package/packages/providers/package.json +1 -1
  91. package/packages/qdrant-skills/package.json +1 -1
  92. package/packages/quota-manager/package.json +1 -1
  93. package/packages/rate-limiter/package.json +1 -1
  94. package/packages/react-vite-plugin/package.json +1 -1
  95. package/packages/relay/package.json +1 -1
  96. package/packages/release-manager/package.json +1 -1
  97. package/packages/requirement-compiler/package.json +1 -1
  98. package/packages/runtime/package.json +1 -1
  99. package/packages/scheduler/package.json +1 -1
  100. package/packages/scheduler-adapter/package.json +1 -1
  101. package/packages/session/package.json +1 -1
  102. package/packages/session-api/package.json +1 -1
  103. package/packages/session-export/package.json +1 -1
  104. package/packages/shared-context/package.json +1 -1
  105. package/packages/skill-mcp-client/package.json +1 -1
  106. package/packages/skill-registry/package.json +1 -1
  107. package/packages/skills/package.json +1 -1
  108. package/packages/sprint-planner/package.json +1 -1
  109. package/packages/subscription-engine/package.json +1 -1
  110. package/packages/task-compiler/package.json +1 -1
  111. package/packages/telegram/package.json +1 -1
  112. package/packages/tencentdb-memory/package.json +1 -1
  113. package/packages/tencentdb-sync/package.json +1 -1
  114. package/packages/test-data-generator/package.json +1 -1
  115. package/packages/test-generator/package.json +1 -1
  116. package/packages/todo-bd-sync/package.json +1 -1
  117. package/packages/token-estimation/package.json +1 -1
  118. package/packages/token-optimizer/package.json +1 -1
  119. package/packages/tooling-preference/dist/detect.d.ts +62 -0
  120. package/packages/tooling-preference/dist/detect.d.ts.map +1 -0
  121. package/packages/tooling-preference/dist/detect.js +209 -0
  122. package/packages/tooling-preference/dist/detect.js.map +1 -0
  123. package/packages/tooling-preference/dist/index.d.ts +13 -0
  124. package/packages/tooling-preference/dist/index.d.ts.map +1 -0
  125. package/packages/tooling-preference/dist/index.js +13 -0
  126. package/packages/tooling-preference/dist/index.js.map +1 -0
  127. package/packages/tooling-preference/dist/proposal.d.ts +70 -0
  128. package/packages/tooling-preference/dist/proposal.d.ts.map +1 -0
  129. package/packages/tooling-preference/dist/proposal.js +137 -0
  130. package/packages/tooling-preference/dist/proposal.js.map +1 -0
  131. package/packages/tooling-preference/dist/registry.d.ts +50 -0
  132. package/packages/tooling-preference/dist/registry.d.ts.map +1 -0
  133. package/packages/tooling-preference/dist/registry.js +53 -0
  134. package/packages/tooling-preference/dist/registry.js.map +1 -0
  135. package/packages/tooling-preference/dist/store.d.ts +61 -0
  136. package/packages/tooling-preference/dist/store.d.ts.map +1 -0
  137. package/packages/tooling-preference/dist/store.js +129 -0
  138. package/packages/tooling-preference/dist/store.js.map +1 -0
  139. package/packages/tooling-preference/package.json +21 -0
  140. package/packages/tooling-preference/src/detect.ts +251 -0
  141. package/packages/tooling-preference/src/index.ts +44 -0
  142. package/packages/tooling-preference/src/proposal.ts +173 -0
  143. package/packages/tooling-preference/src/registry.ts +79 -0
  144. package/packages/tooling-preference/src/store.ts +162 -0
  145. package/packages/tooling-preference/tests/detect.test.ts +188 -0
  146. package/packages/tooling-preference/tests/proposal.test.ts +107 -0
  147. package/packages/tooling-preference/tests/registry.test.ts +51 -0
  148. package/packages/tooling-preference/tests/store.test.ts +99 -0
  149. package/packages/trajectory/package.json +1 -1
  150. package/packages/tui/package.json +1 -1
  151. package/packages/types/package.json +1 -1
  152. package/packages/voice-api/package.json +1 -1
  153. package/packages/webmcp-tester/package.json +1 -1
  154. package/packages/wiki/package.json +1 -1
  155. package/packages/workflow-events/package.json +1 -1
  156. package/packages/workspace-scanner/package.json +1 -1
  157. package/packages/worktree/package.json +1 -1
  158. package/packages/write-review/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/test-generator",
3
- "version": "1.1.404",
3
+ "version": "1.1.405",
4
4
  "description": "Auto-Test Generator — generate unit and E2E tests from source code (RFC-0013)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moocoding/todo-bd-sync",
3
- "version": "1.1.404",
3
+ "version": "1.1.405",
4
4
  "description": "Two-way sync between rpiv-todo overlay and bd issue tracker",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-estimation",
3
- "version": "1.1.404",
3
+ "version": "1.1.405",
4
4
  "description": "pi-harness-runtime — token-estimation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-harness/token-optimizer",
3
- "version": "1.1.404",
3
+ "version": "1.1.405",
4
4
  "description": "Token Budget Optimizer — maximize prompt value within token limits (RFC-0011)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Tooling detection for a workspace.
3
+ *
4
+ * The proposal ("use Biome.js instead of ESLint + Prettier") is only made
5
+ * for a JavaScript/TypeScript workspace that still uses ESLint or Prettier
6
+ * and does not use Biome yet. The detection reads the workspace itself -
7
+ * it never guesses from the harness.
8
+ */
9
+ export interface ToolingContext {
10
+ /** Absolute workspace root. */
11
+ root: string;
12
+ /** The workspace has a package.json. */
13
+ hasPackageJson: boolean;
14
+ /** The workspace is a JavaScript/TypeScript project. */
15
+ isJavaScriptTypeScript: boolean;
16
+ /** Next.js is in use. */
17
+ isNextJs: boolean;
18
+ /** React is in use. */
19
+ isReact: boolean;
20
+ /** Biome is configured or installed. */
21
+ usesBiome: boolean;
22
+ /** ESLint is configured or installed. */
23
+ usesEslint: boolean;
24
+ /** Prettier is configured or installed. */
25
+ usesPrettier: boolean;
26
+ /** The package manager the workspace uses, if it can be told. */
27
+ packageManager: string | null;
28
+ /** The frameworks that were detected. */
29
+ frameworks: string[];
30
+ }
31
+ interface PackageJson {
32
+ name?: string;
33
+ dependencies?: Record<string, string>;
34
+ devDependencies?: Record<string, string>;
35
+ peerDependencies?: Record<string, string>;
36
+ packageManager?: string;
37
+ }
38
+ /**
39
+ * Which package manager does the workspace use?
40
+ *
41
+ * The `packageManager` field wins; a lockfile decides otherwise.
42
+ */
43
+ export declare function detectPackageManager(root: string, pkg: PackageJson | null): string | null;
44
+ /**
45
+ * Read the tooling facts of a workspace.
46
+ */
47
+ export declare function detectToolingContext(root: string): ToolingContext;
48
+ export interface ProposalEligibility {
49
+ /** May the proposal be sent? */
50
+ eligible: boolean;
51
+ /** Why the proposal is (not) sent - a human wording. */
52
+ reason: string;
53
+ }
54
+ /**
55
+ * May the Biome proposal be sent for this workspace?
56
+ *
57
+ * A workspace that already uses Biome is never asked about Biome, and a
58
+ * workspace without ESLint and Prettier has nothing to replace.
59
+ */
60
+ export declare function evaluateBiomeProposalEligibility(context: ToolingContext): ProposalEligibility;
61
+ export {};
62
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,cAAc;IAC9B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,cAAc,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,sBAAsB,EAAE,OAAO,CAAC;IAChC,yBAAyB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,uBAAuB;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,YAAY,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,yCAAyC;IACzC,UAAU,EAAE,MAAM,EAAE,CAAC;CACrB;AAsDD,UAAU,WAAW;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAoED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAQzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAyBjE;AAED,MAAM,WAAW,mBAAmB;IACnC,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,cAAc,GACrB,mBAAmB,CA6BrB"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Tooling detection for a workspace.
3
+ *
4
+ * The proposal ("use Biome.js instead of ESLint + Prettier") is only made
5
+ * for a JavaScript/TypeScript workspace that still uses ESLint or Prettier
6
+ * and does not use Biome yet. The detection reads the workspace itself -
7
+ * it never guesses from the harness.
8
+ */
9
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ const ESLINT_CONFIGS = [
12
+ ".eslintrc",
13
+ ".eslintrc.js",
14
+ ".eslintrc.cjs",
15
+ ".eslintrc.mjs",
16
+ ".eslintrc.json",
17
+ ".eslintrc.yaml",
18
+ ".eslintrc.yml",
19
+ "eslint.config.js",
20
+ "eslint.config.mjs",
21
+ "eslint.config.cjs",
22
+ "eslint.config.ts",
23
+ ];
24
+ const PRETTIER_CONFIGS = [
25
+ ".prettierrc",
26
+ ".prettierrc.json",
27
+ ".prettierrc.yaml",
28
+ ".prettierrc.yml",
29
+ ".prettierrc.js",
30
+ ".prettierrc.cjs",
31
+ ".prettierrc.mjs",
32
+ "prettier.config.js",
33
+ "prettier.config.cjs",
34
+ "prettier.config.mjs",
35
+ "prettier.config.ts",
36
+ ];
37
+ const BIOME_CONFIGS = ["biome.json", "biome.jsonc", "biome.json5"];
38
+ const NEXT_CONFIGS = [
39
+ "next.config.js",
40
+ "next.config.mjs",
41
+ "next.config.cjs",
42
+ "next.config.ts",
43
+ ];
44
+ const SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
45
+ const IGNORED_DIRECTORIES = new Set([
46
+ "node_modules",
47
+ "dist",
48
+ "build",
49
+ "out",
50
+ "coverage",
51
+ "vendor",
52
+ ".git",
53
+ ".next",
54
+ ".turbo",
55
+ ".cache",
56
+ ]);
57
+ function readPackageJson(root) {
58
+ const path = join(root, "package.json");
59
+ if (!existsSync(path))
60
+ return null;
61
+ try {
62
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
63
+ if (!parsed || typeof parsed !== "object")
64
+ return null;
65
+ return parsed;
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ function allDependencies(pkg) {
72
+ if (!pkg)
73
+ return {};
74
+ return {
75
+ ...(pkg.dependencies ?? {}),
76
+ ...(pkg.devDependencies ?? {}),
77
+ ...(pkg.peerDependencies ?? {}),
78
+ };
79
+ }
80
+ function anyExists(root, names) {
81
+ return names.some((name) => existsSync(join(root, name)));
82
+ }
83
+ /**
84
+ * Is there a JavaScript/TypeScript source file in the workspace?
85
+ *
86
+ * The scan is shallow on purpose: it only answers "does this workspace hold
87
+ * JS/TS code at all", so it stops at the first source file and never walks
88
+ * a build or dependency directory.
89
+ */
90
+ function hasSourceFile(root, maxDepth = 2) {
91
+ const queue = [{ dir: root, depth: 0 }];
92
+ while (queue.length > 0) {
93
+ const current = queue.shift();
94
+ if (!current)
95
+ break;
96
+ let entries;
97
+ try {
98
+ entries = readdirSync(current.dir);
99
+ }
100
+ catch {
101
+ continue;
102
+ }
103
+ for (const entry of entries) {
104
+ if (entry.startsWith("."))
105
+ continue;
106
+ const full = join(current.dir, entry);
107
+ let isDirectory = false;
108
+ try {
109
+ isDirectory = statSync(full).isDirectory();
110
+ }
111
+ catch {
112
+ continue;
113
+ }
114
+ if (isDirectory) {
115
+ if (current.depth < maxDepth && !IGNORED_DIRECTORIES.has(entry)) {
116
+ queue.push({ dir: full, depth: current.depth + 1 });
117
+ }
118
+ continue;
119
+ }
120
+ if (SOURCE_EXTENSIONS.some((extension) => entry.endsWith(extension))) {
121
+ return true;
122
+ }
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+ /**
128
+ * Which package manager does the workspace use?
129
+ *
130
+ * The `packageManager` field wins; a lockfile decides otherwise.
131
+ */
132
+ export function detectPackageManager(root, pkg) {
133
+ const declared = pkg?.packageManager?.split("@")[0]?.trim();
134
+ if (declared)
135
+ return declared;
136
+ if (existsSync(join(root, "pnpm-lock.yaml")))
137
+ return "pnpm";
138
+ if (existsSync(join(root, "yarn.lock")))
139
+ return "yarn";
140
+ if (existsSync(join(root, "bun.lock")) || existsSync(join(root, "bun.lockb")))
141
+ return "bun";
142
+ if (existsSync(join(root, "package-lock.json")))
143
+ return "npm";
144
+ return null;
145
+ }
146
+ /**
147
+ * Read the tooling facts of a workspace.
148
+ */
149
+ export function detectToolingContext(root) {
150
+ const pkg = readPackageJson(root);
151
+ const deps = allDependencies(pkg);
152
+ const hasPackageJson = pkg !== null;
153
+ const hasTsConfig = existsSync(join(root, "tsconfig.json"));
154
+ const isNextJs = Boolean(deps.next) || anyExists(root, NEXT_CONFIGS);
155
+ const isReact = Boolean(deps.react || deps["react-dom"]) || isNextJs;
156
+ const isTypeScript = hasTsConfig || Boolean(deps.typescript) || hasSourceFile(root);
157
+ return {
158
+ root,
159
+ hasPackageJson,
160
+ isJavaScriptTypeScript: hasPackageJson && isTypeScript,
161
+ isNextJs,
162
+ isReact,
163
+ usesBiome: anyExists(root, BIOME_CONFIGS) || Boolean(deps["@biomejs/biome"]),
164
+ usesEslint: anyExists(root, ESLINT_CONFIGS) || Boolean(deps.eslint),
165
+ usesPrettier: anyExists(root, PRETTIER_CONFIGS) || Boolean(deps.prettier),
166
+ packageManager: detectPackageManager(root, pkg),
167
+ frameworks: [
168
+ ...(isNextJs ? ["next"] : []),
169
+ ...(isReact && !isNextJs ? ["react"] : []),
170
+ ],
171
+ };
172
+ }
173
+ /**
174
+ * May the Biome proposal be sent for this workspace?
175
+ *
176
+ * A workspace that already uses Biome is never asked about Biome, and a
177
+ * workspace without ESLint and Prettier has nothing to replace.
178
+ */
179
+ export function evaluateBiomeProposalEligibility(context) {
180
+ if (!context.hasPackageJson) {
181
+ return {
182
+ eligible: false,
183
+ reason: "the workspace has no package.json",
184
+ };
185
+ }
186
+ if (!context.isJavaScriptTypeScript) {
187
+ return {
188
+ eligible: false,
189
+ reason: "the workspace is not a JavaScript/TypeScript project",
190
+ };
191
+ }
192
+ if (context.usesBiome) {
193
+ return {
194
+ eligible: false,
195
+ reason: "Biome is already configured in this workspace",
196
+ };
197
+ }
198
+ if (!context.usesEslint && !context.usesPrettier) {
199
+ return {
200
+ eligible: false,
201
+ reason: "the workspace uses neither ESLint nor Prettier",
202
+ };
203
+ }
204
+ return {
205
+ eligible: true,
206
+ reason: "the workspace uses ESLint and/or Prettier and no Biome",
207
+ };
208
+ }
209
+ //# sourceMappingURL=detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../src/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,S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UAAU,EAAE;YACX,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C;KACD,CAAC;AACH,CAAC;AASD;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC/C,OAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7B,OAAO;YACN,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,mCAAmC;SAC3C,CAAC;IACH,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;QACrC,OAAO;YACN,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,sDAAsD;SAC9D,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,OAAO;YACN,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,+CAA+C;SACvD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAClD,OAAO;YACN,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,gDAAgD;SACxD,CAAC;IACH,CAAC;IACD,OAAO;QACN,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,wDAAwD;KAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The JS/TS tooling preference of a workspace.
3
+ *
4
+ * The harness offers the user to replace ESLint and Prettier with Biome.js
5
+ * in a JavaScript/TypeScript workspace. The offer is a decision of its own:
6
+ * it never pauses the work and never travels through the task-approval
7
+ * path.
8
+ */
9
+ export { detectPackageManager, detectToolingContext, evaluateBiomeProposalEligibility, type ProposalEligibility, type ToolingContext, } from "./detect.js";
10
+ export { buildToolingButtons, buildToolingImplementationPrompt, buildToolingProposalMessage, buildToolingRequestId, buildToolingUserKey, parseToolingTarget, TOOLING_ACTION, type ToolingButton, type ToolingChoice, type ToolingPreference, type ToolingTarget, } from "./proposal.js";
11
+ export { harnessRuntimeDir, shouldAskAgain, ToolingPreferenceStore, toolingPreferenceKey, type ToolingPreferenceRecord, } from "./store.js";
12
+ export { ToolingRequestRegistry, type ToolingRequest, type ToolingResolution, } from "./registry.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,EAChC,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,uBAAuB,GAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The JS/TS tooling preference of a workspace.
3
+ *
4
+ * The harness offers the user to replace ESLint and Prettier with Biome.js
5
+ * in a JavaScript/TypeScript workspace. The offer is a decision of its own:
6
+ * it never pauses the work and never travels through the task-approval
7
+ * path.
8
+ */
9
+ export { detectPackageManager, detectToolingContext, evaluateBiomeProposalEligibility, } from "./detect.js";
10
+ export { buildToolingButtons, buildToolingImplementationPrompt, buildToolingProposalMessage, buildToolingRequestId, buildToolingUserKey, parseToolingTarget, TOOLING_ACTION, } from "./proposal.js";
11
+ export { harnessRuntimeDir, shouldAskAgain, ToolingPreferenceStore, toolingPreferenceKey, } from "./store.js";
12
+ export { ToolingRequestRegistry, } from "./registry.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,gCAAgC,GAGhC,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,mBAAmB,EACnB,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GAKd,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,GAEpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACN,sBAAsB,GAGtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The tooling proposal: request IDs, buttons and the wording.
3
+ *
4
+ * The proposal is a decision of its own. It never travels through the
5
+ * task-approval path, because a "No" there pauses the work and a "Yes"
6
+ * there resumes it - neither belongs to a tooling preference.
7
+ */
8
+ import type { ToolingContext } from "./detect.js";
9
+ /**
10
+ * The callback action of the proposal.
11
+ *
12
+ * The callback data is parsed by splitting on "_", so an action must be a
13
+ * single token: an action that carries an underscore would be read as the
14
+ * action up to that underscore, and the rest as the target.
15
+ */
16
+ export declare const TOOLING_ACTION = "biome";
17
+ /** The answer of the user. */
18
+ export type ToolingChoice = "yes" | "no";
19
+ /** The saved preference of a user in a workspace. */
20
+ export type ToolingPreference = "prefer_biome" | "use_project_tools";
21
+ export interface ToolingButton {
22
+ /** The label of the button. */
23
+ text: string;
24
+ /** The callback action - always `TOOLING_ACTION`. */
25
+ action: string;
26
+ /** The choice and the request ID, e.g. `yes-biome-<hash>`. */
27
+ targetId: string;
28
+ }
29
+ export interface ToolingTarget {
30
+ choice: ToolingChoice;
31
+ requestId: string;
32
+ }
33
+ /**
34
+ * The canonical request ID of one proposal.
35
+ *
36
+ * The request ID is the correlation key: both channels send the same ID,
37
+ * and the first answer wins. It only holds hex characters and dashes so it
38
+ * survives the "_" split of the callback data.
39
+ */
40
+ export declare function buildToolingRequestId(userKey: string, workspaceRoot: string): string;
41
+ /**
42
+ * The key of the user the proposal is sent to.
43
+ *
44
+ * The identity is hashed: the store holds the key of a user, never the id
45
+ * of the user.
46
+ */
47
+ export declare function buildToolingUserKey(identity: string): string;
48
+ /**
49
+ * The two buttons of the proposal.
50
+ */
51
+ export declare function buildToolingButtons(requestId: string): ToolingButton[];
52
+ /**
53
+ * Read the choice and the request ID out of a callback target.
54
+ *
55
+ * A target that does not belong to the proposal returns `null` - a click on
56
+ * a foreign button must never resolve a preference.
57
+ */
58
+ export declare function parseToolingTarget(targetId: string | undefined): ToolingTarget | null;
59
+ /**
60
+ * The wording of the proposal.
61
+ */
62
+ export declare function buildToolingProposalMessage(context: ToolingContext): string;
63
+ /**
64
+ * The instruction the agent receives after a "Yes".
65
+ *
66
+ * The agent does the repository work: the harness only records the
67
+ * decision and starts the implementation.
68
+ */
69
+ export declare function buildToolingImplementationPrompt(context: ToolingContext, workspaceRoot: string): string;
70
+ //# sourceMappingURL=proposal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal.d.ts","sourceRoot":"","sources":["../src/proposal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,8BAA8B;AAC9B,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,CAAC;AAEzC,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,mBAAmB,CAAC;AAErE,MAAM,WAAW,aAAa;IAC7B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,CAatE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAKrF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAwB3E;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,MAAM,GACnB,MAAM,CAoCR"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The tooling proposal: request IDs, buttons and the wording.
3
+ *
4
+ * The proposal is a decision of its own. It never travels through the
5
+ * task-approval path, because a "No" there pauses the work and a "Yes"
6
+ * there resumes it - neither belongs to a tooling preference.
7
+ */
8
+ import { createHash } from "node:crypto";
9
+ /**
10
+ * The callback action of the proposal.
11
+ *
12
+ * The callback data is parsed by splitting on "_", so an action must be a
13
+ * single token: an action that carries an underscore would be read as the
14
+ * action up to that underscore, and the rest as the target.
15
+ */
16
+ export const TOOLING_ACTION = "biome";
17
+ function shortHash(value, length = 16) {
18
+ return createHash("sha256").update(value).digest("hex").slice(0, length);
19
+ }
20
+ /**
21
+ * The canonical request ID of one proposal.
22
+ *
23
+ * The request ID is the correlation key: both channels send the same ID,
24
+ * and the first answer wins. It only holds hex characters and dashes so it
25
+ * survives the "_" split of the callback data.
26
+ */
27
+ export function buildToolingRequestId(userKey, workspaceRoot) {
28
+ return `biome-${shortHash(`${userKey} ${workspaceRoot}`)}`;
29
+ }
30
+ /**
31
+ * The key of the user the proposal is sent to.
32
+ *
33
+ * The identity is hashed: the store holds the key of a user, never the id
34
+ * of the user.
35
+ */
36
+ export function buildToolingUserKey(identity) {
37
+ const trimmed = identity.trim();
38
+ if (!trimmed)
39
+ return "default";
40
+ return `u-${shortHash(`user:${trimmed}`)}`;
41
+ }
42
+ /**
43
+ * The two buttons of the proposal.
44
+ */
45
+ export function buildToolingButtons(requestId) {
46
+ return [
47
+ {
48
+ text: "Yes - use Biome.js",
49
+ action: TOOLING_ACTION,
50
+ targetId: `yes-${requestId}`,
51
+ },
52
+ {
53
+ text: "No - keep the current tools",
54
+ action: TOOLING_ACTION,
55
+ targetId: `no-${requestId}`,
56
+ },
57
+ ];
58
+ }
59
+ /**
60
+ * Read the choice and the request ID out of a callback target.
61
+ *
62
+ * A target that does not belong to the proposal returns `null` - a click on
63
+ * a foreign button must never resolve a preference.
64
+ */
65
+ export function parseToolingTarget(targetId) {
66
+ if (!targetId)
67
+ return null;
68
+ const match = /^(yes|no)-(.+)$/.exec(targetId);
69
+ if (!match)
70
+ return null;
71
+ return { choice: match[1], requestId: match[2] };
72
+ }
73
+ /**
74
+ * The wording of the proposal.
75
+ */
76
+ export function buildToolingProposalMessage(context) {
77
+ const frameworks = [];
78
+ if (context.isNextJs)
79
+ frameworks.push("Next.js");
80
+ if (context.isReact && !context.isNextJs)
81
+ frameworks.push("React");
82
+ const tools = [];
83
+ if (context.usesEslint)
84
+ tools.push("ESLint");
85
+ if (context.usesPrettier)
86
+ tools.push("Prettier");
87
+ const lines = [];
88
+ lines.push(frameworks.length > 0
89
+ ? `This workspace looks like a ${frameworks.join(" + ")} project that still uses ${tools.join(" and ")}.`
90
+ : `This workspace looks like a JavaScript/TypeScript project that still uses ${tools.join(" and ")}.`);
91
+ lines.push("");
92
+ lines.push("Biome.js can replace both: one tool for linting, formatting and import order.");
93
+ lines.push("");
94
+ lines.push(`Detected: ${tools.join(", ")}${context.packageManager ? ` - ${context.packageManager}` : ""}`);
95
+ lines.push("");
96
+ lines.push("Yes adds Biome and migrates the lint/format setup here. No keeps the current tools. Nothing changes until you answer.");
97
+ return lines.join("\n");
98
+ }
99
+ /**
100
+ * The instruction the agent receives after a "Yes".
101
+ *
102
+ * The agent does the repository work: the harness only records the
103
+ * decision and starts the implementation.
104
+ */
105
+ export function buildToolingImplementationPrompt(context, workspaceRoot) {
106
+ const frameworks = [];
107
+ if (context.isNextJs)
108
+ frameworks.push("Next.js");
109
+ if (context.isReact && !context.isNextJs)
110
+ frameworks.push("React");
111
+ const manager = context.packageManager;
112
+ let install = "install it as a dev dependency with the package manager of the workspace";
113
+ if (manager === "npm") {
114
+ install = "install it with npm install --save-dev";
115
+ }
116
+ else if (manager) {
117
+ install = `install it with ${manager} add --save-dev`;
118
+ }
119
+ const lines = [];
120
+ lines.push(`The user chose to use Biome.js in this workspace (${workspaceRoot}). Implement it now.`);
121
+ lines.push("");
122
+ lines.push("1. Add Biome to the dev dependencies: " + install + " @biomejs/biome.");
123
+ lines.push("2. Add a biome.json that fits the project:");
124
+ if (frameworks.length > 0) {
125
+ lines.push(` - enable the ${frameworks.join(" and ")} rules,`);
126
+ }
127
+ lines.push(" - enable the formatter, the linter and the import organizer,");
128
+ lines.push(" - keep the settings that match the existing code style (indentation, quotes, semicolons).");
129
+ lines.push("3. Replace the lint and format scripts in package.json with the Biome equivalents (biome check, biome format, biome ci).");
130
+ lines.push("4. Migrate the ESLint and Prettier configuration that Biome replaces and remove the files Biome fully replaces.");
131
+ lines.push("5. Keep the type check and the tests as they are - Biome does not replace them.");
132
+ lines.push("6. Run the Biome check, fix what it reports in the files you touched, and report the result.");
133
+ lines.push("");
134
+ lines.push("Do not touch files outside this workspace and do not change the public behaviour of the code.");
135
+ return lines.join("\n");
136
+ }
137
+ //# sourceMappingURL=proposal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposal.js","sourceRoot":"","sources":["../src/proposal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAsBtC,SAAS,SAAS,CAAC,KAAa,EAAE,MAAM,GAAG,EAAE;IAC5C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,aAAqB;IAC3E,OAAO,SAAS,SAAS,CAAC,GAAG,OAAO,IAAI,aAAa,EAAE,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IACnD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,KAAK,SAAS,CAAC,QAAQ,OAAO,EAAE,CAAC,EAAE,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACpD,OAAO;QACN;YACC,IAAI,EAAE,oBAAoB;YAC1B,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,OAAO,SAAS,EAAE;SAC5B;QACD;YACC,IAAI,EAAE,6BAA6B;YACnC,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,MAAM,SAAS,EAAE;SAC3B;KACD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MA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;QAC3B,KAAK,CAAC,IAAI,CAAC,mBAAmB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;IAC9E,KAAK,CAAC,IAAI,CAAC,8FAA8F,CAAC,CAAC;IAC3G,KAAK,CAAC,IAAI,CACT,0HAA0H,CAC1H,CAAC;IACF,KAAK,CAAC,IAAI,CACT,iHAAiH,CACjH,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAC9F,KAAK,CAAC,IAAI,CAAC,8FAA8F,CAAC,CAAC;IAC3G,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;IAC5G,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The pending proposals of this session.
3
+ *
4
+ * The first answer wins: a second click on the other button changes
5
+ * nothing. The registry is in memory only - a proposal that was never
6
+ * answered simply disappears with the session.
7
+ */
8
+ import type { ToolingChoice, ToolingPreference } from "./proposal.js";
9
+ export interface ToolingRequest {
10
+ /** The canonical request ID of the proposal. */
11
+ requestId: string;
12
+ /** The workspace the proposal belongs to. */
13
+ workspaceRoot: string;
14
+ /** The user the proposal was sent to. */
15
+ userKey: string;
16
+ /** The tooling facts of the workspace. */
17
+ frameworks: string[];
18
+ }
19
+ export interface ToolingResolution {
20
+ choice: ToolingChoice;
21
+ preference: ToolingPreference;
22
+ channel?: string;
23
+ }
24
+ export declare class ToolingRequestRegistry {
25
+ private readonly pending;
26
+ private readonly resolved;
27
+ /**
28
+ * Register a proposal. A request ID that is already known is refused.
29
+ */
30
+ register(request: ToolingRequest): boolean;
31
+ /**
32
+ * Is the request still waiting for an answer?
33
+ */
34
+ has(requestId: string): boolean;
35
+ /**
36
+ * Claim a request for an answer.
37
+ *
38
+ * The claim removes the request, so a second click finds nothing and the
39
+ * first answer stays the one that counts.
40
+ */
41
+ claim(requestId: string, choice: ToolingChoice, channel?: string): {
42
+ request: ToolingRequest;
43
+ resolution: ToolingResolution;
44
+ } | null;
45
+ /**
46
+ * The answer of a request that was already resolved.
47
+ */
48
+ resolutionOf(requestId: string): ToolingResolution | undefined;
49
+ }
50
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC9B,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,sBAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IAEjE;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAMzC;IAED;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE9B;IAED;;;;;OAKG;IACH,KAAK,CACJ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,MAAM,GACd;QAAE,OAAO,EAAE,cAAc,CAAC;QAAC,UAAU,EAAE,iBAAiB,CAAA;KAAE,GAAG,IAAI,CAWnE;IAED;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAE7D;CACD"}