@deksden-com/dd-flow-cli 0.9.0-beta.40 → 0.9.0-beta.42

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @deksden-com/dd-flow-cli
2
2
 
3
+ ## 0.9.0-beta.42
4
+
5
+ ### Patch Changes
6
+
7
+ - 3e1f87f: Reuse an already accepted RUN pause or stop when draining its EVAL scope, preserving the exact control identity and options without weakening stop or replaying work.
8
+
9
+ ## 0.9.0-beta.41
10
+
11
+ ### Patch Changes
12
+
13
+ - c30ae89: Run generated Codex hooks with the explicitly selected CLI, or the isolated runtime shim before global installations. Preserve hook input and fail without a global fallback when the selected CLI is unavailable.
14
+
3
15
  ## 0.9.0-beta.40
4
16
 
5
17
  ### Patch Changes
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "cli_package": "@deksden-com/dd-flow-cli",
3
- "cli_version": "0.9.0-beta.40",
4
- "cli_commit": "652524c6f370aa17c75474de5ebb7b3b9bf0b3a2",
5
- "built_at": "2026-09-09T17:31:05.981Z",
3
+ "cli_version": "0.9.0-beta.42",
4
+ "cli_commit": "fb9736bf2af837404a43027631113232f0134b58",
5
+ "built_at": "2026-09-09T19:11:00.722Z",
6
6
  "built_with_canon": {
7
7
  "version": "4.1.0",
8
8
  "commit": "ef349bf47cba1c987468e51d73a0dbadbd48dc1f",
@@ -1178,7 +1178,8 @@ function commandHook(command, statusMessage) {
1178
1178
  return { type: "command", command, timeout: 5, statusMessage };
1179
1179
  }
1180
1180
  function hookCommand(event) {
1181
- const handler = `PATH="\${HOME}/Library/pnpm:/opt/homebrew/bin:/usr/local/bin:\${PATH}" dd-flow codex hook handle --event ${event} --json`;
1181
+ const args = `codex hook handle --event ${event} --json`;
1182
+ const handler = `if [ -n "\${DD_FLOW_BIN:-}" ]; then "$DD_FLOW_BIN" ${args}; else PATH="\${DD_FLOW_HOME:+\${DD_FLOW_HOME}/bin:}\${PATH}:\${HOME}/Library/pnpm:/opt/homebrew/bin:/usr/local/bin" dd-flow ${args}; fi`;
1182
1183
  return `/bin/bash -c 'log_dir="\${DD_FLOW_HOME:-\${HOME}/.dd-flow}/logs"; mkdir -p "$log_dir"; log="$log_dir/codex-hook.log"; printf "%s event=${event} phase=start pid=%s\\n" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$$" >>"$log"; ${handler} 2> >(tee -a "$log" >&2); status=$?; printf "%s event=${event} phase=finish pid=%s exit=%s\\n" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$$" "$status" >>"$log"; exit "$status"'`;
1183
1184
  }
1184
1185
  function resolveHookTarget(target) {
@@ -316,7 +316,7 @@ export async function controlRuntimeScopeRuns(context, scopeId, requestId, mode)
316
316
  if (!owner || owner.process_id !== record.id || owner.process_lease_token !== record.lease_token || manifest?.resource_home !== resourceHome(context) || manifest.budget?.scope_id !== scopeId || !project?.root)
317
317
  throw new AppError("runtime_scope_owner_unknown", "Scope RUN registration does not match the retained controller", 1);
318
318
  const runRequestId = `scope:${crypto.createHash("sha256").update(JSON.stringify([scopeId, control.generation, key])).digest("hex")}`;
319
- const input = { projectRoot: project.root, runId: record.run_id, requestId: runRequestId, action: mode };
319
+ let input = { projectRoot: project.root, runId: record.run_id, requestId: runRequestId, action: mode };
320
320
  // Lock order is resource registry then RUN database. No provider or await
321
321
  // occurs here; a newer scope request cannot interleave RUN intent creation.
322
322
  registry.exec("BEGIN IMMEDIATE");
@@ -326,6 +326,13 @@ export async function controlRuntimeScopeRuns(context, scopeId, requestId, mode)
326
326
  throw new AppError("runtime_scope_control_superseded", "Scope request no longer owns admission", 1);
327
327
  if (!registry.get("SELECT 1 FROM managed_processes WHERE id = ? AND lease_token = ? AND owner_id = ? AND project_id = ? AND run_id = ? AND metadata_json = ?", [record.id, record.lease_token, record.owner_id, record.project_id, record.run_id, record.metadata_json]))
328
328
  throw new AppError("runtime_scope_owner_changed", "RUN owner changed before scope intent dispatch", 1);
329
+ // A narrower caller may already have fenced this RUN. Reuse its exact
330
+ // intent; a scope stop still escalates a pause through the RUN arbiter.
331
+ const active = runControlStatus(target, input).control;
332
+ if (active?.current && ["requested", "settled"].includes(active.status) && (active.requested_mode === mode || active.requested_mode === "stop")) {
333
+ input = { ...input, requestId: active.request_id, action: active.requested_mode,
334
+ ...(active.requested_mode === "stop" ? { force: active.request.force ?? false } : { graceMs: active.request.grace_ms ?? 30_000, ...(active.request.escalate ? { escalate: active.request.escalate } : {}) }) };
335
+ }
329
336
  recordRunControlIntent(target, input);
330
337
  registry.exec("COMMIT");
331
338
  }
@@ -335,7 +342,7 @@ export async function controlRuntimeScopeRuns(context, scopeId, requestId, mode)
335
342
  }
336
343
  seen.add(key);
337
344
  const receipt = await requestRunControl(target, { ...input, waitMs: 0 });
338
- runs.push({ runtime_home: metadata.dd_flow_home, project_id: record.project_id, run_id: record.run_id, request_id: runRequestId, receipt });
345
+ runs.push({ runtime_home: metadata.dd_flow_home, project_id: record.project_id, run_id: record.run_id, request_id: input.requestId, receipt });
339
346
  }
340
347
  catch (error) {
341
348
  runs.push({ process_id: record.id, run_id: record.run_id, pending: true, reason: error instanceof AppError ? error.code : "runtime_scope_control_failed", message: String(error) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deksden-com/dd-flow-cli",
3
- "version": "0.9.0-beta.40",
3
+ "version": "0.9.0-beta.42",
4
4
  "description": "Mechanical runtime CLI for dd-flow workflows.",
5
5
  "type": "module",
6
6
  "bin": {