@deksden-com/dd-flow-cli 0.9.0-beta.21 → 0.9.0-beta.23
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/CHANGELOG.md +17 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/help.js +1 -0
- package/dist/cli/run-cli.js +3 -0
- package/dist/harness-runtime/bin/dd-agy.mjs +34 -0
- package/dist/harness-runtime/bin/dd-codex.mjs +22 -0
- package/dist/harness-runtime/bin/dd-droid.mjs +30 -0
- package/dist/harness-runtime/bin/dd-grok.mjs +28 -0
- package/dist/harness-runtime/bin/dd-opencode.mjs +18 -0
- package/dist/harness-runtime/bin/dd-zcode.mjs +62 -0
- package/dist/harness-runtime/lib/daemon-operations.mjs +78 -0
- package/dist/harness-runtime/lib/dd-agy-daemon.mjs +249 -0
- package/dist/harness-runtime/lib/dd-agy.mjs +59 -0
- package/dist/harness-runtime/lib/dd-codex-daemon.mjs +90 -0
- package/dist/harness-runtime/lib/dd-codex.mjs +382 -0
- package/dist/harness-runtime/lib/dd-droid-daemon.mjs +123 -0
- package/dist/harness-runtime/lib/dd-droid.mjs +434 -0
- package/dist/harness-runtime/lib/dd-grok-daemon.mjs +279 -0
- package/dist/harness-runtime/lib/dd-grok.mjs +167 -0
- package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +153 -0
- package/dist/harness-runtime/lib/dd-opencode.mjs +80 -0
- package/dist/harness-runtime/lib/dd-zcode-daemon.mjs +420 -0
- package/dist/harness-runtime/lib/dd-zcode.mjs +593 -0
- package/dist/harness-runtime/lib/driver-recovery.mjs +119 -0
- package/dist/harness-runtime/lib/droid-observation.mjs +66 -0
- package/dist/harness-runtime/lib/managed-daemon.mjs +119 -0
- package/dist/harness-runtime/lib/model-observations.mjs +77 -0
- package/dist/harness-runtime/lib/observation-clock.mjs +33 -0
- package/dist/harness-runtime/lib/operation-context.mjs +5 -0
- package/dist/harness-runtime/lib/operation-errors.mjs +19 -0
- package/dist/harness-runtime/lib/process-json.mjs +61 -0
- package/dist/harness-runtime/lib/runner-events.mjs +200 -0
- package/dist/harness-runtime/lib/runner-lock.mjs +42 -0
- package/dist/harness-runtime/lib/session-settlement.mjs +24 -0
- package/dist/services/execution-policy.js +61 -0
- package/dist/services/external-work-launch.js +76 -0
- package/dist/services/harness-adapter.js +31 -14
- package/dist/services/hooks.js +43 -20
- package/dist/services/runs.js +2 -1
- package/dist/services/stage-context.js +2 -2
- package/dist/services/vnext-execution-profile.js +38 -3
- package/dist/services/work-registry.js +8 -1
- package/dist/storage/database.js +21 -0
- package/package.json +19 -14
package/dist/services/runs.js
CHANGED
|
@@ -189,7 +189,8 @@ function snapshotVnextExecutionProfile(projectRoot) {
|
|
|
189
189
|
merge_delivery: profile.merge_delivery,
|
|
190
190
|
merge_cleanup: profile.merge_cleanup,
|
|
191
191
|
stop_target: profile.stop_target,
|
|
192
|
-
code_bootstrap: profile.code_bootstrap
|
|
192
|
+
code_bootstrap: profile.code_bootstrap,
|
|
193
|
+
...(profile.execution ? { execution: profile.execution } : {})
|
|
193
194
|
}
|
|
194
195
|
};
|
|
195
196
|
}
|
|
@@ -76,8 +76,8 @@ export function renderExternalStageContext(input) {
|
|
|
76
76
|
].join("\n");
|
|
77
77
|
}
|
|
78
78
|
function validateContext(value, expectedStage) {
|
|
79
|
-
if (value.schema_id !== "dd-eval/stage-context@1")
|
|
80
|
-
throw new AppError("validation", "Stage context must use dd-
|
|
79
|
+
if (value.schema_id !== "dd-flow/stage-context@1" && value.schema_id !== "dd-eval/stage-context@1")
|
|
80
|
+
throw new AppError("validation", "Stage context must use dd-flow/stage-context@1", 2);
|
|
81
81
|
if (value.stage !== expectedStage)
|
|
82
82
|
throw new AppError("validation", "Stage context does not match --stage", 2, { expected_stage: expectedStage, context_stage: value.stage });
|
|
83
83
|
if (!value.objective?.trim())
|
|
@@ -13,7 +13,7 @@ export function loadVnextExecutionProfile(projectRoot) {
|
|
|
13
13
|
throw new AppError("execution_profile_missing", "vNext flow requires .memory-bank/dd-flow/project-execution.json", 1, { file, cause: String(error) });
|
|
14
14
|
}
|
|
15
15
|
const profile = value;
|
|
16
|
-
if (profile.schema_id !== "dd-flow/project-execution@2"
|
|
16
|
+
if ((profile.schema_id !== "dd-flow/project-execution@2" && profile.schema_id !== "dd-flow/project-execution@3")
|
|
17
17
|
|| (profile.stage_session_mode !== undefined && profile.stage_session_mode !== "same_session" && profile.stage_session_mode !== "new_session")
|
|
18
18
|
|| !["auto", "off", "standard", "deep"].includes(String(profile.plan_review_mode))
|
|
19
19
|
|| (profile.code_review_mode !== undefined && !["auto", "off", "standard", "deep"].includes(String(profile.code_review_mode)))
|
|
@@ -22,9 +22,44 @@ export function loadVnextExecutionProfile(projectRoot) {
|
|
|
22
22
|
|| !["retain", "delete_after_success"].includes(String(profile.merge_cleanup?.source))
|
|
23
23
|
|| !["code_completed", "code_review_completed", "merge_completed"].includes(String(profile.stop_target))
|
|
24
24
|
|| !profile.code_bootstrap || typeof profile.code_bootstrap.command !== "string" || !profile.code_bootstrap.command.trim()
|
|
25
|
-
|| typeof profile.code_bootstrap.policy_ref !== "string" || !profile.code_bootstrap.policy_ref.trim()
|
|
26
|
-
|
|
25
|
+
|| typeof profile.code_bootstrap.policy_ref !== "string" || !profile.code_bootstrap.policy_ref.trim()
|
|
26
|
+
|| !validRouting(profile.execution, profile.schema_id === "dd-flow/project-execution@3")) {
|
|
27
|
+
throw new AppError("execution_profile_invalid", "Project execution profile does not match its supported dd-flow schema", 1, { file });
|
|
27
28
|
}
|
|
28
29
|
return { ...profile, stage_session_mode: profile.stage_session_mode ?? "same_session", code_review_mode: profile.code_review_mode ?? "off" };
|
|
29
30
|
}
|
|
30
31
|
export function executionProfilePath(projectRoot) { return path.join(projectRoot, relativePath); }
|
|
32
|
+
function validRouting(value, required) {
|
|
33
|
+
if (value === undefined)
|
|
34
|
+
return !required;
|
|
35
|
+
if (!object(value) || !profileId(value.agent_profile_id) || !override(value, true))
|
|
36
|
+
return false;
|
|
37
|
+
if (value.stage_overrides !== undefined) {
|
|
38
|
+
if (!object(value.stage_overrides))
|
|
39
|
+
return false;
|
|
40
|
+
for (const [stage, item] of Object.entries(value.stage_overrides))
|
|
41
|
+
if (!stage.trim() || !object(item) || !override(item, false))
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
function override(value, root) {
|
|
47
|
+
const allowed = root ? new Set(["agent_profile_id", "delegation", "stage_overrides"]) : new Set(["agent_profile_id", "delegation"]);
|
|
48
|
+
if (Object.keys(value).some(key => !allowed.has(key)))
|
|
49
|
+
return false;
|
|
50
|
+
if (!root && value.agent_profile_id === undefined && value.delegation === undefined)
|
|
51
|
+
return false;
|
|
52
|
+
if (value.agent_profile_id !== undefined && !profileId(value.agent_profile_id))
|
|
53
|
+
return false;
|
|
54
|
+
if (value.delegation === undefined)
|
|
55
|
+
return true;
|
|
56
|
+
if (!object(value.delegation) || (value.delegation.mode !== "native" && value.delegation.mode !== "external"))
|
|
57
|
+
return false;
|
|
58
|
+
if (value.delegation.agent_profile_id !== undefined && !profileId(value.delegation.agent_profile_id))
|
|
59
|
+
return false;
|
|
60
|
+
if (value.delegation.max_parallel !== undefined && (!Number.isInteger(value.delegation.max_parallel) || Number(value.delegation.max_parallel) < 1))
|
|
61
|
+
return false;
|
|
62
|
+
return value.delegation.mode !== "native" || value.delegation.max_parallel === undefined;
|
|
63
|
+
}
|
|
64
|
+
function profileId(value) { return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value); }
|
|
65
|
+
function object(value) { return Boolean(value) && typeof value === "object" && !Array.isArray(value); }
|
|
@@ -245,7 +245,14 @@ export function startWork(context, id, input) {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
const identity = claimWorkStartHookEvent(context, { projectId: work.project_id, eventKey: hookEventId, workId: work.work_id, projectRoot: run.project_root, ...(recoveryId ? { recoveryId } : {}) });
|
|
248
|
-
|
|
248
|
+
let started;
|
|
249
|
+
try {
|
|
250
|
+
started = startBoundWork(context, work, run, identity, hookEventId);
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
context.db.run("UPDATE hook_events SET status = 'observed', claimed_at = NULL WHERE project_id = ? AND event_key = ? AND status = 'claimed'", [work.project_id, hookEventId]);
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
249
256
|
appendFlowRunTimelineEvent(context, work.project_id, work.run_id, { type: "work_started", work_id: work.work_id, session_id: identity.sessionId, agent_id: identity.agentId });
|
|
250
257
|
return started;
|
|
251
258
|
}
|
package/dist/storage/database.js
CHANGED
|
@@ -116,6 +116,27 @@ export function ensureVnextWorkStorage(db) {
|
|
|
116
116
|
CREATE INDEX IF NOT EXISTS idx_check_receipts_run ON check_receipts(project_id, run_id, started_at);
|
|
117
117
|
`);
|
|
118
118
|
}
|
|
119
|
+
/** Durable intent for a provider-root external Work. It is deliberately
|
|
120
|
+
* separate from `work_sessions`: only a trusted hook may bind that Session. */
|
|
121
|
+
export function ensureWorkLaunchStorage(db) {
|
|
122
|
+
db.exec(`
|
|
123
|
+
CREATE TABLE IF NOT EXISTS work_launches (
|
|
124
|
+
operation_id TEXT PRIMARY KEY,
|
|
125
|
+
work_id TEXT NOT NULL UNIQUE,
|
|
126
|
+
profile_json TEXT NOT NULL,
|
|
127
|
+
profile_hash TEXT NOT NULL,
|
|
128
|
+
status TEXT NOT NULL,
|
|
129
|
+
state_dir TEXT NOT NULL,
|
|
130
|
+
journal_path TEXT NOT NULL,
|
|
131
|
+
provider_session_id TEXT,
|
|
132
|
+
adapter_receipt_json TEXT,
|
|
133
|
+
created_at TEXT NOT NULL,
|
|
134
|
+
updated_at TEXT NOT NULL,
|
|
135
|
+
FOREIGN KEY(work_id) REFERENCES works(work_id)
|
|
136
|
+
);
|
|
137
|
+
CREATE INDEX IF NOT EXISTS idx_work_launches_status ON work_launches(status, updated_at DESC);
|
|
138
|
+
`);
|
|
139
|
+
}
|
|
119
140
|
export function getDatabase(ddFlowHome, mode = "initialize") {
|
|
120
141
|
const dbPath = path.join(ddFlowHome, "db.sqlite");
|
|
121
142
|
const exists = fs.existsSync(dbPath);
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deksden-com/dd-flow-cli",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.23",
|
|
4
4
|
"description": "Mechanical runtime CLI for dd-flow workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"dd-flow": "
|
|
7
|
+
"dd-flow": "dist/cli.js",
|
|
8
|
+
"dd-codex": "dist/harness-runtime/bin/dd-codex.mjs",
|
|
9
|
+
"dd-zcode": "dist/harness-runtime/bin/dd-zcode.mjs",
|
|
10
|
+
"dd-grok": "dist/harness-runtime/bin/dd-grok.mjs",
|
|
11
|
+
"dd-opencode": "dist/harness-runtime/bin/dd-opencode.mjs",
|
|
12
|
+
"dd-agy": "dist/harness-runtime/bin/dd-agy.mjs",
|
|
13
|
+
"dd-droid": "dist/harness-runtime/bin/dd-droid.mjs"
|
|
8
14
|
},
|
|
9
15
|
"files": [
|
|
10
16
|
"dist",
|
|
@@ -16,16 +22,6 @@
|
|
|
16
22
|
"node": ">=26.0.0",
|
|
17
23
|
"pnpm": ">=10.0.0"
|
|
18
24
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc -p tsconfig.build.json && node scripts/generate-build-info.mjs && node scripts/copy-assets.mjs",
|
|
21
|
-
"typecheck": "tsc --noEmit",
|
|
22
|
-
"lint": "eslint . --max-warnings=0",
|
|
23
|
-
"test": "vitest run",
|
|
24
|
-
"changeset": "changeset",
|
|
25
|
-
"version-packages": "changeset version",
|
|
26
|
-
"release": "pnpm run build && changeset publish",
|
|
27
|
-
"prepublishOnly": "node scripts/verify-release-build.mjs"
|
|
28
|
-
},
|
|
29
25
|
"devDependencies": {
|
|
30
26
|
"@changesets/cli": "^2.31.0",
|
|
31
27
|
"@eslint/js": "^9.39.1",
|
|
@@ -44,5 +40,14 @@
|
|
|
44
40
|
"publishConfig": {
|
|
45
41
|
"access": "public"
|
|
46
42
|
},
|
|
47
|
-
"license": "MIT"
|
|
48
|
-
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json && node scripts/generate-build-info.mjs && node scripts/copy-assets.mjs",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"lint": "eslint . --max-warnings=0",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"changeset": "changeset",
|
|
50
|
+
"version-packages": "changeset version",
|
|
51
|
+
"release": "pnpm run build && changeset publish"
|
|
52
|
+
}
|
|
53
|
+
}
|