@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.js CHANGED
@@ -409,10 +409,10 @@ function readInjected(value) {
409
409
  }
410
410
  function getDaemonBuildInfo() {
411
411
  if (cached) return cached;
412
- const commit = readInjected(true ? "850e4d61504ca48047adbeb8c1727ba1f825fea9" : void 0) ?? "unknown";
413
- const commitShort = readInjected(true ? "850e4d61" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
- const version = readInjected(true ? "0.9.82-rc.470" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
- const builtAt = readInjected(true ? "2026-07-05T15:36:34.410Z" : void 0);
412
+ const commit = readInjected(true ? "e59bad103d048ba6e725bc5e11090e3640a272ad" : void 0) ?? "unknown";
413
+ const commitShort = readInjected(true ? "e59bad10" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
+ const version = readInjected(true ? "0.9.82-rc.471" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
+ const builtAt = readInjected(true ? "2026-07-05T17:34:44.457Z" : void 0);
416
416
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
417
417
  return cached;
418
418
  }
@@ -43270,8 +43270,19 @@ var CliProviderInstance = class _CliProviderInstance {
43270
43270
  * bound below still caps the episode, so a worker whose approval truly never
43271
43271
  * returns is surfaced to the coordinator within AUTO_APPROVE_MASK_STALL_MS
43272
43272
  * rather than held forever.
43273
+ *
43274
+ * INVARIANT (do not regress the ordering): this window must fully BRIDGE a
43275
+ * single busy phase, and the mask-stall bound below must in turn exceed it —
43276
+ * AUTO_APPROVE_MASK_STALL_MS > AUTO_APPROVE_FLAP_CONTINUITY_MS + max_busy_phase
43277
+ * + AUTO_APPROVE_SETTLE_MS. Observed flap geometry (delegated-worker Bash
43278
+ * approval): approval frames last ~1.5s, busy phases (modal=none) last
43279
+ * ~4.3–4.5s. With the old 4000ms this window was SHORTER than a busy phase, so
43280
+ * the settle clock was torn down every cycle and never accrued 600ms while the
43281
+ * 4500ms mask-stall tripped INSIDE the first busy phase → a stalled-approval
43282
+ * nudge leaked to the coordinator. 6000ms bridges the ~4.5s busy phase with
43283
+ * margin so the returning approval frame survives to resume its settle clock.
43273
43284
  */
43274
- static AUTO_APPROVE_FLAP_CONTINUITY_MS = 4e3;
43285
+ static AUTO_APPROVE_FLAP_CONTINUITY_MS = 6e3;
43275
43286
  /**
43276
43287
  * STATUS-MISMATCH: upper bound on how long the auto-approve→`generating` SURFACE
43277
43288
  * mask may hide a worker's `waiting_approval` (status + activeModal) before we give
@@ -43288,8 +43299,17 @@ var CliProviderInstance = class _CliProviderInstance {
43288
43299
  * genuine never-resolving stall surfaces within this window. The settle gate keeps
43289
43300
  * running underneath, so a prompt that finally stabilises still auto-approves, and
43290
43301
  * mesh_approve (raw FSM, unmasked) works throughout.
43302
+ *
43303
+ * INVARIANT (do not regress): must be STRICTLY GREATER than
43304
+ * AUTO_APPROVE_FLAP_CONTINUITY_MS + max_busy_phase + AUTO_APPROVE_SETTLE_MS so
43305
+ * that during a flap the settle clock (which FLAP_CONTINUITY keeps alive across
43306
+ * each ~4.3–4.5s busy phase) gets to accrue its 600ms on the RETURNING approval
43307
+ * frame before this stall bound can trip. Observed geometry: approval ~1.5s,
43308
+ * busy ~4.3–4.5s. 9000ms ≥ CONTINUITY(6000) + busy(~4.5s) + SETTLE(600) headroom;
43309
+ * the old 4500ms tripped inside the very first busy phase (while modal=none, so
43310
+ * the nudge was NOT deferred) and leaked to the coordinator.
43291
43311
  */
43292
- static AUTO_APPROVE_MASK_STALL_MS = 4500;
43312
+ static AUTO_APPROVE_MASK_STALL_MS = 9e3;
43293
43313
  adapter;
43294
43314
  context = null;
43295
43315
  events = [];
@@ -44521,13 +44541,11 @@ var CliProviderInstance = class _CliProviderInstance {
44521
44541
  waitedMs,
44522
44542
  busyEpoch: this.busyEpoch
44523
44543
  });
44524
- this.pushEvent({
44525
- event: "agent:generating_completed",
44544
+ this.emitGeneratingCompleted({
44526
44545
  chatTitle: pending.chatTitle,
44527
44546
  duration: pending.duration,
44528
44547
  timestamp: pending.timestamp,
44529
- // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44530
- ...pending.taskId ? { taskId: pending.taskId } : {},
44548
+ taskId: pending.taskId,
44531
44549
  // When finalization is forced past the timeout on a `parsed_status:` block
44532
44550
  // (the parser never confirmed a final assistant turn) we previously rode an
44533
44551
  // empty `finalSummary` unconditionally. That empty value propagates to the
@@ -44556,13 +44574,11 @@ var CliProviderInstance = class _CliProviderInstance {
44556
44574
  duration: pending.duration,
44557
44575
  busyEpoch: this.busyEpoch
44558
44576
  });
44559
- this.pushEvent({
44560
- event: "agent:generating_completed",
44577
+ this.emitGeneratingCompleted({
44561
44578
  chatTitle: pending.chatTitle,
44562
44579
  duration: pending.duration,
44563
44580
  timestamp: pending.timestamp,
44564
- // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44565
- ...pending.taskId ? { taskId: pending.taskId } : {},
44581
+ taskId: pending.taskId,
44566
44582
  finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt)
44567
44583
  });
44568
44584
  this.completedDebouncePending = null;
@@ -44570,6 +44586,35 @@ var CliProviderInstance = class _CliProviderInstance {
44570
44586
  this.generatingStartedAt = 0;
44571
44587
  this.lastApprovalEventFingerprint = "";
44572
44588
  }
44589
+ /**
44590
+ * A-3 (CLI 완료판정 통합): single authoritative emit for a CLI turn's
44591
+ * `agent:generating_completed` event. The completion JUDGMENT — WHETHER and
44592
+ * WHEN a turn is done (settle windows, continuity guards, the finalization
44593
+ * gate, the short-gen / startup-grace / no-progress-monitor discriminators) —
44594
+ * stays at each call site, where it is legitimately path-specific. What used
44595
+ * to be duplicated across all five completion paths was the EVENT-SHAPE
44596
+ * assembly: the `event` name, the conditional `taskId` spread, and the
44597
+ * optional `finalSummary` / `evidenceLevel` / `completionDiagnostic` fields.
44598
+ * Folding that assembly here removes the divergence (e.g. one site spreading
44599
+ * taskId, others omitting it) without touching any judgment. Callers pass the
44600
+ * values they have already computed; omitted optionals are simply absent from
44601
+ * the emitted event, exactly as each inline builder produced before.
44602
+ */
44603
+ emitGeneratingCompleted(opts) {
44604
+ this.pushEvent({
44605
+ event: "agent:generating_completed",
44606
+ chatTitle: opts.chatTitle,
44607
+ duration: opts.duration,
44608
+ timestamp: opts.timestamp,
44609
+ // ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
44610
+ ...opts.taskId ? { taskId: opts.taskId } : {},
44611
+ // finalSummary is always carried (value may be undefined) — every prior
44612
+ // inline builder included the key, so downstream consumers see the same shape.
44613
+ finalSummary: opts.finalSummary,
44614
+ ...opts.evidenceLevel !== void 0 ? { evidenceLevel: opts.evidenceLevel } : {},
44615
+ ...opts.completionDiagnostic !== void 0 ? { completionDiagnostic: opts.completionDiagnostic } : {}
44616
+ });
44617
+ }
44573
44618
  maybeAutoApproveStatus(adapterStatus, now = Date.now()) {
44574
44619
  if (adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove() && this.manualAttendance.isAttended(now)) {
44575
44620
  this.lastAutoApprovalSignature = "";
@@ -44776,8 +44821,7 @@ var CliProviderInstance = class _CliProviderInstance {
44776
44821
  missingEvidence,
44777
44822
  evidenceLevel: "weak"
44778
44823
  });
44779
- this.pushEvent({
44780
- event: "agent:generating_completed",
44824
+ this.emitGeneratingCompleted({
44781
44825
  chatTitle,
44782
44826
  duration: 0,
44783
44827
  timestamp: now,
@@ -44966,8 +45010,7 @@ var CliProviderInstance = class _CliProviderInstance {
44966
45010
  } else if (missingEvidence) {
44967
45011
  LOG.info("CLI", `[${this.type}] short completion suppressed: missing final assistant evidence, non-mesh session (source=${shortEvidenceSource})`);
44968
45012
  } else {
44969
- this.pushEvent({
44970
- event: "agent:generating_completed",
45013
+ this.emitGeneratingCompleted({
44971
45014
  chatTitle,
44972
45015
  duration: 0,
44973
45016
  timestamp: now,
@@ -45086,8 +45129,7 @@ var CliProviderInstance = class _CliProviderInstance {
45086
45129
  if (this.isMeshWorkerSession()) {
45087
45130
  traceMeshEventStage("fired", this.meshTraceCtx(), "no_progress_monitor_final_summary");
45088
45131
  }
45089
- this.pushEvent({
45090
- event: "agent:generating_completed",
45132
+ this.emitGeneratingCompleted({
45091
45133
  chatTitle,
45092
45134
  duration: this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : void 0,
45093
45135
  timestamp: me.timestamp,