@adhdev/daemon-core 0.9.77-rc.5 → 0.9.77-rc.50
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 +3 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +14 -4
- package/dist/commands/mesh-coordinator.d.ts +10 -0
- package/dist/commands/router.d.ts +4 -1
- package/dist/config/mesh-config.d.ts +1 -0
- package/dist/git/git-worktree.d.ts +15 -2
- package/dist/index.d.ts +8 -4
- package/dist/index.js +1959 -291
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1947 -291
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +10 -7
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +55 -0
- package/dist/mesh/mesh-ledger.d.ts +84 -4
- package/dist/mesh/mesh-sync.d.ts +4 -12
- package/dist/mesh/mesh-work-queue.d.ts +56 -1
- package/dist/mesh/p2p-relay-failure.d.ts +35 -0
- package/dist/providers/cli-provider-instance.d.ts +6 -0
- package/dist/repo-mesh-types.d.ts +2 -0
- package/dist/shared-types.d.ts +38 -0
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +5 -0
- package/src/cli-adapters/provider-cli-adapter.ts +35 -4
- package/src/cli-adapters/provider-cli-shared.ts +14 -4
- package/src/commands/cli-manager.ts +0 -4
- package/src/commands/mesh-coordinator.ts +55 -7
- package/src/commands/router.ts +847 -26
- package/src/commands/stream-commands.ts +8 -1
- package/src/config/config.ts +2 -1
- package/src/config/mesh-config.ts +2 -0
- package/src/config/workspaces.ts +1 -1
- package/src/git/git-worktree.ts +56 -4
- package/src/index.d.ts +3 -0
- package/src/index.ts +20 -4
- package/src/mesh/coordinator-prompt.ts +21 -10
- package/src/mesh/mesh-events.ts +522 -22
- package/src/mesh/mesh-ledger-reconciliation.ts +115 -0
- package/src/mesh/mesh-ledger.ts +209 -8
- package/src/mesh/mesh-sync.ts +4 -34
- package/src/mesh/mesh-work-queue.ts +163 -10
- package/src/mesh/p2p-relay-failure.ts +152 -0
- package/src/providers/cli-provider-instance.ts +153 -30
- package/src/repo-mesh-types.ts +2 -0
- package/src/shared-types.ts +38 -0
|
@@ -28,6 +28,15 @@ export type MeshCoordinatorSetup =
|
|
|
28
28
|
instructions: string
|
|
29
29
|
template: string
|
|
30
30
|
}
|
|
31
|
+
| {
|
|
32
|
+
/** Provider registers MCP via its own CLI command (e.g. `codex mcp add` / `gemini mcp add`). */
|
|
33
|
+
kind: 'cli_command'
|
|
34
|
+
serverName: string
|
|
35
|
+
/** The rendered shell command to execute before launching the coordinator session. */
|
|
36
|
+
command: string
|
|
37
|
+
requiresRestart: boolean
|
|
38
|
+
instructions: string
|
|
39
|
+
}
|
|
31
40
|
| {
|
|
32
41
|
kind: 'unsupported'
|
|
33
42
|
reason: string
|
|
@@ -41,6 +50,8 @@ export interface ResolveMeshCoordinatorSetupOptions {
|
|
|
41
50
|
adhdevMcpCommand?: string
|
|
42
51
|
adhdevMcpEntryPath?: string
|
|
43
52
|
nodeExecutable?: string
|
|
53
|
+
adhdevMcpTransport?: 'local' | 'ipc'
|
|
54
|
+
adhdevMcpPort?: number
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
const DEFAULT_SERVER_NAME = 'adhdev-mesh'
|
|
@@ -58,6 +69,8 @@ function resolveHermesMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupO
|
|
|
58
69
|
meshId: options.meshId,
|
|
59
70
|
nodeExecutable: options.nodeExecutable,
|
|
60
71
|
adhdevMcpEntryPath: options.adhdevMcpEntryPath,
|
|
72
|
+
adhdevMcpTransport: options.adhdevMcpTransport,
|
|
73
|
+
adhdevMcpPort: options.adhdevMcpPort,
|
|
61
74
|
})
|
|
62
75
|
if (!mcpServer) {
|
|
63
76
|
return {
|
|
@@ -130,6 +143,8 @@ export function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetup
|
|
|
130
143
|
meshId,
|
|
131
144
|
nodeExecutable: options.nodeExecutable,
|
|
132
145
|
adhdevMcpEntryPath: options.adhdevMcpEntryPath,
|
|
146
|
+
adhdevMcpTransport: options.adhdevMcpTransport,
|
|
147
|
+
adhdevMcpPort: options.adhdevMcpPort,
|
|
133
148
|
})
|
|
134
149
|
if (!mcpServer) {
|
|
135
150
|
return {
|
|
@@ -152,6 +167,24 @@ export function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetup
|
|
|
152
167
|
if (!instructions || !template?.trim()) {
|
|
153
168
|
return { kind: 'unsupported', reason: 'Provider manual MCP setup is missing instructions or template' }
|
|
154
169
|
}
|
|
170
|
+
const renderedTemplate = renderMeshCoordinatorTemplate(template, {
|
|
171
|
+
meshId,
|
|
172
|
+
workspace,
|
|
173
|
+
serverName,
|
|
174
|
+
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND,
|
|
175
|
+
})
|
|
176
|
+
// Detect if the template is a runnable CLI command (single line, no YAML/JSON structure).
|
|
177
|
+
// If so, use cli_command kind so the daemon can execute it automatically.
|
|
178
|
+
const isCliCommand = !renderedTemplate.trim().includes('\n') && !renderedTemplate.trim().startsWith('{')
|
|
179
|
+
if (isCliCommand) {
|
|
180
|
+
return {
|
|
181
|
+
kind: 'cli_command',
|
|
182
|
+
serverName,
|
|
183
|
+
command: renderedTemplate.trim(),
|
|
184
|
+
requiresRestart: mcpConfig.requiresRestart === true,
|
|
185
|
+
instructions: instructions,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
155
188
|
return {
|
|
156
189
|
kind: 'manual',
|
|
157
190
|
serverName,
|
|
@@ -159,12 +192,7 @@ export function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetup
|
|
|
159
192
|
configPathCommand: mcpConfig.configPathCommand,
|
|
160
193
|
requiresRestart: mcpConfig.requiresRestart === true,
|
|
161
194
|
instructions,
|
|
162
|
-
template:
|
|
163
|
-
meshId,
|
|
164
|
-
workspace,
|
|
165
|
-
serverName,
|
|
166
|
-
adhdevMcpCommand: options.adhdevMcpCommand || DEFAULT_ADHDEV_MCP_COMMAND,
|
|
167
|
-
}),
|
|
195
|
+
template: renderedTemplate,
|
|
168
196
|
}
|
|
169
197
|
}
|
|
170
198
|
|
|
@@ -196,17 +224,37 @@ function resolveAdhdevMcpServerLaunch(options: {
|
|
|
196
224
|
meshId: string
|
|
197
225
|
nodeExecutable?: string
|
|
198
226
|
adhdevMcpEntryPath?: string
|
|
227
|
+
adhdevMcpTransport?: 'local' | 'ipc'
|
|
228
|
+
adhdevMcpPort?: number
|
|
199
229
|
}): MeshCoordinatorMcpServerLaunch | null {
|
|
200
230
|
const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath)
|
|
201
231
|
if (!entryPath) return null
|
|
202
232
|
const nodeExecutable = resolveMcpNodeExecutable(options.nodeExecutable)
|
|
203
233
|
if (!nodeExecutable) return null
|
|
234
|
+
const transport = resolveMcpTransport(options.adhdevMcpTransport)
|
|
235
|
+
const args = [entryPath, '--mode', transport, '--repo-mesh', options.meshId]
|
|
236
|
+
const port = resolveMcpPort(options.adhdevMcpPort)
|
|
237
|
+
if (port !== undefined) args.push('--port', String(port))
|
|
204
238
|
return {
|
|
205
239
|
command: nodeExecutable,
|
|
206
|
-
args
|
|
240
|
+
args,
|
|
207
241
|
}
|
|
208
242
|
}
|
|
209
243
|
|
|
244
|
+
function resolveMcpTransport(explicitTransport?: 'local' | 'ipc'): 'local' | 'ipc' {
|
|
245
|
+
if (explicitTransport === 'local' || explicitTransport === 'ipc') return explicitTransport
|
|
246
|
+
const envTransport = process.env.ADHDEV_COORDINATOR_MCP_TRANSPORT?.trim()
|
|
247
|
+
return envTransport === 'local' ? 'local' : 'ipc'
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function resolveMcpPort(explicitPort?: number): number | undefined {
|
|
251
|
+
if (typeof explicitPort === 'number' && Number.isInteger(explicitPort) && explicitPort > 0) return explicitPort
|
|
252
|
+
const raw = process.env.ADHDEV_COORDINATOR_MCP_PORT?.trim()
|
|
253
|
+
if (!raw) return undefined
|
|
254
|
+
const parsed = Number(raw)
|
|
255
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined
|
|
256
|
+
}
|
|
257
|
+
|
|
210
258
|
function resolveMcpNodeExecutable(explicitExecutable?: string): string | null {
|
|
211
259
|
const explicit = explicitExecutable?.trim()
|
|
212
260
|
if (explicit) return explicit
|