@adhdev/daemon-core 0.9.82-rc.470 → 0.9.82-rc.471

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/dist/index.mjs CHANGED
@@ -404,10 +404,10 @@ function readInjected(value) {
404
404
  }
405
405
  function getDaemonBuildInfo() {
406
406
  if (cached) return cached;
407
- const commit = readInjected(true ? "850e4d61504ca48047adbeb8c1727ba1f825fea9" : void 0) ?? "unknown";
408
- const commitShort = readInjected(true ? "850e4d61" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
409
- const version = readInjected(true ? "0.9.82-rc.470" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
410
- const builtAt = readInjected(true ? "2026-07-05T15:36:34.410Z" : void 0);
407
+ const commit = readInjected(true ? "e59bad103d048ba6e725bc5e11090e3640a272ad" : void 0) ?? "unknown";
408
+ const commitShort = readInjected(true ? "e59bad10" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
409
+ const version = readInjected(true ? "0.9.82-rc.471" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
410
+ const builtAt = readInjected(true ? "2026-07-05T17:34:44.457Z" : void 0);
411
411
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
412
412
  return cached;
413
413
  }
@@ -42852,8 +42852,19 @@ var CliProviderInstance = class _CliProviderInstance {
42852
42852
  * bound below still caps the episode, so a worker whose approval truly never
42853
42853
  * returns is surfaced to the coordinator within AUTO_APPROVE_MASK_STALL_MS
42854
42854
  * rather than held forever.
42855
+ *
42856
+ * INVARIANT (do not regress the ordering): this window must fully BRIDGE a
42857
+ * single busy phase, and the mask-stall bound below must in turn exceed it —
42858
+ * AUTO_APPROVE_MASK_STALL_MS > AUTO_APPROVE_FLAP_CONTINUITY_MS + max_busy_phase
42859
+ * + AUTO_APPROVE_SETTLE_MS. Observed flap geometry (delegated-worker Bash
42860
+ * approval): approval frames last ~1.5s, busy phases (modal=none) last
42861
+ * ~4.3–4.5s. With the old 4000ms this window was SHORTER than a busy phase, so
42862
+ * the settle clock was torn down every cycle and never accrued 600ms while the
42863
+ * 4500ms mask-stall tripped INSIDE the first busy phase → a stalled-approval
42864
+ * nudge leaked to the coordinator. 6000ms bridges the ~4.5s busy phase with
42865
+ * margin so the returning approval frame survives to resume its settle clock.
42855
42866
  */
42856
- static AUTO_APPROVE_FLAP_CONTINUITY_MS = 4e3;
42867
+ static AUTO_APPROVE_FLAP_CONTINUITY_MS = 6e3;
42857
42868
  /**
42858
42869
  * STATUS-MISMATCH: upper bound on how long the auto-approve→`generating` SURFACE
42859
42870
  * mask may hide a worker's `waiting_approval` (status + activeModal) before we give
@@ -42870,8 +42881,17 @@ var CliProviderInstance = class _CliProviderInstance {
42870
42881
  * genuine never-resolving stall surfaces within this window. The settle gate keeps
42871
42882
  * running underneath, so a prompt that finally stabilises still auto-approves, and
42872
42883
  * mesh_approve (raw FSM, unmasked) works throughout.
42884
+ *
42885
+ * INVARIANT (do not regress): must be STRICTLY GREATER than
42886
+ * AUTO_APPROVE_FLAP_CONTINUITY_MS + max_busy_phase + AUTO_APPROVE_SETTLE_MS so
42887
+ * that during a flap the settle clock (which FLAP_CONTINUITY keeps alive across
42888
+ * each ~4.3–4.5s busy phase) gets to accrue its 600ms on the RETURNING approval
42889
+ * frame before this stall bound can trip. Observed geometry: approval ~1.5s,
42890
+ * busy ~4.3–4.5s. 9000ms ≥ CONTINUITY(6000) + busy(~4.5s) + SETTLE(600) headroom;
42891
+ * the old 4500ms tripped inside the very first busy phase (while modal=none, so
42892
+ * the nudge was NOT deferred) and leaked to the coordinator.
42873
42893
  */
42874
- static AUTO_APPROVE_MASK_STALL_MS = 4500;
42894
+ static AUTO_APPROVE_MASK_STALL_MS = 9e3;
42875
42895
  adapter;
42876
42896
  context = null;
42877
42897
  events = [];
@@ -44103,13 +44123,11 @@ var CliProviderInstance = class _CliProviderInstance {
44103
44123
  waitedMs,
44104
44124
  busyEpoch: this.busyEpoch
44105
44125
  });
44106
- this.pushEvent({
44107
- event: "agent:generating_completed",
44126
+ this.emitGeneratingCompleted({
44108
44127
  chatTitle: pending.chatTitle,
44109
44128
  duration: pending.duration,
44110
44129
  timestamp: pending.timestamp,
44111
- // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44112
- ...pending.taskId ? { taskId: pending.taskId } : {},
44130
+ taskId: pending.taskId,
44113
44131
  // When finalization is forced past the timeout on a `parsed_status:` block
44114
44132
  // (the parser never confirmed a final assistant turn) we previously rode an
44115
44133
  // empty `finalSummary` unconditionally. That empty value propagates to the
@@ -44138,13 +44156,11 @@ var CliProviderInstance = class _CliProviderInstance {
44138
44156
  duration: pending.duration,
44139
44157
  busyEpoch: this.busyEpoch
44140
44158
  });
44141
- this.pushEvent({
44142
- event: "agent:generating_completed",
44159
+ this.emitGeneratingCompleted({
44143
44160
  chatTitle: pending.chatTitle,
44144
44161
  duration: pending.duration,
44145
44162
  timestamp: pending.timestamp,
44146
- // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44147
- ...pending.taskId ? { taskId: pending.taskId } : {},
44163
+ taskId: pending.taskId,
44148
44164
  finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt)
44149
44165
  });
44150
44166
  this.completedDebouncePending = null;
@@ -44152,6 +44168,35 @@ var CliProviderInstance = class _CliProviderInstance {
44152
44168
  this.generatingStartedAt = 0;
44153
44169
  this.lastApprovalEventFingerprint = "";
44154
44170
  }
44171
+ /**
44172
+ * A-3 (CLI 완료판정 통합): single authoritative emit for a CLI turn's
44173
+ * `agent:generating_completed` event. The completion JUDGMENT — WHETHER and
44174
+ * WHEN a turn is done (settle windows, continuity guards, the finalization
44175
+ * gate, the short-gen / startup-grace / no-progress-monitor discriminators) —
44176
+ * stays at each call site, where it is legitimately path-specific. What used
44177
+ * to be duplicated across all five completion paths was the EVENT-SHAPE
44178
+ * assembly: the `event` name, the conditional `taskId` spread, and the
44179
+ * optional `finalSummary` / `evidenceLevel` / `completionDiagnostic` fields.
44180
+ * Folding that assembly here removes the divergence (e.g. one site spreading
44181
+ * taskId, others omitting it) without touching any judgment. Callers pass the
44182
+ * values they have already computed; omitted optionals are simply absent from
44183
+ * the emitted event, exactly as each inline builder produced before.
44184
+ */
44185
+ emitGeneratingCompleted(opts) {
44186
+ this.pushEvent({
44187
+ event: "agent:generating_completed",
44188
+ chatTitle: opts.chatTitle,
44189
+ duration: opts.duration,
44190
+ timestamp: opts.timestamp,
44191
+ // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44192
+ ...opts.taskId ? { taskId: opts.taskId } : {},
44193
+ // finalSummary is always carried (value may be undefined) — every prior
44194
+ // inline builder included the key, so downstream consumers see the same shape.
44195
+ finalSummary: opts.finalSummary,
44196
+ ...opts.evidenceLevel !== void 0 ? { evidenceLevel: opts.evidenceLevel } : {},
44197
+ ...opts.completionDiagnostic !== void 0 ? { completionDiagnostic: opts.completionDiagnostic } : {}
44198
+ });
44199
+ }
44155
44200
  maybeAutoApproveStatus(adapterStatus, now = Date.now()) {
44156
44201
  if (adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove() && this.manualAttendance.isAttended(now)) {
44157
44202
  this.lastAutoApprovalSignature = "";
@@ -44358,8 +44403,7 @@ var CliProviderInstance = class _CliProviderInstance {
44358
44403
  missingEvidence,
44359
44404
  evidenceLevel: "weak"
44360
44405
  });
44361
- this.pushEvent({
44362
- event: "agent:generating_completed",
44406
+ this.emitGeneratingCompleted({
44363
44407
  chatTitle,
44364
44408
  duration: 0,
44365
44409
  timestamp: now,
@@ -44548,8 +44592,7 @@ var CliProviderInstance = class _CliProviderInstance {
44548
44592
  } else if (missingEvidence) {
44549
44593
  LOG.info("CLI", `[${this.type}] short completion suppressed: missing final assistant evidence, non-mesh session (source=${shortEvidenceSource})`);
44550
44594
  } else {
44551
- this.pushEvent({
44552
- event: "agent:generating_completed",
44595
+ this.emitGeneratingCompleted({
44553
44596
  chatTitle,
44554
44597
  duration: 0,
44555
44598
  timestamp: now,
@@ -44668,8 +44711,7 @@ var CliProviderInstance = class _CliProviderInstance {
44668
44711
  if (this.isMeshWorkerSession()) {
44669
44712
  traceMeshEventStage("fired", this.meshTraceCtx(), "no_progress_monitor_final_summary");
44670
44713
  }
44671
- this.pushEvent({
44672
- event: "agent:generating_completed",
44714
+ this.emitGeneratingCompleted({
44673
44715
  chatTitle,
44674
44716
  duration: this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : void 0,
44675
44717
  timestamp: me.timestamp,