@deksden-com/dd-flow-cli 0.9.0-beta.41 → 0.9.0-beta.43

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,20 @@
1
1
  # @deksden-com/dd-flow-cli
2
2
 
3
+ ## 0.9.0-beta.43
4
+
5
+ ### Patch Changes
6
+
7
+ - 78e3eaf: Keep Codex prompt and inspection receipts compact by returning historical turn
8
+ identities and statuses without duplicating their item transcripts. Preserve the
9
+ current result, final answer, native history reference, descendants and observed
10
+ profile so long-running sessions remain within the bounded adapter reply limit.
11
+
12
+ ## 0.9.0-beta.42
13
+
14
+ ### Patch Changes
15
+
16
+ - 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.
17
+
3
18
  ## 0.9.0-beta.41
4
19
 
5
20
  ### Patch Changes
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "cli_package": "@deksden-com/dd-flow-cli",
3
- "cli_version": "0.9.0-beta.41",
4
- "cli_commit": "a8be25a9ff2a4f772e2b006d29d23176cbd01736",
5
- "built_at": "2026-09-09T18:18:54.558Z",
3
+ "cli_version": "0.9.0-beta.43",
4
+ "cli_commit": "387b5ce2c63b7e4f97ff240d0a22763f7cc38c47",
5
+ "built_at": "2026-09-09T21:42:22.490Z",
6
6
  "built_with_canon": {
7
7
  "version": "4.1.0",
8
8
  "commit": "ef349bf47cba1c987468e51d73a0dbadbd48dc1f",
@@ -165,6 +165,15 @@ function profile(options) { return { harness: "codex-desktop", model: options.mo
165
165
  function threadId(result) { const id = result?.thread?.id ?? result?.threadId; return required(id, "Codex thread id"); }
166
166
  function directChildren(bridge, sessionId) { return typeof bridge?.directChildren === "function" ? bridge.directChildren(sessionId) : []; }
167
167
 
168
+ function threadReceipt(thread) {
169
+ // Thread reads can include the whole transcript even with includeTurns:false.
170
+ // Item evidence lives in the native history/journal, not each command reply.
171
+ return { ...thread, ...(Array.isArray(thread.turns) ? { turns: thread.turns.map(turn => ({
172
+ id: turn?.id ?? null, status: turn?.status ?? null,
173
+ startedAt: turn?.startedAt ?? null, completedAt: turn?.completedAt ?? null
174
+ })) } : {}) };
175
+ }
176
+
168
177
  export async function doctor(options = {}) {
169
178
  const codex_cli = parseCodexCliVersion(await commandText(options.bin ?? process.env.DD_CODEX_BIN ?? "codex", ["--version"]));
170
179
  return await withBridge(options, async () => ({ harness: "codex-desktop", app_server: "available", observed_runtime: { codex_cli, dd_harness_contract: "dd-codex-harness@1" }, requested_profile: profile(options), observed_at: now() }));
@@ -235,7 +244,7 @@ export async function promptSessionWithBridge(bridge, options) {
235
244
  const completed = await waitForTurn(bridge, sessionId, turnId, options.timeoutMs ?? 1_800_000, options, cwd);
236
245
  const thread = await readCompletedThread(bridge, sessionId);
237
246
  const assistantText = latestAssistantText(thread) ?? latestAssistantText(completed);
238
- return { harness: "codex-desktop", provider_session_id: sessionId, adapter_session_id: sessionId, turn_id: turnId, status: "completed", turn: completed, ...(thread ? { thread } : {}), descendants: directChildren(bridge, sessionId), ...(assistantText ? { assistant_text: assistantText } : {}), requested_profile: profile(options), observed_profile: await observeCodexProfile(bridge, options, sessionId, { model: thread?.model ?? null, reasoning: thread?.reasoningEffort ?? null, provider: thread?.modelProvider ?? null }, "thread/read.after_turn") };
247
+ return { harness: "codex-desktop", provider_session_id: sessionId, adapter_session_id: sessionId, turn_id: turnId, status: "completed", turn: completed, ...(thread ? { thread: threadReceipt(thread) } : {}), descendants: directChildren(bridge, sessionId), ...(assistantText ? { assistant_text: assistantText } : {}), requested_profile: profile(options), observed_profile: await observeCodexProfile(bridge, options, sessionId, { model: thread?.model ?? null, reasoning: thread?.reasoningEffort ?? null, provider: thread?.modelProvider ?? null }, "thread/read.after_turn") };
239
248
  }
240
249
 
241
250
  async function ensureThreadLoaded(bridge, sessionId, options, cwd) {
@@ -370,7 +379,7 @@ export async function inspectSession(options) {
370
379
 
371
380
  export async function inspectSessionWithBridge(bridge, options) {
372
381
  const sessionId = required(options.sessionId, "--session-id"); const value = await bridge.request("thread/read", { threadId: sessionId, includeTurns: false }); const thread = value?.thread ?? value;
373
- return { harness: "codex-desktop", provider_session_id: sessionId, adapter_session_id: sessionId, status: thread.status ?? null, thread, descendants: directChildren(bridge, sessionId), requested_profile: profile(options), observed_profile: await observeCodexProfile(bridge, options, sessionId, { model: thread.model ?? null, reasoning: thread.reasoningEffort ?? null, provider: thread.modelProvider ?? null }, "thread/read") };
382
+ return { harness: "codex-desktop", provider_session_id: sessionId, adapter_session_id: sessionId, status: thread.status ?? null, thread: threadReceipt(thread), descendants: directChildren(bridge, sessionId), requested_profile: profile(options), observed_profile: await observeCodexProfile(bridge, options, sessionId, { model: thread.model ?? null, reasoning: thread.reasoningEffort ?? null, provider: thread.modelProvider ?? null }, "thread/read") };
374
383
  }
375
384
 
376
385
  export async function cancelSession(options) {
@@ -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.41",
3
+ "version": "0.9.0-beta.43",
4
4
  "description": "Mechanical runtime CLI for dd-flow workflows.",
5
5
  "type": "module",
6
6
  "bin": {