@adhdev/daemon-core 0.9.82-rc.9 → 0.9.82-rc.90

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 (67) hide show
  1. package/dist/cli-adapters/provider-cli-adapter.d.ts +2 -0
  2. package/dist/cli-adapters/provider-cli-parse.d.ts +1 -0
  3. package/dist/cli-adapters/provider-cli-shared.d.ts +2 -0
  4. package/dist/commands/router.d.ts +22 -0
  5. package/dist/config/mesh-config.d.ts +66 -1
  6. package/dist/index.d.ts +13 -6
  7. package/dist/index.js +5395 -1197
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +5359 -1183
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/installer.d.ts +1 -4
  12. package/dist/launch.d.ts +1 -1
  13. package/dist/logging/async-batch-writer.d.ts +10 -0
  14. package/dist/mesh/beads-db.d.ts +18 -0
  15. package/dist/mesh/mesh-active-work.d.ts +60 -0
  16. package/dist/mesh/mesh-events.d.ts +29 -5
  17. package/dist/mesh/mesh-fast-forward.d.ts +39 -0
  18. package/dist/mesh/mesh-host-ownership.d.ts +9 -0
  19. package/dist/mesh/mesh-ledger.d.ts +38 -1
  20. package/dist/mesh/mesh-work-queue.d.ts +27 -5
  21. package/dist/mesh/refine-config.d.ts +176 -0
  22. package/dist/providers/chat-message-normalization.d.ts +1 -0
  23. package/dist/providers/cli-provider-instance.d.ts +2 -1
  24. package/dist/repo-mesh-types.d.ts +46 -0
  25. package/dist/status/reporter.d.ts +2 -0
  26. package/package.json +3 -1
  27. package/src/boot/daemon-lifecycle.ts +1 -0
  28. package/src/cli-adapters/provider-cli-adapter.ts +91 -3
  29. package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
  30. package/src/cli-adapters/provider-cli-parse.ts +4 -0
  31. package/src/cli-adapters/provider-cli-runtime.ts +3 -1
  32. package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
  33. package/src/cli-adapters/provider-cli-shared.ts +20 -10
  34. package/src/commands/chat-commands.ts +454 -15
  35. package/src/commands/cli-manager.ts +126 -0
  36. package/src/commands/handler.ts +8 -1
  37. package/src/commands/mesh-coordinator.ts +13 -143
  38. package/src/commands/router.ts +2687 -435
  39. package/src/config/chat-history.ts +9 -7
  40. package/src/config/mesh-config.ts +245 -1
  41. package/src/daemon/dev-cli-debug.ts +10 -1
  42. package/src/detection/ide-detector.ts +26 -16
  43. package/src/index.ts +31 -5
  44. package/src/installer.d.ts +1 -1
  45. package/src/installer.ts +8 -6
  46. package/src/launch.d.ts +1 -1
  47. package/src/launch.ts +37 -28
  48. package/src/logging/async-batch-writer.ts +55 -0
  49. package/src/logging/logger.ts +2 -1
  50. package/src/mesh/beads-db.ts +176 -0
  51. package/src/mesh/coordinator-prompt.ts +30 -7
  52. package/src/mesh/mesh-active-work.ts +243 -0
  53. package/src/mesh/mesh-events.ts +400 -47
  54. package/src/mesh/mesh-fast-forward.ts +430 -0
  55. package/src/mesh/mesh-host-ownership.ts +73 -0
  56. package/src/mesh/mesh-ledger.ts +138 -1
  57. package/src/mesh/mesh-work-queue.ts +199 -137
  58. package/src/mesh/refine-config.ts +356 -0
  59. package/src/providers/chat-message-normalization.ts +3 -1
  60. package/src/providers/cli-provider-instance.ts +91 -13
  61. package/src/providers/ide-provider-instance.ts +17 -3
  62. package/src/providers/provider-loader.ts +10 -4
  63. package/src/providers/read-chat-contract.ts +1 -1
  64. package/src/providers/version-archive.ts +38 -20
  65. package/src/repo-mesh-types.ts +51 -0
  66. package/src/status/reporter.ts +15 -0
  67. package/src/system/host-memory.ts +29 -12
@@ -28,10 +28,7 @@ export interface InstallResult {
28
28
  alreadyInstalled: boolean;
29
29
  error?: string;
30
30
  }
31
- /**
32
- * Check if an extension is already installed
33
- */
34
- export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): boolean;
31
+ export declare function isExtensionInstalled(ide: IDEInfo, marketplaceId: string): Promise<boolean>;
35
32
  /**
36
33
  * Install a single extension
37
34
  */
package/dist/launch.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  /** Kill IDE process (graceful → force) */
19
19
  export declare function killIdeProcess(ideId: string): Promise<boolean>;
20
20
  /** Check if IDE process is running */
21
- export declare function isIdeRunning(ideId: string): boolean;
21
+ export declare function isIdeRunning(ideId: string): Promise<boolean>;
22
22
  export interface LaunchOptions {
23
23
  ideId?: string;
24
24
  workspace?: string;
@@ -0,0 +1,10 @@
1
+ export declare class AsyncBatchWriter {
2
+ private static buffers;
3
+ private static writePromises;
4
+ private static flushTimer;
5
+ /**
6
+ * Queues data to be written to a file asynchronously in a batch.
7
+ */
8
+ static write(filePath: string, data: string): void;
9
+ private static flushAll;
10
+ }
@@ -0,0 +1,18 @@
1
+ import type { MeshTaskStatus, MeshWorkQueueEntry } from './mesh-work-queue.js';
2
+ export declare class BeadsDB {
3
+ private static instance;
4
+ private readonly db;
5
+ private readonly migratedMeshIds;
6
+ private constructor();
7
+ static getInstance(): BeadsDB;
8
+ static resetForTests(): void;
9
+ close(): void;
10
+ transaction<T>(fn: () => T): T;
11
+ private migrate;
12
+ private ensureLegacyQueueMigrated;
13
+ getQueueEntries(meshId: string, statuses?: MeshTaskStatus[]): MeshWorkQueueEntry[];
14
+ getQueueRevision(meshId: string): string;
15
+ replaceQueue(meshId: string, queue: MeshWorkQueueEntry[]): void;
16
+ deleteQueue(meshId: string): void;
17
+ private toRow;
18
+ }
@@ -0,0 +1,60 @@
1
+ import type { MeshLedgerEntry } from './mesh-ledger.js';
2
+ import type { MeshWorkQueueEntry } from './mesh-work-queue.js';
3
+ export type MeshActiveWorkSource = 'queue' | 'direct';
4
+ export type MeshActiveWorkStatus = 'pending' | 'assigned' | 'generating' | 'idle' | 'failed' | 'awaiting_approval';
5
+ export interface MeshActiveWorkRecord {
6
+ taskId: string;
7
+ source: MeshActiveWorkSource;
8
+ status: MeshActiveWorkStatus;
9
+ nodeId?: string;
10
+ sessionId?: string;
11
+ providerType?: string;
12
+ taskTitle: string;
13
+ taskSummary: string;
14
+ message?: string;
15
+ taskMode?: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ dispatchedAt?: string;
19
+ elapsedMs: number;
20
+ terminal?: boolean;
21
+ terminalKind?: string;
22
+ terminalAt?: string;
23
+ staleReason?: string;
24
+ }
25
+ export interface MeshActiveWorkSummary {
26
+ totalActiveCount: number;
27
+ queueActiveCount: number;
28
+ directActiveCount: number;
29
+ awaitingApprovalCount: number;
30
+ generatingCount: number;
31
+ failedCount: number;
32
+ idleCount: number;
33
+ sourceCounts: Record<MeshActiveWorkSource, number>;
34
+ statusCounts: Record<MeshActiveWorkStatus, number>;
35
+ staleDirectCount: number;
36
+ /**
37
+ * When staleDirectCount > 0, this note clarifies that stale direct records are
38
+ * historical/recovery evidence — orphaned ledger entries whose original node or session
39
+ * is no longer present in the live mesh. They are NOT active or unresolved work items.
40
+ * The active queue (queue source) is the authoritative source for pending/assigned work.
41
+ */
42
+ staleDirectNote?: string;
43
+ }
44
+ export interface BuildMeshActiveWorkOptions {
45
+ meshId: string;
46
+ queue?: MeshWorkQueueEntry[];
47
+ ledgerEntries?: MeshLedgerEntry[];
48
+ nodes?: any[];
49
+ now?: number;
50
+ /** Include terminal direct rows (idle/failed) for handoff/recent-work surfaces. Defaults false. */
51
+ includeTerminalDirect?: boolean;
52
+ }
53
+ export declare function buildMeshActiveWorkSummary(activeWork: MeshActiveWorkRecord[]): MeshActiveWorkSummary;
54
+ export declare function buildMeshActiveWork(opts: BuildMeshActiveWorkOptions): {
55
+ activeWork: MeshActiveWorkRecord[];
56
+ staleDirectWork: MeshActiveWorkRecord[];
57
+ staleDirectWorkNote?: string;
58
+ terminalDirectWork: MeshActiveWorkRecord[];
59
+ summary: MeshActiveWorkSummary;
60
+ };
@@ -3,15 +3,19 @@ export interface PendingMeshCoordinatorEvent {
3
3
  event: string;
4
4
  meshId: string;
5
5
  nodeLabel: string;
6
+ nodeId?: string;
7
+ workspace?: string;
6
8
  metadataEvent: Record<string, unknown>;
9
+ coordinatorMessage?: string;
7
10
  queuedAt: number;
8
11
  }
9
- /** Drain and return all pending coordinator events, clearing the queue. */
10
- export declare function drainPendingMeshCoordinatorEvents(): PendingMeshCoordinatorEvent[];
12
+ export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
13
+ /** Drain and return all pending coordinator events for meshId, removing them from disk. */
14
+ export declare function drainPendingMeshCoordinatorEvents(meshId?: string): PendingMeshCoordinatorEvent[];
11
15
  /** Peek at pending coordinator events without draining (non-destructive). */
12
- export declare function getPendingMeshCoordinatorEvents(): readonly PendingMeshCoordinatorEvent[];
13
- /** Explicitly clear all pending coordinator events. */
14
- export declare function clearPendingMeshCoordinatorEvents(): void;
16
+ export declare function getPendingMeshCoordinatorEvents(meshId?: string): readonly PendingMeshCoordinatorEvent[];
17
+ /** Explicitly clear all pending coordinator events for a mesh. */
18
+ export declare function clearPendingMeshCoordinatorEvents(meshId?: string): void;
15
19
  export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
16
20
  /**
17
21
  * Triggers a queue check for all nodes in the mesh.
@@ -23,12 +27,32 @@ export declare function handleMeshForwardEvent(components: DaemonComponents, pay
23
27
  forwarded: number;
24
28
  suppressed: boolean;
25
29
  intentionalCleanupStop: boolean;
30
+ duplicateRefineTerminalEvent?: undefined;
31
+ duplicateCompletion?: undefined;
32
+ error?: undefined;
33
+ } | {
34
+ success: boolean;
35
+ forwarded: number;
36
+ suppressed: boolean;
37
+ duplicateRefineTerminalEvent: boolean;
38
+ intentionalCleanupStop?: undefined;
39
+ duplicateCompletion?: undefined;
40
+ error?: undefined;
41
+ } | {
42
+ success: boolean;
43
+ forwarded: number;
44
+ suppressed: boolean;
45
+ duplicateCompletion: boolean;
46
+ intentionalCleanupStop?: undefined;
47
+ duplicateRefineTerminalEvent?: undefined;
26
48
  error?: undefined;
27
49
  } | {
28
50
  success: boolean;
29
51
  forwarded: number;
30
52
  suppressed?: undefined;
31
53
  intentionalCleanupStop?: undefined;
54
+ duplicateRefineTerminalEvent?: undefined;
55
+ duplicateCompletion?: undefined;
32
56
  error?: undefined;
33
57
  } | {
34
58
  success: boolean;
@@ -0,0 +1,39 @@
1
+ import type { GitRepoStatus } from '../git/git-types.js';
2
+ export interface MeshFastForwardNodeArgs {
3
+ nodeId?: string;
4
+ meshId?: string;
5
+ workspace: string;
6
+ branch?: string;
7
+ execute?: boolean;
8
+ dryRun?: boolean;
9
+ updateSubmodules?: boolean;
10
+ submoduleIgnorePaths?: string[];
11
+ timeoutMs?: number;
12
+ }
13
+ export interface MeshFastForwardPlannedStep {
14
+ operation: 'refresh_upstream' | 'verify_clean_worktree' | 'verify_fast_forward' | 'merge_ff_only' | 'submodule_update' | 'verify_post_status';
15
+ description: string;
16
+ safe: true;
17
+ willMutateWorktree: boolean;
18
+ }
19
+ export interface MeshFastForwardResult {
20
+ success: boolean;
21
+ code: string;
22
+ nodeId?: string;
23
+ meshId?: string;
24
+ workspace: string;
25
+ allowed: boolean;
26
+ dryRun: boolean;
27
+ willRun: boolean;
28
+ executed: boolean;
29
+ updateSubmodules: boolean;
30
+ blockingReasons: string[];
31
+ plannedSteps: MeshFastForwardPlannedStep[];
32
+ current?: GitRepoStatus;
33
+ preStatus?: GitRepoStatus;
34
+ postStatus?: GitRepoStatus;
35
+ finalBranchConvergenceState?: Record<string, unknown>;
36
+ operationError?: string;
37
+ ledgerError?: string;
38
+ }
39
+ export declare function fastForwardMeshNode(args: MeshFastForwardNodeArgs): Promise<MeshFastForwardResult>;
@@ -0,0 +1,9 @@
1
+ import type { RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostStatus } from '../repo-mesh-types.js';
2
+ export declare function normalizeMeshDaemonRole(value: unknown): RepoMeshDaemonRole | undefined;
3
+ export declare function resolveMeshHostStatus(mesh: unknown): RepoMeshHostStatus;
4
+ export declare function isMeshHostOwner(mesh: unknown): boolean;
5
+ export declare function buildMeshHostRequiredFailure(mesh: unknown, operation: string): Record<string, unknown>;
6
+ export declare function requireMeshHostQueueOwner(opts?: {
7
+ ownerRole?: RepoMeshDaemonRole;
8
+ }): void;
9
+ export declare function createDefaultMeshHostMetadata(): RepoMeshHostMetadata;
@@ -13,7 +13,7 @@
13
13
  * Safety: mode 0o600, atomic append via appendFileSync
14
14
  */
15
15
  import { EventEmitter } from 'events';
16
- export type MeshLedgerKind = 'task_dispatched' | 'task_completed' | 'task_failed' | 'task_stalled' | 'task_approval_needed' | 'session_launched' | 'session_auto_launch' | 'session_stopped' | 'checkpoint_created' | 'node_cloned' | 'node_removed' | 'coordinator_started' | 'recovery_attempted' | 'ledger_replicated' | 'ledger_reconciled';
16
+ export type MeshLedgerKind = 'task_dispatched' | 'task_completed' | 'task_failed' | 'task_stalled' | 'task_approval_needed' | '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';
17
17
  export interface MeshLedgerEntry {
18
18
  id: string;
19
19
  meshId: string;
@@ -25,6 +25,40 @@ export interface MeshLedgerEntry {
25
25
  payload: Record<string, unknown>;
26
26
  }
27
27
  export declare function isIntentionalCleanupStopEntry(entry: Pick<MeshLedgerEntry, 'kind' | 'payload'>): boolean;
28
+ export type MeshWorkerResultStatus = 'completed' | 'failed' | 'blocked' | 'partial' | 'unknown';
29
+ export type MeshProcessArtifactKind = 'process' | 'log' | 'port' | 'window' | 'session' | 'file' | 'url' | 'other';
30
+ export interface MeshValidationResultArtifact {
31
+ command?: string;
32
+ status: 'passed' | 'failed' | 'skipped' | 'unknown';
33
+ durationMs?: number;
34
+ outputPath?: string;
35
+ summary?: string;
36
+ }
37
+ export interface MeshProcessArtifact {
38
+ kind: MeshProcessArtifactKind;
39
+ id?: string;
40
+ label?: string;
41
+ locator?: string;
42
+ pid?: number;
43
+ port?: number;
44
+ url?: string;
45
+ path?: string;
46
+ sessionId?: string;
47
+ keepRunning?: boolean;
48
+ metadata?: Record<string, unknown>;
49
+ }
50
+ export interface MeshWorkerResultArtifact {
51
+ status: MeshWorkerResultStatus;
52
+ classification?: string;
53
+ changedFiles: string[];
54
+ validationResults: MeshValidationResultArtifact[];
55
+ gitStatus?: Record<string, unknown>;
56
+ processArtifacts: MeshProcessArtifact[];
57
+ errors: string[];
58
+ nextAction?: string;
59
+ requiresUserAction: boolean;
60
+ source: 'explicit_metadata' | 'final_summary_json' | 'default';
61
+ }
28
62
  export interface MeshTaskCompletionEvidence {
29
63
  source: 'agent_status_event';
30
64
  event: 'agent:generating_completed' | 'agent:ready';
@@ -38,6 +72,7 @@ export interface MeshTaskCompletionEvidence {
38
72
  providerSessionId?: string;
39
73
  finalSummaryAvailable: boolean;
40
74
  };
75
+ workerResult: MeshWorkerResultArtifact;
41
76
  git: {
42
77
  status: 'deferred';
43
78
  reason: string;
@@ -59,6 +94,7 @@ export interface BuildTaskCompletionEvidenceOptions {
59
94
  providerType?: string;
60
95
  providerSessionId?: string;
61
96
  finalSummary?: string;
97
+ workerResult?: Record<string, unknown>;
62
98
  completedAt?: string;
63
99
  }
64
100
  export interface MeshLedgerSummary {
@@ -115,6 +151,7 @@ export interface AppendRemoteLedgerResult {
115
151
  }
116
152
  export declare const MAX_LEDGER_SLICE_LIMIT = 500;
117
153
  export declare function getLedgerDir(): string;
154
+ export declare function normalizeMeshWorkerResult(input?: Record<string, unknown>, source?: MeshWorkerResultArtifact['source']): MeshWorkerResultArtifact;
118
155
  export declare function buildTaskCompletionEvidence(opts: BuildTaskCompletionEvidenceOptions): MeshTaskCompletionEvidence;
119
156
  /**
120
157
  * Append a new entry to the mesh ledger.
@@ -1,13 +1,25 @@
1
+ import type { RepoMeshDaemonRole } from '../repo-mesh-types.js';
1
2
  export type MeshTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
2
3
  export type MeshActiveTaskStatus = Extract<MeshTaskStatus, 'pending' | 'assigned'>;
3
4
  export type MeshHistoricalTaskStatus = Extract<MeshTaskStatus, 'completed' | 'failed' | 'cancelled'>;
5
+ export type MeshTaskMode = 'code_change' | 'validation' | 'live_debug_readonly' | 'launch_app' | 'convergence';
4
6
  export declare const ACTIVE_MESH_QUEUE_STATUSES: MeshActiveTaskStatus[];
5
7
  export declare const HISTORICAL_MESH_QUEUE_STATUSES: MeshHistoricalTaskStatus[];
8
+ export declare const MESH_TASK_MODES: MeshTaskMode[];
9
+ export interface MeshTaskModeValidationResult {
10
+ valid: boolean;
11
+ taskMode?: MeshTaskMode;
12
+ violations: string[];
13
+ allowedOperations?: string[];
14
+ }
15
+ export declare function normalizeMeshTaskMode(value: unknown): MeshTaskMode | undefined;
16
+ export declare function validateMeshTaskModeRequest(mode: unknown, message: string): MeshTaskModeValidationResult;
6
17
  export interface MeshWorkQueueEntry {
7
18
  id: string;
8
19
  meshId: string;
9
20
  message: string;
10
21
  status: MeshTaskStatus;
22
+ taskMode?: MeshTaskMode;
11
23
  /** If specified, only this node can claim the task (used by legacy mesh_send_task) */
12
24
  targetNodeId?: string;
13
25
  /** If specified, only this runtime session can claim the task */
@@ -37,19 +49,24 @@ export interface MeshWorkQueueEntry {
37
49
  createdAt: string;
38
50
  updatedAt: string;
39
51
  }
52
+ export interface MeshQueueMutationOptions {
53
+ ownerRole?: RepoMeshDaemonRole;
54
+ }
40
55
  /**
41
56
  * Add a new task to the mesh queue.
42
57
  */
43
58
  export declare function enqueueTask(meshId: string, message: string, opts?: {
44
59
  targetNodeId?: string;
45
60
  targetSessionId?: string;
46
- }): MeshWorkQueueEntry;
61
+ taskMode?: MeshTaskMode | string;
62
+ } & MeshQueueMutationOptions): MeshWorkQueueEntry;
47
63
  /**
48
64
  * Get all tasks in the queue, optionally filtered by status.
49
65
  */
50
66
  export declare function getQueue(meshId: string, opts?: {
51
67
  status?: MeshTaskStatus[];
52
68
  }): MeshWorkQueueEntry[];
69
+ export declare function getMeshQueueRevision(meshId: string): string;
53
70
  /**
54
71
  * Find the next pending task that this node is allowed to claim, and mark it as assigned.
55
72
  */
@@ -58,14 +75,14 @@ export declare function claimNextTask(meshId: string, nodeId: string, sessionId:
58
75
  * Update the status of a specific task.
59
76
  * Used when a session completes, fails, or stalls.
60
77
  */
61
- export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
78
+ export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: MeshQueueMutationOptions): MeshWorkQueueEntry | null;
62
79
  export declare function recordTaskAutoLaunch(meshId: string, taskId: string, autoLaunch: Omit<NonNullable<MeshWorkQueueEntry['autoLaunch']>, 'updatedAt'>): MeshWorkQueueEntry | null;
63
80
  /**
64
81
  * Mark a queue task as manually cancelled without deleting audit history.
65
82
  */
66
83
  export declare function cancelTask(meshId: string, taskId: string, opts?: {
67
84
  reason?: string;
68
- }): MeshWorkQueueEntry | null;
85
+ } & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
69
86
  /**
70
87
  * Return a queue task to pending for retry. By default, dead session targeting
71
88
  * and assigned ownership are cleared so stale assignments do not strand again.
@@ -76,11 +93,13 @@ export declare function requeueTask(meshId: string, taskId: string, opts?: {
76
93
  targetSessionId?: string;
77
94
  clearTargetNode?: boolean;
78
95
  clearTargetSession?: boolean;
79
- }): MeshWorkQueueEntry | null;
96
+ } & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
80
97
  /**
81
98
  * Update the status of the task currently assigned to a specific session.
82
99
  */
83
- export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
100
+ export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus, opts?: {
101
+ occurredAt?: string;
102
+ }): MeshWorkQueueEntry | null;
84
103
  export interface MeshWorkQueueStats {
85
104
  total: number;
86
105
  active: number;
@@ -105,3 +124,6 @@ export interface MeshWorkQueueStats {
105
124
  * Return aggregate queue statistics for the given mesh.
106
125
  */
107
126
  export declare function getMeshQueueStats(meshId: string): MeshWorkQueueStats;
127
+ export declare function __replaceMeshQueueForTests(meshId: string, queue: MeshWorkQueueEntry[]): void;
128
+ export declare function __clearMeshQueueForTests(meshId: string): void;
129
+ export declare function __resetBeadsDBForTests(): void;
@@ -0,0 +1,176 @@
1
+ export declare const MESH_REFINE_VALIDATION_CATEGORIES: readonly ["typecheck", "test", "lint", "build"];
2
+ export type MeshRefineValidationCategory = typeof MESH_REFINE_VALIDATION_CATEGORIES[number];
3
+ export interface RepoMeshRefineValidationCommandConfig {
4
+ /** Executable name or a whitespace-tokenized command string. Never executed through a shell. */
5
+ command: string;
6
+ /** Optional explicit argv. Prefer this over shell-like command strings. */
7
+ args?: string[];
8
+ category?: MeshRefineValidationCategory;
9
+ cwd?: string;
10
+ timeoutMs?: number;
11
+ env?: Record<string, string>;
12
+ }
13
+ export interface RepoMeshRefineConfig {
14
+ version: 1;
15
+ /**
16
+ * Narrow Refinery opt-in for monorepos with submodule gitlinks.
17
+ * When true, Refinery may non-force publish unreachable submodule gitlink
18
+ * commits to the submodule remote main branch after validation and
19
+ * patch-equivalence pass, then verify remote-main reachability.
20
+ */
21
+ allowAutoPublishSubmoduleMainCommits?: boolean;
22
+ validation?: {
23
+ required?: boolean;
24
+ /**
25
+ * Optional dependency/bootstrap commands that Refinery runs before
26
+ * validation commands. Refinery never infers installs on its own.
27
+ */
28
+ bootstrapCommands?: RepoMeshRefineValidationCommandConfig[];
29
+ commands?: RepoMeshRefineValidationCommandConfig[];
30
+ };
31
+ }
32
+ export interface MeshRefineValidationCommandPlan {
33
+ command: string;
34
+ args: string[];
35
+ displayCommand: string;
36
+ category: MeshRefineValidationCategory | 'custom';
37
+ source: string;
38
+ cwd?: string;
39
+ timeoutMs?: number;
40
+ env?: Record<string, string>;
41
+ }
42
+ export interface MeshRefineConfigLoadResult {
43
+ config?: RepoMeshRefineConfig;
44
+ source: string;
45
+ sourceType: 'mesh_policy' | 'repo_file' | 'unavailable' | 'invalid';
46
+ path?: string;
47
+ error?: string;
48
+ }
49
+ export interface MeshRefineValidationPlan {
50
+ source: string;
51
+ sourceType: MeshRefineConfigLoadResult['sourceType'];
52
+ bootstrapCommands: MeshRefineValidationCommandPlan[];
53
+ commands: MeshRefineValidationCommandPlan[];
54
+ rejectedCommands: Array<Record<string, unknown>>;
55
+ suggestions: RepoMeshRefineValidationCommandConfig[];
56
+ suggestedConfig?: RepoMeshRefineConfig;
57
+ unavailableReason?: string;
58
+ }
59
+ export declare const MESH_REFINE_CONFIG_LOCATIONS: string[];
60
+ export declare const MESH_REFINE_CONFIG_SCHEMA: {
61
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
62
+ readonly title: "ADHDev Repo Mesh Refinery Config";
63
+ readonly type: "object";
64
+ readonly additionalProperties: false;
65
+ readonly required: readonly ["version"];
66
+ readonly properties: {
67
+ readonly version: {
68
+ readonly const: 1;
69
+ };
70
+ readonly allowAutoPublishSubmoduleMainCommits: {
71
+ readonly type: "boolean";
72
+ readonly default: false;
73
+ readonly description: "When true, Refinery may non-force publish submodule gitlink commits referenced by the refined root tree to each submodule origin/main after validation and patch-equivalence pass, then verify reachability.";
74
+ };
75
+ readonly validation: {
76
+ readonly type: "object";
77
+ readonly additionalProperties: false;
78
+ readonly properties: {
79
+ readonly required: {
80
+ readonly type: "boolean";
81
+ readonly default: true;
82
+ };
83
+ readonly commands: {
84
+ readonly type: "array";
85
+ readonly minItems: 1;
86
+ readonly maxItems: 8;
87
+ readonly items: {
88
+ readonly type: "object";
89
+ readonly additionalProperties: false;
90
+ readonly required: readonly ["command"];
91
+ readonly properties: {
92
+ readonly command: {
93
+ readonly type: "string";
94
+ readonly minLength: 1;
95
+ };
96
+ readonly args: {
97
+ readonly type: "array";
98
+ readonly items: {
99
+ readonly type: "string";
100
+ };
101
+ };
102
+ readonly category: {
103
+ readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
104
+ };
105
+ readonly cwd: {
106
+ readonly type: "string";
107
+ };
108
+ readonly timeoutMs: {
109
+ readonly type: "number";
110
+ readonly minimum: 1000;
111
+ readonly maximum: 600000;
112
+ };
113
+ readonly env: {
114
+ readonly type: "object";
115
+ readonly additionalProperties: {
116
+ readonly type: "string";
117
+ };
118
+ };
119
+ };
120
+ };
121
+ };
122
+ readonly bootstrapCommands: {
123
+ readonly type: "array";
124
+ readonly maxItems: 4;
125
+ readonly items: {
126
+ readonly type: "object";
127
+ readonly additionalProperties: false;
128
+ readonly required: readonly ["command"];
129
+ readonly properties: {
130
+ readonly command: {
131
+ readonly type: "string";
132
+ readonly minLength: 1;
133
+ };
134
+ readonly args: {
135
+ readonly type: "array";
136
+ readonly items: {
137
+ readonly type: "string";
138
+ };
139
+ };
140
+ readonly category: {
141
+ readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
142
+ };
143
+ readonly cwd: {
144
+ readonly type: "string";
145
+ };
146
+ readonly timeoutMs: {
147
+ readonly type: "number";
148
+ readonly minimum: 1000;
149
+ readonly maximum: 600000;
150
+ };
151
+ readonly env: {
152
+ readonly type: "object";
153
+ readonly additionalProperties: {
154
+ readonly type: "string";
155
+ };
156
+ };
157
+ };
158
+ };
159
+ };
160
+ };
161
+ };
162
+ };
163
+ };
164
+ export declare function validateMeshRefineConfig(config: unknown, source?: string): {
165
+ valid: boolean;
166
+ errors: string[];
167
+ bootstrapCommands: MeshRefineValidationCommandPlan[];
168
+ commands: MeshRefineValidationCommandPlan[];
169
+ rejectedCommands: Array<Record<string, unknown>>;
170
+ };
171
+ export declare function loadMeshRefineConfig(mesh: any, workspace: string): MeshRefineConfigLoadResult;
172
+ export declare function suggestMeshRefineConfig(mesh: any, workspace: string): {
173
+ suggestions: RepoMeshRefineValidationCommandConfig[];
174
+ suggestedConfig?: RepoMeshRefineConfig;
175
+ };
176
+ export declare function resolveMeshRefineValidationPlan(mesh: any, workspace: string): MeshRefineValidationPlan;
@@ -1,4 +1,5 @@
1
1
  import type { ChatMessage } from '../types.js';
2
+ export declare const DEFAULT_FINAL_SUMMARY_MAX_CHARS = 4000;
2
3
  export declare function extractFinalSummaryFromMessages(messages: ChatMessage[] | null | undefined, maxChars?: number): string;
3
4
  export declare const BUILTIN_CHAT_MESSAGE_KINDS: readonly ["standard", "thought", "tool", "terminal", "system"];
4
5
  export type BuiltinChatMessageKind = typeof BUILTIN_CHAT_MESSAGE_KINDS[number];
@@ -101,9 +101,10 @@ export declare class CliProviderInstance implements ProviderInstance {
101
101
  private completedDebouncePending;
102
102
  private enforceFreshSessionLaunchIfNeeded;
103
103
  private completionHasFinalAssistantMessage;
104
+ private buildCompletedFinalizationDiagnostic;
104
105
  private hasAdapterPendingResponse;
105
106
  private shouldSuppressStaleParsedBusyStatus;
106
- private getCompletedFinalizationBlockReason;
107
+ private getCompletedFinalizationBlock;
107
108
  private scheduleCompletedDebounceFlush;
108
109
  private flushCompletedDebounceIfFinalized;
109
110
  private maybeAutoApproveStatus;