@adhdev/daemon-core 0.9.82-rc.259 → 0.9.82-rc.260

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.
@@ -64,6 +64,26 @@ export declare class CliStateEngine {
64
64
  } | null;
65
65
  lastApprovalResolvedAt: number;
66
66
  lastResolvedModalMessage: string;
67
+ /**
68
+ * Monotonic counter bumped every time the FSM *enters* waiting_approval
69
+ * with a freshly captured modal (see `applyWaitingApproval`). It is the
70
+ * single discriminator between "the same approval re-observed across TUI
71
+ * paint flaps" and "a genuinely new, distinct approval".
72
+ *
73
+ * The message-equality cooldown below (`lastResolvedModalMessage`) cannot
74
+ * tell these apart on its own: claude-cli routinely presents consecutive
75
+ * approvals whose modal message text is identical (e.g. two back-to-back
76
+ * Bash-command prompts). When that second approval arrived inside
77
+ * `approvalCooldown`, the message-equality guard silently swallowed the
78
+ * key write and the approval stuck forever — fatal under auto-approval.
79
+ *
80
+ * `approvalEntrySeq` increments on every fresh entry; `lastResolvedEntrySeq`
81
+ * records which entry the cooldown belongs to. We only short-circuit the
82
+ * write when we are still resolving *that same* entry — a new entry (new
83
+ * seq) is always a real, distinct approval and must be written.
84
+ */
85
+ approvalEntrySeq: number;
86
+ private lastResolvedEntrySeq;
67
87
  /**
68
88
  * When the engine previously held a modal but the latest parse failed
69
89
  * to extract one, we record the timestamp here and only drop the modal
@@ -27,6 +27,15 @@ export interface CliSessionStatus {
27
27
  message: string;
28
28
  buttons: string[];
29
29
  } | null;
30
+ /**
31
+ * Monotonic counter identifying which approval *entry* the current modal
32
+ * belongs to. Bumped by the FSM on every fresh waiting_approval entry.
33
+ * Consumers (e.g. auto-approval) use it to distinguish a genuinely new
34
+ * approval from the same approval re-observed across TUI paint flaps —
35
+ * two distinct approvals can carry identical message/button text, so the
36
+ * seq is the only reliable discriminator.
37
+ */
38
+ approvalEntrySeq?: number;
30
39
  activeInteractivePrompt?: InteractivePrompt | null;
31
40
  pendingOutboundCount?: number;
32
41
  pendingOutboundMessages?: Array<{
@@ -140,6 +140,20 @@ export declare class DaemonCommandRouter {
140
140
  */
141
141
  resumePendingRefineJobsOnStartup(): Promise<void>;
142
142
  private executeMeshRefineNodeSynchronously;
143
+ /**
144
+ * Batch refinery: converge multiple sibling worktree nodes onto the base branch
145
+ * in one sequential pipeline, absorbing the rebase + patch-equivalence churn that
146
+ * arises when several siblings touch the same submodule.
147
+ *
148
+ * Reuses executeMeshRefineNodeSynchronously per node — every node goes through the
149
+ * exact same validation / patch-equivalence / submodule-reachability / merge / cleanup
150
+ * gates, including its built-in auto-rebase onto fresh origin/<base>. Because each
151
+ * node fetches origin/<base> at the start of its own refine, a node merged earlier in
152
+ * the batch advances the base, and the next node's refine auto-rebases onto it before
153
+ * re-running patch-equivalence. No force-push, no reset — conflicting nodes are
154
+ * isolated as blocked_review while the rest of the batch proceeds.
155
+ */
156
+ private batchRefineMeshNodes;
143
157
  private finishMeshRefineJob;
144
158
  private startMeshRefineJob;
145
159
  /**
package/dist/index.d.ts CHANGED
@@ -49,12 +49,12 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
49
49
  export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
50
50
  export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
51
51
  export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
52
- export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
52
+ export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
53
53
  export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
54
54
  export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary } from './mesh/mesh-active-work.js';
55
55
  export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
56
- export { buildMeshAsyncRefineJobs } from './mesh/mesh-refine-status.js';
57
- export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary } from './mesh/mesh-refine-status.js';
56
+ export { buildMeshAsyncRefineJobs, summarizeMeshAsyncRefineJobs, STALE_TERMINAL_REFINE_WINDOW_MS, RECENT_TERMINAL_REFINE_CAP } from './mesh/mesh-refine-status.js';
57
+ export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary, MeshAsyncRefineJobsSummary } from './mesh/mesh-refine-status.js';
58
58
  export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';
59
59
  export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent, reconcileDirectDispatchCompletionFromTranscript } from './mesh/mesh-events.js';
60
60
  export type { PendingMeshCoordinatorEvent } from './mesh/mesh-events.js';