cortex-agents 2.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.opencode/agents/{plan.md → architect.md} +104 -45
  2. package/.opencode/agents/audit.md +314 -0
  3. package/.opencode/agents/crosslayer.md +218 -0
  4. package/.opencode/agents/{debug.md → fix.md} +75 -46
  5. package/.opencode/agents/guard.md +202 -0
  6. package/.opencode/agents/{build.md → implement.md} +151 -107
  7. package/.opencode/agents/qa.md +265 -0
  8. package/.opencode/agents/ship.md +249 -0
  9. package/README.md +119 -31
  10. package/dist/cli.js +87 -16
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +215 -9
  13. package/dist/registry.d.ts +8 -3
  14. package/dist/registry.d.ts.map +1 -1
  15. package/dist/registry.js +16 -2
  16. package/dist/tools/cortex.d.ts +2 -2
  17. package/dist/tools/cortex.js +7 -7
  18. package/dist/tools/environment.d.ts +31 -0
  19. package/dist/tools/environment.d.ts.map +1 -0
  20. package/dist/tools/environment.js +93 -0
  21. package/dist/tools/github.d.ts +42 -0
  22. package/dist/tools/github.d.ts.map +1 -0
  23. package/dist/tools/github.js +200 -0
  24. package/dist/tools/repl.d.ts +50 -0
  25. package/dist/tools/repl.d.ts.map +1 -0
  26. package/dist/tools/repl.js +240 -0
  27. package/dist/tools/task.d.ts +2 -0
  28. package/dist/tools/task.d.ts.map +1 -1
  29. package/dist/tools/task.js +25 -30
  30. package/dist/tools/worktree.d.ts.map +1 -1
  31. package/dist/tools/worktree.js +22 -11
  32. package/dist/utils/github.d.ts +104 -0
  33. package/dist/utils/github.d.ts.map +1 -0
  34. package/dist/utils/github.js +243 -0
  35. package/dist/utils/ide.d.ts +76 -0
  36. package/dist/utils/ide.d.ts.map +1 -0
  37. package/dist/utils/ide.js +307 -0
  38. package/dist/utils/plan-extract.d.ts +7 -0
  39. package/dist/utils/plan-extract.d.ts.map +1 -1
  40. package/dist/utils/plan-extract.js +25 -1
  41. package/dist/utils/repl.d.ts +114 -0
  42. package/dist/utils/repl.d.ts.map +1 -0
  43. package/dist/utils/repl.js +434 -0
  44. package/dist/utils/terminal.d.ts +53 -1
  45. package/dist/utils/terminal.d.ts.map +1 -1
  46. package/dist/utils/terminal.js +642 -5
  47. package/package.json +1 -1
  48. package/.opencode/agents/devops.md +0 -176
  49. package/.opencode/agents/fullstack.md +0 -171
  50. package/.opencode/agents/security.md +0 -148
  51. package/.opencode/agents/testing.md +0 -132
  52. package/dist/plugin.d.ts +0 -1
  53. package/dist/plugin.d.ts.map +0 -1
  54. package/dist/plugin.js +0 -4
@@ -0,0 +1,307 @@
1
+ /**
2
+ * IDE Detection System
3
+ *
4
+ * Detects the current Integrated Development Environment or editor context.
5
+ * This is used to offer appropriate worktree launch options that match
6
+ * the user's current workflow.
7
+ *
8
+ * Detection is based on environment variables set by various IDEs when
9
+ * running terminal sessions within them.
10
+ */
11
+ import { shellEscape, which } from "./shell.js";
12
+ /**
13
+ * Detect the current IDE/editor environment.
14
+ * Checks environment variables, process hierarchy, and context clues.
15
+ */
16
+ export function detectIDE() {
17
+ const env = process.env;
18
+ // VS Code detection
19
+ // VSCODE_PID is set when running in VS Code's integrated terminal
20
+ // VSCODE_CWD is set in some VS Code contexts
21
+ // TERM_PROGRAM=vscode is set by VS Code's terminal
22
+ if (env.VSCODE_PID || env.VSCODE_CWD || env.TERM_PROGRAM === "vscode") {
23
+ return {
24
+ type: "vscode",
25
+ name: "Visual Studio Code",
26
+ version: env.VSCODE_VERSION,
27
+ hasIntegratedTerminal: true,
28
+ canOpenInTerminal: true,
29
+ canOpenInWindow: true,
30
+ detectionSource: env.VSCODE_PID ? "VSCODE_PID" :
31
+ env.VSCODE_CWD ? "VSCODE_CWD" : "TERM_PROGRAM",
32
+ };
33
+ }
34
+ // Cursor detection
35
+ // CURSOR_TRACE_ID is set by Cursor AI editor
36
+ // CURSOR_SHELL_VERSION indicates Cursor's shell integration
37
+ if (env.CURSOR_TRACE_ID || env.CURSOR_SHELL_VERSION) {
38
+ return {
39
+ type: "cursor",
40
+ name: "Cursor",
41
+ version: env.CURSOR_SHELL_VERSION,
42
+ hasIntegratedTerminal: true,
43
+ canOpenInTerminal: true,
44
+ canOpenInWindow: true,
45
+ detectionSource: env.CURSOR_TRACE_ID ? "CURSOR_TRACE_ID" : "CURSOR_SHELL_VERSION",
46
+ };
47
+ }
48
+ // Windsurf detection
49
+ // WINDSURF_PARENT_PROCESS indicates Windsurf editor
50
+ // WINDSURF_EDITOR is set by Windsurf's terminal
51
+ if (env.WINDSURF_PARENT_PROCESS || env.WINDSURF_EDITOR) {
52
+ return {
53
+ type: "windsurf",
54
+ name: "Windsurf",
55
+ hasIntegratedTerminal: true,
56
+ canOpenInTerminal: true,
57
+ canOpenInWindow: true,
58
+ detectionSource: env.WINDSURF_PARENT_PROCESS ? "WINDSURF_PARENT_PROCESS" : "WINDSURF_EDITOR",
59
+ };
60
+ }
61
+ // JetBrains detection
62
+ // TERMINAL_EMULATOR contains "JetBrains" when in JB IDE terminal
63
+ // JETBRAINS_IDE is set by some JetBrains IDEs
64
+ if (env.TERMINAL_EMULATOR?.includes("JetBrains") || env.JETBRAINS_IDE) {
65
+ return {
66
+ type: "jetbrains",
67
+ name: env.JETBRAINS_IDE_NAME || "JetBrains IDE",
68
+ hasIntegratedTerminal: true,
69
+ canOpenInTerminal: true, // Can open in terminal, but no CLI for new window
70
+ canOpenInWindow: false, // JB IDEs don't have CLI window opening
71
+ detectionSource: env.JETBRAINS_IDE ? "JETBRAINS_IDE" : "TERMINAL_EMULATOR",
72
+ };
73
+ }
74
+ // Zed detection
75
+ // ZED_TERM is set by Zed's integrated terminal
76
+ // TERM_PROGRAM=zed in some Zed configurations
77
+ if (env.ZED_TERM || env.TERM_PROGRAM === "zed") {
78
+ return {
79
+ type: "zed",
80
+ name: "Zed",
81
+ hasIntegratedTerminal: true,
82
+ canOpenInTerminal: true,
83
+ canOpenInWindow: true,
84
+ detectionSource: env.ZED_TERM ? "ZED_TERM" : "TERM_PROGRAM",
85
+ };
86
+ }
87
+ // Terminal-only detection (fallback when no IDE detected)
88
+ // This means we're in a standalone terminal emulator
89
+ if (env.TERM_PROGRAM || env.TMUX || env.TERM) {
90
+ return {
91
+ type: "terminal",
92
+ name: env.TERM_PROGRAM || env.TERM || "Terminal",
93
+ hasIntegratedTerminal: false,
94
+ canOpenInTerminal: false,
95
+ canOpenInWindow: true,
96
+ detectionSource: env.TERM_PROGRAM ? "TERM_PROGRAM" :
97
+ env.TMUX ? "TMUX" : "TERM",
98
+ };
99
+ }
100
+ // Unknown environment
101
+ return {
102
+ type: "unknown",
103
+ name: "Unknown",
104
+ hasIntegratedTerminal: false,
105
+ canOpenInTerminal: false,
106
+ canOpenInWindow: true,
107
+ detectionSource: "none",
108
+ };
109
+ }
110
+ /**
111
+ * Get the command to open a worktree in the IDE's integrated terminal.
112
+ * Returns null if the IDE doesn't support CLI-based opening.
113
+ *
114
+ * Note: This function is currently unused but kept for future use.
115
+ * All inputs are escaped to prevent command injection.
116
+ */
117
+ export function getIDEOpenCommand(ide, worktreePath) {
118
+ // Escape the path to prevent command injection
119
+ const safePath = shellEscape(worktreePath);
120
+ switch (ide.type) {
121
+ case "vscode":
122
+ // VS Code: use `code` CLI to open folder in new window
123
+ return `code --new-window "${safePath}"`;
124
+ case "cursor":
125
+ // Cursor: use `cursor` CLI
126
+ return `cursor --new-window "${safePath}"`;
127
+ case "windsurf":
128
+ // Windsurf: use `windsurf` CLI
129
+ return `windsurf "${safePath}"`;
130
+ case "zed":
131
+ // Zed: use `zed` CLI
132
+ return `zed "${safePath}"`;
133
+ case "jetbrains":
134
+ // JetBrains: requires manual opening or platform-specific CLI
135
+ // Common CLIs: idea, webstorm, pycharm, etc.
136
+ return null;
137
+ default:
138
+ return null;
139
+ }
140
+ }
141
+ /**
142
+ * Get the name of the CLI binary for the detected IDE.
143
+ * Returns null if no CLI is available or known.
144
+ */
145
+ export function getIDECliBinary(ide) {
146
+ switch (ide.type) {
147
+ case "vscode":
148
+ return "code";
149
+ case "cursor":
150
+ return "cursor";
151
+ case "windsurf":
152
+ return "windsurf";
153
+ case "zed":
154
+ return "zed";
155
+ default:
156
+ return null;
157
+ }
158
+ }
159
+ /**
160
+ * Get a human-readable hint for installing an IDE's CLI binary.
161
+ * Each IDE has a different installation method.
162
+ */
163
+ export function getInstallHint(type, binary) {
164
+ switch (type) {
165
+ case "vscode":
166
+ return "Cmd+Shift+P → 'Shell Command: Install code command in PATH'";
167
+ case "cursor":
168
+ return "Cmd+Shift+P → 'Shell Command: Install cursor command in PATH'";
169
+ case "windsurf":
170
+ return "Ensure Windsurf is installed and 'windsurf' is in PATH";
171
+ case "zed":
172
+ return "Ensure Zed is installed and 'zed' is in PATH";
173
+ default:
174
+ return `Ensure '${binary}' is in PATH`;
175
+ }
176
+ }
177
+ /**
178
+ * Async version of detectIDE() that also checks whether the IDE's CLI binary
179
+ * is actually available in PATH. Use this in tools where you need to verify
180
+ * runtime availability before offering IDE launch options.
181
+ *
182
+ * The sync detectIDE() is preserved for non-async contexts.
183
+ */
184
+ export async function detectIDEWithCLICheck() {
185
+ const ide = detectIDE();
186
+ const cliBinary = getIDECliBinary(ide);
187
+ if (cliBinary) {
188
+ const available = await which(cliBinary);
189
+ ide.cliAvailable = !!available;
190
+ ide.cliBinary = cliBinary;
191
+ if (!available) {
192
+ ide.cliInstallHint = getInstallHint(ide.type, cliBinary);
193
+ }
194
+ }
195
+ else {
196
+ ide.cliAvailable = false;
197
+ }
198
+ return ide;
199
+ }
200
+ /**
201
+ * Check if we're already inside an IDE terminal.
202
+ * This helps determine if we should offer "stay here" as primary option.
203
+ */
204
+ export function isInIDETerminal() {
205
+ const ide = detectIDE();
206
+ return ide.hasIntegratedTerminal && !!process.env.TERM;
207
+ }
208
+ /**
209
+ * Generate contextual recommendations based on detected environment.
210
+ * Used by agents to offer appropriate launch options to users.
211
+ */
212
+ export function generateEnvironmentRecommendations(ide) {
213
+ const recommendations = [];
214
+ if (ide.hasIntegratedTerminal && ide.canOpenInTerminal && ide.cliAvailable !== false) {
215
+ // Only offer IDE option when CLI is confirmed available or hasn't been checked yet
216
+ recommendations.push({
217
+ option: `Open in ${ide.name} (Recommended)`,
218
+ priority: "high",
219
+ reason: `${ide.name} integrated terminal maintains context and is familiar`,
220
+ mode: "ide",
221
+ });
222
+ }
223
+ else if (ide.hasIntegratedTerminal && ide.cliAvailable === false) {
224
+ // IDE detected but CLI missing — note it but don't recommend
225
+ recommendations.push({
226
+ option: `Open in ${ide.name} (CLI not installed)`,
227
+ priority: "low",
228
+ reason: `${ide.cliBinary || "CLI"} not in PATH. ${ide.cliInstallHint || "Install the CLI to enable this option."}`,
229
+ mode: "ide",
230
+ });
231
+ }
232
+ recommendations.push({
233
+ option: "Open in new terminal tab",
234
+ priority: ide.cliAvailable === false ? "high" : "medium",
235
+ reason: "Open in your current terminal emulator as a new tab",
236
+ mode: "terminal",
237
+ });
238
+ recommendations.push({
239
+ option: "Open in-app PTY",
240
+ priority: "medium",
241
+ reason: "Embedded terminal within this OpenCode session",
242
+ mode: "pty",
243
+ });
244
+ recommendations.push({
245
+ option: "Run in background",
246
+ priority: "low",
247
+ reason: "AI implements headlessly while you keep working here",
248
+ mode: "background",
249
+ });
250
+ recommendations.push({
251
+ option: "Stay in current session",
252
+ priority: "low",
253
+ reason: "Continue working in this terminal session",
254
+ mode: "stay",
255
+ });
256
+ return recommendations;
257
+ }
258
+ /**
259
+ * Format environment detection as a human-readable report.
260
+ * Used by the detect_environment tool.
261
+ */
262
+ export function formatEnvironmentReport(ide, terminalName) {
263
+ const lines = [
264
+ `## Environment Detection`,
265
+ ``,
266
+ `**IDE/Editor:** ${ide.name}`,
267
+ `**Detection Method:** ${ide.detectionSource}`,
268
+ `**Terminal:** ${terminalName}`,
269
+ `**Platform:** ${process.platform}`,
270
+ ``,
271
+ ];
272
+ if (ide.version) {
273
+ lines.push(`**Version:** ${ide.version}`, ``);
274
+ }
275
+ lines.push(`### Capabilities`, ``);
276
+ if (ide.hasIntegratedTerminal) {
277
+ lines.push(`- ✓ Has integrated terminal`);
278
+ }
279
+ else {
280
+ lines.push(`- ✗ No integrated terminal`);
281
+ }
282
+ if (ide.canOpenInWindow) {
283
+ if (ide.cliAvailable === false) {
284
+ lines.push(`- ⚠ Can open new window via CLI — but \`${ide.cliBinary || "cli"}\` NOT found in PATH`);
285
+ if (ide.cliInstallHint) {
286
+ lines.push(` Fix: ${ide.cliInstallHint}`);
287
+ }
288
+ }
289
+ else if (ide.cliAvailable === true) {
290
+ lines.push(`- ✓ Can open new window via CLI (\`${ide.cliBinary}\` available)`);
291
+ }
292
+ else {
293
+ lines.push(`- ✓ Can open new window via CLI`);
294
+ }
295
+ }
296
+ else {
297
+ lines.push(`- ✗ Cannot open new window via CLI`);
298
+ }
299
+ lines.push(``, `### Recommended Launch Options`, ``);
300
+ const recommendations = generateEnvironmentRecommendations(ide);
301
+ for (const rec of recommendations) {
302
+ const priorityBadge = rec.priority === "high" ? " (Recommended)" :
303
+ rec.priority === "medium" ? "" : "";
304
+ lines.push(`- **${rec.option}${priorityBadge}** — ${rec.reason}`);
305
+ }
306
+ return lines.join("\n");
307
+ }
@@ -13,6 +13,13 @@ export interface PlanSections {
13
13
  /** The raw plan filename */
14
14
  filename: string;
15
15
  }
16
+ /**
17
+ * Extract GitHub issue references from plan frontmatter.
18
+ *
19
+ * Looks for `issues: [42, 51]` in YAML frontmatter.
20
+ * Returns an array of issue numbers, or an empty array if none found.
21
+ */
22
+ export declare function extractIssueRefs(planContent: string): number[];
16
23
  /**
17
24
  * Extract relevant sections from a plan markdown file for composing a PR body.
18
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plan-extract.d.ts","sourceRoot":"","sources":["../../src/utils/plan-extract.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,MAA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EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAClB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA0C9C"}
@@ -2,6 +2,25 @@ import * as fs from "fs";
2
2
  import * as path from "path";
3
3
  const CORTEX_DIR = ".cortex";
4
4
  const PLANS_DIR = "plans";
5
+ /**
6
+ * Extract GitHub issue references from plan frontmatter.
7
+ *
8
+ * Looks for `issues: [42, 51]` in YAML frontmatter.
9
+ * Returns an array of issue numbers, or an empty array if none found.
10
+ */
11
+ export function extractIssueRefs(planContent) {
12
+ const frontmatterMatch = planContent.match(/^---\n([\s\S]*?)\n---/);
13
+ if (!frontmatterMatch)
14
+ return [];
15
+ // Match issues: [42, 51] or issues: [42]
16
+ const issuesMatch = frontmatterMatch[1].match(/issues:\s*\[([^\]]*)\]/);
17
+ if (!issuesMatch)
18
+ return [];
19
+ return issuesMatch[1]
20
+ .split(",")
21
+ .map((s) => parseInt(s.trim(), 10))
22
+ .filter((n) => !isNaN(n) && n > 0);
23
+ }
5
24
  /**
6
25
  * Extract relevant sections from a plan markdown file for composing a PR body.
7
26
  *
@@ -106,7 +125,12 @@ export function findPlanContent(worktree, planFilename, branchName) {
106
125
  if (!fs.existsSync(plansDir))
107
126
  return null;
108
127
  if (planFilename) {
109
- const filepath = path.join(plansDir, planFilename);
128
+ // Prevent path traversal — resolve and verify the path is strictly inside plansDir
129
+ const filepath = path.resolve(plansDir, planFilename);
130
+ const resolvedPlansDir = path.resolve(plansDir);
131
+ if (!filepath.startsWith(resolvedPlansDir + path.sep)) {
132
+ return null; // Reject traversal attempts and directory-level references (".", "")
133
+ }
110
134
  if (fs.existsSync(filepath)) {
111
135
  return { content: fs.readFileSync(filepath, "utf-8"), filename: planFilename };
112
136
  }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * REPL Loop Utilities
3
+ *
4
+ * State management, plan task parsing, build/test command auto-detection,
5
+ * and progress formatting for the implement agent's iterative task loop.
6
+ *
7
+ * State is persisted to `.cortex/repl-state.json` so it survives context
8
+ * compaction, session restarts, and agent switches.
9
+ */
10
+ export type TaskStatus = "pending" | "in_progress" | "passed" | "failed" | "skipped";
11
+ export interface TaskIteration {
12
+ /** ISO timestamp of this iteration */
13
+ at: string;
14
+ /** Outcome of this iteration */
15
+ result: "pass" | "fail" | "skip";
16
+ /** Test output summary, error message, or skip reason */
17
+ detail: string;
18
+ }
19
+ export interface ReplTask {
20
+ /** Zero-based index in the task list */
21
+ index: number;
22
+ /** Task description from the plan */
23
+ description: string;
24
+ /** Current status in the state machine */
25
+ status: TaskStatus;
26
+ /** Number of failed attempts (resets on pass) */
27
+ retries: number;
28
+ /** Full iteration history */
29
+ iterations: TaskIteration[];
30
+ }
31
+ export interface ReplState {
32
+ /** Source plan filename */
33
+ planFilename: string;
34
+ /** ISO timestamp when the loop started */
35
+ startedAt: string;
36
+ /** ISO timestamp when the loop completed (all tasks done or aborted) */
37
+ completedAt?: string;
38
+ /** Auto-detected or user-provided build command */
39
+ buildCommand: string | null;
40
+ /** Auto-detected or user-provided test command */
41
+ testCommand: string | null;
42
+ /** Optional lint command */
43
+ lintCommand: string | null;
44
+ /** Max retries per task before escalating to user (default: 3) */
45
+ maxRetries: number;
46
+ /** Index of the currently active task (-1 if not started) */
47
+ currentTaskIndex: number;
48
+ /** All tasks in the loop */
49
+ tasks: ReplTask[];
50
+ }
51
+ export interface CommandDetection {
52
+ buildCommand: string | null;
53
+ testCommand: string | null;
54
+ lintCommand: string | null;
55
+ /** Detected framework name (e.g., "vitest", "jest", "pytest") */
56
+ framework: string;
57
+ /** Whether auto-detection found anything */
58
+ detected: boolean;
59
+ }
60
+ /**
61
+ * Parse plan tasks from plan markdown content.
62
+ *
63
+ * Looks for unchecked checkbox items (`- [ ] ...`) in a `## Tasks` section.
64
+ * Falls back to any unchecked checkboxes anywhere in the document.
65
+ * Strips the `Task N:` prefix if present to get a clean description.
66
+ */
67
+ export declare function parseTasksFromPlan(planContent: string): string[];
68
+ /**
69
+ * Auto-detect build, test, and lint commands from project configuration files.
70
+ *
71
+ * Detection priority:
72
+ * 1. package.json (npm/node projects)
73
+ * 2. Makefile
74
+ * 3. Cargo.toml (Rust)
75
+ * 4. go.mod (Go)
76
+ * 5. pyproject.toml / setup.py (Python)
77
+ * 6. mix.exs (Elixir)
78
+ */
79
+ export declare function detectCommands(cwd: string): Promise<CommandDetection>;
80
+ /**
81
+ * Read the current REPL state from .cortex/repl-state.json.
82
+ * Returns null if no state file exists.
83
+ */
84
+ export declare function readReplState(cwd: string): ReplState | null;
85
+ /**
86
+ * Write REPL state to .cortex/repl-state.json.
87
+ * Uses atomic write (temp file + rename) to prevent corruption.
88
+ */
89
+ export declare function writeReplState(cwd: string, state: ReplState): void;
90
+ /**
91
+ * Get the next pending task (first task with status "pending").
92
+ * Returns null if all tasks are done.
93
+ */
94
+ export declare function getNextTask(state: ReplState): ReplTask | null;
95
+ /**
96
+ * Get the currently in-progress task.
97
+ * Returns null if no task is in progress.
98
+ */
99
+ export declare function getCurrentTask(state: ReplState): ReplTask | null;
100
+ /**
101
+ * Check if the loop is complete (no pending or in_progress tasks).
102
+ */
103
+ export declare function isLoopComplete(state: ReplState): boolean;
104
+ /**
105
+ * Format the current loop status as a human-readable string.
106
+ * Used by repl_status tool output.
107
+ */
108
+ export declare function formatProgress(state: ReplState): string;
109
+ /**
110
+ * Format a full summary of the loop results for PR body inclusion.
111
+ * Returns a markdown block with a results table, counts, and timing.
112
+ */
113
+ export declare function formatSummary(state: ReplState): string;
114
+ //# sourceMappingURL=repl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/utils/repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErF,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