@gonzih/cc-agent 0.15.23 → 0.15.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +9 -1
- package/dist/agent.js.map +1 -1
- package/dist/index.js +304 -2
- package/dist/index.js.map +1 -1
- package/dist/store.d.ts +2 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -0
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wiki.d.ts +17 -0
- package/dist/wiki.d.ts.map +1 -0
- package/dist/wiki.js +102 -0
- package/dist/wiki.js.map +1 -0
- package/dist/workflow.d.ts +45 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +262 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow.ts — dynamic workflow execution for cc-agent
|
|
3
|
+
*
|
|
4
|
+
* Decomposes a high-level goal into an ordered dependency DAG (stages) via
|
|
5
|
+
* Anthropic Messages API (native fetch, zero new npm deps), then spawns all
|
|
6
|
+
* jobs with proper stage-based dependsOn constraints so later stages only
|
|
7
|
+
* start after all jobs in the prior stage complete.
|
|
8
|
+
*/
|
|
9
|
+
import type { Redis } from "ioredis";
|
|
10
|
+
import type { JobManager } from "./agent.js";
|
|
11
|
+
import type { WorkflowRecord, WorkflowStage } from "./types.js";
|
|
12
|
+
export declare const WORKFLOW_MAX_STAGES_HARD_CAP = 20;
|
|
13
|
+
/**
|
|
14
|
+
* Parse the text content from an Anthropic Messages API response and extract
|
|
15
|
+
* the JSON array of stage objects. Exported for unit testing.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseWorkflowResponse(text: string): WorkflowStage[];
|
|
18
|
+
/** Ensure every element has { stage: number, steps: [{id, task}] }. Exported for testing. */
|
|
19
|
+
export declare function validateStages(arr: unknown[]): WorkflowStage[];
|
|
20
|
+
export interface RunWorkflowParams {
|
|
21
|
+
repoUrl: string;
|
|
22
|
+
goal: string;
|
|
23
|
+
maxStages?: number;
|
|
24
|
+
maxAgentsPerStage?: number;
|
|
25
|
+
maxBudgetPerAgent?: number;
|
|
26
|
+
agentModel?: string;
|
|
27
|
+
agentDriver?: string;
|
|
28
|
+
manager: JobManager;
|
|
29
|
+
redis: Redis | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Entry point called from index.ts.
|
|
33
|
+
* Returns immediately with workflow_id, total_stages, total_jobs, job_ids.
|
|
34
|
+
* Stage ordering is enforced via dependsOn job IDs from the prior stage.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runWorkflow(params: RunWorkflowParams): Promise<{
|
|
37
|
+
workflow_id: string;
|
|
38
|
+
total_stages: number;
|
|
39
|
+
total_jobs: number;
|
|
40
|
+
job_ids: string[];
|
|
41
|
+
stages: WorkflowStage[];
|
|
42
|
+
}>;
|
|
43
|
+
/** Status polling — called by get_workflow_status MCP tool. */
|
|
44
|
+
export declare function getWorkflowStatus(workflowId: string, redis: Redis | null): Promise<WorkflowRecord | null>;
|
|
45
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAU9E,eAAO,MAAM,4BAA4B,KAAK,CAAC;AA0C/C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CA4BnE;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CA0B9D;AAkHD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB,CAAC,CAsFD;AAED,+DAA+D;AAC/D,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,KAAK,GAAG,IAAI,GAClB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEhC"}
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow.ts — dynamic workflow execution for cc-agent
|
|
3
|
+
*
|
|
4
|
+
* Decomposes a high-level goal into an ordered dependency DAG (stages) via
|
|
5
|
+
* Anthropic Messages API (native fetch, zero new npm deps), then spawns all
|
|
6
|
+
* jobs with proper stage-based dependsOn constraints so later stages only
|
|
7
|
+
* start after all jobs in the prior stage complete.
|
|
8
|
+
*/
|
|
9
|
+
import { v4 as uuidv4 } from "uuid";
|
|
10
|
+
import { logger } from "./logger.js";
|
|
11
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
12
|
+
const WORKFLOW_TTL_SECONDS = 7 * 24 * 60 * 60; // 7 days
|
|
13
|
+
const DECOMPOSE_MODEL = "claude-haiku-4-5-20251001";
|
|
14
|
+
const ANTHROPIC_API_URL = "https://api.anthropic.com/v1/messages";
|
|
15
|
+
const ANTHROPIC_API_VERSION = "2023-06-01";
|
|
16
|
+
// Hard cap on stages per workflow
|
|
17
|
+
export const WORKFLOW_MAX_STAGES_HARD_CAP = 20;
|
|
18
|
+
// Redis key helper — cc-wire does not export a workflowKey so we define it here
|
|
19
|
+
const workflowRedisKey = (id) => `cca:workflow:${id}`;
|
|
20
|
+
// ─── In-memory fallback ───────────────────────────────────────────────────────
|
|
21
|
+
const memWorkflows = new Map();
|
|
22
|
+
// ─── Redis helpers ────────────────────────────────────────────────────────────
|
|
23
|
+
async function saveWorkflow(redis, record) {
|
|
24
|
+
if (redis) {
|
|
25
|
+
try {
|
|
26
|
+
await redis.set(workflowRedisKey(record.workflow_id), JSON.stringify(record), "EX", WORKFLOW_TTL_SECONDS);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
logger.error("workflow:save-failed", { workflow_id: record.workflow_id, err: String(err) });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
memWorkflows.set(record.workflow_id, record);
|
|
34
|
+
}
|
|
35
|
+
async function loadWorkflow(redis, workflowId) {
|
|
36
|
+
if (redis) {
|
|
37
|
+
try {
|
|
38
|
+
const raw = await redis.get(workflowRedisKey(workflowId));
|
|
39
|
+
return raw ? JSON.parse(raw) : null;
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
logger.error("workflow:load-failed", { workflow_id: workflowId, err: String(err) });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return memWorkflows.get(workflowId) ?? null;
|
|
46
|
+
}
|
|
47
|
+
// ─── Decomposition ────────────────────────────────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* Parse the text content from an Anthropic Messages API response and extract
|
|
50
|
+
* the JSON array of stage objects. Exported for unit testing.
|
|
51
|
+
*/
|
|
52
|
+
export function parseWorkflowResponse(text) {
|
|
53
|
+
const cleaned = text.trim();
|
|
54
|
+
// Strategy 1: entire text is valid JSON
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(cleaned);
|
|
57
|
+
if (Array.isArray(parsed))
|
|
58
|
+
return validateStages(parsed);
|
|
59
|
+
}
|
|
60
|
+
catch { /* fall through */ }
|
|
61
|
+
// Strategy 2: find first [...] block (handles markdown fences + prose)
|
|
62
|
+
const arrayMatch = cleaned.match(/\[[\s\S]*\]/);
|
|
63
|
+
if (arrayMatch) {
|
|
64
|
+
try {
|
|
65
|
+
const parsed = JSON.parse(arrayMatch[0]);
|
|
66
|
+
if (Array.isArray(parsed))
|
|
67
|
+
return validateStages(parsed);
|
|
68
|
+
}
|
|
69
|
+
catch { /* fall through */ }
|
|
70
|
+
}
|
|
71
|
+
// Strategy 3: find a JSON code fence block
|
|
72
|
+
const fenceMatch = cleaned.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
73
|
+
if (fenceMatch) {
|
|
74
|
+
try {
|
|
75
|
+
const parsed = JSON.parse(fenceMatch[1].trim());
|
|
76
|
+
if (Array.isArray(parsed))
|
|
77
|
+
return validateStages(parsed);
|
|
78
|
+
}
|
|
79
|
+
catch { /* fall through */ }
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`Cannot extract JSON array from workflow response: ${cleaned.slice(0, 500)}`);
|
|
82
|
+
}
|
|
83
|
+
/** Ensure every element has { stage: number, steps: [{id, task}] }. Exported for testing. */
|
|
84
|
+
export function validateStages(arr) {
|
|
85
|
+
return arr
|
|
86
|
+
.filter((item) => typeof item === "object" && item !== null && "stage" in item && "steps" in item)
|
|
87
|
+
.map((item) => {
|
|
88
|
+
const stageNum = Number(item.stage) || 0;
|
|
89
|
+
const stepsRaw = Array.isArray(item.steps) ? item.steps : [];
|
|
90
|
+
const steps = stepsRaw
|
|
91
|
+
.filter((s) => typeof s === "object" && s !== null && "task" in s)
|
|
92
|
+
.map((s, i) => ({
|
|
93
|
+
id: String(s.id || `s${stageNum}-${i + 1}`),
|
|
94
|
+
task: String(s.task || ""),
|
|
95
|
+
depends_on: Array.isArray(s.depends_on) ? s.depends_on.map(String) : undefined,
|
|
96
|
+
}))
|
|
97
|
+
.filter((s) => s.task.trim().length > 0);
|
|
98
|
+
return { stage: stageNum, steps };
|
|
99
|
+
})
|
|
100
|
+
.filter((s) => s.steps.length > 0)
|
|
101
|
+
.sort((a, b) => a.stage - b.stage);
|
|
102
|
+
}
|
|
103
|
+
/** Call Anthropic Messages API to decompose a goal into ordered stages. */
|
|
104
|
+
async function decomposeWorkflowGoal(goal, maxStages, maxAgentsPerStage) {
|
|
105
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
106
|
+
const oauthToken = process.env.CLAUDE_CODE_OAUTH_TOKEN ?? process.env.CLAUDE_CODE_TOKEN;
|
|
107
|
+
if (!apiKey && !oauthToken) {
|
|
108
|
+
throw new Error("Workflow decomposition requires ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN to be set");
|
|
109
|
+
}
|
|
110
|
+
const headers = {
|
|
111
|
+
"content-type": "application/json",
|
|
112
|
+
"anthropic-version": ANTHROPIC_API_VERSION,
|
|
113
|
+
};
|
|
114
|
+
if (apiKey) {
|
|
115
|
+
headers["x-api-key"] = apiKey;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
headers["authorization"] = `Bearer ${oauthToken}`;
|
|
119
|
+
headers["anthropic-beta"] = "oauth-2025-04-20";
|
|
120
|
+
}
|
|
121
|
+
const prompt = buildWorkflowDecomposePrompt(goal, maxStages, maxAgentsPerStage);
|
|
122
|
+
const body = JSON.stringify({
|
|
123
|
+
model: DECOMPOSE_MODEL,
|
|
124
|
+
max_tokens: 4096,
|
|
125
|
+
messages: [{ role: "user", content: prompt }],
|
|
126
|
+
});
|
|
127
|
+
logger.info("workflow:decompose-request", {
|
|
128
|
+
model: DECOMPOSE_MODEL,
|
|
129
|
+
goal: goal.slice(0, 120),
|
|
130
|
+
max_stages: maxStages,
|
|
131
|
+
});
|
|
132
|
+
const response = await fetch(ANTHROPIC_API_URL, {
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers,
|
|
135
|
+
body,
|
|
136
|
+
});
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
const errText = await response.text().catch(() => "(no body)");
|
|
139
|
+
throw new Error(`Anthropic API error ${response.status}: ${errText.slice(0, 500)}`);
|
|
140
|
+
}
|
|
141
|
+
const data = (await response.json());
|
|
142
|
+
const textBlock = data.content?.find((b) => b.type === "text");
|
|
143
|
+
if (!textBlock?.text) {
|
|
144
|
+
throw new Error("Anthropic API returned no text content in workflow decompose response");
|
|
145
|
+
}
|
|
146
|
+
const stages = parseWorkflowResponse(textBlock.text);
|
|
147
|
+
if (stages.length === 0) {
|
|
148
|
+
throw new Error("Workflow decomposition returned 0 stages — cannot proceed");
|
|
149
|
+
}
|
|
150
|
+
logger.info("workflow:decomposed", {
|
|
151
|
+
stage_count: stages.length,
|
|
152
|
+
total_steps: stages.reduce((n, s) => n + s.steps.length, 0),
|
|
153
|
+
});
|
|
154
|
+
return stages;
|
|
155
|
+
}
|
|
156
|
+
function buildWorkflowDecomposePrompt(goal, maxStages, maxAgentsPerStage) {
|
|
157
|
+
return `You are a workflow decomposition assistant. Break the following goal into an ordered sequence of stages, where each stage can contain multiple parallel tasks. Tasks in later stages depend on all tasks in earlier stages completing first.
|
|
158
|
+
|
|
159
|
+
GOAL:
|
|
160
|
+
${goal}
|
|
161
|
+
|
|
162
|
+
Return ONLY a JSON array (no prose, no markdown fences) where each element represents a stage:
|
|
163
|
+
- "stage": stage number starting at 1
|
|
164
|
+
- "steps": array of parallel tasks within this stage, each with:
|
|
165
|
+
- "id": a short unique slug (e.g. "s1-build", "s2-test", "s3-deploy")
|
|
166
|
+
- "task": a clear, actionable description for a coding agent
|
|
167
|
+
|
|
168
|
+
Rules:
|
|
169
|
+
- Use at most ${maxStages} stages
|
|
170
|
+
- Use at most ${maxAgentsPerStage} parallel steps per stage
|
|
171
|
+
- Steps in the same stage run concurrently
|
|
172
|
+
- A later stage only starts after ALL steps in the previous stage complete
|
|
173
|
+
- Each step should be a self-contained unit of work for one coding agent
|
|
174
|
+
|
|
175
|
+
Example output:
|
|
176
|
+
[
|
|
177
|
+
{"stage": 1, "steps": [{"id": "s1-setup", "task": "Set up project scaffolding and install dependencies"}]},
|
|
178
|
+
{"stage": 2, "steps": [{"id": "s2-impl", "task": "Implement the core feature"}, {"id": "s2-tests", "task": "Write the test suite"}]},
|
|
179
|
+
{"stage": 3, "steps": [{"id": "s3-deploy", "task": "Create deployment configuration and open a PR"}]}
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
Return at least 1 stage. Return no more than ${maxStages} stages with no more than ${maxAgentsPerStage} steps per stage.`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Entry point called from index.ts.
|
|
186
|
+
* Returns immediately with workflow_id, total_stages, total_jobs, job_ids.
|
|
187
|
+
* Stage ordering is enforced via dependsOn job IDs from the prior stage.
|
|
188
|
+
*/
|
|
189
|
+
export async function runWorkflow(params) {
|
|
190
|
+
const { repoUrl, goal, maxStages = 8, maxAgentsPerStage = 3, maxBudgetPerAgent = 5, agentModel, agentDriver, manager, redis, } = params;
|
|
191
|
+
const effectiveMaxStages = Math.min(maxStages, WORKFLOW_MAX_STAGES_HARD_CAP);
|
|
192
|
+
let stages;
|
|
193
|
+
try {
|
|
194
|
+
stages = await decomposeWorkflowGoal(goal, effectiveMaxStages, maxAgentsPerStage);
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
throw new Error(`Workflow decomposition failed: ${String(err)}`);
|
|
198
|
+
}
|
|
199
|
+
const workflowId = uuidv4();
|
|
200
|
+
const allJobIds = [];
|
|
201
|
+
let priorStageJobIds = [];
|
|
202
|
+
for (const stageEntry of stages) {
|
|
203
|
+
const currentStageJobIds = [];
|
|
204
|
+
for (const step of stageEntry.steps) {
|
|
205
|
+
try {
|
|
206
|
+
const jobId = await manager.spawn({
|
|
207
|
+
repoUrl,
|
|
208
|
+
task: step.task,
|
|
209
|
+
dependsOn: priorStageJobIds.length > 0 ? [...priorStageJobIds] : undefined,
|
|
210
|
+
maxBudgetUsd: maxBudgetPerAgent,
|
|
211
|
+
agentModel,
|
|
212
|
+
agentDriver,
|
|
213
|
+
noPreamble: false,
|
|
214
|
+
});
|
|
215
|
+
step.job_id = jobId;
|
|
216
|
+
currentStageJobIds.push(jobId);
|
|
217
|
+
allJobIds.push(jobId);
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
logger.error("workflow:step-spawn-failed", {
|
|
221
|
+
workflow_id: workflowId,
|
|
222
|
+
stage: stageEntry.stage,
|
|
223
|
+
step_id: step.id,
|
|
224
|
+
err: String(err),
|
|
225
|
+
});
|
|
226
|
+
// Continue spawning remaining steps even if one fails
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
priorStageJobIds = currentStageJobIds;
|
|
230
|
+
}
|
|
231
|
+
if (allJobIds.length === 0) {
|
|
232
|
+
throw new Error("All workflow step spawns failed — cannot proceed");
|
|
233
|
+
}
|
|
234
|
+
const record = {
|
|
235
|
+
workflow_id: workflowId,
|
|
236
|
+
goal,
|
|
237
|
+
repo_url: repoUrl,
|
|
238
|
+
stages,
|
|
239
|
+
all_job_ids: allJobIds,
|
|
240
|
+
status: "running",
|
|
241
|
+
created_at: new Date().toISOString(),
|
|
242
|
+
};
|
|
243
|
+
await saveWorkflow(redis, record);
|
|
244
|
+
logger.info("workflow:started", {
|
|
245
|
+
workflow_id: workflowId,
|
|
246
|
+
total_stages: stages.length,
|
|
247
|
+
total_jobs: allJobIds.length,
|
|
248
|
+
goal: goal.slice(0, 120),
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
workflow_id: workflowId,
|
|
252
|
+
total_stages: stages.length,
|
|
253
|
+
total_jobs: allJobIds.length,
|
|
254
|
+
job_ids: allJobIds,
|
|
255
|
+
stages,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/** Status polling — called by get_workflow_status MCP tool. */
|
|
259
|
+
export async function getWorkflowStatus(workflowId, redis) {
|
|
260
|
+
return loadWorkflow(redis, workflowId);
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,iFAAiF;AAEjF,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS;AACxD,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAClE,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C,kCAAkC;AAClC,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,gBAAgB,EAAE,EAAE,CAAC;AAE9D,iFAAiF;AAEjF,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,iFAAiF;AAEjF,KAAK,UAAU,YAAY,CAAC,KAAmB,EAAE,MAAsB;IACrE,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,GAAG,CACb,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,EACpC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EACtB,IAAI,EACJ,oBAAoB,CACrB,CAAC;YACF,OA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