@adhdev/daemon-core 0.9.82-rc.114 → 0.9.82-rc.116
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/config/mesh-config.d.ts +2 -0
- package/dist/git/git-commands.d.ts +5 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +981 -264
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +965 -255
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-active-work.d.ts +13 -0
- package/dist/mesh/mesh-refine-status.d.ts +27 -0
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +17 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +115 -0
- package/dist/repo-mesh-types.d.ts +17 -0
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +29 -2
- package/src/commands/router.ts +341 -5
- package/src/config/mesh-config.ts +4 -1
- package/src/git/git-commands.ts +17 -5
- package/src/index.ts +13 -2
- package/src/mesh/mesh-active-work.ts +37 -0
- package/src/mesh/mesh-refine-status.ts +145 -0
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +17 -7
- package/src/mesh/worktree-bootstrap-config.ts +234 -0
- package/src/repo-mesh-types.ts +17 -0
|
@@ -41,6 +41,14 @@ export interface MeshActiveWorkSummary {
|
|
|
41
41
|
*/
|
|
42
42
|
staleDirectNote?: string;
|
|
43
43
|
}
|
|
44
|
+
export interface MeshStaleDirectWorkSummary {
|
|
45
|
+
count: number;
|
|
46
|
+
sampleLimit: number;
|
|
47
|
+
sample: Array<Pick<MeshActiveWorkRecord, 'taskId' | 'status' | 'nodeId' | 'sessionId' | 'taskTitle' | 'createdAt' | 'staleReason'>>;
|
|
48
|
+
reasonCounts: Record<string, number>;
|
|
49
|
+
detailHint: string;
|
|
50
|
+
note?: string;
|
|
51
|
+
}
|
|
44
52
|
export interface BuildMeshActiveWorkOptions {
|
|
45
53
|
meshId: string;
|
|
46
54
|
queue?: MeshWorkQueueEntry[];
|
|
@@ -58,3 +66,8 @@ export declare function buildMeshActiveWork(opts: BuildMeshActiveWorkOptions): {
|
|
|
58
66
|
terminalDirectWork: MeshActiveWorkRecord[];
|
|
59
67
|
summary: MeshActiveWorkSummary;
|
|
60
68
|
};
|
|
69
|
+
export declare function buildCompactStaleDirectWorkSummary(staleDirectWork: MeshActiveWorkRecord[], opts?: {
|
|
70
|
+
sampleLimit?: number;
|
|
71
|
+
detailHint?: string;
|
|
72
|
+
note?: string;
|
|
73
|
+
}): MeshStaleDirectWorkSummary;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MeshLedgerEntry } from './mesh-ledger.js';
|
|
2
|
+
import type { PendingMeshCoordinatorEvent } from './mesh-events.js';
|
|
3
|
+
export type MeshAsyncRefineJobStatus = 'accepted' | 'running' | 'completed' | 'failed';
|
|
4
|
+
export interface MeshAsyncRefineJobSummary {
|
|
5
|
+
jobId: string;
|
|
6
|
+
interactionId?: string;
|
|
7
|
+
status: MeshAsyncRefineJobStatus;
|
|
8
|
+
meshId?: string;
|
|
9
|
+
nodeId?: string;
|
|
10
|
+
targetNodeId?: string;
|
|
11
|
+
targetDaemonId?: string;
|
|
12
|
+
workspace?: string;
|
|
13
|
+
branch?: string;
|
|
14
|
+
into?: string;
|
|
15
|
+
startedAt?: string;
|
|
16
|
+
completedAt?: string;
|
|
17
|
+
retryOfJobId?: string;
|
|
18
|
+
lastEvent?: string;
|
|
19
|
+
lastLedgerKind?: string;
|
|
20
|
+
lastUpdatedAt?: string;
|
|
21
|
+
instruction: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildMeshAsyncRefineJobs(args: {
|
|
24
|
+
meshId?: string;
|
|
25
|
+
ledgerEntries?: MeshLedgerEntry[];
|
|
26
|
+
pendingEvents?: PendingMeshCoordinatorEvent[];
|
|
27
|
+
}): MeshAsyncRefineJobSummary[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PreviewFreshnessStatus = 'fresh' | 'stale' | 'unknown' | 'not_configured';
|
|
2
|
+
export interface PreviewFreshness {
|
|
3
|
+
status: PreviewFreshnessStatus;
|
|
4
|
+
lastPreviewCommit: string | null;
|
|
5
|
+
currentMainCommit: string | null;
|
|
6
|
+
currentMainCommitSource: 'origin/main' | 'HEAD' | 'unknown';
|
|
7
|
+
recordPath: string;
|
|
8
|
+
lastDeployedAt?: string;
|
|
9
|
+
lastTarget?: string;
|
|
10
|
+
previewVersion?: string;
|
|
11
|
+
targets: Record<'npm' | 'server' | 'web', {
|
|
12
|
+
commit: string | null;
|
|
13
|
+
deployedAt?: string;
|
|
14
|
+
status: PreviewFreshnessStatus;
|
|
15
|
+
}>;
|
|
16
|
+
nextAction: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildPreviewFreshness(repoRoot: string): PreviewFreshness;
|
|
@@ -8,6 +8,7 @@ export interface RepoMeshRefineValidationCommandConfig {
|
|
|
8
8
|
category?: MeshRefineValidationCategory;
|
|
9
9
|
cwd?: string;
|
|
10
10
|
timeoutMs?: number;
|
|
11
|
+
outputLimitBytes?: number;
|
|
11
12
|
env?: Record<string, string>;
|
|
12
13
|
}
|
|
13
14
|
export interface RepoMeshRefineConfig {
|
|
@@ -37,6 +38,7 @@ export interface MeshRefineValidationCommandPlan {
|
|
|
37
38
|
source: string;
|
|
38
39
|
cwd?: string;
|
|
39
40
|
timeoutMs?: number;
|
|
41
|
+
outputLimitBytes?: number;
|
|
40
42
|
env?: Record<string, string>;
|
|
41
43
|
}
|
|
42
44
|
export interface MeshRefineConfigLoadResult {
|
|
@@ -110,6 +112,11 @@ export declare const MESH_REFINE_CONFIG_SCHEMA: {
|
|
|
110
112
|
readonly minimum: 1000;
|
|
111
113
|
readonly maximum: 600000;
|
|
112
114
|
};
|
|
115
|
+
readonly outputLimitBytes: {
|
|
116
|
+
readonly type: "number";
|
|
117
|
+
readonly minimum: 1024;
|
|
118
|
+
readonly maximum: 1048576;
|
|
119
|
+
};
|
|
113
120
|
readonly env: {
|
|
114
121
|
readonly type: "object";
|
|
115
122
|
readonly additionalProperties: {
|
|
@@ -148,6 +155,11 @@ export declare const MESH_REFINE_CONFIG_SCHEMA: {
|
|
|
148
155
|
readonly minimum: 1000;
|
|
149
156
|
readonly maximum: 600000;
|
|
150
157
|
};
|
|
158
|
+
readonly outputLimitBytes: {
|
|
159
|
+
readonly type: "number";
|
|
160
|
+
readonly minimum: 1024;
|
|
161
|
+
readonly maximum: 1048576;
|
|
162
|
+
};
|
|
151
163
|
readonly env: {
|
|
152
164
|
readonly type: "object";
|
|
153
165
|
readonly additionalProperties: {
|
|
@@ -161,6 +173,11 @@ export declare const MESH_REFINE_CONFIG_SCHEMA: {
|
|
|
161
173
|
};
|
|
162
174
|
};
|
|
163
175
|
};
|
|
176
|
+
export declare function isMeshConfigRecord(value: unknown): value is Record<string, unknown>;
|
|
177
|
+
export declare function normalizeMeshCommandConfig(entry: unknown, source: string): {
|
|
178
|
+
command?: MeshRefineValidationCommandPlan;
|
|
179
|
+
rejected?: Record<string, unknown>;
|
|
180
|
+
};
|
|
164
181
|
export declare function validateMeshRefineConfig(config: unknown, source?: string): {
|
|
165
182
|
valid: boolean;
|
|
166
183
|
errors: string[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { type MeshRefineValidationCommandPlan, type RepoMeshRefineValidationCommandConfig } from './refine-config.js';
|
|
2
|
+
export type WorktreeBootstrapStatus = 'ready' | 'running' | 'failed' | 'not_configured' | 'disabled' | 'stale';
|
|
3
|
+
export interface RepoMeshWorktreeBootstrapConfig {
|
|
4
|
+
version: 1;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
runOnClone?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
commands?: RepoMeshRefineValidationCommandConfig[];
|
|
9
|
+
staleInputs?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface WorktreeBootstrapState {
|
|
12
|
+
status: WorktreeBootstrapStatus;
|
|
13
|
+
required: boolean;
|
|
14
|
+
configSource?: string;
|
|
15
|
+
configSourceType?: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
|
|
16
|
+
startedAt?: string;
|
|
17
|
+
completedAt?: string;
|
|
18
|
+
lastCommand?: string;
|
|
19
|
+
exitCode?: number | null;
|
|
20
|
+
error?: string;
|
|
21
|
+
commandsRun?: Array<Record<string, unknown>>;
|
|
22
|
+
staleInputs?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface WorktreeBootstrapConfigLoadResult {
|
|
25
|
+
config?: RepoMeshWorktreeBootstrapConfig;
|
|
26
|
+
source: string;
|
|
27
|
+
sourceType: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
|
|
28
|
+
path?: string;
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS: string[];
|
|
32
|
+
export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA: {
|
|
33
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
34
|
+
readonly title: "ADHDev Repo Mesh Worktree Bootstrap Config";
|
|
35
|
+
readonly type: "object";
|
|
36
|
+
readonly additionalProperties: false;
|
|
37
|
+
readonly required: readonly ["version"];
|
|
38
|
+
readonly properties: {
|
|
39
|
+
readonly version: {
|
|
40
|
+
readonly const: 1;
|
|
41
|
+
};
|
|
42
|
+
readonly enabled: {
|
|
43
|
+
readonly type: "boolean";
|
|
44
|
+
readonly default: true;
|
|
45
|
+
};
|
|
46
|
+
readonly runOnClone: {
|
|
47
|
+
readonly type: "boolean";
|
|
48
|
+
readonly default: true;
|
|
49
|
+
};
|
|
50
|
+
readonly required: {
|
|
51
|
+
readonly type: "boolean";
|
|
52
|
+
readonly default: true;
|
|
53
|
+
};
|
|
54
|
+
readonly staleInputs: {
|
|
55
|
+
readonly type: "array";
|
|
56
|
+
readonly maxItems: 16;
|
|
57
|
+
readonly items: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly minLength: 1;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly commands: {
|
|
63
|
+
readonly type: "array";
|
|
64
|
+
readonly minItems: 1;
|
|
65
|
+
readonly maxItems: 4;
|
|
66
|
+
readonly items: {
|
|
67
|
+
readonly type: "object";
|
|
68
|
+
readonly additionalProperties: false;
|
|
69
|
+
readonly required: readonly ["command"];
|
|
70
|
+
readonly properties: {
|
|
71
|
+
readonly command: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly minLength: 1;
|
|
74
|
+
};
|
|
75
|
+
readonly args: {
|
|
76
|
+
readonly type: "array";
|
|
77
|
+
readonly items: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly category: {
|
|
82
|
+
readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
|
|
83
|
+
};
|
|
84
|
+
readonly cwd: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
};
|
|
87
|
+
readonly timeoutMs: {
|
|
88
|
+
readonly type: "number";
|
|
89
|
+
readonly minimum: 1000;
|
|
90
|
+
readonly maximum: 600000;
|
|
91
|
+
};
|
|
92
|
+
readonly outputLimitBytes: {
|
|
93
|
+
readonly type: "number";
|
|
94
|
+
readonly minimum: 1024;
|
|
95
|
+
readonly maximum: 1048576;
|
|
96
|
+
};
|
|
97
|
+
readonly env: {
|
|
98
|
+
readonly type: "object";
|
|
99
|
+
readonly additionalProperties: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
export declare function validateMeshWorktreeBootstrapConfig(config: unknown, source?: string): {
|
|
109
|
+
valid: boolean;
|
|
110
|
+
errors: string[];
|
|
111
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
112
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
113
|
+
};
|
|
114
|
+
export declare function loadMeshWorktreeBootstrapConfig(mesh: any, workspace: string): WorktreeBootstrapConfigLoadResult;
|
|
115
|
+
export declare function runMeshWorktreeBootstrap(mesh: any, workspace: string): Promise<WorktreeBootstrapState>;
|
|
@@ -240,6 +240,20 @@ export interface LocalMeshNodeEntry {
|
|
|
240
240
|
worktreeBranch?: string;
|
|
241
241
|
/** Node ID this worktree was cloned from */
|
|
242
242
|
clonedFromNodeId?: string;
|
|
243
|
+
/** Repo-local preparation result for ADHDev-created worktree nodes. */
|
|
244
|
+
worktreeBootstrap?: {
|
|
245
|
+
status: 'ready' | 'running' | 'failed' | 'not_configured' | 'disabled' | 'stale';
|
|
246
|
+
required?: boolean;
|
|
247
|
+
configSource?: string;
|
|
248
|
+
configSourceType?: string;
|
|
249
|
+
startedAt?: string;
|
|
250
|
+
completedAt?: string;
|
|
251
|
+
lastCommand?: string;
|
|
252
|
+
exitCode?: number | null;
|
|
253
|
+
error?: string;
|
|
254
|
+
commandsRun?: Array<Record<string, unknown>>;
|
|
255
|
+
staleInputs?: string[];
|
|
256
|
+
};
|
|
243
257
|
/** Optional associated/external repos configured as node metadata. */
|
|
244
258
|
relatedRepos?: RepoMeshRelatedRepo[];
|
|
245
259
|
role?: RepoMeshDaemonRole;
|
|
@@ -304,6 +318,9 @@ export interface RepoMeshNodeStatus {
|
|
|
304
318
|
activeSessionDetails?: RepoMeshSessionStatus[];
|
|
305
319
|
providerPriority?: string[];
|
|
306
320
|
launchReady?: boolean;
|
|
321
|
+
worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
|
|
322
|
+
launchBlockedReason?: string;
|
|
323
|
+
launchBlockedMessage?: string;
|
|
307
324
|
lastSeenAt?: string;
|
|
308
325
|
updatedAt?: string;
|
|
309
326
|
connection?: RepoMeshPeerConnectionStatus;
|
package/package.json
CHANGED
|
@@ -455,18 +455,45 @@ function hasSafeNativeHistoryMapping(args: {
|
|
|
455
455
|
ptyMessages?: ChatMessage[];
|
|
456
456
|
requireWorkspaceContentOverlap?: boolean;
|
|
457
457
|
}): boolean {
|
|
458
|
+
const isCoordinatorTranscript = args.nativeMessages.some((m: any) => {
|
|
459
|
+
const text = typeof m?.content === 'string' ? m.content : JSON.stringify(m?.content || '');
|
|
460
|
+
return text.includes('mesh_send_task') || text.includes('mesh_status') || text.includes('mesh_read_chat') || text.includes('mesh_launch_session');
|
|
461
|
+
});
|
|
462
|
+
|
|
458
463
|
const explicitSessionId = String(args.historySessionId || args.providerSessionId || '').trim();
|
|
459
464
|
if (explicitSessionId) {
|
|
460
465
|
const messageSessionIds = args.nativeMessages
|
|
461
466
|
.map((message: any) => typeof message?.historySessionId === 'string' ? message.historySessionId.trim() : '')
|
|
462
467
|
.filter(Boolean);
|
|
463
|
-
if (messageSessionIds.length
|
|
464
|
-
|
|
468
|
+
if (messageSessionIds.length > 0) {
|
|
469
|
+
return messageSessionIds.some((id) => id === explicitSessionId);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (isCoordinatorTranscript && args.ptyMessages && args.ptyMessages.length > 0) {
|
|
473
|
+
const ptyHasCoordinator = args.ptyMessages.some((m: any) => {
|
|
474
|
+
const text = typeof m?.content === 'string' ? m.content : JSON.stringify(m?.content || '');
|
|
475
|
+
return text.includes('mesh_send_task') || text.includes('mesh_status') || text.includes('mesh_read_chat');
|
|
476
|
+
});
|
|
477
|
+
if (!ptyHasCoordinator) {
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
465
481
|
}
|
|
466
482
|
const workspace = String(args.workspace || '').trim();
|
|
467
483
|
if (!workspace) return false;
|
|
468
484
|
const workspaceMatches = args.nativeMessages.some((message: any) => String(message?.workspace || '').trim() === workspace);
|
|
469
485
|
if (!workspaceMatches) return false;
|
|
486
|
+
|
|
487
|
+
if (isCoordinatorTranscript && args.ptyMessages && args.ptyMessages.length > 0) {
|
|
488
|
+
const ptyHasCoordinator = args.ptyMessages.some((m: any) => {
|
|
489
|
+
const text = typeof m?.content === 'string' ? m.content : JSON.stringify(m?.content || '');
|
|
490
|
+
return text.includes('mesh_send_task') || text.includes('mesh_status') || text.includes('mesh_read_chat');
|
|
491
|
+
});
|
|
492
|
+
if (!ptyHasCoordinator) {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
470
497
|
if (!args.requireWorkspaceContentOverlap) return true;
|
|
471
498
|
return hasOverlappingVisibleConversationText(args.nativeMessages, args.ptyMessages || []);
|
|
472
499
|
}
|