adhdev 0.9.67 → 0.9.68

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/index.js CHANGED
@@ -2179,6 +2179,19 @@ var init_saved_sessions = __esm({
2179
2179
  });
2180
2180
 
2181
2181
  // ../../oss/packages/daemon-core/src/config/mesh-config.ts
2182
+ var mesh_config_exports = {};
2183
+ __export(mesh_config_exports, {
2184
+ addNode: () => addNode,
2185
+ createMesh: () => createMesh,
2186
+ deleteMesh: () => deleteMesh,
2187
+ getMesh: () => getMesh,
2188
+ getMeshByRepo: () => getMeshByRepo,
2189
+ listMeshes: () => listMeshes,
2190
+ normalizeRepoIdentity: () => normalizeRepoIdentity,
2191
+ removeNode: () => removeNode,
2192
+ updateMesh: () => updateMesh,
2193
+ updateNode: () => updateNode
2194
+ });
2182
2195
  function getMeshConfigPath() {
2183
2196
  return (0, import_path2.join)(getConfigDir(), "meshes.json");
2184
2197
  }
@@ -2323,6 +2336,10 @@ var init_mesh_config = __esm({
2323
2336
  });
2324
2337
 
2325
2338
  // ../../oss/packages/daemon-core/src/mesh/coordinator-prompt.ts
2339
+ var coordinator_prompt_exports = {};
2340
+ __export(coordinator_prompt_exports, {
2341
+ buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt
2342
+ });
2326
2343
  function buildCoordinatorSystemPrompt(ctx) {
2327
2344
  const { mesh, status, userInstruction } = ctx;
2328
2345
  const sections = [];
@@ -40294,6 +40311,142 @@ var init_router = __esm({
40294
40311
  updateConfig({ machineNickname: nickname || null });
40295
40312
  return { success: true };
40296
40313
  }
40314
+ // ─── Mesh CRUD (local meshes.json) ───
40315
+ case "list_meshes": {
40316
+ try {
40317
+ const { listMeshes: listMeshes2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40318
+ return { success: true, meshes: listMeshes2() };
40319
+ } catch (e) {
40320
+ return { success: false, error: e.message };
40321
+ }
40322
+ }
40323
+ case "get_mesh": {
40324
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
40325
+ if (!meshId) return { success: false, error: "meshId required" };
40326
+ try {
40327
+ const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40328
+ const mesh = getMesh3(meshId);
40329
+ if (!mesh) return { success: false, error: "Mesh not found" };
40330
+ return { success: true, mesh };
40331
+ } catch (e) {
40332
+ return { success: false, error: e.message };
40333
+ }
40334
+ }
40335
+ case "create_mesh": {
40336
+ const name = typeof args?.name === "string" ? args.name.trim() : "";
40337
+ const repoIdentity = typeof args?.repoIdentity === "string" ? args.repoIdentity.trim() : "";
40338
+ const repoRemoteUrl = typeof args?.repoRemoteUrl === "string" ? args.repoRemoteUrl.trim() : void 0;
40339
+ const defaultBranch = typeof args?.defaultBranch === "string" ? args.defaultBranch.trim() : void 0;
40340
+ if (!name) return { success: false, error: "name required" };
40341
+ try {
40342
+ const { createMesh: createMesh2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40343
+ const mesh = createMesh2({ name, repoIdentity, repoRemoteUrl, defaultBranch });
40344
+ return { success: true, mesh };
40345
+ } catch (e) {
40346
+ return { success: false, error: e.message };
40347
+ }
40348
+ }
40349
+ case "delete_mesh": {
40350
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
40351
+ if (!meshId) return { success: false, error: "meshId required" };
40352
+ try {
40353
+ const { deleteMesh: deleteMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40354
+ const deleted = deleteMesh3(meshId);
40355
+ return { success: true, deleted };
40356
+ } catch (e) {
40357
+ return { success: false, error: e.message };
40358
+ }
40359
+ }
40360
+ case "add_mesh_node": {
40361
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
40362
+ const workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
40363
+ if (!meshId) return { success: false, error: "meshId required" };
40364
+ if (!workspace) return { success: false, error: "workspace required" };
40365
+ try {
40366
+ const { addNode: addNode3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40367
+ const node = addNode3(meshId, { workspace });
40368
+ if (!node) return { success: false, error: "Mesh not found" };
40369
+ return { success: true, node };
40370
+ } catch (e) {
40371
+ return { success: false, error: e.message };
40372
+ }
40373
+ }
40374
+ case "remove_mesh_node": {
40375
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
40376
+ const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
40377
+ if (!meshId || !nodeId) return { success: false, error: "meshId and nodeId required" };
40378
+ try {
40379
+ const { removeNode: removeNode3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40380
+ const removed = removeNode3(meshId, nodeId);
40381
+ return { success: true, removed };
40382
+ } catch (e) {
40383
+ return { success: false, error: e.message };
40384
+ }
40385
+ }
40386
+ // ─── Mesh Coordinator Launch ───
40387
+ case "launch_mesh_coordinator": {
40388
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
40389
+ const cliType = typeof args?.cliType === "string" ? args.cliType.trim() : "claude-cli";
40390
+ if (!meshId) return { success: false, error: "meshId required" };
40391
+ try {
40392
+ const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40393
+ const { buildCoordinatorSystemPrompt: buildCoordinatorSystemPrompt2 } = await Promise.resolve().then(() => (init_coordinator_prompt(), coordinator_prompt_exports));
40394
+ const mesh = getMesh3(meshId);
40395
+ if (!mesh) return { success: false, error: "Mesh not found" };
40396
+ if (mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
40397
+ const workspace = mesh.nodes[0].workspace;
40398
+ const { existsSync: existsSync25, readFileSync: readFileSync20, writeFileSync: writeFileSync14, copyFileSync: copyFileSync4 } = await import("fs");
40399
+ const { join: join32 } = await import("path");
40400
+ const mcpConfigPath = join32(workspace, ".mcp.json");
40401
+ const hadExistingMcpConfig = existsSync25(mcpConfigPath);
40402
+ let existingMcpConfig = {};
40403
+ if (hadExistingMcpConfig) {
40404
+ try {
40405
+ existingMcpConfig = JSON.parse(readFileSync20(mcpConfigPath, "utf-8"));
40406
+ copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
40407
+ } catch {
40408
+ }
40409
+ }
40410
+ const mcpConfig = {
40411
+ ...existingMcpConfig,
40412
+ mcpServers: {
40413
+ ...existingMcpConfig.mcpServers || {},
40414
+ "adhdev-mesh": {
40415
+ command: "adhdev-mcp",
40416
+ args: ["--repo-mesh", meshId]
40417
+ }
40418
+ }
40419
+ };
40420
+ writeFileSync14(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
40421
+ LOG.info("MeshCoordinator", `Wrote .mcp.json to ${workspace} with adhdev-mesh server`);
40422
+ let systemPrompt = "";
40423
+ try {
40424
+ systemPrompt = buildCoordinatorSystemPrompt2({ mesh });
40425
+ } catch {
40426
+ systemPrompt = `You are a Repo Mesh Coordinator for "${mesh.name}". Use the adhdev-mesh MCP tools (mesh_status, mesh_list_nodes, mesh_send_task, mesh_read_chat, mesh_launch_session, etc.) to orchestrate work across ${mesh.nodes.length} node(s).`;
40427
+ }
40428
+ const launchResult = await this.deps.cliManager.handleCliCommand("launch_cli", {
40429
+ cliType,
40430
+ dir: workspace,
40431
+ initialPrompt: systemPrompt
40432
+ });
40433
+ if (!launchResult?.success) {
40434
+ return { success: false, error: launchResult?.error || "Failed to launch CLI session" };
40435
+ }
40436
+ LOG.info("MeshCoordinator", `Launched ${cliType} coordinator for mesh ${meshId} in ${workspace}`);
40437
+ return {
40438
+ success: true,
40439
+ meshId,
40440
+ cliType,
40441
+ workspace,
40442
+ sessionId: launchResult.sessionId || launchResult.id,
40443
+ mcpConfigWritten: true
40444
+ };
40445
+ } catch (e) {
40446
+ LOG.error("MeshCoordinator", `Failed: ${e.message}`);
40447
+ return { success: false, error: e.message };
40448
+ }
40449
+ }
40297
40450
  default:
40298
40451
  break;
40299
40452
  }
@@ -58597,7 +58750,7 @@ var init_adhdev_daemon = __esm({
58597
58750
  init_version();
58598
58751
  init_src();
58599
58752
  init_runtime_defaults();
58600
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.67" });
58753
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.68" });
58601
58754
  AdhdevDaemon = class _AdhdevDaemon {
58602
58755
  localHttpServer = null;
58603
58756
  localWss = null;