@adhdev/daemon-core 1.0.18-rc.19 → 1.0.18-rc.2

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.
Files changed (82) hide show
  1. package/dist/cli-adapters/cli-state-engine.d.ts +0 -77
  2. package/dist/cli-adapters/provider-cli-shared.d.ts +0 -33
  3. package/dist/cli-adapters/pty-transport.d.ts +1 -2
  4. package/dist/commands/cli-manager.d.ts +0 -9
  5. package/dist/commands/upgrade-helper.d.ts +0 -1
  6. package/dist/commands/windows-atomic-upgrade.d.ts +1 -17
  7. package/dist/config/mesh-json-config.d.ts +0 -62
  8. package/dist/index.d.ts +2 -4
  9. package/dist/index.js +4143 -6578
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +4138 -6570
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/mesh/coordinator-prompt.d.ts +0 -76
  14. package/dist/mesh/mesh-active-work.d.ts +1 -1
  15. package/dist/mesh/mesh-ledger.d.ts +1 -28
  16. package/dist/mesh/mesh-node-identity.d.ts +0 -23
  17. package/dist/mesh/mesh-refine-gates.d.ts +0 -89
  18. package/dist/mesh/mesh-remote-event-pull.d.ts +0 -3
  19. package/dist/mesh/mesh-runtime-store.d.ts +0 -11
  20. package/dist/mesh/mesh-work-queue.d.ts +1 -24
  21. package/dist/providers/chat-message-normalization.d.ts +0 -22
  22. package/dist/providers/cli-provider-instance-types.d.ts +0 -4
  23. package/dist/providers/cli-provider-instance.d.ts +0 -78
  24. package/dist/providers/contracts.d.ts +0 -17
  25. package/dist/providers/provider-schema.d.ts +0 -1
  26. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +0 -14
  27. package/dist/providers/types/interactive-prompt.d.ts +0 -18
  28. package/dist/repo-mesh-types.d.ts +6 -38
  29. package/dist/shared-types.d.ts +2 -4
  30. package/package.json +3 -3
  31. package/src/boot/daemon-lifecycle.ts +0 -10
  32. package/src/cli-adapters/cli-state-engine.ts +3 -220
  33. package/src/cli-adapters/provider-cli-adapter.ts +11 -41
  34. package/src/cli-adapters/provider-cli-shared.ts +0 -41
  35. package/src/cli-adapters/pty-transport.d.ts +1 -2
  36. package/src/cli-adapters/pty-transport.ts +1 -1
  37. package/src/cli-adapters/session-host-transport.ts +3 -8
  38. package/src/commands/cli-manager.ts +8 -72
  39. package/src/commands/high-family/mesh-coordinator-launch.ts +2 -17
  40. package/src/commands/high-family/mesh-events.ts +2 -13
  41. package/src/commands/med-family/mesh-crud.ts +0 -155
  42. package/src/commands/med-family/mesh-queue.ts +1 -74
  43. package/src/commands/router-refine.ts +4 -71
  44. package/src/commands/router.ts +0 -8
  45. package/src/commands/upgrade-helper.ts +82 -106
  46. package/src/commands/windows-atomic-upgrade.ts +35 -281
  47. package/src/config/mesh-json-config.ts +0 -111
  48. package/src/index.ts +1 -21
  49. package/src/mesh/coordinator-prompt.ts +11 -258
  50. package/src/mesh/mesh-active-work.ts +1 -11
  51. package/src/mesh/mesh-completion-synthesis.ts +1 -12
  52. package/src/mesh/mesh-event-classify.ts +0 -19
  53. package/src/mesh/mesh-event-forwarding.ts +6 -64
  54. package/src/mesh/mesh-events-utils.ts +0 -42
  55. package/src/mesh/mesh-ledger.ts +0 -77
  56. package/src/mesh/mesh-node-identity.ts +0 -49
  57. package/src/mesh/mesh-queue-assignment.ts +11 -210
  58. package/src/mesh/mesh-reconcile-loop.ts +3 -306
  59. package/src/mesh/mesh-refine-gates.ts +0 -300
  60. package/src/mesh/mesh-remote-event-pull.ts +47 -68
  61. package/src/mesh/mesh-runtime-store.ts +0 -21
  62. package/src/mesh/mesh-work-queue.ts +2 -85
  63. package/src/providers/chat-message-normalization.ts +0 -53
  64. package/src/providers/cli-provider-instance-types.ts +0 -53
  65. package/src/providers/cli-provider-instance.ts +15 -497
  66. package/src/providers/contracts.ts +1 -25
  67. package/src/providers/provider-schema.ts +0 -83
  68. package/src/providers/sdk/v1/builders/cli/detect-status.ts +0 -23
  69. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +0 -20
  70. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +0 -44
  71. package/src/providers/types/interactive-prompt.ts +0 -77
  72. package/src/repo-mesh-types.ts +12 -112
  73. package/src/session-host/managed-host.ts +0 -34
  74. package/src/shared-types.ts +1 -9
  75. package/src/status/reporter.ts +0 -1
  76. package/src/status/snapshot.ts +0 -2
  77. package/dist/commands/process-lifecycle.d.ts +0 -43
  78. package/dist/mesh/mesh-disk-retention.d.ts +0 -105
  79. package/dist/providers/auto-approve-modes.d.ts +0 -14
  80. package/src/commands/process-lifecycle.ts +0 -248
  81. package/src/mesh/mesh-disk-retention.ts +0 -370
  82. package/src/providers/auto-approve-modes.ts +0 -97
@@ -68,41 +68,6 @@ export interface CoordinatorOperatingNote {
68
68
  category?: 'provider_quirk' | 'pattern_to_avoid' | 'recovery_lesson';
69
69
  createdAt?: string;
70
70
  sourceCoordinator?: string;
71
- /**
72
- * Operating-notes lifecycle (minimal first cut). When true the note ALWAYS
73
- * rides into the coordinator prompt — it is never dropped by TTL expiry and
74
- * survives the injection cap ahead of unpinned notes. Legacy notes without
75
- * this field default to false.
76
- */
77
- pinned?: boolean;
78
- /**
79
- * Optional explicit expiry ISO timestamp. When set and in the past, an
80
- * UNPINNED note is dropped from the injected prompt (read-side only — the
81
- * ledger entry is never pruned by age). When absent, the category→TTL map
82
- * (see isNoteExpired) governs expiry; pinned notes never expire regardless.
83
- */
84
- expiresAt?: string;
85
- /**
86
- * Phase 2 — the ledger id of this note, when known. Threaded from the ledger
87
- * entry id at launch so version-supersede can target a specific note and
88
- * same-class folding can list the subsumed ids. Repo-declared notes may lack
89
- * one; absent is fine (folding/supersede fall back to the subject key).
90
- */
91
- noteId?: string;
92
- /**
93
- * Phase 2 (b) version-supersede — an optional note-id or stable subject-key
94
- * this note replaces. At injection, any earlier LIVE note whose `noteId` or
95
- * `subjectKey` matches this value is hidden from the prompt (the ledger entry
96
- * is retained for audit). Optional and lossless: absent = supersedes nothing.
97
- */
98
- supersedes?: string;
99
- /**
100
- * Phase 2 (b)/(c) — an optional stable subject-key grouping notes about the
101
- * same subject. Drives version-supersede targeting and same-class folding.
102
- * When absent, folding derives a key from a leading `[tag]` bracket instead,
103
- * so legacy notes still collapse by their conventional tag prefix.
104
- */
105
- subjectKey?: string;
106
71
  }
107
72
  export interface CoordinatorPromptContext {
108
73
  mesh: LocalMeshEntry;
@@ -137,46 +102,6 @@ export interface CoordinatorPromptContext {
137
102
  magiKindPanels?: MagiKindPanelMap;
138
103
  }
139
104
  export declare function buildCoordinatorSystemPrompt(ctx: CoordinatorPromptContext): string;
140
- /**
141
- * Phase 2 (c) — deterministic same-class fold. Given ranked notes (already
142
- * highest-priority first), collapse runs of UNPINNED notes that share the same
143
- * category AND subject key into a single injected entry: keep the highest-ranked
144
- * (first-seen) note and record the note-ids/count it subsumes so the rendered
145
- * line can say "(+N earlier)". Pinned notes never fold — each pinned note is
146
- * author-opted-in and shown verbatim. The store is untouched; this is a pure,
147
- * model-free text fold at injection time.
148
- *
149
- * Returns the folded note list (order preserved) with per-entry subsumed info.
150
- */
151
- interface FoldedNote {
152
- note: CoordinatorOperatingNote;
153
- /** note-ids of same-class notes this entry subsumes (may be empty). */
154
- subsumedIds: string[];
155
- /** count of subsumed notes (== subsumedIds.length, but counts id-less ones too). */
156
- subsumedCount: number;
157
- }
158
- /**
159
- * Operating-notes lifecycle selection (read-side). Given the effective notes
160
- * (oldest-first, ledger order) and the current time, produce the ordered list
161
- * that rides into the prompt:
162
- * (i) ALWAYS include pinned notes.
163
- * (ii) drop expired UNPINNED notes (per category TTL / explicit expiresAt).
164
- * (iii) Phase 2 (b) drop any note SUPERSEDED by a later live note (by noteId
165
- * or subjectKey); pinned notes are never dropped by supersede.
166
- * (iv) rank pinned-first, then durable-category, then recency (newest first).
167
- * (v) Phase 2 (c) fold same-category/same-subject unpinned runs into one.
168
- * (vi) Phase 2 (d) fill up to a byte budget AND a count cap; pinned always
169
- * kept even if they alone exceed the byte budget.
170
- * Pure + deterministic given `now`. Returns { shown, omittedCount } where `shown`
171
- * carries per-entry fold info for the renderer.
172
- *
173
- * Ranking is stable on the original ledger index so, within a tier, newest notes
174
- * lead. The caps keep the leading (highest-priority) entries.
175
- */
176
- export declare function selectOperatingNotesForPrompt(notes: CoordinatorOperatingNote[], now: number, cap?: number, byteBudget?: number): {
177
- shown: FoldedNote[];
178
- omittedCount: number;
179
- };
180
105
  /**
181
106
  * Render the machine-local MAGI kind-panel bindings so the coordinator KNOWS
182
107
  * which cross-verification panels (rca / design / claim_audit / freeform) are
@@ -189,4 +114,3 @@ export declare function selectOperatingNotesForPrompt(notes: CoordinatorOperatin
189
114
  * That keeps a MAGI-less mesh's prompt byte-identical to before.
190
115
  */
191
116
  export declare function buildMagiKindPanelsSection(panels: MagiKindPanelMap | undefined | null): string | null;
192
- export {};
@@ -1,7 +1,7 @@
1
1
  import type { MeshLedgerEntry } from './mesh-ledger.js';
2
2
  import type { MeshWorkQueueEntry, DirectDispatchRecord } from './mesh-work-queue.js';
3
3
  export type MeshActiveWorkSource = 'queue' | 'direct';
4
- export type MeshActiveWorkStatus = 'pending' | 'assigned' | 'generating' | 'idle' | 'failed' | 'awaiting_approval' | 'awaiting_choice';
4
+ export type MeshActiveWorkStatus = 'pending' | 'assigned' | 'generating' | 'idle' | 'failed' | 'awaiting_approval';
5
5
  export interface MeshActiveWorkRecord {
6
6
  taskId: string;
7
7
  source: MeshActiveWorkSource;
@@ -15,7 +15,7 @@
15
15
  import { EventEmitter } from 'events';
16
16
  import { MeshRuntimeStore } from './mesh-runtime-store.js';
17
17
  import { type MeshLedgerOriginatingCoordinatorV2 } from './contracts.js';
18
- export type MeshLedgerKind = 'task_dispatched' | 'task_completed' | 'task_failed' | 'task_stalled' | 'task_approval_needed' | 'task_question_pending' | 'p2p_dispatch_failed' | 'session_launched' | 'session_auto_launch' | 'session_stopped' | 'checkpoint_created' | 'node_cloned' | 'node_joined' | 'node_removed' | 'coordinator_started' | 'recovery_attempted' | 'ledger_replicated' | 'ledger_reconciled' | 'direct_fast_forward' | 'delivery_unroutable' | 'direct_dispatch_pruned' | 'event_held' | 'event_held_requeued' | 'task_reclaimed' | 'coordinator_operating_note' | 'coordinator_operating_note_tombstone' | 'mission_created' | 'mission_status_changed' | 'mission_goal_updated' | 'magi_dispatched' | 'magi_synthesis' | 'key_injection' | 'worktree_cleanup_candidate';
18
+ export type MeshLedgerKind = 'task_dispatched' | 'task_completed' | 'task_failed' | 'task_stalled' | 'task_approval_needed' | 'p2p_dispatch_failed' | 'session_launched' | 'session_auto_launch' | 'session_stopped' | 'checkpoint_created' | 'node_cloned' | 'node_joined' | 'node_removed' | 'coordinator_started' | 'recovery_attempted' | 'ledger_replicated' | 'ledger_reconciled' | 'direct_fast_forward' | 'delivery_unroutable' | 'direct_dispatch_pruned' | 'event_held' | 'event_held_requeued' | 'task_reclaimed' | 'coordinator_operating_note' | 'coordinator_operating_note_tombstone' | 'mission_created' | 'mission_status_changed' | 'mission_goal_updated' | 'magi_dispatched' | 'magi_synthesis' | 'key_injection';
19
19
  export interface MeshLedgerEntry {
20
20
  id: string;
21
21
  meshId: string;
@@ -162,33 +162,6 @@ export declare const OPERATING_NOTE_KIND: MeshLedgerKind;
162
162
  export declare const OPERATING_NOTE_TOMBSTONE_KIND: MeshLedgerKind;
163
163
  export declare const OPERATING_NOTE_DEDUPE_WINDOW = 40;
164
164
  export declare const OPERATING_NOTE_KEEP_LATEST = 100;
165
- export declare const OPERATING_NOTE_CATEGORY_TTL_DAYS: Readonly<Record<string, number>>;
166
- /**
167
- * Shape isNoteExpired reads. Structural so mesh-ledger stays free of a
168
- * coordinator-prompt import (CoordinatorOperatingNote satisfies this).
169
- */
170
- export interface OperatingNoteExpiryInput {
171
- category?: string;
172
- pinned?: boolean;
173
- createdAt?: string;
174
- /** Explicit expiry override; wins over the category TTL when parseable. */
175
- expiresAt?: string;
176
- /** Fallback creation time (ledger entry timestamp) when createdAt absent. */
177
- timestamp?: string;
178
- }
179
- /**
180
- * Pure helper: is this UNPINNED operating note expired as of `now` (epoch ms)?
181
- *
182
- * Rules:
183
- * - pinned notes NEVER expire (always false).
184
- * - an explicit, parseable `expiresAt` in the past → expired.
185
- * - otherwise the category TTL applies; a durable category (provider_quirk,
186
- * uncategorized, or any category not in the TTL map) never expires.
187
- * - age is measured from createdAt, falling back to `timestamp` (ledger entry
188
- * time). If neither is a valid date, the note is treated as NOT expired
189
- * (never silently drop a note we cannot age).
190
- */
191
- export declare function isNoteExpired(note: OperatingNoteExpiryInput, now: number): boolean;
192
165
  export declare function getLedgerDir(): string;
193
166
  /**
194
167
  * Footer to append to worker task messages so workers output structured results
@@ -107,29 +107,6 @@ export declare function resolveEffectiveMeshNodeHealth(node: any): string;
107
107
  * replica that can never run.
108
108
  */
109
109
  export declare function isMeshNodeHealthLaunchable(node: any): boolean;
110
- /**
111
- * Launch FRESHNESS gate — distinct from the health gate above.
112
- *
113
- * `deriveMeshNodeHealthFromGit` reports a clean-tree node with `behind > 0` as
114
- * 'online', so the health gate (isMeshNodeHealthLaunchable) happily lets a STALE
115
- * node — one whose branch is N commits behind its upstream — win auto-launch fitness
116
- * routing and run a fresh worker against out-of-date code. `behind` is deliberately
117
- * NOT folded into deriveMeshNodeHealthFromGit because "behind" is not universally
118
- * unhealthy (the MAGI planner and other callers share that resolver); it is only
119
- * unhealthy for *spawning new work*. This gate encodes exactly that launch-time axis.
120
- *
121
- * Returns false (NOT fresh → skip / de-rank) only when git telemetry is PRESENT and
122
- * proves staleness:
123
- * - behind count exceeds `maxBehind` (default 0 — any behind blocks), OR
124
- * - a submodule is out of sync (gitlink points off upstream — cannot be caught up
125
- * by a simple worktree ff and would launch against a mismatched submodule).
126
- *
127
- * When telemetry is absent it returns true (fresh), preserving the online/unknown-pass
128
- * philosophy: we never block on missing data, only on data that proves the node stale.
129
- */
130
- export declare function isMeshNodeFreshEnoughToLaunch(node: any, opts?: {
131
- maxBehind?: number;
132
- }): boolean;
133
110
  export declare function applyInlineMeshBranchConvergence(mesh: any, node: any, status: Record<string, unknown>): void;
134
111
  export declare function summarizeInlineMeshBranchConvergence(nodes: Array<Record<string, unknown>>): Record<string, unknown>;
135
112
  export declare function readCachedInlineMeshActiveSessions(node: any): string[];
@@ -504,95 +504,6 @@ type GitlinkTrivialFastForwardEvaluation = {
504
504
  * gate.
505
505
  */
506
506
  export declare function collectFastForwardGitlinkPaths(repoRoot: string, baseHead: string, branchHead: string): string[];
507
- export type SubmoduleGitlinkConvergeResult = {
508
- /** True when at least one diverged gitlink submodule was rebased onto its base-side commit. */
509
- converged: boolean;
510
- /**
511
- * Set when convergence was declined/aborted (fail-safe → caller keeps the
512
- * original defer→blocked_review path). One of:
513
- * no_changed_gitlinks — no gitlink differs base↔branch
514
- * not_diverged — the gitlink is ff/behind/equal (gate handles it)
515
- * rebase_conflict — replaying branch-side onto base-side hit a real
516
- * content conflict inside the submodule (aborted)
517
- */
518
- reason?: string;
519
- /**
520
- * Converged gitlinks: path → the rebased submodule commit (SUBNEW) that the
521
- * root rebase must resolve the gitlink conflict to. Only populated for paths
522
- * whose submodule was successfully rebased (base-side is now a strict ancestor).
523
- */
524
- resolutions: Array<{
525
- path: string;
526
- baseCommit: string;
527
- branchCommit: string;
528
- rebasedCommit: string;
529
- }>;
530
- /** Per-path outcome for observability/logging. */
531
- gitlinks: Array<{
532
- path: string;
533
- baseCommit?: string;
534
- branchCommit?: string;
535
- rebasedCommit?: string;
536
- action: 'rebased' | 'skipped_not_diverged' | 'rebase_conflict';
537
- }>;
538
- };
539
- /**
540
- * STEP 1 of auto-converging diverged oss-style submodule gitlinks: rebase the
541
- * branch-side submodule commit(s) onto the base-side submodule commit INSIDE the
542
- * worktree's submodule checkout (detached HEAD), so the base-side commit becomes a
543
- * strict ancestor of the rebased tip. Returns the rebased commit per path so the
544
- * caller's root rebase can resolve the gitlink conflict to it (STEP 2, see
545
- * {@link rootRebaseResolvingGitlinks}). This automates the documented manual
546
- * strict-fast-forward bypass and keeps the landed submodule history linear rather
547
- * than masking a divergence.
548
- *
549
- * Fail-safe by construction: it only touches gitlinks that are a genuine sibling
550
- * divergence (both commits local, neither an ancestor of the other, shared merge
551
- * base). A submodule rebase content conflict aborts, restores the branch-side
552
- * checkout, and returns `converged:false` (caller keeps defer→blocked_review). It
553
- * never commits the root and NEVER pushes — remote publish is the merge/
554
- * reachability stage's job; this stage is local reconciliation only.
555
- *
556
- * @param worktreeRoot the branch worktree root (its `<path>` submodule checkout is rebased)
557
- * @param baseRepoRoot the source/base repo root (reads the base-side gitlink commit)
558
- * @param baseHead the fetched base head (root ref) — source of base-side gitlink commits
559
- * @param branchHead the worktree branch head (root ref) — source of branch-side gitlink commits
560
- */
561
- export declare function convergeDivergedSubmoduleGitlinks(worktreeRoot: string, baseRepoRoot: string, baseHead: string, branchHead: string): SubmoduleGitlinkConvergeResult;
562
- export type RootRebaseGitlinkResolveResult = {
563
- /** True when the root rebase completed (with gitlink conflicts resolved to the converged commits). */
564
- ok: boolean;
565
- /** New root HEAD after the rebase (only meaningful when ok). */
566
- branchHead?: string;
567
- /**
568
- * Set when the rebase was aborted (fail-safe). One of:
569
- * non_gitlink_conflict — a conflict on a non-submodule path (genuine content conflict)
570
- * unexpected_gitlink — a gitlink conflicted that we have no converged commit for
571
- * rebase_error — the rebase failed for a non-conflict reason
572
- */
573
- reason?: string;
574
- /** The paths that conflicted at the point of abort (for diagnostics). */
575
- conflictPaths?: string[];
576
- };
577
- /**
578
- * STEP 2 of auto-converging diverged submodule gitlinks: rebase the worktree root
579
- * branch onto `baseHead`, resolving each submodule-gitlink conflict to the
580
- * pre-converged commit from {@link convergeDivergedSubmoduleGitlinks}. git's
581
- * recursive merge refuses to auto-merge a diverged gitlink ("Recursive merging
582
- * with submodules currently only supports trivial cases"), so we drive the rebase
583
- * ourselves: on each stop, if the ONLY unmerged paths are gitlinks we have a
584
- * converged commit for, we stage those to the converged commit and `--continue`.
585
- * Any non-gitlink conflict (or a gitlink with no converged commit) aborts the
586
- * rebase and returns `ok:false` → caller keeps the defer→blocked_review path.
587
- *
588
- * On success the base-side gitlink is a strict ancestor of the resolved branch-side
589
- * commit, so the downstream patch-equivalence gate treats it as a trivial
590
- * fast-forward and passes.
591
- */
592
- export declare function rootRebaseResolvingGitlinks(worktreeRoot: string, baseHead: string, resolutions: Array<{
593
- path: string;
594
- rebasedCommit: string;
595
- }>): RootRebaseGitlinkResolveResult;
596
507
  /**
597
508
  * Decide whether a merge-tree submodule conflict between base and branch is a
598
509
  * trivial gitlink fast-forward (and nothing else).
@@ -1,9 +1,6 @@
1
1
  import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
2
2
  import type { LocalMeshEntry } from '../repo-mesh-types.js';
3
3
  export declare function pullRemoteNodeQueues(components: DaemonComponents, mesh: LocalMeshEntry, localDaemonId: string | undefined, candidateDaemonIds: string[]): Promise<void>;
4
- export declare function pullPendingEventsFromNode(components: DaemonComponents, meshId: string, node: {
5
- daemonId?: string;
6
- }, localDaemonId: string | undefined, candidateDaemonIds: string[], pulls: Array<Record<string, unknown>>): Promise<void>;
7
4
  export declare function unwrapReadChatPayload(raw: unknown): Record<string, unknown> | null;
8
5
  export declare function readChatPayloadStatus(payload: Record<string, unknown> | null): string;
9
6
  export declare function realTerminalEmitPendingForTask(meshId: string, taskId: string): boolean;
@@ -23,17 +23,6 @@ export declare class MeshRuntimeStore {
23
23
  private static loggedGetInstanceFailure;
24
24
  static getInstance(): MeshRuntimeStore;
25
25
  static resetForTests(): void;
26
- /**
27
- * VACUUM the SQLite database to reclaim on-disk space. Retention prunes rows
28
- * with DELETE, which frees pages inside the file but does NOT shrink it — the
29
- * mesh-runtime.db grew to hundreds of MB (mission 86def38d disk-accumulation
30
- * bootstrap failure) precisely because the file was never compacted. This
31
- * rewrites the DB into a minimal footprint. Best-effort: a VACUUM failure (e.g.
32
- * insufficient temp space, a read lock) is logged and swallowed so it can never
33
- * block daemon shutdown. Called once on shutdown (see daemon-lifecycle), never
34
- * on the hot path — VACUUM takes an exclusive lock and rewrites the whole file.
35
- */
36
- vacuum(): void;
37
26
  close(): void;
38
27
  transaction<T>(fn: () => T): T;
39
28
  private migrate;
@@ -337,15 +337,7 @@ export type DependencyFailurePolicy = 'block' | 'cancel';
337
337
  * Update the status of a specific task.
338
338
  * Used when a session completes, fails, or stalls.
339
339
  */
340
- export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: {
341
- /**
342
- * CANCEL-STICKY-TERMINAL: operator/system override to permit a terminal→non-terminal
343
- * transition (e.g. an explicit operator reopen). Without this, a write that would flip
344
- * a `completed`/`failed`/`cancelled` row back to `pending`/`assigned` is refused as a
345
- * no-op. Terminal→terminal and any transition FROM a non-terminal state are unaffected.
346
- */
347
- force?: boolean;
348
- } & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
340
+ export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: MeshQueueMutationOptions): MeshWorkQueueEntry | null;
349
341
  export declare function recordTaskAutoLaunch(meshId: string, taskId: string, autoLaunch: Omit<NonNullable<MeshWorkQueueEntry['autoLaunch']>, 'updatedAt'>): MeshWorkQueueEntry | null;
350
342
  /**
351
343
  * Mark a queue task as manually cancelled without deleting audit history.
@@ -353,21 +345,6 @@ export declare function recordTaskAutoLaunch(meshId: string, taskId: string, aut
353
345
  export declare function cancelTask(meshId: string, taskId: string, opts?: {
354
346
  reason?: string;
355
347
  } & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
356
- /**
357
- * CANCEL-STICKY-TERMINAL: the assignment a task carried at cancel time, handed to the cancel
358
- * command handler so it can stop the bound worker. cancelTask runs in the pure queue-store
359
- * module (no DaemonComponents), so it records the binding here and the handler drains it.
360
- */
361
- export interface CancelledTaskAssignment {
362
- sessionId: string;
363
- nodeId?: string;
364
- providerType?: string;
365
- }
366
- /**
367
- * Read-and-clear the assignment a just-cancelled task was bound to. Returns undefined when the
368
- * cancelled task had no live assignment (nothing to stop). One-shot: the entry is deleted on read.
369
- */
370
- export declare function takeCancelledTaskAssignment(meshId: string, taskId: string): CancelledTaskAssignment | undefined;
371
348
  /**
372
349
  * Return a queue task to pending for retry. By default, dead session targeting
373
350
  * and assigned ownership are cleared so stale assignments do not strand again.
@@ -58,28 +58,6 @@ export declare function extractFinalAssistantSummaryEvidence(messages: ChatMessa
58
58
  * grace gate) on top of this structural check.
59
59
  */
60
60
  export declare function selectFinalAssistantTurnEndMessage(messages: ChatMessage[] | null | undefined): ChatMessage | null;
61
- /**
62
- * EARLY-IDLE-COMPLETION-FALSE-POSITIVE — trailing tool/terminal activity detector.
63
- *
64
- * True when the transcript's LAST non-empty user-facing assistant bubble is followed
65
- * by one or more TOOL / TERMINAL activity bubbles (a tool_use/command the assistant
66
- * fired AFTER its text) — i.e. the assistant emitted a preamble ("Let me explore…"),
67
- * then started running Read/Grep, so the turn is still executing and its answer has
68
- * not landed. Callers that would otherwise promote that preamble to a turn-end summary
69
- * off a momentary (startup-grace / inter-tool) idle read use this as a veto.
70
- *
71
- * Deliberately NARROW so the pure-PTY completion rescue is preserved:
72
- * - Only TOOL/TERMINAL activity trailing the assistant vetoes. A trailing THOUGHT or
73
- * status bubble does NOT (a finished turn can end on an internal thought), matching
74
- * selectFinalAssistantTurnEndMessage's skip set minus the "still-working" signals.
75
- * - A genuinely FINISHED worker (final assistant last, no trailing tool activity —
76
- * the kimi pure-PTY continuous-idle shape) returns false, so its early completion
77
- * is untouched.
78
- *
79
- * Returns false when there is no final assistant bubble at all (the caller's
80
- * selectFinalAssistantTurnEndMessage already handles that as "not a turn end").
81
- */
82
- export declare function hasTrailingToolActivityAfterFinalAssistant(messages: ChatMessage[] | null | undefined): boolean;
83
61
  export declare const BUILTIN_CHAT_MESSAGE_KINDS: readonly ["standard", "thought", "tool", "terminal", "system"];
84
62
  export type BuiltinChatMessageKind = typeof BUILTIN_CHAT_MESSAGE_KINDS[number];
85
63
  export type ChatMessageKind = BuiltinChatMessageKind | (string & {});
@@ -19,7 +19,6 @@ export type CompletedFinalizationBlock = {
19
19
  terminal?: boolean;
20
20
  allowTimeout?: boolean;
21
21
  holdForTranscript?: boolean;
22
- noExternalTranscriptSource?: boolean;
23
22
  };
24
23
  export type CompletionFinalAssistantEvidence = {
25
24
  present: boolean;
@@ -38,11 +37,8 @@ export type ExternalTranscriptProbe = {
38
37
  };
39
38
  export declare const COMPLETED_FINALIZATION_RETRY_MS = 1000;
40
39
  export declare const COMPLETED_FINALIZATION_MAX_WAIT_MS = 30000;
41
- export declare const CANON_C_MISSING_ASSISTANT_MIN_ELAPSED_MS = 20000;
42
40
  export declare const NATIVE_HISTORY_MESH_IDLE_SETTLE_MS = 4000;
43
41
  export declare const PTY_PARSED_FINAL_ASSISTANT_QUIET_DWELL_MS = 1200;
44
- export declare const ANTIGRAVITY_HOLD_QUIET_DWELL_MS = 3000;
45
- export declare const ANTIGRAVITY_HOLD_HARD_CAP_MS: number;
46
42
  export declare const BACKGROUND_TASK_HOLD_MAX_MS: number;
47
43
  export declare const USER_INPUT_ACK_DEDUP_WINDOW_MS = 60000;
48
44
  export declare const STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS = 12000;
@@ -192,7 +192,6 @@ export declare class CliProviderInstance implements ProviderInstance {
192
192
  private meshStallEmittedForAnchor;
193
193
  private meshStallTurnActiveLast;
194
194
  private meshStallLastFiredAt;
195
- private meshStallNativeTranscriptSample;
196
195
  private busyEpoch;
197
196
  private fastCollapseSynthesizedTaskId;
198
197
  private startupGraceCollapseAt;
@@ -202,7 +201,6 @@ export declare class CliProviderInstance implements ProviderInstance {
202
201
  private generatingDebounceTimer;
203
202
  private generatingDebouncePending;
204
203
  private lastApprovalEventFingerprint;
205
- private lastInteractivePromptEventKey;
206
204
  private autoApproveBusy;
207
205
  private autoApproveBusyTimer;
208
206
  private lastAutoApprovalSignature;
@@ -425,7 +423,6 @@ export declare class CliProviderInstance implements ProviderInstance {
425
423
  * once at completion). Reset on the next turn's start.
426
424
  */
427
425
  private lastCompletionSummary;
428
- private lastEmittedCompletion;
429
426
  private enforceFreshSessionLaunchIfNeeded;
430
427
  /**
431
428
  * BRAIN-ROUTING (runtime-control thinking axis): for a provider that selects
@@ -476,7 +473,6 @@ export declare class CliProviderInstance implements ProviderInstance {
476
473
  private completionFinalSummary;
477
474
  private buildCompletedFinalizationDiagnostic;
478
475
  private hasAdapterPendingResponse;
479
- private antigravityHoldPtyStillActive;
480
476
  private shouldSuppressStaleParsedBusyStatus;
481
477
  private getCompletedFinalizationBlock;
482
478
  private hasApprovalResolutionEvidence;
@@ -576,76 +572,6 @@ export declare class CliProviderInstance implements ProviderInstance {
576
572
  * starts with a clean slate (a restart is not throttled by a prior stall).
577
573
  */
578
574
  private resetMeshStallEpisode;
579
- /**
580
- * KIMI-MESH-COMPLETION-EMIT (axis 1). For a native-source provider
581
- * (transcriptAuthority=provider — its authoritative history is an on-disk
582
- * transcript file, e.g. kimi's wire.jsonl), sample the transcript's current
583
- * progress fingerprint (record count + source-file mtime) WITHOUT parsing the
584
- * PTY. Used by the stall watchdog to distinguish "PTY render is quiet but the
585
- * worker is still doing long tool work (transcript growing)" from a genuine
586
- * wedge. Returns null for a pure-PTY provider (no native source) or when the
587
- * source cannot be resolved this tick — the caller then falls back to the
588
- * unchanged lastOutputAt-only judgment.
589
- *
590
- * Generalized on the provider's native-source flag, NOT a hardcoded provider
591
- * type, so every current and future pure-PTY long-tool native-source provider
592
- * benefits. Cheap enough for the stall path: it runs only at the stall threshold
593
- * (≥180s of PTY stasis), never on the routine 5s tick.
594
- */
595
- private sampleNativeTranscriptProgress;
596
- /**
597
- * KIMI-MESH-COMPLETION-EMIT (axis 2). Last-chance completion emit for a mesh
598
- * DELEGATED worker whose PTY has already exited (e.g. killed by a false stall)
599
- * and is about to be auto-cleaned (cli-manager.startCliExitMonitor →
600
- * removeInstance closes the event-emit window forever). If the worker actually
601
- * FINISHED its assigned turn — its authoritative native transcript holds a final
602
- * assistant message for the injected task — but the completion event never fired
603
- * (the stall-kill happened before the FSM's idle transition), emit it now so the
604
- * coordinator learns the task completed instead of waiting ~180s for the reconcile
605
- * transcript-poll to reclaim it.
606
- *
607
- * Scope & guards (must all hold to emit):
608
- * • mesh worker session only — a normal standalone session's ordinary exit is
609
- * never synthesized (isMeshWorkerSession()).
610
- * • DOUBLE-EMIT guard — refuse if this turn's completion already fired
611
- * (lastEmittedCompletion matches the current taskId). A worker that completed
612
- * cleanly and is merely being cleaned up never double-emits.
613
- * • evidence gate — reuse the same final-assistant/turn-scoped summary machinery
614
- * as the normal completion path (completionFinalSummary over the native
615
- * transcript). No in-turn assistant summary ⇒ no proof of completion ⇒ leave
616
- * the reclaim path to handle a genuinely-unfinished worker.
617
- *
618
- * Returns true when a synthetic completion was emitted, false otherwise. Safe to
619
- * call unconditionally from the cleanup path.
620
- */
621
- flushMeshCompletionBeforeCleanup(): boolean;
622
- /**
623
- * KIMI-PURE-PTY-COMPLETION-EMIT (Fix 3): stall-path completion reconcile for the
624
- * PURE-PTY transcript class (kimi and kin — no native transcript, no provider
625
- * authority; see isPurePtyTranscriptProvider). Such a worker whose
626
- * generating_completed never emitted (the onTurnStarted idle→idle collapse Fix 1
627
- * fixes at the source) sits at a STATIC idle prompt: its PTY output stops the
628
- * instant the answer is rendered, so the status-agnostic no-progress watchdog
629
- * (checkMeshWorkerStall) reads the finished-but-quiet session as a stall and would
630
- * false-fire monitor:no_progress. The native-transcript reconcile
631
- * (sampleNativeTranscriptProgress) does NOT cover this class (no native source →
632
- * null sample), so the stall path needs its own guard.
633
- *
634
- * Called from checkMeshWorkerStall just before the fire. Returns true when the
635
- * session is a finished pure-PTY turn — idle, no pending response, and a PTY-parsed
636
- * in-turn final assistant summary — in which case it emits the missing
637
- * generating_completed (idempotent: a real/late emit writes the terminal ledger and
638
- * the coordinator's reconcile makes any duplicate a no-op) and the caller SUPPRESSES
639
- * the stall. Returns false for every other class/state (native-source provider, a
640
- * genuinely mid-turn or wedged worker with no final assistant), so a real stall still
641
- * fires unchanged.
642
- *
643
- * Evidence bar is identical to flushMeshCompletionBeforeCleanup: injected task's turn
644
- * genuinely started + an in-turn final assistant summary. Conservative by
645
- * construction — no summary ⇒ no proof of completion ⇒ return false and let the real
646
- * stall fire.
647
- */
648
- private tryReconcilePurePtyCompletionForStall;
649
575
  /**
650
576
  * AUTOAPPROVE-FLAP-RECUR (Fix A+B): how long a busy blip / modal scroll-out may
651
577
  * persist before the in-progress settle gate is torn down. For a delegated
@@ -810,11 +736,7 @@ export declare class CliProviderInstance implements ProviderInstance {
810
736
  getAdapter(): ProviderCliAdapter;
811
737
  get cliType(): string;
812
738
  get cliName(): string;
813
- private resolveAutoApproveMode;
814
- /** Legacy boolean view retained for internal/test compatibility. */
815
739
  private shouldAutoApprove;
816
- private shouldUsePtyAutoApprove;
817
- private resetPtyAutoApproveState;
818
740
  /** @see ProviderInstance.noteManualInteraction */
819
741
  noteManualInteraction(now?: number, opts?: {
820
742
  passive?: boolean;
@@ -389,21 +389,6 @@ export interface ProviderCompatibilityEntry {
389
389
  ideVersion: string;
390
390
  scriptDir: string;
391
391
  }
392
- export type AutoApproveModeStrategy = 'pty-parse-default' | 'launch-args' | 'post-boot-command';
393
- export type AutoApproveModeRisk = 'safe' | 'caution' | 'dangerous';
394
- export interface AutoApproveMode {
395
- id: string;
396
- label: string;
397
- strategy: AutoApproveModeStrategy;
398
- risk: AutoApproveModeRisk;
399
- warning?: string;
400
- launchArgs?: string[];
401
- removeArgs?: string[];
402
- }
403
- export interface AutoApproveModesConfig {
404
- default: string;
405
- modes: AutoApproveMode[];
406
- }
407
392
  export interface ProviderModule {
408
393
  /** Unique identifier (e.g. 'cline', 'cursor', 'gemini-cli') */
409
394
  type: string;
@@ -433,8 +418,6 @@ export interface ProviderModule {
433
418
  status?: string;
434
419
  /** Inventory/support detail string maintained in adhdev-providers */
435
420
  details?: string;
436
- /** Provider-specific auto-approve choices and their launch/runtime strategy. */
437
- autoApproveModes?: AutoApproveModesConfig;
438
421
  /** Install instructions (shown when command is missing) */
439
422
  install?: string;
440
423
  /** Custom version detection command (e.g. 'cursor --version', 'claude -v') */
@@ -3,4 +3,3 @@ export interface ProviderValidationResult {
3
3
  warnings: string[];
4
4
  }
5
5
  export declare function validateProviderDefinition(raw: unknown): ProviderValidationResult;
6
- export declare function validateAutoApproveModes(raw: unknown, errors: string[]): void;
@@ -75,20 +75,6 @@ export interface DetectStatusTuiSpec {
75
75
  declare function scopeText(input: CliStatusInput, scope: SpinnerSpec['scope'] | SettledPromptSpec['scope'], windowLines: number | undefined): string;
76
76
  declare function spinnerMatches(spec: SpinnerSpec, input: CliStatusInput): boolean;
77
77
  declare function settledPromptMatches(spec: SettledPromptSpec, input: CliStatusInput): boolean;
78
- /**
79
- * APPROVAL-PICKER-MISROUTE (mission f1d25e11) defense-in-depth: an
80
- * AskUserQuestion multi-choice picker is NOT an approval modal. Its option rows
81
- * ("❯ 1. label") can otherwise satisfy the approval button cue and get
82
- * mis-classified as `waiting_approval`, so the worker's question is surfaced to
83
- * the coordinator as a task_approval_needed (→ mesh_approve, which cannot answer
84
- * it). The picker carries a distinctive signature the approval FSM never does:
85
- * the claude TUI select footer ("Enter to select … Esc to cancel") together with
86
- * the freeform escape hatch ("Type something" / "Chat about this"). When both are
87
- * present the screen is a question picker — surfaced separately as
88
- * waiting_choice — so the approval matchers must yield. Mirrors the legacy
89
- * looksLikeSelectionPicker guard (cli-provider-instance.ts) ported to SDK-v1.
90
- */
91
- export declare function isAskUserQuestionPickerSignature(text: string): boolean;
92
78
  declare function modalMatches(spec: ModalSpec, input: CliStatusInput): boolean;
93
79
  export declare function buildDetectStatusFromTui(spec: DetectStatusTuiSpec): CliDetectStatusFn;
94
80
  export declare const __internal: {
@@ -28,24 +28,6 @@ export interface InteractiveAnswer {
28
28
  }
29
29
  export declare function normalizeInteractivePrompt(raw: unknown): InteractivePrompt | null;
30
30
  export declare function normalizeInteractivePromptResponse(raw: unknown): InteractivePromptResponse;
31
- /**
32
- * Resolve a coordinator-friendly answer form into the strict, questionId-keyed
33
- * InteractivePromptResponse the TUI/answer machinery consumes (mission f1d25e11).
34
- *
35
- * mesh_answer_question lets the coordinator answer against the option LABELS or
36
- * 1-based INDEXES it saw in the agent:waiting_choice event, without having to
37
- * reconstruct the exact questionId → selectedLabels map. This resolves that
38
- * ergonomic form against the AUTHORITATIVE active prompt (the daemon holds it),
39
- * so index/label resolution and question ordering are correct by construction.
40
- *
41
- * Accepted `raw` shapes:
42
- * - The strict form ({ promptId, answers: { [questionId]: { selectedLabels } } })
43
- * — passed straight to normalizeInteractivePromptResponse (back-compat).
44
- * - The friendly form ({ promptId, answers: [ { questionId?, select?, freeform? } ] })
45
- * — entries map to questions by questionId, else by array position. `select`
46
- * is a label (string) / 1-based index (number) / array of either.
47
- */
48
- export declare function resolveInteractivePromptResponse(prompt: InteractivePrompt, raw: unknown): InteractivePromptResponse;
49
31
  export declare function buildClaudeInteractiveToolResult(response: InteractivePromptResponse): string;
50
32
  export interface ClaudeInteractiveTuiPage {
51
33
  screenText: string;