@dewtech/dare-cli 2.1.0 → 2.3.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.
- package/README.md +53 -7
- package/dist/__tests__/dag-runner/adapters.test.d.ts +2 -0
- package/dist/__tests__/dag-runner/adapters.test.d.ts.map +1 -0
- package/dist/__tests__/dag-runner/adapters.test.js +134 -0
- package/dist/__tests__/dag-runner/adapters.test.js.map +1 -0
- 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 +105 -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.d.ts +2 -0
- package/dist/__tests__/dag-runner/utils.test.d.ts.map +1 -0
- package/dist/__tests__/dag-runner/utils.test.js +47 -0
- package/dist/__tests__/dag-runner/utils.test.js.map +1 -0
- 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 +172 -45
- 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 +155 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/dag-runner/adapters/antigravity.d.ts +6 -0
- package/dist/dag-runner/adapters/antigravity.d.ts.map +1 -0
- package/dist/dag-runner/adapters/antigravity.js +54 -0
- package/dist/dag-runner/adapters/antigravity.js.map +1 -0
- package/dist/dag-runner/adapters/claude.d.ts +6 -0
- package/dist/dag-runner/adapters/claude.d.ts.map +1 -0
- package/dist/dag-runner/adapters/claude.js +48 -0
- package/dist/dag-runner/adapters/claude.js.map +1 -0
- package/dist/dag-runner/adapters/cursor.d.ts +6 -0
- package/dist/dag-runner/adapters/cursor.d.ts.map +1 -0
- package/dist/dag-runner/adapters/cursor.js +58 -0
- package/dist/dag-runner/adapters/cursor.js.map +1 -0
- package/dist/dag-runner/adapters/index.d.ts +46 -0
- package/dist/dag-runner/adapters/index.d.ts.map +1 -0
- package/dist/dag-runner/adapters/index.js +55 -0
- package/dist/dag-runner/adapters/index.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 +51 -24
- package/dist/dag-runner/run_dag.d.ts.map +1 -1
- package/dist/dag-runner/run_dag.js +163 -109
- 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 +14 -0
- package/dist/dag-runner/utils/cap-output.d.ts.map +1 -0
- package/dist/dag-runner/utils/cap-output.js +25 -0
- package/dist/dag-runner/utils/cap-output.js.map +1 -0
- package/dist/dag-runner/utils/stitch-context.d.ts +24 -0
- package/dist/dag-runner/utils/stitch-context.d.ts.map +1 -0
- package/dist/dag-runner/utils/stitch-context.js +36 -0
- package/dist/dag-runner/utils/stitch-context.js.map +1 -0
- package/dist/dag-runner/utils/timeout.d.ts +27 -0
- package/dist/dag-runner/utils/timeout.d.ts.map +1 -0
- package/dist/dag-runner/utils/timeout.js +55 -0
- package/dist/dag-runner/utils/timeout.js.map +1 -0
- 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 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- 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,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor adapter — uses @cursor/sdk to execute a task as a local subagent.
|
|
3
|
+
*
|
|
4
|
+
* Env: CURSOR_API_KEY
|
|
5
|
+
*
|
|
6
|
+
* Compatible with the cookbook DAG Task Runner pattern (Agent.create + send + wait).
|
|
7
|
+
*/
|
|
8
|
+
import { Agent } from '@cursor/sdk';
|
|
9
|
+
import { AdapterCallError, MissingApiKeyError, pickModel, } from './index.js';
|
|
10
|
+
export class CursorAdapter {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.name = 'cursor';
|
|
13
|
+
}
|
|
14
|
+
async call({ prompt, complexity, models, signal }) {
|
|
15
|
+
const apiKey = process.env.CURSOR_API_KEY;
|
|
16
|
+
if (!apiKey)
|
|
17
|
+
throw new MissingApiKeyError('cursor', 'CURSOR_API_KEY');
|
|
18
|
+
const model = pickModel(models, complexity);
|
|
19
|
+
let agent;
|
|
20
|
+
try {
|
|
21
|
+
agent = await Agent.create({
|
|
22
|
+
apiKey,
|
|
23
|
+
model: { id: model },
|
|
24
|
+
name: 'DARE DAG Subagent',
|
|
25
|
+
});
|
|
26
|
+
const run = await agent.send(prompt);
|
|
27
|
+
const onAbort = () => {
|
|
28
|
+
// Best-effort cancel; ignore failures.
|
|
29
|
+
run.cancel().catch(() => undefined);
|
|
30
|
+
};
|
|
31
|
+
if (signal.aborted)
|
|
32
|
+
onAbort();
|
|
33
|
+
else
|
|
34
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
35
|
+
const result = await run.wait();
|
|
36
|
+
return { output: result.result ?? '' };
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
if (err instanceof MissingApiKeyError)
|
|
40
|
+
throw err;
|
|
41
|
+
throw new AdapterCallError('cursor', extractErrorMessage(err), err);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
try {
|
|
45
|
+
await agent?.close();
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// ignore close failures — task already completed/failed
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function extractErrorMessage(err) {
|
|
54
|
+
if (err instanceof Error)
|
|
55
|
+
return err.message;
|
|
56
|
+
return String(err);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/dag-runner/adapters/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC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AY,kBAAkB;gBAAE,MAAM,GAAG,CAAC;YACjD,MAAM,IAAI,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACtE,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC;YACvB,CAAC;YAAC,MAAM,CAAC;gBACP,wDAAwD;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,SAAS,mBAAmB,CAAC,GAAY;IACvC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner adapters — execute a single DAG task by calling the underlying
|
|
3
|
+
* provider SDK (Anthropic, Cursor, Google).
|
|
4
|
+
*
|
|
5
|
+
* Each adapter must:
|
|
6
|
+
* - read its API key from the documented env var (or throw a clear error)
|
|
7
|
+
* - honor the AbortSignal forwarded by `withTimeout`
|
|
8
|
+
* - return raw text output (capping is the runner's responsibility)
|
|
9
|
+
* - report token usage when the SDK exposes it
|
|
10
|
+
*/
|
|
11
|
+
import type { Complexity, DagModelMap, RunnerName } from '../run_dag.js';
|
|
12
|
+
export interface AdapterCallInput {
|
|
13
|
+
prompt: string;
|
|
14
|
+
complexity: Complexity;
|
|
15
|
+
models: DagModelMap;
|
|
16
|
+
signal: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
export interface AdapterCallResult {
|
|
19
|
+
output: string;
|
|
20
|
+
tokens?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RunnerAdapter {
|
|
23
|
+
readonly name: RunnerName;
|
|
24
|
+
call(input: AdapterCallInput): Promise<AdapterCallResult>;
|
|
25
|
+
}
|
|
26
|
+
export declare class MissingApiKeyError extends Error {
|
|
27
|
+
readonly runner: RunnerName;
|
|
28
|
+
readonly envVar: string;
|
|
29
|
+
constructor(runner: RunnerName, envVar: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class AdapterCallError extends Error {
|
|
32
|
+
readonly runner: RunnerName;
|
|
33
|
+
readonly cause?: unknown | undefined;
|
|
34
|
+
constructor(runner: RunnerName, message: string, cause?: unknown | undefined);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a model id from complexity → model map, with a soft fallback.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pickModel(models: DagModelMap | undefined, complexity: Complexity): string;
|
|
40
|
+
/**
|
|
41
|
+
* Lazy factory — keeps SDK imports out of the require graph until the
|
|
42
|
+
* specific adapter is actually invoked. Avoids loading three SDKs when only
|
|
43
|
+
* one is in use.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getAdapter(name: RunnerName): Promise<RunnerAdapter>;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dag-runner/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC3D;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aACf,MAAM,EAAE,UAAU;aAAkB,MAAM,EAAE,MAAM;gBAAlD,MAAM,EAAE,UAAU,EAAkB,MAAM,EAAE,MAAM;CAO/E;AAED,qBAAa,gBAAiB,SAAQ,KAAK;aACb,MAAM,EAAE,UAAU;aAAmC,KAAK,CAAC,EAAE,OAAO;gBAApE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,OAAO,YAAA;CAIjG;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CASzF;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAkBzE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export class MissingApiKeyError extends Error {
|
|
2
|
+
constructor(runner, envVar) {
|
|
3
|
+
super(`${runner} runner requires ${envVar} to be set. ` +
|
|
4
|
+
`Export it before running: setx ${envVar} <your-key> (Windows) or export ${envVar}=<your-key> (bash).`);
|
|
5
|
+
this.runner = runner;
|
|
6
|
+
this.envVar = envVar;
|
|
7
|
+
this.name = 'MissingApiKeyError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class AdapterCallError extends Error {
|
|
11
|
+
constructor(runner, message, cause) {
|
|
12
|
+
super(`${runner} adapter: ${message}`);
|
|
13
|
+
this.runner = runner;
|
|
14
|
+
this.cause = cause;
|
|
15
|
+
this.name = 'AdapterCallError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a model id from complexity → model map, with a soft fallback.
|
|
20
|
+
*/
|
|
21
|
+
export function pickModel(models, complexity) {
|
|
22
|
+
if (!models) {
|
|
23
|
+
throw new Error(`No model mapping configured for complexity=${complexity}`);
|
|
24
|
+
}
|
|
25
|
+
const id = models[complexity];
|
|
26
|
+
if (!id) {
|
|
27
|
+
throw new Error(`Missing model for complexity=${complexity} in dare-dag.yaml`);
|
|
28
|
+
}
|
|
29
|
+
return id;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Lazy factory — keeps SDK imports out of the require graph until the
|
|
33
|
+
* specific adapter is actually invoked. Avoids loading three SDKs when only
|
|
34
|
+
* one is in use.
|
|
35
|
+
*/
|
|
36
|
+
export async function getAdapter(name) {
|
|
37
|
+
switch (name) {
|
|
38
|
+
case 'claude': {
|
|
39
|
+
const { ClaudeAdapter } = await import('./claude.js');
|
|
40
|
+
return new ClaudeAdapter();
|
|
41
|
+
}
|
|
42
|
+
case 'cursor': {
|
|
43
|
+
const { CursorAdapter } = await import('./cursor.js');
|
|
44
|
+
return new CursorAdapter();
|
|
45
|
+
}
|
|
46
|
+
case 'antigravity': {
|
|
47
|
+
const { AntigravityAdapter } = await import('./antigravity.js');
|
|
48
|
+
return new AntigravityAdapter();
|
|
49
|
+
}
|
|
50
|
+
default: {
|
|
51
|
+
throw new Error(`Unknown runner: ${name}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dag-runner/adapters/index.ts"],"names":[],"mappings":"AA6BA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAA4B,MAAkB,EAAkB,MAAc;QAC5E,KAAK,CACH,GAAG,MAAM,oBAAoB,MAAM,cAAc;YAC/C,kCAAkC,MAAM,sCAAsC,MAAM,sBAAsB,CAC7G,CAAC;QAJwB,WAAM,GAAN,MAAM,CAAY;QAAkB,WAAM,GAAN,MAAM,CAAQ;QAK5E,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAA4B,MAAkB,EAAE,OAAe,EAAkB,KAAe;QAC9F,KAAK,CAAC,G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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Dag, DagTask } from './run_dag.js';
|
|
2
|
+
import type { KnowledgeGraph } from '../graphrag/knowledge-graph.js';
|
|
3
|
+
export interface IngestOptions {
|
|
4
|
+
/** Project root used to resolve relative file paths. Defaults to cwd. */
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Ingest a single task. Idempotent — re-running upserts by id.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ingestTask(graph: KnowledgeGraph, task: DagTask, dag: Dag, _opts?: IngestOptions): void;
|
|
11
|
+
/**
|
|
12
|
+
* Ingest every task of a DAG. Useful for `dare graph ingest` after an
|
|
13
|
+
* execution finishes (re-syncs the graph from in-memory DAG state).
|
|
14
|
+
*/
|
|
15
|
+
export declare function ingestDag(graph: KnowledgeGraph, dag: Dag, opts?: IngestOptions): void;
|
|
16
|
+
export declare function extractFilePaths(text: string): string[];
|
|
17
|
+
//# sourceMappingURL=graph-ingest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-ingest.d.ts","sourceRoot":"","sources":["../../src/dag-runner/graph-ingest.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,GAAG,EACR,KAAK,GAAE,aAAkB,GACxB,IAAI,CA+CN;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,GAAE,aAAkB,GAAG,IAAI,CAEzF;AAqBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBvD"}
|
|
@@ -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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U;IACpD,OAAO,GAAG,IAAI,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DARE
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* DARE DAG Task Runner — orchestration only.
|
|
3
|
+
*
|
|
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`).
|
|
5
18
|
*/
|
|
19
|
+
import type { KnowledgeGraph } from '../graphrag/knowledge-graph.js';
|
|
6
20
|
export type Complexity = 'LOW' | 'MED' | 'HIGH';
|
|
7
21
|
export type RunnerName = 'cursor' | 'claude' | 'antigravity';
|
|
8
22
|
export type TaskStatus = 'PENDING' | 'RUNNING' | 'DONE' | 'FAILED' | 'SKIPPED';
|
|
@@ -16,46 +30,59 @@ export interface DagTask {
|
|
|
16
30
|
spec_file?: string;
|
|
17
31
|
status?: TaskStatus;
|
|
18
32
|
output?: string;
|
|
33
|
+
error?: string;
|
|
19
34
|
tokens?: number;
|
|
20
35
|
duration?: number;
|
|
21
36
|
}
|
|
22
|
-
/** Hard limits applied per task during execution. */
|
|
23
37
|
export interface DagLimits {
|
|
24
|
-
/** Snippet (in chars) of each parent's output injected into a child's context. */
|
|
25
38
|
parent_context_chars: number;
|
|
26
|
-
/** Cap (in chars) on the captured output of a single task. */
|
|
27
39
|
task_output_chars: number;
|
|
28
|
-
/** Per-task timeout, used by AbortController. */
|
|
29
40
|
timeout_seconds: number;
|
|
30
41
|
}
|
|
31
|
-
/** complexity → model mapping. */
|
|
32
42
|
export type DagModelMap = Record<Complexity, string>;
|
|
33
|
-
/**
|
|
34
|
-
* Full models block. New schema is per-runner (cursor / claude / antigravity).
|
|
35
|
-
* Legacy flat schema (HIGH/MED/LOW directly) is also accepted by the parser
|
|
36
|
-
* and normalized to the runner-keyed form on read.
|
|
37
|
-
*/
|
|
38
43
|
export type DagModels = Partial<Record<RunnerName, DagModelMap>>;
|
|
39
44
|
export interface Dag {
|
|
40
45
|
title: string;
|
|
41
46
|
version: string;
|
|
42
|
-
/** Optional ISO timestamp set when the YAML was generated. */
|
|
43
47
|
generated?: string;
|
|
44
|
-
/** Optional execution limits (defaults applied if missing). */
|
|
45
48
|
limits?: DagLimits;
|
|
46
|
-
/** Per-runner model mapping. */
|
|
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: string;
|
|
55
|
-
canvasPath: string;
|
|
56
|
-
}
|
|
57
53
|
/**
|
|
58
|
-
*
|
|
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).
|
|
57
|
+
*/
|
|
58
|
+
export declare function computeRanks(tasks: DagTask[]): Map<string, number>;
|
|
59
|
+
/**
|
|
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.
|
|
65
|
+
*/
|
|
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.
|
|
59
75
|
*/
|
|
60
|
-
export declare function
|
|
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>;
|
|
61
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,KAA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