adhdev 0.9.66 → 0.9.67

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
@@ -34,6 +34,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
+ // ../../oss/packages/daemon-core/src/repo-mesh-types.ts
38
+ var DEFAULT_MESH_POLICY;
39
+ var init_repo_mesh_types = __esm({
40
+ "../../oss/packages/daemon-core/src/repo-mesh-types.ts"() {
41
+ "use strict";
42
+ DEFAULT_MESH_POLICY = {
43
+ requirePreTaskCheckpoint: false,
44
+ requirePostTaskCheckpoint: true,
45
+ requireApprovalForPush: true,
46
+ requireApprovalForDestructiveGit: true,
47
+ dirtyWorkspaceBehavior: "warn",
48
+ maxParallelTasks: 2
49
+ };
50
+ }
51
+ });
52
+
37
53
  // ../../oss/packages/daemon-core/src/git/git-executor.ts
38
54
  async function resolveGitRepository(workspace, options = {}) {
39
55
  const normalizedWorkspace = await validateWorkspace(workspace);
@@ -2162,12 +2178,326 @@ var init_saved_sessions = __esm({
2162
2178
  }
2163
2179
  });
2164
2180
 
2181
+ // ../../oss/packages/daemon-core/src/config/mesh-config.ts
2182
+ function getMeshConfigPath() {
2183
+ return (0, import_path2.join)(getConfigDir(), "meshes.json");
2184
+ }
2185
+ function loadMeshConfig() {
2186
+ const path33 = getMeshConfigPath();
2187
+ if (!(0, import_fs2.existsSync)(path33)) return { meshes: [] };
2188
+ try {
2189
+ const raw = JSON.parse((0, import_fs2.readFileSync)(path33, "utf-8"));
2190
+ if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
2191
+ return raw;
2192
+ } catch {
2193
+ return { meshes: [] };
2194
+ }
2195
+ }
2196
+ function saveMeshConfig(config2) {
2197
+ const path33 = getMeshConfigPath();
2198
+ (0, import_fs2.writeFileSync)(path33, JSON.stringify(config2, null, 2), { encoding: "utf-8", mode: 384 });
2199
+ }
2200
+ function normalizeRepoIdentity(remoteUrl) {
2201
+ let identity = remoteUrl.trim();
2202
+ if (identity.startsWith("http://") || identity.startsWith("https://")) {
2203
+ try {
2204
+ const url2 = new URL(identity);
2205
+ const path33 = url2.pathname.replace(/^\//, "").replace(/\.git$/, "");
2206
+ return `${url2.hostname}/${path33}`;
2207
+ } catch {
2208
+ }
2209
+ }
2210
+ const sshMatch = identity.match(/^(?:ssh:\/\/)?[\w.-]+@([\w.-]+)[:/]([\w.\-/]+?)(?:\.git)?$/);
2211
+ if (sshMatch) return `${sshMatch[1]}/${sshMatch[2]}`;
2212
+ return identity;
2213
+ }
2214
+ function listMeshes() {
2215
+ return loadMeshConfig().meshes;
2216
+ }
2217
+ function getMesh(meshId) {
2218
+ return loadMeshConfig().meshes.find((m) => m.id === meshId);
2219
+ }
2220
+ function getMeshByRepo(repoIdentity) {
2221
+ return loadMeshConfig().meshes.find((m) => m.repoIdentity === repoIdentity);
2222
+ }
2223
+ function createMesh(opts) {
2224
+ const config2 = loadMeshConfig();
2225
+ if (config2.meshes.length >= 20) {
2226
+ throw new Error("Maximum 20 meshes allowed");
2227
+ }
2228
+ const repoIdentity = opts.repoIdentity || (opts.repoRemoteUrl ? normalizeRepoIdentity(opts.repoRemoteUrl) : "");
2229
+ if (!repoIdentity) throw new Error("Either repoRemoteUrl or repoIdentity is required");
2230
+ const now = (/* @__PURE__ */ new Date()).toISOString();
2231
+ const mesh = {
2232
+ id: `mesh_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`,
2233
+ name: opts.name.trim().slice(0, 100),
2234
+ repoIdentity,
2235
+ repoRemoteUrl: opts.repoRemoteUrl,
2236
+ defaultBranch: opts.defaultBranch,
2237
+ policy: { ...DEFAULT_MESH_POLICY, ...opts.policy },
2238
+ coordinator: opts.coordinator || {},
2239
+ nodes: [],
2240
+ createdAt: now,
2241
+ updatedAt: now
2242
+ };
2243
+ config2.meshes.push(mesh);
2244
+ saveMeshConfig(config2);
2245
+ return mesh;
2246
+ }
2247
+ function updateMesh(meshId, opts) {
2248
+ const config2 = loadMeshConfig();
2249
+ const mesh = config2.meshes.find((m) => m.id === meshId);
2250
+ if (!mesh) return void 0;
2251
+ if (opts.name !== void 0) mesh.name = opts.name.trim().slice(0, 100);
2252
+ if (opts.defaultBranch !== void 0) mesh.defaultBranch = opts.defaultBranch;
2253
+ if (opts.policy) mesh.policy = { ...mesh.policy, ...opts.policy };
2254
+ if (opts.coordinator) mesh.coordinator = opts.coordinator;
2255
+ mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2256
+ saveMeshConfig(config2);
2257
+ return mesh;
2258
+ }
2259
+ function deleteMesh(meshId) {
2260
+ const config2 = loadMeshConfig();
2261
+ const idx = config2.meshes.findIndex((m) => m.id === meshId);
2262
+ if (idx === -1) return false;
2263
+ config2.meshes.splice(idx, 1);
2264
+ saveMeshConfig(config2);
2265
+ return true;
2266
+ }
2267
+ function addNode(meshId, opts) {
2268
+ const config2 = loadMeshConfig();
2269
+ const mesh = config2.meshes.find((m) => m.id === meshId);
2270
+ if (!mesh) return void 0;
2271
+ if (mesh.nodes.length >= 10) {
2272
+ throw new Error("Maximum 10 nodes per mesh");
2273
+ }
2274
+ if (mesh.nodes.some((n) => n.workspace === opts.workspace)) {
2275
+ throw new Error("This workspace is already in the mesh");
2276
+ }
2277
+ const node = {
2278
+ id: `node_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`,
2279
+ workspace: opts.workspace.trim(),
2280
+ repoRoot: opts.repoRoot,
2281
+ userOverrides: opts.userOverrides || {},
2282
+ policy: opts.policy || {},
2283
+ isLocalWorktree: opts.isLocalWorktree
2284
+ };
2285
+ mesh.nodes.push(node);
2286
+ mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2287
+ saveMeshConfig(config2);
2288
+ return node;
2289
+ }
2290
+ function removeNode(meshId, nodeId) {
2291
+ const config2 = loadMeshConfig();
2292
+ const mesh = config2.meshes.find((m) => m.id === meshId);
2293
+ if (!mesh) return false;
2294
+ const idx = mesh.nodes.findIndex((n) => n.id === nodeId);
2295
+ if (idx === -1) return false;
2296
+ mesh.nodes.splice(idx, 1);
2297
+ mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2298
+ saveMeshConfig(config2);
2299
+ return true;
2300
+ }
2301
+ function updateNode(meshId, nodeId, opts) {
2302
+ const config2 = loadMeshConfig();
2303
+ const mesh = config2.meshes.find((m) => m.id === meshId);
2304
+ if (!mesh) return void 0;
2305
+ const node = mesh.nodes.find((n) => n.id === nodeId);
2306
+ if (!node) return void 0;
2307
+ if (opts.userOverrides) node.userOverrides = { ...node.userOverrides, ...opts.userOverrides };
2308
+ if (opts.policy) node.policy = { ...node.policy, ...opts.policy };
2309
+ mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2310
+ saveMeshConfig(config2);
2311
+ return node;
2312
+ }
2313
+ var import_fs2, import_path2, import_crypto3;
2314
+ var init_mesh_config = __esm({
2315
+ "../../oss/packages/daemon-core/src/config/mesh-config.ts"() {
2316
+ "use strict";
2317
+ import_fs2 = require("fs");
2318
+ import_path2 = require("path");
2319
+ import_crypto3 = require("crypto");
2320
+ init_config();
2321
+ init_repo_mesh_types();
2322
+ }
2323
+ });
2324
+
2325
+ // ../../oss/packages/daemon-core/src/mesh/coordinator-prompt.ts
2326
+ function buildCoordinatorSystemPrompt(ctx) {
2327
+ const { mesh, status, userInstruction } = ctx;
2328
+ const sections = [];
2329
+ sections.push(`You are a **Repo Mesh Coordinator** \u2014 a technical team lead who orchestrates work across multiple agent sessions on a shared Git repository.
2330
+
2331
+ Your mesh: **${mesh.name}**
2332
+ Repository: \`${mesh.repoIdentity}\`${mesh.defaultBranch ? `
2333
+ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
2334
+ if (status?.nodes?.length) {
2335
+ sections.push(buildNodeStatusSection(status.nodes));
2336
+ } else if (mesh.nodes.length) {
2337
+ sections.push(buildNodeConfigSection(mesh));
2338
+ } else {
2339
+ sections.push("## Nodes\nNo nodes configured yet. Ask the user to add nodes with `adhdev mesh add-node`.");
2340
+ }
2341
+ sections.push(buildPolicySection(mesh.policy));
2342
+ sections.push(TOOLS_SECTION);
2343
+ sections.push(WORKFLOW_SECTION);
2344
+ sections.push(RULES_SECTION);
2345
+ if (userInstruction) {
2346
+ sections.push(`## Additional Context
2347
+ ${userInstruction}`);
2348
+ }
2349
+ if (mesh.coordinator.systemPromptSuffix) {
2350
+ sections.push(mesh.coordinator.systemPromptSuffix);
2351
+ }
2352
+ return sections.join("\n\n");
2353
+ }
2354
+ function buildNodeStatusSection(nodes) {
2355
+ const lines = ["## Current Node Status", ""];
2356
+ for (const n of nodes) {
2357
+ const healthIcon = n.health === "online" ? "\u{1F7E2}" : n.health === "dirty" ? "\u{1F7E1}" : n.health === "offline" ? "\u26AB" : "\u{1F534}";
2358
+ const sessions = n.activeSessions.length > 0 ? `sessions: ${n.activeSessions.join(", ")}` : "no active sessions";
2359
+ const branch = n.git?.branch ? `branch: \`${n.git.branch}\`` : "";
2360
+ lines.push(`- ${healthIcon} **${n.machineLabel}** (${n.nodeId})`);
2361
+ lines.push(` workspace: \`${n.workspace}\` | ${branch} | ${sessions}`);
2362
+ if (n.error) lines.push(` \u26A0\uFE0F ${n.error}`);
2363
+ }
2364
+ return lines.join("\n");
2365
+ }
2366
+ function buildNodeConfigSection(mesh) {
2367
+ const lines = ["## Configured Nodes", ""];
2368
+ for (const n of mesh.nodes) {
2369
+ const labels = [];
2370
+ if (n.isLocalWorktree) labels.push("worktree");
2371
+ if (n.policy.readOnly) labels.push("read-only");
2372
+ const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
2373
+ lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
2374
+ }
2375
+ lines.push("", "_Use `mesh_status` to probe live health before delegating work._");
2376
+ return lines.join("\n");
2377
+ }
2378
+ function buildPolicySection(policy) {
2379
+ const rules = [];
2380
+ if (policy.requirePreTaskCheckpoint) rules.push("- Create a git checkpoint **before** starting each task");
2381
+ if (policy.requirePostTaskCheckpoint) rules.push("- Create a git checkpoint **after** each task completes");
2382
+ if (policy.requireApprovalForPush) rules.push("- **Ask for user approval** before pushing to remote");
2383
+ if (policy.requireApprovalForDestructiveGit) rules.push("- **Ask for user approval** before destructive git operations (force push, reset, etc.)");
2384
+ const dirtyBehavior = {
2385
+ block: "- **Do not** send tasks to nodes with dirty workspaces",
2386
+ warn: "- Warn the user if a node has uncommitted changes before sending a task",
2387
+ checkpoint_then_continue: "- Auto-checkpoint dirty nodes before sending tasks"
2388
+ }[policy.dirtyWorkspaceBehavior] || "";
2389
+ if (dirtyBehavior) rules.push(dirtyBehavior);
2390
+ rules.push(`- Maximum **${policy.maxParallelTasks}** tasks running in parallel`);
2391
+ return `## Policy
2392
+ ${rules.join("\n")}`;
2393
+ }
2394
+ var TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION;
2395
+ var init_coordinator_prompt = __esm({
2396
+ "../../oss/packages/daemon-core/src/mesh/coordinator-prompt.ts"() {
2397
+ "use strict";
2398
+ TOOLS_SECTION = `## Available Tools
2399
+
2400
+ | Tool | Purpose |
2401
+ |------|---------|
2402
+ | \`mesh_status\` | Check all nodes' health, git state, and active sessions |
2403
+ | \`mesh_list_nodes\` | List nodes with workspace paths |
2404
+ | \`mesh_launch_session\` | Start a new agent session on a node |
2405
+ | \`mesh_send_task\` | Send a task (natural language) to a running agent |
2406
+ | \`mesh_read_chat\` | Read an agent's recent messages to check progress |
2407
+ | \`mesh_git_status\` | Check git status on a specific node |
2408
+ | \`mesh_checkpoint\` | Create a git checkpoint on a node |
2409
+ | \`mesh_approve\` | Approve/reject a pending agent action |`;
2410
+ WORKFLOW_SECTION = `## Orchestration Workflow
2411
+
2412
+ 1. **Assess** \u2014 Call \`mesh_status\` to see which nodes are healthy and available.
2413
+ 2. **Plan** \u2014 Decompose the user's request into independent tasks for parallel execution, or sequential tasks when dependencies exist.
2414
+ 3. **Delegate** \u2014 For each task:
2415
+ a. Pick the best node (consider: health, dirty state, current workload).
2416
+ b. If no session exists, call \`mesh_launch_session\` to start one.
2417
+ c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
2418
+ 4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
2419
+ 5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
2420
+ 6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
2421
+ 7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
2422
+ RULES_SECTION = `## Rules
2423
+
2424
+ - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
2425
+ - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
2426
+ - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
2427
+ - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
2428
+ - **Keep the user informed.** Report progress after each delegation round.
2429
+ - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
2430
+ - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
2431
+ }
2432
+ });
2433
+
2434
+ // ../../oss/packages/daemon-core/src/mesh/mesh-sync.ts
2435
+ async function syncMeshes(transport) {
2436
+ const result = { pushed: 0, pulled: 0, deleted: 0, errors: [] };
2437
+ let remoteMeshes;
2438
+ try {
2439
+ const res = await transport.listRemoteMeshes();
2440
+ remoteMeshes = res.meshes;
2441
+ } catch (e) {
2442
+ result.errors.push(`Failed to list remote meshes: ${e.message}`);
2443
+ return result;
2444
+ }
2445
+ const localMeshes = listMeshes();
2446
+ const remoteByIdentity = new Map(remoteMeshes.map((m) => [m.repo_identity, m]));
2447
+ const localByIdentity = new Map(localMeshes.map((m) => [m.repoIdentity, m]));
2448
+ for (const local of localMeshes) {
2449
+ if (!remoteByIdentity.has(local.repoIdentity)) {
2450
+ try {
2451
+ await transport.createRemoteMesh({
2452
+ name: local.name,
2453
+ repo_identity: local.repoIdentity,
2454
+ repo_remote_url: local.repoRemoteUrl,
2455
+ default_branch: local.defaultBranch,
2456
+ policy: JSON.stringify(local.policy)
2457
+ });
2458
+ result.pushed++;
2459
+ } catch (e) {
2460
+ result.errors.push(`Push failed for "${local.name}": ${e.message}`);
2461
+ }
2462
+ }
2463
+ }
2464
+ for (const remote of remoteMeshes) {
2465
+ if (!localByIdentity.has(remote.repo_identity)) {
2466
+ try {
2467
+ let policy;
2468
+ try {
2469
+ policy = JSON.parse(remote.policy);
2470
+ } catch {
2471
+ policy = void 0;
2472
+ }
2473
+ createMesh({
2474
+ name: remote.name,
2475
+ repoIdentity: remote.repo_identity,
2476
+ repoRemoteUrl: remote.repo_remote_url || void 0,
2477
+ defaultBranch: remote.default_branch || void 0,
2478
+ policy
2479
+ });
2480
+ result.pulled++;
2481
+ } catch (e) {
2482
+ result.errors.push(`Pull failed for "${remote.name}": ${e.message}`);
2483
+ }
2484
+ }
2485
+ }
2486
+ return result;
2487
+ }
2488
+ var init_mesh_sync = __esm({
2489
+ "../../oss/packages/daemon-core/src/mesh/mesh-sync.ts"() {
2490
+ "use strict";
2491
+ init_mesh_config();
2492
+ }
2493
+ });
2494
+
2165
2495
  // ../../oss/packages/daemon-core/src/config/state-store.ts
2166
2496
  function isPlainObject2(value) {
2167
2497
  return !!value && typeof value === "object" && !Array.isArray(value);
2168
2498
  }
2169
2499
  function getStatePath() {
2170
- return (0, import_path2.join)(getConfigDir(), "state.json");
2500
+ return (0, import_path3.join)(getConfigDir(), "state.json");
2171
2501
  }
2172
2502
  function normalizeState(raw) {
2173
2503
  const parsed = isPlainObject2(raw) ? raw : {};
@@ -2203,11 +2533,11 @@ function normalizeState(raw) {
2203
2533
  }
2204
2534
  function loadState() {
2205
2535
  const statePath = getStatePath();
2206
- if (!(0, import_fs2.existsSync)(statePath)) {
2536
+ if (!(0, import_fs3.existsSync)(statePath)) {
2207
2537
  return { ...DEFAULT_STATE };
2208
2538
  }
2209
2539
  try {
2210
- const raw = (0, import_fs2.readFileSync)(statePath, "utf-8");
2540
+ const raw = (0, import_fs3.readFileSync)(statePath, "utf-8");
2211
2541
  return normalizeState(JSON.parse(raw));
2212
2542
  } catch {
2213
2543
  return { ...DEFAULT_STATE };
@@ -2216,17 +2546,17 @@ function loadState() {
2216
2546
  function saveState(state) {
2217
2547
  const statePath = getStatePath();
2218
2548
  const normalized = normalizeState(state);
2219
- (0, import_fs2.writeFileSync)(statePath, JSON.stringify(normalized, null, 2), { encoding: "utf-8", mode: 384 });
2549
+ (0, import_fs3.writeFileSync)(statePath, JSON.stringify(normalized, null, 2), { encoding: "utf-8", mode: 384 });
2220
2550
  }
2221
2551
  function resetState() {
2222
2552
  saveState({ ...DEFAULT_STATE });
2223
2553
  }
2224
- var import_fs2, import_path2, DEFAULT_STATE;
2554
+ var import_fs3, import_path3, DEFAULT_STATE;
2225
2555
  var init_state_store = __esm({
2226
2556
  "../../oss/packages/daemon-core/src/config/state-store.ts"() {
2227
2557
  "use strict";
2228
- import_fs2 = require("fs");
2229
- import_path2 = require("path");
2558
+ import_fs3 = require("fs");
2559
+ import_path3 = require("path");
2230
2560
  init_config();
2231
2561
  DEFAULT_STATE = {
2232
2562
  recentActivity: [],
@@ -2259,7 +2589,7 @@ function findCliCommand(command) {
2259
2589
  if (path7.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~")) {
2260
2590
  const candidate = trimmed.startsWith("~") ? path7.join((0, import_os2.homedir)(), trimmed.slice(1)) : trimmed;
2261
2591
  const resolved = path7.isAbsolute(candidate) ? candidate : path7.resolve(candidate);
2262
- return (0, import_fs3.existsSync)(resolved) ? resolved : null;
2592
+ return (0, import_fs4.existsSync)(resolved) ? resolved : null;
2263
2593
  }
2264
2594
  try {
2265
2595
  const result = (0, import_child_process.execSync)(
@@ -2290,9 +2620,9 @@ function checkPathExists(paths) {
2290
2620
  if (normalized.includes("*")) {
2291
2621
  const username = home.split(/[\\/]/).pop() || "";
2292
2622
  const resolved = normalized.replace("*", username);
2293
- if ((0, import_fs3.existsSync)(resolved)) return resolved;
2623
+ if ((0, import_fs4.existsSync)(resolved)) return resolved;
2294
2624
  } else {
2295
- if ((0, import_fs3.existsSync)(normalized)) return normalized;
2625
+ if ((0, import_fs4.existsSync)(normalized)) return normalized;
2296
2626
  }
2297
2627
  }
2298
2628
  return null;
@@ -2306,7 +2636,7 @@ async function detectIDEs(providerLoader) {
2306
2636
  let resolvedCli = cliPath;
2307
2637
  if (!resolvedCli && appPath && os29 === "darwin") {
2308
2638
  const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
2309
- if ((0, import_fs3.existsSync)(bundledCli)) resolvedCli = bundledCli;
2639
+ if ((0, import_fs4.existsSync)(bundledCli)) resolvedCli = bundledCli;
2310
2640
  }
2311
2641
  if (!resolvedCli && appPath && os29 === "win32") {
2312
2642
  const { dirname: dirname10 } = await import("path");
@@ -2319,7 +2649,7 @@ async function detectIDEs(providerLoader) {
2319
2649
  `${appDir}\\\\resources\\\\app\\\\bin\\\\${def.cli}.cmd`
2320
2650
  ];
2321
2651
  for (const c of candidates) {
2322
- if ((0, import_fs3.existsSync)(c)) {
2652
+ if ((0, import_fs4.existsSync)(c)) {
2323
2653
  resolvedCli = c;
2324
2654
  break;
2325
2655
  }
@@ -2340,12 +2670,12 @@ async function detectIDEs(providerLoader) {
2340
2670
  }
2341
2671
  return results;
2342
2672
  }
2343
- var import_child_process, import_fs3, import_os2, path7, BUILTIN_IDE_DEFINITIONS, registeredIDEs;
2673
+ var import_child_process, import_fs4, import_os2, path7, BUILTIN_IDE_DEFINITIONS, registeredIDEs;
2344
2674
  var init_ide_detector = __esm({
2345
2675
  "../../oss/packages/daemon-core/src/detection/ide-detector.ts"() {
2346
2676
  "use strict";
2347
2677
  import_child_process = require("child_process");
2348
- import_fs3 = require("fs");
2678
+ import_fs4 = require("fs");
2349
2679
  import_os2 = require("os");
2350
2680
  path7 = __toESM(require("path"));
2351
2681
  BUILTIN_IDE_DEFINITIONS = [];
@@ -2377,7 +2707,7 @@ function resolveCommandPath(command) {
2377
2707
  if (isExplicitCommandPath(trimmed)) {
2378
2708
  const expanded = expandHome(trimmed);
2379
2709
  const candidate = path8.isAbsolute(expanded) ? expanded : path8.resolve(expanded);
2380
- return (0, import_fs4.existsSync)(candidate) ? candidate : null;
2710
+ return (0, import_fs5.existsSync)(candidate) ? candidate : null;
2381
2711
  }
2382
2712
  return null;
2383
2713
  }
@@ -2477,14 +2807,14 @@ async function detectCLI(cliId, providerLoader, options) {
2477
2807
  const all = await detectCLIs(providerLoader, options);
2478
2808
  return all.find((c) => c.id === resolvedId && c.installed) || null;
2479
2809
  }
2480
- var import_child_process2, os2, path8, import_fs4;
2810
+ var import_child_process2, os2, path8, import_fs5;
2481
2811
  var init_cli_detector = __esm({
2482
2812
  "../../oss/packages/daemon-core/src/detection/cli-detector.ts"() {
2483
2813
  "use strict";
2484
2814
  import_child_process2 = require("child_process");
2485
2815
  os2 = __toESM(require("os"));
2486
2816
  path8 = __toESM(require("path"));
2487
- import_fs4 = require("fs");
2817
+ import_fs5 = require("fs");
2488
2818
  }
2489
2819
  });
2490
2820
 
@@ -12494,14 +12824,14 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
12494
12824
  } catch {
12495
12825
  }
12496
12826
  }
12497
- var os9, path22, net, import_crypto3, os22, path32, __require, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, SessionHostClient;
12827
+ var os9, path22, net, import_crypto4, os22, path32, __require, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, SessionHostClient;
12498
12828
  var init_dist = __esm({
12499
12829
  "../../oss/packages/session-host-core/dist/index.mjs"() {
12500
12830
  "use strict";
12501
12831
  os9 = __toESM(require("os"), 1);
12502
12832
  path22 = __toESM(require("path"), 1);
12503
12833
  net = __toESM(require("net"), 1);
12504
- import_crypto3 = require("crypto");
12834
+ import_crypto4 = require("crypto");
12505
12835
  os22 = __toESM(require("os"), 1);
12506
12836
  path32 = __toESM(require("path"), 1);
12507
12837
  __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -12572,7 +12902,7 @@ var init_dist = __esm({
12572
12902
  async request(request) {
12573
12903
  await this.connect();
12574
12904
  if (!this.socket) throw new Error("Session host socket unavailable");
12575
- const requestId = (0, import_crypto3.randomUUID)();
12905
+ const requestId = (0, import_crypto4.randomUUID)();
12576
12906
  const envelope = {
12577
12907
  kind: "request",
12578
12908
  requestId,
@@ -33608,7 +33938,7 @@ function commandExists(command) {
33608
33938
  const trimmed = command.trim();
33609
33939
  if (!trimmed) return false;
33610
33940
  if (isExplicitCommand(trimmed)) {
33611
- return (0, import_fs5.existsSync)(expandExecutable(trimmed));
33941
+ return (0, import_fs6.existsSync)(expandExecutable(trimmed));
33612
33942
  }
33613
33943
  try {
33614
33944
  (0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
@@ -33739,14 +34069,14 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
33739
34069
  launchMode: "new"
33740
34070
  };
33741
34071
  }
33742
- var os15, path16, crypto4, import_fs5, import_child_process6, chalkModule, chalkApi, DaemonCliManager;
34072
+ var os15, path16, crypto4, import_fs6, import_child_process6, chalkModule, chalkApi, DaemonCliManager;
33743
34073
  var init_cli_manager = __esm({
33744
34074
  "../../oss/packages/daemon-core/src/commands/cli-manager.ts"() {
33745
34075
  "use strict";
33746
34076
  os15 = __toESM(require("os"));
33747
34077
  path16 = __toESM(require("path"));
33748
34078
  crypto4 = __toESM(require("crypto"));
33749
- import_fs5 = require("fs");
34079
+ import_fs6 = require("fs");
33750
34080
  import_child_process6 = require("child_process");
33751
34081
  init_source();
33752
34082
  init_provider_cli_adapter();
@@ -48102,6 +48432,7 @@ __export(src_exports, {
48102
48432
  DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
48103
48433
  DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS: () => DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS,
48104
48434
  DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
48435
+ DEFAULT_MESH_POLICY: () => DEFAULT_MESH_POLICY,
48105
48436
  DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
48106
48437
  DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
48107
48438
  DEFAULT_SESSION_HOST_READY_TIMEOUT_MS: () => DEFAULT_SESSION_HOST_READY_TIMEOUT_MS,
@@ -48135,11 +48466,13 @@ __export(src_exports, {
48135
48466
  SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
48136
48467
  TurnSnapshotTracker: () => TurnSnapshotTracker,
48137
48468
  VersionArchive: () => VersionArchive,
48469
+ addNode: () => addNode,
48138
48470
  appendRecentActivity: () => appendRecentActivity,
48139
48471
  buildAssistantChatMessage: () => buildAssistantChatMessage,
48140
48472
  buildChatMessage: () => buildChatMessage,
48141
48473
  buildChatMessageSignature: () => buildChatMessageSignature,
48142
48474
  buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
48475
+ buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
48143
48476
  buildMachineInfo: () => buildMachineInfo,
48144
48477
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
48145
48478
  buildRuntimeSystemChatMessage: () => buildRuntimeSystemChatMessage,
@@ -48162,6 +48495,8 @@ __export(src_exports, {
48162
48495
  createGitSnapshotStore: () => createGitSnapshotStore,
48163
48496
  createGitWorkspaceMonitor: () => createGitWorkspaceMonitor,
48164
48497
  createInteractionId: () => createInteractionId,
48498
+ createMesh: () => createMesh,
48499
+ deleteMesh: () => deleteMesh,
48165
48500
  detectAllVersions: () => detectAllVersions,
48166
48501
  detectCLIs: () => detectCLIs,
48167
48502
  detectIDEs: () => detectIDEs,
@@ -48180,6 +48515,8 @@ __export(src_exports, {
48180
48515
  getGitRepoStatus: () => getGitRepoStatus,
48181
48516
  getHostMemorySnapshot: () => getHostMemorySnapshot,
48182
48517
  getLogLevel: () => getLogLevel,
48518
+ getMesh: () => getMesh,
48519
+ getMeshByRepo: () => getMeshByRepo,
48183
48520
  getNpmExecOptions: () => getNpmExecOptions,
48184
48521
  getRecentActivity: () => getRecentActivity,
48185
48522
  getRecentCommands: () => getRecentCommands,
@@ -48210,6 +48547,7 @@ __export(src_exports, {
48210
48547
  launchIDE: () => launchIDE,
48211
48548
  launchWithCdp: () => launchWithCdp,
48212
48549
  listHostedCliRuntimes: () => listHostedCliRuntimes,
48550
+ listMeshes: () => listMeshes,
48213
48551
  loadConfig: () => loadConfig,
48214
48552
  loadState: () => loadState,
48215
48553
  logCommand: () => logCommand,
@@ -48225,6 +48563,7 @@ __export(src_exports, {
48225
48563
  normalizeInputEnvelope: () => normalizeInputEnvelope,
48226
48564
  normalizeManagedStatus: () => normalizeManagedStatus,
48227
48565
  normalizeMessageParts: () => normalizeMessageParts,
48566
+ normalizeRepoIdentity: () => normalizeRepoIdentity,
48228
48567
  normalizeSessionModalFields: () => normalizeSessionModalFields,
48229
48568
  parsePorcelainV2Status: () => parsePorcelainV2Status,
48230
48569
  parseProviderSourceConfigUpdate: () => parseProviderSourceConfigUpdate,
@@ -48236,6 +48575,7 @@ __export(src_exports, {
48236
48575
  readChatHistory: () => readChatHistory,
48237
48576
  recordDebugTrace: () => recordDebugTrace,
48238
48577
  registerExtensionProviders: () => registerExtensionProviders,
48578
+ removeNode: () => removeNode,
48239
48579
  resetConfig: () => resetConfig,
48240
48580
  resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
48241
48581
  resetState: () => resetState,
@@ -48258,17 +48598,24 @@ __export(src_exports, {
48258
48598
  spawnDetachedDaemonUpgradeHelper: () => spawnDetachedDaemonUpgradeHelper,
48259
48599
  startDaemonDevSupport: () => startDaemonDevSupport,
48260
48600
  summarizeGitStatus: () => summarizeGitStatus,
48601
+ syncMeshes: () => syncMeshes,
48261
48602
  updateConfig: () => updateConfig,
48603
+ updateMesh: () => updateMesh,
48604
+ updateNode: () => updateNode,
48262
48605
  upsertSavedProviderSession: () => upsertSavedProviderSession
48263
48606
  });
48264
48607
  var init_src = __esm({
48265
48608
  "../../oss/packages/daemon-core/src/index.ts"() {
48266
48609
  "use strict";
48610
+ init_repo_mesh_types();
48267
48611
  init_git();
48268
48612
  init_config();
48269
48613
  init_workspaces();
48270
48614
  init_recent_activity();
48271
48615
  init_saved_sessions();
48616
+ init_mesh_config();
48617
+ init_coordinator_prompt();
48618
+ init_mesh_sync();
48272
48619
  init_state_store();
48273
48620
  init_ide_detector();
48274
48621
  init_cli_detector();
@@ -50237,7 +50584,7 @@ var require_filesystem = __commonJS({
50237
50584
  var LDD_PATH = "/usr/bin/ldd";
50238
50585
  var SELF_PATH = "/proc/self/exe";
50239
50586
  var MAX_LENGTH = 2048;
50240
- var readFileSync19 = (path33) => {
50587
+ var readFileSync20 = (path33) => {
50241
50588
  const fd = fs20.openSync(path33, "r");
50242
50589
  const buffer = Buffer.alloc(MAX_LENGTH);
50243
50590
  const bytesRead = fs20.readSync(fd, buffer, 0, MAX_LENGTH, 0);
@@ -50262,7 +50609,7 @@ var require_filesystem = __commonJS({
50262
50609
  module2.exports = {
50263
50610
  LDD_PATH,
50264
50611
  SELF_PATH,
50265
- readFileSync: readFileSync19,
50612
+ readFileSync: readFileSync20,
50266
50613
  readFile: readFile2
50267
50614
  };
50268
50615
  }
@@ -50311,7 +50658,7 @@ var require_detect_libc = __commonJS({
50311
50658
  "use strict";
50312
50659
  var childProcess = require("child_process");
50313
50660
  var { isLinux: isLinux2, getReport } = require_process();
50314
- var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync: readFileSync19 } = require_filesystem();
50661
+ var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync: readFileSync20 } = require_filesystem();
50315
50662
  var { interpreterPath } = require_elf();
50316
50663
  var cachedFamilyInterpreter;
50317
50664
  var cachedFamilyFilesystem;
@@ -50403,7 +50750,7 @@ var require_detect_libc = __commonJS({
50403
50750
  }
50404
50751
  cachedFamilyFilesystem = null;
50405
50752
  try {
50406
- const lddContent = readFileSync19(LDD_PATH);
50753
+ const lddContent = readFileSync20(LDD_PATH);
50407
50754
  cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
50408
50755
  } catch (e) {
50409
50756
  }
@@ -50428,7 +50775,7 @@ var require_detect_libc = __commonJS({
50428
50775
  }
50429
50776
  cachedFamilyInterpreter = null;
50430
50777
  try {
50431
- const selfContent = readFileSync19(SELF_PATH);
50778
+ const selfContent = readFileSync20(SELF_PATH);
50432
50779
  const path33 = interpreterPath(selfContent);
50433
50780
  cachedFamilyInterpreter = familyFromInterpreterPath(path33);
50434
50781
  } catch (e) {
@@ -50492,7 +50839,7 @@ var require_detect_libc = __commonJS({
50492
50839
  }
50493
50840
  cachedVersionFilesystem = null;
50494
50841
  try {
50495
- const lddContent = readFileSync19(LDD_PATH);
50842
+ const lddContent = readFileSync20(LDD_PATH);
50496
50843
  const versionMatch = lddContent.match(RE_GLIBC_VERSION);
50497
50844
  if (versionMatch) {
50498
50845
  cachedVersionFilesystem = versionMatch[1];
@@ -57903,25 +58250,25 @@ function resolvePackageVersion(options) {
57903
58250
  const injectedVersion = options?.injectedVersion || "unknown";
57904
58251
  const dir = options?.dirname || __dirname;
57905
58252
  const possiblePaths = [
57906
- (0, import_path3.join)(dir, "..", "..", "package.json"),
57907
- (0, import_path3.join)(dir, "..", "package.json"),
57908
- (0, import_path3.join)(dir, "package.json")
58253
+ (0, import_path4.join)(dir, "..", "..", "package.json"),
58254
+ (0, import_path4.join)(dir, "..", "package.json"),
58255
+ (0, import_path4.join)(dir, "package.json")
57909
58256
  ];
57910
58257
  for (const p of possiblePaths) {
57911
58258
  try {
57912
- const data = JSON.parse((0, import_fs6.readFileSync)(p, "utf-8"));
58259
+ const data = JSON.parse((0, import_fs7.readFileSync)(p, "utf-8"));
57913
58260
  if (data.version) return data.version;
57914
58261
  } catch {
57915
58262
  }
57916
58263
  }
57917
58264
  return injectedVersion;
57918
58265
  }
57919
- var import_fs6, import_path3;
58266
+ var import_fs7, import_path4;
57920
58267
  var init_version = __esm({
57921
58268
  "src/version.ts"() {
57922
58269
  "use strict";
57923
- import_fs6 = require("fs");
57924
- import_path3 = require("path");
58270
+ import_fs7 = require("fs");
58271
+ import_path4 = require("path");
57925
58272
  }
57926
58273
  });
57927
58274
 
@@ -58250,7 +58597,7 @@ var init_adhdev_daemon = __esm({
58250
58597
  init_version();
58251
58598
  init_src();
58252
58599
  init_runtime_defaults();
58253
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.66" });
58600
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.67" });
58254
58601
  AdhdevDaemon = class _AdhdevDaemon {
58255
58602
  localHttpServer = null;
58256
58603
  localWss = null;
@@ -74118,7 +74465,7 @@ var require_buffer_list = __commonJS({
74118
74465
  }
74119
74466
  }, {
74120
74467
  key: "join",
74121
- value: function join31(s) {
74468
+ value: function join32(s) {
74122
74469
  if (this.length === 0) return "";
74123
74470
  var p = this.head;
74124
74471
  var ret = "" + p.data;
@@ -88177,13 +88524,13 @@ function splitStringBySpace(str) {
88177
88524
  }
88178
88525
  return pieces;
88179
88526
  }
88180
- var import_chardet, import_child_process14, import_fs7, import_node_path2, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
88527
+ var import_chardet, import_child_process14, import_fs8, import_node_path2, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
88181
88528
  var init_esm2 = __esm({
88182
88529
  "../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
88183
88530
  "use strict";
88184
88531
  import_chardet = __toESM(require_lib2(), 1);
88185
88532
  import_child_process14 = require("child_process");
88186
- import_fs7 = require("fs");
88533
+ import_fs8 = require("fs");
88187
88534
  import_node_path2 = __toESM(require("path"), 1);
88188
88535
  import_node_os4 = __toESM(require("os"), 1);
88189
88536
  import_node_crypto2 = require("crypto");
@@ -88259,14 +88606,14 @@ var init_esm2 = __esm({
88259
88606
  if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
88260
88607
  opt.mode = this.fileOptions.mode;
88261
88608
  }
88262
- (0, import_fs7.writeFileSync)(this.tempFile, this.text, opt);
88609
+ (0, import_fs8.writeFileSync)(this.tempFile, this.text, opt);
88263
88610
  } catch (createFileError) {
88264
88611
  throw new CreateFileError(createFileError);
88265
88612
  }
88266
88613
  }
88267
88614
  readTemporaryFile() {
88268
88615
  try {
88269
- const tempFileBuffer = (0, import_fs7.readFileSync)(this.tempFile);
88616
+ const tempFileBuffer = (0, import_fs8.readFileSync)(this.tempFile);
88270
88617
  if (tempFileBuffer.length === 0) {
88271
88618
  this.text = "";
88272
88619
  } else {
@@ -88282,7 +88629,7 @@ var init_esm2 = __esm({
88282
88629
  }
88283
88630
  removeTemporaryFile() {
88284
88631
  try {
88285
- (0, import_fs7.unlinkSync)(this.tempFile);
88632
+ (0, import_fs8.unlinkSync)(this.tempFile);
88286
88633
  } catch (removeFileError) {
88287
88634
  throw new RemoveFileError(removeFileError);
88288
88635
  }