@adhdev/daemon-core 0.9.82-rc.6 → 0.9.82-rc.61
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/boot/daemon-lifecycle.d.ts +2 -0
- package/dist/commands/router.d.ts +24 -0
- package/dist/config/mesh-config.d.ts +66 -1
- package/dist/git/git-commands.d.ts +1 -0
- package/dist/git/git-status.d.ts +5 -0
- package/dist/git/git-types.d.ts +10 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +3522 -593
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3496 -587
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-active-work.d.ts +48 -0
- package/dist/mesh/mesh-events.d.ts +17 -5
- package/dist/mesh/mesh-fast-forward.d.ts +39 -0
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-ledger.d.ts +38 -1
- package/dist/mesh/mesh-work-queue.d.ts +23 -5
- package/dist/mesh/refine-config.d.ts +119 -0
- package/dist/providers/chat-message-normalization.d.ts +1 -0
- package/dist/providers/cli-provider-instance.d.ts +1 -0
- package/dist/repo-mesh-types.d.ts +160 -0
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +4 -0
- package/src/cli-adapters/provider-cli-runtime.ts +3 -1
- package/src/commands/router.ts +2178 -419
- package/src/config/mesh-config.ts +244 -1
- package/src/git/git-commands.ts +3 -3
- package/src/git/git-status.ts +97 -6
- package/src/git/git-summary.ts +3 -0
- package/src/git/git-types.ts +11 -0
- package/src/index.ts +39 -5
- package/src/mesh/coordinator-prompt.ts +4 -2
- package/src/mesh/mesh-active-work.ts +205 -0
- package/src/mesh/mesh-events.ts +210 -38
- package/src/mesh/mesh-fast-forward.ts +430 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-ledger.ts +137 -0
- package/src/mesh/mesh-work-queue.ts +202 -122
- package/src/mesh/refine-config.ts +306 -0
- package/src/providers/chat-message-normalization.ts +3 -1
- package/src/providers/cli-provider-instance.ts +66 -1
- package/src/repo-mesh-types.ts +174 -0
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
24
|
+
export interface MeshActiveWorkSummary {
|
|
25
|
+
totalActiveCount: number;
|
|
26
|
+
queueActiveCount: number;
|
|
27
|
+
directActiveCount: number;
|
|
28
|
+
awaitingApprovalCount: number;
|
|
29
|
+
generatingCount: number;
|
|
30
|
+
failedCount: number;
|
|
31
|
+
idleCount: number;
|
|
32
|
+
sourceCounts: Record<MeshActiveWorkSource, number>;
|
|
33
|
+
statusCounts: Record<MeshActiveWorkStatus, number>;
|
|
34
|
+
}
|
|
35
|
+
export interface BuildMeshActiveWorkOptions {
|
|
36
|
+
meshId: string;
|
|
37
|
+
queue?: MeshWorkQueueEntry[];
|
|
38
|
+
ledgerEntries?: MeshLedgerEntry[];
|
|
39
|
+
nodes?: any[];
|
|
40
|
+
now?: number;
|
|
41
|
+
/** Include terminal direct rows (idle/failed) for handoff/recent-work surfaces. Defaults false. */
|
|
42
|
+
includeTerminalDirect?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function buildMeshActiveWorkSummary(activeWork: MeshActiveWorkRecord[]): MeshActiveWorkSummary;
|
|
45
|
+
export declare function buildMeshActiveWork(opts: BuildMeshActiveWorkOptions): {
|
|
46
|
+
activeWork: MeshActiveWorkRecord[];
|
|
47
|
+
summary: MeshActiveWorkSummary;
|
|
48
|
+
};
|
|
@@ -3,15 +3,18 @@ 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>;
|
|
7
9
|
queuedAt: number;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
12
|
+
/** Drain and return all pending coordinator events for meshId, removing them from disk. */
|
|
13
|
+
export declare function drainPendingMeshCoordinatorEvents(meshId?: string): PendingMeshCoordinatorEvent[];
|
|
11
14
|
/** 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;
|
|
15
|
+
export declare function getPendingMeshCoordinatorEvents(meshId?: string): readonly PendingMeshCoordinatorEvent[];
|
|
16
|
+
/** Explicitly clear all pending coordinator events for a mesh. */
|
|
17
|
+
export declare function clearPendingMeshCoordinatorEvents(meshId?: string): void;
|
|
15
18
|
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Triggers a queue check for all nodes in the mesh.
|
|
@@ -23,12 +26,21 @@ export declare function handleMeshForwardEvent(components: DaemonComponents, pay
|
|
|
23
26
|
forwarded: number;
|
|
24
27
|
suppressed: boolean;
|
|
25
28
|
intentionalCleanupStop: boolean;
|
|
29
|
+
duplicateCompletion?: undefined;
|
|
30
|
+
error?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
success: boolean;
|
|
33
|
+
forwarded: number;
|
|
34
|
+
suppressed: boolean;
|
|
35
|
+
duplicateCompletion: boolean;
|
|
36
|
+
intentionalCleanupStop?: undefined;
|
|
26
37
|
error?: undefined;
|
|
27
38
|
} | {
|
|
28
39
|
success: boolean;
|
|
29
40
|
forwarded: number;
|
|
30
41
|
suppressed?: undefined;
|
|
31
42
|
intentionalCleanupStop?: undefined;
|
|
43
|
+
duplicateCompletion?: undefined;
|
|
32
44
|
error?: undefined;
|
|
33
45
|
} | {
|
|
34
46
|
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,13 +49,17 @@ 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
|
-
|
|
61
|
+
taskMode?: MeshTaskMode | string;
|
|
62
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry;
|
|
47
63
|
/**
|
|
48
64
|
* Get all tasks in the queue, optionally filtered by status.
|
|
49
65
|
*/
|
|
@@ -58,14 +74,14 @@ export declare function claimNextTask(meshId: string, nodeId: string, sessionId:
|
|
|
58
74
|
* Update the status of a specific task.
|
|
59
75
|
* Used when a session completes, fails, or stalls.
|
|
60
76
|
*/
|
|
61
|
-
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
|
|
77
|
+
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
62
78
|
export declare function recordTaskAutoLaunch(meshId: string, taskId: string, autoLaunch: Omit<NonNullable<MeshWorkQueueEntry['autoLaunch']>, 'updatedAt'>): MeshWorkQueueEntry | null;
|
|
63
79
|
/**
|
|
64
80
|
* Mark a queue task as manually cancelled without deleting audit history.
|
|
65
81
|
*/
|
|
66
82
|
export declare function cancelTask(meshId: string, taskId: string, opts?: {
|
|
67
83
|
reason?: string;
|
|
68
|
-
}): MeshWorkQueueEntry | null;
|
|
84
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
69
85
|
/**
|
|
70
86
|
* Return a queue task to pending for retry. By default, dead session targeting
|
|
71
87
|
* and assigned ownership are cleared so stale assignments do not strand again.
|
|
@@ -76,11 +92,13 @@ export declare function requeueTask(meshId: string, taskId: string, opts?: {
|
|
|
76
92
|
targetSessionId?: string;
|
|
77
93
|
clearTargetNode?: boolean;
|
|
78
94
|
clearTargetSession?: boolean;
|
|
79
|
-
}): MeshWorkQueueEntry | null;
|
|
95
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
80
96
|
/**
|
|
81
97
|
* Update the status of the task currently assigned to a specific session.
|
|
82
98
|
*/
|
|
83
|
-
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus
|
|
99
|
+
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus, opts?: {
|
|
100
|
+
occurredAt?: string;
|
|
101
|
+
}): MeshWorkQueueEntry | null;
|
|
84
102
|
export interface MeshWorkQueueStats {
|
|
85
103
|
total: number;
|
|
86
104
|
active: number;
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
validation?: {
|
|
16
|
+
required?: boolean;
|
|
17
|
+
commands?: RepoMeshRefineValidationCommandConfig[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface MeshRefineValidationCommandPlan {
|
|
21
|
+
command: string;
|
|
22
|
+
args: string[];
|
|
23
|
+
displayCommand: string;
|
|
24
|
+
category: MeshRefineValidationCategory | 'custom';
|
|
25
|
+
source: string;
|
|
26
|
+
cwd?: string;
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export interface MeshRefineConfigLoadResult {
|
|
31
|
+
config?: RepoMeshRefineConfig;
|
|
32
|
+
source: string;
|
|
33
|
+
sourceType: 'mesh_policy' | 'repo_file' | 'unavailable' | 'invalid';
|
|
34
|
+
path?: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface MeshRefineValidationPlan {
|
|
38
|
+
source: string;
|
|
39
|
+
sourceType: MeshRefineConfigLoadResult['sourceType'];
|
|
40
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
41
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
42
|
+
suggestions: RepoMeshRefineValidationCommandConfig[];
|
|
43
|
+
suggestedConfig?: RepoMeshRefineConfig;
|
|
44
|
+
unavailableReason?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare const MESH_REFINE_CONFIG_LOCATIONS: string[];
|
|
47
|
+
export declare const MESH_REFINE_CONFIG_SCHEMA: {
|
|
48
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
49
|
+
readonly title: "ADHDev Repo Mesh Refinery Config";
|
|
50
|
+
readonly type: "object";
|
|
51
|
+
readonly additionalProperties: false;
|
|
52
|
+
readonly required: readonly ["version"];
|
|
53
|
+
readonly properties: {
|
|
54
|
+
readonly version: {
|
|
55
|
+
readonly const: 1;
|
|
56
|
+
};
|
|
57
|
+
readonly validation: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly additionalProperties: false;
|
|
60
|
+
readonly properties: {
|
|
61
|
+
readonly required: {
|
|
62
|
+
readonly type: "boolean";
|
|
63
|
+
readonly default: true;
|
|
64
|
+
};
|
|
65
|
+
readonly commands: {
|
|
66
|
+
readonly type: "array";
|
|
67
|
+
readonly minItems: 1;
|
|
68
|
+
readonly maxItems: 8;
|
|
69
|
+
readonly items: {
|
|
70
|
+
readonly type: "object";
|
|
71
|
+
readonly additionalProperties: false;
|
|
72
|
+
readonly required: readonly ["command"];
|
|
73
|
+
readonly properties: {
|
|
74
|
+
readonly command: {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
readonly minLength: 1;
|
|
77
|
+
};
|
|
78
|
+
readonly args: {
|
|
79
|
+
readonly type: "array";
|
|
80
|
+
readonly items: {
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly category: {
|
|
85
|
+
readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
|
|
86
|
+
};
|
|
87
|
+
readonly cwd: {
|
|
88
|
+
readonly type: "string";
|
|
89
|
+
};
|
|
90
|
+
readonly timeoutMs: {
|
|
91
|
+
readonly type: "number";
|
|
92
|
+
readonly minimum: 1000;
|
|
93
|
+
readonly maximum: 600000;
|
|
94
|
+
};
|
|
95
|
+
readonly env: {
|
|
96
|
+
readonly type: "object";
|
|
97
|
+
readonly additionalProperties: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare function validateMeshRefineConfig(config: unknown, source?: string): {
|
|
109
|
+
valid: boolean;
|
|
110
|
+
errors: string[];
|
|
111
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
112
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
113
|
+
};
|
|
114
|
+
export declare function loadMeshRefineConfig(mesh: any, workspace: string): MeshRefineConfigLoadResult;
|
|
115
|
+
export declare function suggestMeshRefineConfig(mesh: any, workspace: string): {
|
|
116
|
+
suggestions: RepoMeshRefineValidationCommandConfig[];
|
|
117
|
+
suggestedConfig?: RepoMeshRefineConfig;
|
|
118
|
+
};
|
|
119
|
+
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,6 +101,7 @@ 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
107
|
private getCompletedFinalizationBlockReason;
|
|
@@ -19,10 +19,37 @@ export interface RepoMesh {
|
|
|
19
19
|
defaultBranch?: string;
|
|
20
20
|
policy: RepoMeshPolicy;
|
|
21
21
|
coordinator: RepoMeshCoordinatorConfig;
|
|
22
|
+
meshHost?: RepoMeshHostMetadata;
|
|
22
23
|
projectContext: ProjectContextSnapshot;
|
|
23
24
|
nodes: RepoMeshNode[];
|
|
24
25
|
status: 'active' | 'archived' | 'deleted';
|
|
25
26
|
}
|
|
27
|
+
export type RepoMeshDaemonRole = 'host' | 'member';
|
|
28
|
+
export interface RepoMeshHostPairingMetadata {
|
|
29
|
+
status: 'not_configured' | 'pairing' | 'paired' | 'rejected' | 'revoked';
|
|
30
|
+
tokenId?: string;
|
|
31
|
+
joinedAt?: string;
|
|
32
|
+
lastPairedAt?: string;
|
|
33
|
+
lastRejectedAt?: string;
|
|
34
|
+
expiresAt?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface RepoMeshHostMetadata {
|
|
37
|
+
/** Local daemon role for this mesh. Missing metadata defaults to host for standalone compatibility. */
|
|
38
|
+
role: RepoMeshDaemonRole;
|
|
39
|
+
/** Daemon that owns mesh truth/status/git/queue/session/ledger/coordinator ownership. */
|
|
40
|
+
hostDaemonId?: string;
|
|
41
|
+
/** Mesh node that represents the host daemon, when known. */
|
|
42
|
+
hostNodeId?: string;
|
|
43
|
+
/** Future standalone manual pairing endpoint entered by member daemons. */
|
|
44
|
+
hostAddress?: string;
|
|
45
|
+
/** Redacted pairing state only; raw join tokens must not be persisted here. */
|
|
46
|
+
pairing?: RepoMeshHostPairingMetadata;
|
|
47
|
+
}
|
|
48
|
+
export interface RepoMeshHostStatus extends RepoMeshHostMetadata {
|
|
49
|
+
canOwnCoordinator: boolean;
|
|
50
|
+
canOwnQueue: boolean;
|
|
51
|
+
defaulted: boolean;
|
|
52
|
+
}
|
|
26
53
|
export interface RepoMeshNode {
|
|
27
54
|
id: string;
|
|
28
55
|
daemonId: string;
|
|
@@ -37,6 +64,7 @@ export interface RepoMeshNode {
|
|
|
37
64
|
effectiveCapabilities: RepoMeshNodeCapabilities;
|
|
38
65
|
policy: RepoMeshNodePolicy;
|
|
39
66
|
health: RepoMeshNodeHealth;
|
|
67
|
+
role?: RepoMeshDaemonRole;
|
|
40
68
|
status: 'enabled' | 'disabled' | 'removed';
|
|
41
69
|
}
|
|
42
70
|
export type RepoMeshNodeHealth = 'online' | 'offline' | 'degraded' | 'dirty' | 'wrong_branch' | 'unknown';
|
|
@@ -185,6 +213,7 @@ export interface LocalMeshEntry {
|
|
|
185
213
|
defaultBranch?: string;
|
|
186
214
|
policy: RepoMeshPolicy;
|
|
187
215
|
coordinator: RepoMeshCoordinatorConfig;
|
|
216
|
+
meshHost?: RepoMeshHostMetadata;
|
|
188
217
|
nodes: LocalMeshNodeEntry[];
|
|
189
218
|
createdAt: string;
|
|
190
219
|
updatedAt: string;
|
|
@@ -206,21 +235,152 @@ export interface LocalMeshNodeEntry {
|
|
|
206
235
|
clonedFromNodeId?: string;
|
|
207
236
|
/** Optional associated/external repos configured as node metadata. */
|
|
208
237
|
relatedRepos?: RepoMeshRelatedRepo[];
|
|
238
|
+
role?: RepoMeshDaemonRole;
|
|
209
239
|
}
|
|
210
240
|
export interface RepoMeshStatus {
|
|
211
241
|
meshId: string;
|
|
212
242
|
meshName: string;
|
|
213
243
|
repoIdentity: string;
|
|
244
|
+
defaultBranch?: string;
|
|
214
245
|
refreshedAt: string;
|
|
246
|
+
meshHost?: RepoMeshHostStatus;
|
|
215
247
|
nodes: RepoMeshNodeStatus[];
|
|
248
|
+
queue?: RepoMeshQueueStatus;
|
|
249
|
+
ledger?: RepoMeshLedgerStatus;
|
|
250
|
+
}
|
|
251
|
+
export interface RepoMeshSessionStatus {
|
|
252
|
+
sessionId: string;
|
|
253
|
+
providerType?: string;
|
|
254
|
+
state?: string;
|
|
255
|
+
lifecycle?: 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'interrupted';
|
|
256
|
+
surfaceKind?: 'live_runtime' | 'recovery_snapshot' | 'inactive_record';
|
|
257
|
+
recoveryState?: string | null;
|
|
258
|
+
workspace?: string | null;
|
|
259
|
+
title?: string | null;
|
|
260
|
+
lastActivityAt?: string | null;
|
|
261
|
+
isCached?: boolean;
|
|
262
|
+
}
|
|
263
|
+
export type RepoMeshPeerConnectionState = 'self' | 'connected' | 'connecting' | 'disconnected' | 'failed' | 'closed' | 'unknown';
|
|
264
|
+
export type RepoMeshPeerConnectionTransport = 'local' | 'direct' | 'relay' | 'unknown';
|
|
265
|
+
export interface RepoMeshPeerConnectionStatus {
|
|
266
|
+
perspective: 'selected_coordinator';
|
|
267
|
+
source: 'mesh_peer_status' | 'not_reported';
|
|
268
|
+
state: RepoMeshPeerConnectionState;
|
|
269
|
+
transport: RepoMeshPeerConnectionTransport;
|
|
270
|
+
reported: boolean;
|
|
271
|
+
reason?: string;
|
|
272
|
+
lastStateChangeAt?: string;
|
|
273
|
+
lastConnectedAt?: string;
|
|
274
|
+
lastCommandAt?: string;
|
|
216
275
|
}
|
|
217
276
|
export interface RepoMeshNodeStatus {
|
|
218
277
|
nodeId: string;
|
|
219
278
|
machineLabel: string;
|
|
220
279
|
workspace: string;
|
|
280
|
+
repoRoot?: string;
|
|
281
|
+
daemonId?: string;
|
|
282
|
+
machineId?: string;
|
|
283
|
+
role?: RepoMeshDaemonRole;
|
|
284
|
+
machineStatus?: string;
|
|
285
|
+
isLocalWorktree?: boolean;
|
|
286
|
+
worktreeBranch?: string;
|
|
221
287
|
health: RepoMeshNodeHealth;
|
|
222
288
|
git?: GitRepoStatus;
|
|
289
|
+
/**
|
|
290
|
+
* True when the selected coordinator has evidence that a peer git probe is still
|
|
291
|
+
* in flight or just timed out during initial mesh handshake, so callers should
|
|
292
|
+
* treat missing git data as pending instead of authoritative absence.
|
|
293
|
+
*/
|
|
294
|
+
gitProbePending?: boolean;
|
|
223
295
|
providers: string[];
|
|
224
296
|
activeSessions: string[];
|
|
297
|
+
activeSessionDetails?: RepoMeshSessionStatus[];
|
|
298
|
+
providerPriority?: string[];
|
|
299
|
+
launchReady?: boolean;
|
|
300
|
+
lastSeenAt?: string;
|
|
301
|
+
updatedAt?: string;
|
|
302
|
+
connection?: RepoMeshPeerConnectionStatus;
|
|
225
303
|
error?: string;
|
|
226
304
|
}
|
|
305
|
+
export type RepoMeshQueueTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
306
|
+
export interface RepoMeshQueueTask {
|
|
307
|
+
id: string;
|
|
308
|
+
meshId: string;
|
|
309
|
+
message: string;
|
|
310
|
+
status: RepoMeshQueueTaskStatus;
|
|
311
|
+
targetNodeId?: string;
|
|
312
|
+
targetSessionId?: string;
|
|
313
|
+
assignedNodeId?: string;
|
|
314
|
+
assignedSessionId?: string;
|
|
315
|
+
cancelReason?: string;
|
|
316
|
+
cancelledAt?: string;
|
|
317
|
+
requeueReason?: string;
|
|
318
|
+
requeuedAt?: string;
|
|
319
|
+
requeueCount?: number;
|
|
320
|
+
autoLaunch?: {
|
|
321
|
+
status: 'skipped' | 'started' | 'failed' | 'completed';
|
|
322
|
+
reason?: string;
|
|
323
|
+
nodeId?: string;
|
|
324
|
+
providerType?: string;
|
|
325
|
+
sessionId?: string;
|
|
326
|
+
updatedAt: string;
|
|
327
|
+
};
|
|
328
|
+
dispatchTimestamp?: string;
|
|
329
|
+
createdAt: string;
|
|
330
|
+
updatedAt: string;
|
|
331
|
+
}
|
|
332
|
+
export interface RepoMeshQueueSummary {
|
|
333
|
+
total: number;
|
|
334
|
+
active: number;
|
|
335
|
+
historical: number;
|
|
336
|
+
pending: number;
|
|
337
|
+
assigned: number;
|
|
338
|
+
completed: number;
|
|
339
|
+
failed: number;
|
|
340
|
+
cancelled: number;
|
|
341
|
+
activeCounts: {
|
|
342
|
+
pending: number;
|
|
343
|
+
assigned: number;
|
|
344
|
+
};
|
|
345
|
+
historicalCounts: {
|
|
346
|
+
completed: number;
|
|
347
|
+
failed: number;
|
|
348
|
+
cancelled: number;
|
|
349
|
+
};
|
|
350
|
+
activeAssignments: Array<{
|
|
351
|
+
id: string;
|
|
352
|
+
nodeId?: string;
|
|
353
|
+
sessionId?: string;
|
|
354
|
+
message: string;
|
|
355
|
+
}>;
|
|
356
|
+
}
|
|
357
|
+
export interface RepoMeshQueueStatus {
|
|
358
|
+
tasks: RepoMeshQueueTask[];
|
|
359
|
+
summary: RepoMeshQueueSummary;
|
|
360
|
+
}
|
|
361
|
+
export interface RepoMeshLedgerEntryStatus {
|
|
362
|
+
id: string;
|
|
363
|
+
meshId: string;
|
|
364
|
+
timestamp: string;
|
|
365
|
+
kind: string;
|
|
366
|
+
nodeId?: string;
|
|
367
|
+
sessionId?: string;
|
|
368
|
+
providerType?: string;
|
|
369
|
+
payload: Record<string, unknown>;
|
|
370
|
+
}
|
|
371
|
+
export interface RepoMeshLedgerSummaryStatus {
|
|
372
|
+
meshId: string;
|
|
373
|
+
totalEntries: number;
|
|
374
|
+
taskDispatched: number;
|
|
375
|
+
taskCompleted: number;
|
|
376
|
+
taskFailed: number;
|
|
377
|
+
taskStalled: number;
|
|
378
|
+
sessionLaunched: number;
|
|
379
|
+
checkpointCreated: number;
|
|
380
|
+
lastActivityAt: string | null;
|
|
381
|
+
recentFailures: number;
|
|
382
|
+
}
|
|
383
|
+
export interface RepoMeshLedgerStatus {
|
|
384
|
+
entries: RepoMeshLedgerEntryStatus[];
|
|
385
|
+
summary: RepoMeshLedgerSummaryStatus;
|
|
386
|
+
}
|
package/package.json
CHANGED
|
@@ -86,6 +86,8 @@ export interface DaemonInitConfig {
|
|
|
86
86
|
|
|
87
87
|
/** Relays a command to a remote mesh node daemon */
|
|
88
88
|
dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
|
|
89
|
+
/** Returns selected-coordinator mesh peer telemetry for a target daemon when available. */
|
|
90
|
+
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
// ─── Result ───
|
|
@@ -306,6 +308,8 @@ export async function initDaemonComponents(config: DaemonInitConfig): Promise<Da
|
|
|
306
308
|
sessionHostControl: config.sessionHostControl,
|
|
307
309
|
statusInstanceId: config.statusInstanceId,
|
|
308
310
|
statusVersion: config.statusVersion,
|
|
311
|
+
getMeshPeerConnectionStatus: config.getMeshPeerConnectionStatus,
|
|
312
|
+
dispatchMeshCommand: config.dispatchMeshCommand,
|
|
309
313
|
getCdpLogFn: config.getCdpLogFn || ((ideType: string) => LOG.forComponent(`CDP:${ideType}`).asLogFn()),
|
|
310
314
|
});
|
|
311
315
|
|
|
@@ -36,7 +36,9 @@ export function resolveCliSpawnPlan(options: {
|
|
|
36
36
|
: spawnConfig.command;
|
|
37
37
|
const binaryPath = findBinary(configuredCommand);
|
|
38
38
|
const isWin = os.platform() === 'win32';
|
|
39
|
-
const allArgs = [...spawnConfig.args, ...extraArgs]
|
|
39
|
+
const allArgs = [...spawnConfig.args, ...extraArgs].map((arg) =>
|
|
40
|
+
typeof arg === 'string' ? arg.replace(/\{\{workingDir\}\}/g, workingDir) : arg,
|
|
41
|
+
);
|
|
40
42
|
|
|
41
43
|
let shellCmd: string;
|
|
42
44
|
let shellArgs: string[];
|