@dewtech/dare-cli 2.2.0 → 2.3.1
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 +46 -27
- package/dist/__tests__/dag-runner/graph-ingest.test.d.ts +2 -0
- package/dist/__tests__/dag-runner/graph-ingest.test.d.ts.map +1 -0
- package/dist/__tests__/dag-runner/graph-ingest.test.js +116 -0
- package/dist/__tests__/dag-runner/graph-ingest.test.js.map +1 -0
- package/dist/__tests__/dag-runner/orchestrator.test.d.ts +2 -0
- package/dist/__tests__/dag-runner/orchestrator.test.d.ts.map +1 -0
- package/dist/__tests__/dag-runner/orchestrator.test.js +107 -0
- package/dist/__tests__/dag-runner/orchestrator.test.js.map +1 -0
- package/dist/__tests__/dag-runner/utils.test.js +0 -28
- package/dist/__tests__/dag-runner/utils.test.js.map +1 -1
- package/dist/__tests__/graphrag/json-graph.test.d.ts +2 -0
- package/dist/__tests__/graphrag/json-graph.test.d.ts.map +1 -0
- package/dist/__tests__/graphrag/json-graph.test.js +57 -0
- package/dist/__tests__/graphrag/json-graph.test.js.map +1 -0
- package/dist/bin/dare.js +2 -0
- package/dist/bin/dare.js.map +1 -1
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +175 -46
- package/dist/commands/execute.js.map +1 -1
- package/dist/commands/graph.d.ts +9 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +177 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/dag-runner/graph-ingest.d.ts +17 -0
- package/dist/dag-runner/graph-ingest.d.ts.map +1 -0
- package/dist/dag-runner/graph-ingest.js +149 -0
- package/dist/dag-runner/graph-ingest.js.map +1 -0
- package/dist/dag-runner/run_dag.d.ts +47 -30
- package/dist/dag-runner/run_dag.d.ts.map +1 -1
- package/dist/dag-runner/run_dag.js +145 -166
- package/dist/dag-runner/run_dag.js.map +1 -1
- package/dist/dag-runner/state-store.d.ts +13 -0
- package/dist/dag-runner/state-store.d.ts.map +1 -0
- package/dist/dag-runner/state-store.js +69 -0
- package/dist/dag-runner/state-store.js.map +1 -0
- package/dist/dag-runner/utils/cap-output.d.ts.map +1 -1
- package/dist/dag-runner/utils/cap-output.js +5 -2
- package/dist/dag-runner/utils/cap-output.js.map +1 -1
- package/dist/graphrag/factory.d.ts +25 -0
- package/dist/graphrag/factory.d.ts.map +1 -0
- package/dist/graphrag/factory.js +66 -0
- package/dist/graphrag/factory.js.map +1 -0
- package/dist/graphrag/index.d.ts +4 -0
- package/dist/graphrag/index.d.ts.map +1 -1
- package/dist/graphrag/index.js +2 -0
- package/dist/graphrag/index.js.map +1 -1
- package/dist/graphrag/json-graph.d.ts +28 -0
- package/dist/graphrag/json-graph.d.ts.map +1 -0
- package/dist/graphrag/json-graph.js +168 -0
- package/dist/graphrag/json-graph.js.map +1 -0
- package/dist/graphrag/knowledge-graph.d.ts +33 -0
- package/dist/graphrag/knowledge-graph.d.ts.map +1 -0
- package/dist/graphrag/knowledge-graph.js +2 -0
- package/dist/graphrag/knowledge-graph.js.map +1 -0
- package/dist/index.d.ts +13 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -4
- package/templates/ide/antigravity/.agents/skills/dare-dag-runner/SKILL.md +99 -96
- package/templates/ide/claude/.claude/commands/dare-dag-run.md +68 -69
- package/templates/ide/cursor/.cursor/commands/run-dag.md +67 -44
- package/templates/ide/cursor/.cursor/rules/skill-dag-runner.mdc +97 -87
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingest a finished DAG task into the knowledge graph.
|
|
3
|
+
*
|
|
4
|
+
* For each task we add:
|
|
5
|
+
* - one `task` node with status / duration / tokens metadata
|
|
6
|
+
* - one `depends_on` edge per parent task in the DAG
|
|
7
|
+
* - one `file` node + `implements` edge for each file the task touched
|
|
8
|
+
*
|
|
9
|
+
* "Files touched" are inferred heuristically from the task's captured output:
|
|
10
|
+
* - explicit markers ("Created: …", "Modified: …", "File: …", "wrote …")
|
|
11
|
+
* - bare path-like tokens with extensions (e.g. `src/auth.ts`, `tests/x.py`)
|
|
12
|
+
*
|
|
13
|
+
* The heuristic is intentionally simple — false positives are tolerated;
|
|
14
|
+
* the graph is meant to power discovery, not be a build-system source of truth.
|
|
15
|
+
*/
|
|
16
|
+
import path from 'path';
|
|
17
|
+
/**
|
|
18
|
+
* Ingest a single task. Idempotent — re-running upserts by id.
|
|
19
|
+
*/
|
|
20
|
+
export function ingestTask(graph, task, dag, _opts = {}) {
|
|
21
|
+
if (!task.status || task.status === 'PENDING' || task.status === 'RUNNING')
|
|
22
|
+
return;
|
|
23
|
+
// 1) task node
|
|
24
|
+
graph.addNode({
|
|
25
|
+
id: nodeId('task', task.id),
|
|
26
|
+
type: 'task',
|
|
27
|
+
label: task.title,
|
|
28
|
+
description: task.subtask_prompt.slice(0, 500),
|
|
29
|
+
metadata: {
|
|
30
|
+
status: task.status,
|
|
31
|
+
complexity: task.complexity,
|
|
32
|
+
tokens: task.tokens,
|
|
33
|
+
duration_ms: task.duration,
|
|
34
|
+
error: task.error,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
// 2) depends_on edges (mirror DAG)
|
|
38
|
+
for (const parentId of task.depends_on) {
|
|
39
|
+
graph.addEdge({
|
|
40
|
+
id: edgeId('depends_on', task.id, parentId),
|
|
41
|
+
sourceId: nodeId('task', task.id),
|
|
42
|
+
targetId: nodeId('task', parentId),
|
|
43
|
+
type: 'depends_on',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// 3) file nodes + implements edges (only for DONE tasks)
|
|
47
|
+
if (task.status !== 'DONE' || !task.output)
|
|
48
|
+
return;
|
|
49
|
+
const files = extractFilePaths(task.output);
|
|
50
|
+
for (const filePath of files) {
|
|
51
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
52
|
+
graph.addNode({
|
|
53
|
+
id: nodeId('file', normalized),
|
|
54
|
+
type: 'file',
|
|
55
|
+
label: path.basename(normalized),
|
|
56
|
+
description: normalized,
|
|
57
|
+
metadata: { path: normalized, language: detectLanguage(normalized) },
|
|
58
|
+
});
|
|
59
|
+
graph.addEdge({
|
|
60
|
+
id: edgeId('implements', task.id, normalized),
|
|
61
|
+
sourceId: nodeId('task', task.id),
|
|
62
|
+
targetId: nodeId('file', normalized),
|
|
63
|
+
type: 'implements',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Ingest every task of a DAG. Useful for `dare graph ingest` after an
|
|
69
|
+
* execution finishes (re-syncs the graph from in-memory DAG state).
|
|
70
|
+
*/
|
|
71
|
+
export function ingestDag(graph, dag, opts = {}) {
|
|
72
|
+
for (const task of dag.tasks)
|
|
73
|
+
ingestTask(graph, task, dag, opts);
|
|
74
|
+
}
|
|
75
|
+
// ─── Heuristics ─────────────────────────────────────────────────────────────
|
|
76
|
+
// Find any token that contains a '/' and ends with .ext — explicit anchors and
|
|
77
|
+
// punctuation-trimming is handled in `looksLikePath` after extraction.
|
|
78
|
+
const FILE_PATH_REGEX = /[./\w-]+\/[./\w-]+/g;
|
|
79
|
+
const EXPLICIT_MARKERS = [
|
|
80
|
+
/(?:created|modified|wrote|updated|added|new file)[:\s]+([^\s`'"]+)/gi,
|
|
81
|
+
/(?:^|\n)\s*[-*]\s+([^\s`'"]+\.[a-zA-Z]{1,8})\s*$/gm,
|
|
82
|
+
];
|
|
83
|
+
const COMMON_EXTENSIONS = new Set([
|
|
84
|
+
'ts', 'tsx', 'js', 'jsx', 'mjs', 'cjs',
|
|
85
|
+
'py', 'rs', 'go', 'java', 'kt', 'swift',
|
|
86
|
+
'php', 'rb', 'cs', 'cpp', 'c', 'h', 'hpp',
|
|
87
|
+
'json', 'yaml', 'yml', 'toml', 'xml', 'html',
|
|
88
|
+
'css', 'scss', 'less', 'vue', 'svelte',
|
|
89
|
+
'md', 'mdx', 'sql', 'sh', 'bash', 'env', 'lock', 'gitignore',
|
|
90
|
+
]);
|
|
91
|
+
export function extractFilePaths(text) {
|
|
92
|
+
// Strip http/https URLs first so the path heuristic doesn't pick up
|
|
93
|
+
// tokens like "example.com/a.ts".
|
|
94
|
+
const sanitized = text.replace(/https?:\/\/\S+/g, ' ');
|
|
95
|
+
const found = new Set();
|
|
96
|
+
for (const re of EXPLICIT_MARKERS) {
|
|
97
|
+
re.lastIndex = 0;
|
|
98
|
+
for (let m; (m = re.exec(sanitized));) {
|
|
99
|
+
const cleaned = stripWrappers(m[1]);
|
|
100
|
+
if (looksLikePath(cleaned))
|
|
101
|
+
found.add(cleaned);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
FILE_PATH_REGEX.lastIndex = 0;
|
|
105
|
+
for (let m; (m = FILE_PATH_REGEX.exec(sanitized));) {
|
|
106
|
+
const cleaned = stripWrappers(m[0]);
|
|
107
|
+
if (looksLikePath(cleaned))
|
|
108
|
+
found.add(cleaned);
|
|
109
|
+
}
|
|
110
|
+
return [...found];
|
|
111
|
+
}
|
|
112
|
+
function looksLikePath(p) {
|
|
113
|
+
if (p.length === 0 || p.length > 200)
|
|
114
|
+
return false;
|
|
115
|
+
if (p.startsWith('http://') || p.startsWith('https://'))
|
|
116
|
+
return false;
|
|
117
|
+
const dot = p.lastIndexOf('.');
|
|
118
|
+
if (dot < 0)
|
|
119
|
+
return false;
|
|
120
|
+
const ext = p.slice(dot + 1).toLowerCase();
|
|
121
|
+
return COMMON_EXTENSIONS.has(ext);
|
|
122
|
+
}
|
|
123
|
+
function stripWrappers(s) {
|
|
124
|
+
return s.replace(/^[`'"(\[]+|[`'")\],.;:!?]+$/g, '').trim();
|
|
125
|
+
}
|
|
126
|
+
function detectLanguage(filePath) {
|
|
127
|
+
const ext = path.extname(filePath).slice(1).toLowerCase();
|
|
128
|
+
const map = {
|
|
129
|
+
ts: 'typescript', tsx: 'typescript',
|
|
130
|
+
js: 'javascript', jsx: 'javascript', mjs: 'javascript', cjs: 'javascript',
|
|
131
|
+
py: 'python',
|
|
132
|
+
rs: 'rust',
|
|
133
|
+
go: 'go',
|
|
134
|
+
java: 'java',
|
|
135
|
+
php: 'php',
|
|
136
|
+
rb: 'ruby',
|
|
137
|
+
vue: 'vue',
|
|
138
|
+
svelte: 'svelte',
|
|
139
|
+
sql: 'sql',
|
|
140
|
+
};
|
|
141
|
+
return map[ext];
|
|
142
|
+
}
|
|
143
|
+
function nodeId(type, id) {
|
|
144
|
+
return `${type}:${id}`;
|
|
145
|
+
}
|
|
146
|
+
function edgeId(kind, from, to) {
|
|
147
|
+
return `${kind}:${from}->${to}`;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=graph-ingest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-ingest.js","sourceRoot":"","sources":["../../src/dag-runner/graph-ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,KAAqB,EACrB,IAAa,EACb,GAAQ,EACR,QAAuB,EAAE;IAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO;IAEnF,eAAe;IACf,KAAK,CAAC,OAAO,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC3B,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAC9C,QAAQ,EAAE;YACR,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,QAAQ;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AAa,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1D,MAAM,GAAG,GAA2B;QAClC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;QACnC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;QACzE,EAAE,EAAE,QAAQ;QACZ,EAAE,EAAE,MAAM;QACV,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;QACV,EAAE,EAAE,MAAM;QACV,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;KACX,CAAC;IACF,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,MAAM,CAAC,IAAqB,EAAE,EAAU;IAC/C,OAAO,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,IAAY,EAAE,EAAU;IACpD,OAAO,GAAG,IAAI,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DARE
|
|
2
|
+
* DARE DAG Task Runner — orchestration only.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The DAG runner is **not** an executor. The agent inside the user's IDE
|
|
5
|
+
* (Cursor / Antigravity / Claude Code) executes each task using its native
|
|
6
|
+
* runtime — the IDE is already authenticated and the user already pays for
|
|
7
|
+
* inference there. This CLI is responsible for:
|
|
8
|
+
*
|
|
9
|
+
* 1. ordering tasks (Kahn's algorithm) and surfacing what to execute next
|
|
10
|
+
* 2. computing the prompt the agent should run, with parent-output context
|
|
11
|
+
* 3. recording status transitions (PENDING → RUNNING → DONE / FAILED / SKIPPED)
|
|
12
|
+
* 4. cascading-skip when a parent fails
|
|
13
|
+
* 5. rendering the live canvas at DARE/.canvas.md
|
|
14
|
+
* 6. (optionally) ingesting finished tasks into the knowledge graph
|
|
15
|
+
*
|
|
16
|
+
* The actual task execution loop lives outside this file: see `dare execute`
|
|
17
|
+
* (`--next` / `--complete` / `--fail`).
|
|
7
18
|
*/
|
|
19
|
+
import type { KnowledgeGraph } from '../graphrag/knowledge-graph.js';
|
|
8
20
|
export type Complexity = 'LOW' | 'MED' | 'HIGH';
|
|
9
21
|
export type RunnerName = 'cursor' | 'claude' | 'antigravity';
|
|
10
22
|
export type TaskStatus = 'PENDING' | 'RUNNING' | 'DONE' | 'FAILED' | 'SKIPPED';
|
|
@@ -18,26 +30,16 @@ export interface DagTask {
|
|
|
18
30
|
spec_file?: string;
|
|
19
31
|
status?: TaskStatus;
|
|
20
32
|
output?: string;
|
|
21
|
-
/** Last error message when status is FAILED. */
|
|
22
33
|
error?: string;
|
|
23
34
|
tokens?: number;
|
|
24
35
|
duration?: number;
|
|
25
36
|
}
|
|
26
|
-
/** Hard limits applied per task during execution. */
|
|
27
37
|
export interface DagLimits {
|
|
28
|
-
/** Snippet (in chars) of each parent's output injected into a child's context. */
|
|
29
38
|
parent_context_chars: number;
|
|
30
|
-
/** Cap (in chars) on the captured output of a single task. */
|
|
31
39
|
task_output_chars: number;
|
|
32
|
-
/** Per-task timeout, used by AbortController. */
|
|
33
40
|
timeout_seconds: number;
|
|
34
41
|
}
|
|
35
|
-
/** complexity → model mapping. */
|
|
36
42
|
export type DagModelMap = Record<Complexity, string>;
|
|
37
|
-
/**
|
|
38
|
-
* Per-runner model mapping. Legacy flat schema is normalized into this form
|
|
39
|
-
* by the YAML parser.
|
|
40
|
-
*/
|
|
41
43
|
export type DagModels = Partial<Record<RunnerName, DagModelMap>>;
|
|
42
44
|
export interface Dag {
|
|
43
45
|
title: string;
|
|
@@ -47,25 +49,40 @@ export interface Dag {
|
|
|
47
49
|
models: DagModels;
|
|
48
50
|
tasks: DagTask[];
|
|
49
51
|
}
|
|
50
|
-
/** Defaults used when a YAML omits the `limits` block. */
|
|
51
52
|
export declare const DEFAULT_DAG_LIMITS: DagLimits;
|
|
52
|
-
export interface RunDagOptions {
|
|
53
|
-
parallel: boolean;
|
|
54
|
-
runner: RunnerName | string;
|
|
55
|
-
canvasPath: string;
|
|
56
|
-
/** When true, only PENDING/FAILED tasks run (DONE/SKIPPED are kept). */
|
|
57
|
-
resume?: boolean;
|
|
58
|
-
/** Restrict execution to a single task id. */
|
|
59
|
-
onlyTaskId?: string;
|
|
60
|
-
}
|
|
61
53
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
54
|
+
* Compute execution ranks for tasks based on dependencies. Tasks in the same
|
|
55
|
+
* rank can run in parallel (logical parallelism: the IDE agent decides
|
|
56
|
+
* whether to literally fan them out or run them back-to-back).
|
|
64
57
|
*/
|
|
65
|
-
export declare function
|
|
58
|
+
export declare function computeRanks(tasks: DagTask[]): Map<string, number>;
|
|
66
59
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
60
|
+
* Return the next batch of tasks the agent should execute now: PENDING tasks
|
|
61
|
+
* whose every parent is DONE. These can be executed in parallel by the agent.
|
|
62
|
+
*
|
|
63
|
+
* If `currentRankOnly` is true (default), restrict to the lowest rank that
|
|
64
|
+
* still has executable tasks — gives a clean "rank-by-rank" cadence.
|
|
69
65
|
*/
|
|
70
|
-
export declare function
|
|
66
|
+
export declare function nextExecutableTasks(dag: Dag, currentRankOnly?: boolean): DagTask[];
|
|
67
|
+
/**
|
|
68
|
+
* Cascade: any PENDING task whose dependency is FAILED/SKIPPED becomes SKIPPED.
|
|
69
|
+
* Returns the list of newly-skipped tasks (caller can ingest them).
|
|
70
|
+
*/
|
|
71
|
+
export declare function applyCascadingSkip(dag: Dag): DagTask[];
|
|
72
|
+
/**
|
|
73
|
+
* Compose the prompt for a given task: the task's `subtask_prompt` plus an
|
|
74
|
+
* "Upstream context" block with capped snippets of each parent's output.
|
|
75
|
+
*/
|
|
76
|
+
export declare function buildTaskPrompt(dag: Dag, task: DagTask): string;
|
|
77
|
+
export interface MarkOptions {
|
|
78
|
+
output?: string;
|
|
79
|
+
error?: string;
|
|
80
|
+
tokens?: number;
|
|
81
|
+
durationMs?: number;
|
|
82
|
+
graph?: KnowledgeGraph;
|
|
83
|
+
}
|
|
84
|
+
export declare function markRunning(dag: Dag, taskId: string): DagTask;
|
|
85
|
+
export declare function markDone(dag: Dag, taskId: string, opts?: MarkOptions): DagTask;
|
|
86
|
+
export declare function markFailed(dag: Dag, taskId: string, opts?: MarkOptions): DagTask;
|
|
87
|
+
export declare function renderCanvas(dag: Dag, canvasPath: string): Promise<void>;
|
|
71
88
|
//# sourceMappingURL=run_dag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_dag.d.ts","sourceRoot":"","sources":["../../src/dag-runner/run_dag.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"run_dag.d.ts","sourceRoot":"","sources":["../../src/dag-runner/run_dag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;AAC7D,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/E,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAA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