@adhdev/daemon-standalone 0.9.82-rc.210 → 0.9.82-rc.212

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
@@ -35316,12 +35316,14 @@ ${rendered}`, "utf-8");
35316
35316
  const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
35317
35317
  const diagnosticReason = completionDiagnostic ? readNonEmptyString2(completionDiagnostic.blockReason) || "present" : "";
35318
35318
  const finalAssistantPresent = typeof completionDiagnostic?.finalAssistantPresent === "boolean" ? String(completionDiagnostic.finalAssistantPresent) : "";
35319
+ const evidenceLevel = readNonEmptyString2(event.evidenceLevel);
35319
35320
  const parts = [
35320
35321
  readNonEmptyString2(event.targetSessionId) ? `session_id=${readNonEmptyString2(event.targetSessionId)}` : "",
35321
35322
  readNonEmptyString2(event.providerType) ? `provider=${readNonEmptyString2(event.providerType)}` : "",
35322
35323
  readNonEmptyString2(event.providerSessionId) ? `provider_session_id=${readNonEmptyString2(event.providerSessionId)}` : "",
35323
35324
  diagnosticReason ? `completion_diagnostic=${diagnosticReason}` : "",
35324
- finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : ""
35325
+ finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : "",
35326
+ evidenceLevel && evidenceLevel !== "sufficient" ? `evidence_level=${evidenceLevel}` : ""
35325
35327
  ].filter(Boolean);
35326
35328
  return parts.length > 0 ? ` (${parts.join("; ")})` : "";
35327
35329
  }
@@ -35331,7 +35333,8 @@ ${rendered}`, "utf-8");
35331
35333
  if (args.metadataEvent.source === "long_generating_reconciliation") {
35332
35334
  return `[System] ${args.nodeLabel} already has completion evidence${metadata}. The long-generating monitor reconciled the terminal handoff and marked the session complete; wait for the queued completion event/status refresh before doing any manual transcript check.`;
35333
35335
  }
35334
- return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. This completion came from the agent status event path; use mesh_read_chat once to review its final progress, but do not poll repeatedly.`;
35336
+ const reviewNote = args.metadataEvent.reviewRecommended === true ? " Completion evidence is insufficient \u2014 verify via git status or provider_session_id before assuming the task is done. Use mesh_read_chat once if needed, but do not poll repeatedly." : " Use mesh_read_chat once to review its final progress, but do not poll repeatedly.";
35337
+ return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. This completion came from the agent status event path;${reviewNote}`;
35335
35338
  }
35336
35339
  if (args.event === "agent:waiting_approval") {
35337
35340
  return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
@@ -58126,6 +58129,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58126
58129
  "busy_hold_ms": { "type": "integer", "minimum": 0 },
58127
58130
  "idle_hold_ms": { "type": "integer", "minimum": 0 },
58128
58131
  "startup_grace_ms": { "type": "integer", "minimum": 0 },
58132
+ "screen_active_hold_ms": { "type": "integer", "minimum": 0 },
58129
58133
  "completion_marker": {
58130
58134
  "type": "object",
58131
58135
  "additionalProperties": false,
@@ -58466,6 +58470,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58466
58470
  ...t.busy_hold_ms !== void 0 ? { busy_hold_ms: t.busy_hold_ms } : {},
58467
58471
  ...t.idle_hold_ms !== void 0 ? { idle_hold_ms: t.idle_hold_ms } : {},
58468
58472
  ...t.startup_grace_ms !== void 0 ? { startup_grace_ms: t.startup_grace_ms } : {},
58473
+ ...t.screen_active_hold_ms !== void 0 ? { screen_active_hold_ms: t.screen_active_hold_ms } : {},
58469
58474
  ...cm ? {
58470
58475
  completion_idle_after: {
58471
58476
  ...cm.section ? { section: cm.section } : {},
@@ -58767,6 +58772,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58767
58772
  completionIdleKey = "";
58768
58773
  /** Previous screen lines — passed to evaluate() for `changed` condition detection. */
58769
58774
  prevScreenLines = [];
58775
+ /** Timestamp of the last PTY frame that changed the screen content.
58776
+ * Used by screen_active_hold_ms to suppress idle downshifts while
58777
+ * the terminal is still actively updating. */
58778
+ lastScreenChangedAt = 0;
58770
58779
  /** Timer that re-runs evaluate() once the hold window expires. Needed
58771
58780
  * because the PTY stops emitting once the agent finishes; without an
58772
58781
  * explicit wake-up there's nothing to trigger the busy → idle
@@ -58845,6 +58854,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58845
58854
  if (this.idleHoldTimer) {
58846
58855
  clearTimeout(this.idleHoldTimer);
58847
58856
  this.idleHoldTimer = null;
58857
+ this.completionIdleKey = "";
58858
+ this.completionIdleFirstSeenAt = 0;
58848
58859
  }
58849
58860
  this.pendingIdleState = null;
58850
58861
  }
@@ -58966,8 +58977,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58966
58977
  reevaluate(forceEmit = false) {
58967
58978
  const screen = this.adapter.snapshot();
58968
58979
  const cursor = this.adapter.getCursorPosition();
58980
+ const currentLines = screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
58969
58981
  const ev = evaluate(this.spec, screen, cursor, this.prevScreenLines.length > 0 ? this.prevScreenLines : void 0);
58970
- this.prevScreenLines = screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
58982
+ if (this.prevScreenLines.length > 0 && currentLines.join("\n") !== this.prevScreenLines.join("\n")) {
58983
+ this.lastScreenChangedAt = Date.now();
58984
+ }
58985
+ this.prevScreenLines = currentLines;
58971
58986
  let evState = ev.state;
58972
58987
  const busyHoldMs = this.spec.debounce?.busy_hold_ms ?? BUSY_HOLD_MS;
58973
58988
  if (this.currentStateId === "busy" && evState.id === "idle") {
@@ -58985,12 +59000,19 @@ ${formatManifestValidationIssues2(validation.issues)}`,
58985
59000
  }
58986
59001
  }
58987
59002
  const completionIdleRule = this.spec.debounce?.completion_idle_after;
59003
+ const screenActiveHoldMs = this.spec.debounce?.screen_active_hold_ms;
58988
59004
  let busyWakeMs = busyHoldMs;
58989
59005
  const postModalGraceMs = busyHoldMs;
58990
59006
  const now = Date.now();
58991
59007
  const recentlyInModal = isModalState(this.currentStateId) || this.lastModalAt > 0 && now - this.lastModalAt < postModalGraceMs;
58992
59008
  const recentlyLeftModal = !recentlyInModal && this.lastModalExitAt > 0 && now - this.lastModalExitAt < postModalGraceMs;
58993
- if (evState.id === "busy" && completionIdleRule && !recentlyInModal && !recentlyLeftModal) {
59009
+ const screenActiveMs = screenActiveHoldMs ?? 0;
59010
+ const screenStableMs = this.lastScreenChangedAt > 0 ? now - this.lastScreenChangedAt : Infinity;
59011
+ const screenIsActive = screenActiveMs > 0 && screenStableMs < screenActiveMs;
59012
+ if (screenIsActive) {
59013
+ busyWakeMs = Math.min(busyWakeMs, screenActiveMs - screenStableMs + 50);
59014
+ }
59015
+ if (evState.id === "busy" && completionIdleRule && !recentlyInModal && !recentlyLeftModal && !screenIsActive) {
58994
59016
  const completionKey = matchesCompletionIdleRule(this.spec, ev, screen);
58995
59017
  if (completionKey) {
58996
59018
  const now2 = Date.now();
@@ -59020,8 +59042,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
59020
59042
  this.completionIdleFirstSeenAt = 0;
59021
59043
  }
59022
59044
  } else if (evState.id !== "busy") {
59023
- this.completionIdleKey = "";
59024
- this.completionIdleFirstSeenAt = 0;
59045
+ if (!screenIsActive) {
59046
+ this.completionIdleKey = "";
59047
+ this.completionIdleFirstSeenAt = 0;
59048
+ }
59049
+ }
59050
+ if (screenIsActive && this.currentStateId === "busy" && evState.id === (this.spec.default_state ?? "idle")) {
59051
+ evState = this.lastBusyState ?? evState;
59025
59052
  }
59026
59053
  if (evState.id === "busy") {
59027
59054
  this.lastBusyAt = Date.now();
@@ -61716,7 +61743,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
61716
61743
  message: typeof modal?.message === "string" ? modal.message.trim() : "",
61717
61744
  buttons: Array.isArray(modal?.buttons) ? modal.buttons.map((button) => String(button).trim()) : []
61718
61745
  });
61719
- if (this.lastStatus !== "waiting_approval" && approvalFingerprint !== this.lastApprovalEventFingerprint) {
61746
+ if (approvalFingerprint !== this.lastApprovalEventFingerprint) {
61720
61747
  this.lastApprovalEventFingerprint = approvalFingerprint;
61721
61748
  this.appendRuntimeSystemMessage(
61722
61749
  this.formatApprovalRequestMessage(modal?.message, modal?.buttons),