adhdev 0.9.66 → 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/cli/index.js +838 -57
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +543 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +427 -10
- package/vendor/mcp-server/index.js.map +1 -1
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,343 @@ var init_saved_sessions = __esm({
|
|
|
2162
2178
|
}
|
|
2163
2179
|
});
|
|
2164
2180
|
|
|
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
|
+
});
|
|
2195
|
+
function getMeshConfigPath() {
|
|
2196
|
+
return (0, import_path2.join)(getConfigDir(), "meshes.json");
|
|
2197
|
+
}
|
|
2198
|
+
function loadMeshConfig() {
|
|
2199
|
+
const path33 = getMeshConfigPath();
|
|
2200
|
+
if (!(0, import_fs2.existsSync)(path33)) return { meshes: [] };
|
|
2201
|
+
try {
|
|
2202
|
+
const raw = JSON.parse((0, import_fs2.readFileSync)(path33, "utf-8"));
|
|
2203
|
+
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
2204
|
+
return raw;
|
|
2205
|
+
} catch {
|
|
2206
|
+
return { meshes: [] };
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
function saveMeshConfig(config2) {
|
|
2210
|
+
const path33 = getMeshConfigPath();
|
|
2211
|
+
(0, import_fs2.writeFileSync)(path33, JSON.stringify(config2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
2212
|
+
}
|
|
2213
|
+
function normalizeRepoIdentity(remoteUrl) {
|
|
2214
|
+
let identity = remoteUrl.trim();
|
|
2215
|
+
if (identity.startsWith("http://") || identity.startsWith("https://")) {
|
|
2216
|
+
try {
|
|
2217
|
+
const url2 = new URL(identity);
|
|
2218
|
+
const path33 = url2.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
2219
|
+
return `${url2.hostname}/${path33}`;
|
|
2220
|
+
} catch {
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
const sshMatch = identity.match(/^(?:ssh:\/\/)?[\w.-]+@([\w.-]+)[:/]([\w.\-/]+?)(?:\.git)?$/);
|
|
2224
|
+
if (sshMatch) return `${sshMatch[1]}/${sshMatch[2]}`;
|
|
2225
|
+
return identity;
|
|
2226
|
+
}
|
|
2227
|
+
function listMeshes() {
|
|
2228
|
+
return loadMeshConfig().meshes;
|
|
2229
|
+
}
|
|
2230
|
+
function getMesh(meshId) {
|
|
2231
|
+
return loadMeshConfig().meshes.find((m) => m.id === meshId);
|
|
2232
|
+
}
|
|
2233
|
+
function getMeshByRepo(repoIdentity) {
|
|
2234
|
+
return loadMeshConfig().meshes.find((m) => m.repoIdentity === repoIdentity);
|
|
2235
|
+
}
|
|
2236
|
+
function createMesh(opts) {
|
|
2237
|
+
const config2 = loadMeshConfig();
|
|
2238
|
+
if (config2.meshes.length >= 20) {
|
|
2239
|
+
throw new Error("Maximum 20 meshes allowed");
|
|
2240
|
+
}
|
|
2241
|
+
const repoIdentity = opts.repoIdentity || (opts.repoRemoteUrl ? normalizeRepoIdentity(opts.repoRemoteUrl) : "");
|
|
2242
|
+
if (!repoIdentity) throw new Error("Either repoRemoteUrl or repoIdentity is required");
|
|
2243
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2244
|
+
const mesh = {
|
|
2245
|
+
id: `mesh_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`,
|
|
2246
|
+
name: opts.name.trim().slice(0, 100),
|
|
2247
|
+
repoIdentity,
|
|
2248
|
+
repoRemoteUrl: opts.repoRemoteUrl,
|
|
2249
|
+
defaultBranch: opts.defaultBranch,
|
|
2250
|
+
policy: { ...DEFAULT_MESH_POLICY, ...opts.policy },
|
|
2251
|
+
coordinator: opts.coordinator || {},
|
|
2252
|
+
nodes: [],
|
|
2253
|
+
createdAt: now,
|
|
2254
|
+
updatedAt: now
|
|
2255
|
+
};
|
|
2256
|
+
config2.meshes.push(mesh);
|
|
2257
|
+
saveMeshConfig(config2);
|
|
2258
|
+
return mesh;
|
|
2259
|
+
}
|
|
2260
|
+
function updateMesh(meshId, opts) {
|
|
2261
|
+
const config2 = loadMeshConfig();
|
|
2262
|
+
const mesh = config2.meshes.find((m) => m.id === meshId);
|
|
2263
|
+
if (!mesh) return void 0;
|
|
2264
|
+
if (opts.name !== void 0) mesh.name = opts.name.trim().slice(0, 100);
|
|
2265
|
+
if (opts.defaultBranch !== void 0) mesh.defaultBranch = opts.defaultBranch;
|
|
2266
|
+
if (opts.policy) mesh.policy = { ...mesh.policy, ...opts.policy };
|
|
2267
|
+
if (opts.coordinator) mesh.coordinator = opts.coordinator;
|
|
2268
|
+
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2269
|
+
saveMeshConfig(config2);
|
|
2270
|
+
return mesh;
|
|
2271
|
+
}
|
|
2272
|
+
function deleteMesh(meshId) {
|
|
2273
|
+
const config2 = loadMeshConfig();
|
|
2274
|
+
const idx = config2.meshes.findIndex((m) => m.id === meshId);
|
|
2275
|
+
if (idx === -1) return false;
|
|
2276
|
+
config2.meshes.splice(idx, 1);
|
|
2277
|
+
saveMeshConfig(config2);
|
|
2278
|
+
return true;
|
|
2279
|
+
}
|
|
2280
|
+
function addNode(meshId, opts) {
|
|
2281
|
+
const config2 = loadMeshConfig();
|
|
2282
|
+
const mesh = config2.meshes.find((m) => m.id === meshId);
|
|
2283
|
+
if (!mesh) return void 0;
|
|
2284
|
+
if (mesh.nodes.length >= 10) {
|
|
2285
|
+
throw new Error("Maximum 10 nodes per mesh");
|
|
2286
|
+
}
|
|
2287
|
+
if (mesh.nodes.some((n) => n.workspace === opts.workspace)) {
|
|
2288
|
+
throw new Error("This workspace is already in the mesh");
|
|
2289
|
+
}
|
|
2290
|
+
const node = {
|
|
2291
|
+
id: `node_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`,
|
|
2292
|
+
workspace: opts.workspace.trim(),
|
|
2293
|
+
repoRoot: opts.repoRoot,
|
|
2294
|
+
userOverrides: opts.userOverrides || {},
|
|
2295
|
+
policy: opts.policy || {},
|
|
2296
|
+
isLocalWorktree: opts.isLocalWorktree
|
|
2297
|
+
};
|
|
2298
|
+
mesh.nodes.push(node);
|
|
2299
|
+
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2300
|
+
saveMeshConfig(config2);
|
|
2301
|
+
return node;
|
|
2302
|
+
}
|
|
2303
|
+
function removeNode(meshId, nodeId) {
|
|
2304
|
+
const config2 = loadMeshConfig();
|
|
2305
|
+
const mesh = config2.meshes.find((m) => m.id === meshId);
|
|
2306
|
+
if (!mesh) return false;
|
|
2307
|
+
const idx = mesh.nodes.findIndex((n) => n.id === nodeId);
|
|
2308
|
+
if (idx === -1) return false;
|
|
2309
|
+
mesh.nodes.splice(idx, 1);
|
|
2310
|
+
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2311
|
+
saveMeshConfig(config2);
|
|
2312
|
+
return true;
|
|
2313
|
+
}
|
|
2314
|
+
function updateNode(meshId, nodeId, opts) {
|
|
2315
|
+
const config2 = loadMeshConfig();
|
|
2316
|
+
const mesh = config2.meshes.find((m) => m.id === meshId);
|
|
2317
|
+
if (!mesh) return void 0;
|
|
2318
|
+
const node = mesh.nodes.find((n) => n.id === nodeId);
|
|
2319
|
+
if (!node) return void 0;
|
|
2320
|
+
if (opts.userOverrides) node.userOverrides = { ...node.userOverrides, ...opts.userOverrides };
|
|
2321
|
+
if (opts.policy) node.policy = { ...node.policy, ...opts.policy };
|
|
2322
|
+
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2323
|
+
saveMeshConfig(config2);
|
|
2324
|
+
return node;
|
|
2325
|
+
}
|
|
2326
|
+
var import_fs2, import_path2, import_crypto3;
|
|
2327
|
+
var init_mesh_config = __esm({
|
|
2328
|
+
"../../oss/packages/daemon-core/src/config/mesh-config.ts"() {
|
|
2329
|
+
"use strict";
|
|
2330
|
+
import_fs2 = require("fs");
|
|
2331
|
+
import_path2 = require("path");
|
|
2332
|
+
import_crypto3 = require("crypto");
|
|
2333
|
+
init_config();
|
|
2334
|
+
init_repo_mesh_types();
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
|
|
2338
|
+
// ../../oss/packages/daemon-core/src/mesh/coordinator-prompt.ts
|
|
2339
|
+
var coordinator_prompt_exports = {};
|
|
2340
|
+
__export(coordinator_prompt_exports, {
|
|
2341
|
+
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt
|
|
2342
|
+
});
|
|
2343
|
+
function buildCoordinatorSystemPrompt(ctx) {
|
|
2344
|
+
const { mesh, status, userInstruction } = ctx;
|
|
2345
|
+
const sections = [];
|
|
2346
|
+
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.
|
|
2347
|
+
|
|
2348
|
+
Your mesh: **${mesh.name}**
|
|
2349
|
+
Repository: \`${mesh.repoIdentity}\`${mesh.defaultBranch ? `
|
|
2350
|
+
Default branch: \`${mesh.defaultBranch}\`` : ""}`);
|
|
2351
|
+
if (status?.nodes?.length) {
|
|
2352
|
+
sections.push(buildNodeStatusSection(status.nodes));
|
|
2353
|
+
} else if (mesh.nodes.length) {
|
|
2354
|
+
sections.push(buildNodeConfigSection(mesh));
|
|
2355
|
+
} else {
|
|
2356
|
+
sections.push("## Nodes\nNo nodes configured yet. Ask the user to add nodes with `adhdev mesh add-node`.");
|
|
2357
|
+
}
|
|
2358
|
+
sections.push(buildPolicySection(mesh.policy));
|
|
2359
|
+
sections.push(TOOLS_SECTION);
|
|
2360
|
+
sections.push(WORKFLOW_SECTION);
|
|
2361
|
+
sections.push(RULES_SECTION);
|
|
2362
|
+
if (userInstruction) {
|
|
2363
|
+
sections.push(`## Additional Context
|
|
2364
|
+
${userInstruction}`);
|
|
2365
|
+
}
|
|
2366
|
+
if (mesh.coordinator.systemPromptSuffix) {
|
|
2367
|
+
sections.push(mesh.coordinator.systemPromptSuffix);
|
|
2368
|
+
}
|
|
2369
|
+
return sections.join("\n\n");
|
|
2370
|
+
}
|
|
2371
|
+
function buildNodeStatusSection(nodes) {
|
|
2372
|
+
const lines = ["## Current Node Status", ""];
|
|
2373
|
+
for (const n of nodes) {
|
|
2374
|
+
const healthIcon = n.health === "online" ? "\u{1F7E2}" : n.health === "dirty" ? "\u{1F7E1}" : n.health === "offline" ? "\u26AB" : "\u{1F534}";
|
|
2375
|
+
const sessions = n.activeSessions.length > 0 ? `sessions: ${n.activeSessions.join(", ")}` : "no active sessions";
|
|
2376
|
+
const branch = n.git?.branch ? `branch: \`${n.git.branch}\`` : "";
|
|
2377
|
+
lines.push(`- ${healthIcon} **${n.machineLabel}** (${n.nodeId})`);
|
|
2378
|
+
lines.push(` workspace: \`${n.workspace}\` | ${branch} | ${sessions}`);
|
|
2379
|
+
if (n.error) lines.push(` \u26A0\uFE0F ${n.error}`);
|
|
2380
|
+
}
|
|
2381
|
+
return lines.join("\n");
|
|
2382
|
+
}
|
|
2383
|
+
function buildNodeConfigSection(mesh) {
|
|
2384
|
+
const lines = ["## Configured Nodes", ""];
|
|
2385
|
+
for (const n of mesh.nodes) {
|
|
2386
|
+
const labels = [];
|
|
2387
|
+
if (n.isLocalWorktree) labels.push("worktree");
|
|
2388
|
+
if (n.policy.readOnly) labels.push("read-only");
|
|
2389
|
+
const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
|
|
2390
|
+
lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
|
|
2391
|
+
}
|
|
2392
|
+
lines.push("", "_Use `mesh_status` to probe live health before delegating work._");
|
|
2393
|
+
return lines.join("\n");
|
|
2394
|
+
}
|
|
2395
|
+
function buildPolicySection(policy) {
|
|
2396
|
+
const rules = [];
|
|
2397
|
+
if (policy.requirePreTaskCheckpoint) rules.push("- Create a git checkpoint **before** starting each task");
|
|
2398
|
+
if (policy.requirePostTaskCheckpoint) rules.push("- Create a git checkpoint **after** each task completes");
|
|
2399
|
+
if (policy.requireApprovalForPush) rules.push("- **Ask for user approval** before pushing to remote");
|
|
2400
|
+
if (policy.requireApprovalForDestructiveGit) rules.push("- **Ask for user approval** before destructive git operations (force push, reset, etc.)");
|
|
2401
|
+
const dirtyBehavior = {
|
|
2402
|
+
block: "- **Do not** send tasks to nodes with dirty workspaces",
|
|
2403
|
+
warn: "- Warn the user if a node has uncommitted changes before sending a task",
|
|
2404
|
+
checkpoint_then_continue: "- Auto-checkpoint dirty nodes before sending tasks"
|
|
2405
|
+
}[policy.dirtyWorkspaceBehavior] || "";
|
|
2406
|
+
if (dirtyBehavior) rules.push(dirtyBehavior);
|
|
2407
|
+
rules.push(`- Maximum **${policy.maxParallelTasks}** tasks running in parallel`);
|
|
2408
|
+
return `## Policy
|
|
2409
|
+
${rules.join("\n")}`;
|
|
2410
|
+
}
|
|
2411
|
+
var TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION;
|
|
2412
|
+
var init_coordinator_prompt = __esm({
|
|
2413
|
+
"../../oss/packages/daemon-core/src/mesh/coordinator-prompt.ts"() {
|
|
2414
|
+
"use strict";
|
|
2415
|
+
TOOLS_SECTION = `## Available Tools
|
|
2416
|
+
|
|
2417
|
+
| Tool | Purpose |
|
|
2418
|
+
|------|---------|
|
|
2419
|
+
| \`mesh_status\` | Check all nodes' health, git state, and active sessions |
|
|
2420
|
+
| \`mesh_list_nodes\` | List nodes with workspace paths |
|
|
2421
|
+
| \`mesh_launch_session\` | Start a new agent session on a node |
|
|
2422
|
+
| \`mesh_send_task\` | Send a task (natural language) to a running agent |
|
|
2423
|
+
| \`mesh_read_chat\` | Read an agent's recent messages to check progress |
|
|
2424
|
+
| \`mesh_git_status\` | Check git status on a specific node |
|
|
2425
|
+
| \`mesh_checkpoint\` | Create a git checkpoint on a node |
|
|
2426
|
+
| \`mesh_approve\` | Approve/reject a pending agent action |`;
|
|
2427
|
+
WORKFLOW_SECTION = `## Orchestration Workflow
|
|
2428
|
+
|
|
2429
|
+
1. **Assess** \u2014 Call \`mesh_status\` to see which nodes are healthy and available.
|
|
2430
|
+
2. **Plan** \u2014 Decompose the user's request into independent tasks for parallel execution, or sequential tasks when dependencies exist.
|
|
2431
|
+
3. **Delegate** \u2014 For each task:
|
|
2432
|
+
a. Pick the best node (consider: health, dirty state, current workload).
|
|
2433
|
+
b. If no session exists, call \`mesh_launch_session\` to start one.
|
|
2434
|
+
c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
|
|
2435
|
+
4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
|
|
2436
|
+
5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
|
|
2437
|
+
6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
|
|
2438
|
+
7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
|
|
2439
|
+
RULES_SECTION = `## Rules
|
|
2440
|
+
|
|
2441
|
+
- **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
|
|
2442
|
+
- **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
|
|
2443
|
+
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
|
|
2444
|
+
- **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
|
|
2445
|
+
- **Keep the user informed.** Report progress after each delegation round.
|
|
2446
|
+
- **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
|
|
2447
|
+
- **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
|
|
2448
|
+
}
|
|
2449
|
+
});
|
|
2450
|
+
|
|
2451
|
+
// ../../oss/packages/daemon-core/src/mesh/mesh-sync.ts
|
|
2452
|
+
async function syncMeshes(transport) {
|
|
2453
|
+
const result = { pushed: 0, pulled: 0, deleted: 0, errors: [] };
|
|
2454
|
+
let remoteMeshes;
|
|
2455
|
+
try {
|
|
2456
|
+
const res = await transport.listRemoteMeshes();
|
|
2457
|
+
remoteMeshes = res.meshes;
|
|
2458
|
+
} catch (e) {
|
|
2459
|
+
result.errors.push(`Failed to list remote meshes: ${e.message}`);
|
|
2460
|
+
return result;
|
|
2461
|
+
}
|
|
2462
|
+
const localMeshes = listMeshes();
|
|
2463
|
+
const remoteByIdentity = new Map(remoteMeshes.map((m) => [m.repo_identity, m]));
|
|
2464
|
+
const localByIdentity = new Map(localMeshes.map((m) => [m.repoIdentity, m]));
|
|
2465
|
+
for (const local of localMeshes) {
|
|
2466
|
+
if (!remoteByIdentity.has(local.repoIdentity)) {
|
|
2467
|
+
try {
|
|
2468
|
+
await transport.createRemoteMesh({
|
|
2469
|
+
name: local.name,
|
|
2470
|
+
repo_identity: local.repoIdentity,
|
|
2471
|
+
repo_remote_url: local.repoRemoteUrl,
|
|
2472
|
+
default_branch: local.defaultBranch,
|
|
2473
|
+
policy: JSON.stringify(local.policy)
|
|
2474
|
+
});
|
|
2475
|
+
result.pushed++;
|
|
2476
|
+
} catch (e) {
|
|
2477
|
+
result.errors.push(`Push failed for "${local.name}": ${e.message}`);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
for (const remote of remoteMeshes) {
|
|
2482
|
+
if (!localByIdentity.has(remote.repo_identity)) {
|
|
2483
|
+
try {
|
|
2484
|
+
let policy;
|
|
2485
|
+
try {
|
|
2486
|
+
policy = JSON.parse(remote.policy);
|
|
2487
|
+
} catch {
|
|
2488
|
+
policy = void 0;
|
|
2489
|
+
}
|
|
2490
|
+
createMesh({
|
|
2491
|
+
name: remote.name,
|
|
2492
|
+
repoIdentity: remote.repo_identity,
|
|
2493
|
+
repoRemoteUrl: remote.repo_remote_url || void 0,
|
|
2494
|
+
defaultBranch: remote.default_branch || void 0,
|
|
2495
|
+
policy
|
|
2496
|
+
});
|
|
2497
|
+
result.pulled++;
|
|
2498
|
+
} catch (e) {
|
|
2499
|
+
result.errors.push(`Pull failed for "${remote.name}": ${e.message}`);
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
return result;
|
|
2504
|
+
}
|
|
2505
|
+
var init_mesh_sync = __esm({
|
|
2506
|
+
"../../oss/packages/daemon-core/src/mesh/mesh-sync.ts"() {
|
|
2507
|
+
"use strict";
|
|
2508
|
+
init_mesh_config();
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
|
|
2165
2512
|
// ../../oss/packages/daemon-core/src/config/state-store.ts
|
|
2166
2513
|
function isPlainObject2(value) {
|
|
2167
2514
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
2168
2515
|
}
|
|
2169
2516
|
function getStatePath() {
|
|
2170
|
-
return (0,
|
|
2517
|
+
return (0, import_path3.join)(getConfigDir(), "state.json");
|
|
2171
2518
|
}
|
|
2172
2519
|
function normalizeState(raw) {
|
|
2173
2520
|
const parsed = isPlainObject2(raw) ? raw : {};
|
|
@@ -2203,11 +2550,11 @@ function normalizeState(raw) {
|
|
|
2203
2550
|
}
|
|
2204
2551
|
function loadState() {
|
|
2205
2552
|
const statePath = getStatePath();
|
|
2206
|
-
if (!(0,
|
|
2553
|
+
if (!(0, import_fs3.existsSync)(statePath)) {
|
|
2207
2554
|
return { ...DEFAULT_STATE };
|
|
2208
2555
|
}
|
|
2209
2556
|
try {
|
|
2210
|
-
const raw = (0,
|
|
2557
|
+
const raw = (0, import_fs3.readFileSync)(statePath, "utf-8");
|
|
2211
2558
|
return normalizeState(JSON.parse(raw));
|
|
2212
2559
|
} catch {
|
|
2213
2560
|
return { ...DEFAULT_STATE };
|
|
@@ -2216,17 +2563,17 @@ function loadState() {
|
|
|
2216
2563
|
function saveState(state) {
|
|
2217
2564
|
const statePath = getStatePath();
|
|
2218
2565
|
const normalized = normalizeState(state);
|
|
2219
|
-
(0,
|
|
2566
|
+
(0, import_fs3.writeFileSync)(statePath, JSON.stringify(normalized, null, 2), { encoding: "utf-8", mode: 384 });
|
|
2220
2567
|
}
|
|
2221
2568
|
function resetState() {
|
|
2222
2569
|
saveState({ ...DEFAULT_STATE });
|
|
2223
2570
|
}
|
|
2224
|
-
var
|
|
2571
|
+
var import_fs3, import_path3, DEFAULT_STATE;
|
|
2225
2572
|
var init_state_store = __esm({
|
|
2226
2573
|
"../../oss/packages/daemon-core/src/config/state-store.ts"() {
|
|
2227
2574
|
"use strict";
|
|
2228
|
-
|
|
2229
|
-
|
|
2575
|
+
import_fs3 = require("fs");
|
|
2576
|
+
import_path3 = require("path");
|
|
2230
2577
|
init_config();
|
|
2231
2578
|
DEFAULT_STATE = {
|
|
2232
2579
|
recentActivity: [],
|
|
@@ -2259,7 +2606,7 @@ function findCliCommand(command) {
|
|
|
2259
2606
|
if (path7.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~")) {
|
|
2260
2607
|
const candidate = trimmed.startsWith("~") ? path7.join((0, import_os2.homedir)(), trimmed.slice(1)) : trimmed;
|
|
2261
2608
|
const resolved = path7.isAbsolute(candidate) ? candidate : path7.resolve(candidate);
|
|
2262
|
-
return (0,
|
|
2609
|
+
return (0, import_fs4.existsSync)(resolved) ? resolved : null;
|
|
2263
2610
|
}
|
|
2264
2611
|
try {
|
|
2265
2612
|
const result = (0, import_child_process.execSync)(
|
|
@@ -2290,9 +2637,9 @@ function checkPathExists(paths) {
|
|
|
2290
2637
|
if (normalized.includes("*")) {
|
|
2291
2638
|
const username = home.split(/[\\/]/).pop() || "";
|
|
2292
2639
|
const resolved = normalized.replace("*", username);
|
|
2293
|
-
if ((0,
|
|
2640
|
+
if ((0, import_fs4.existsSync)(resolved)) return resolved;
|
|
2294
2641
|
} else {
|
|
2295
|
-
if ((0,
|
|
2642
|
+
if ((0, import_fs4.existsSync)(normalized)) return normalized;
|
|
2296
2643
|
}
|
|
2297
2644
|
}
|
|
2298
2645
|
return null;
|
|
@@ -2306,7 +2653,7 @@ async function detectIDEs(providerLoader) {
|
|
|
2306
2653
|
let resolvedCli = cliPath;
|
|
2307
2654
|
if (!resolvedCli && appPath && os29 === "darwin") {
|
|
2308
2655
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
2309
|
-
if ((0,
|
|
2656
|
+
if ((0, import_fs4.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
2310
2657
|
}
|
|
2311
2658
|
if (!resolvedCli && appPath && os29 === "win32") {
|
|
2312
2659
|
const { dirname: dirname10 } = await import("path");
|
|
@@ -2319,7 +2666,7 @@ async function detectIDEs(providerLoader) {
|
|
|
2319
2666
|
`${appDir}\\\\resources\\\\app\\\\bin\\\\${def.cli}.cmd`
|
|
2320
2667
|
];
|
|
2321
2668
|
for (const c of candidates) {
|
|
2322
|
-
if ((0,
|
|
2669
|
+
if ((0, import_fs4.existsSync)(c)) {
|
|
2323
2670
|
resolvedCli = c;
|
|
2324
2671
|
break;
|
|
2325
2672
|
}
|
|
@@ -2340,12 +2687,12 @@ async function detectIDEs(providerLoader) {
|
|
|
2340
2687
|
}
|
|
2341
2688
|
return results;
|
|
2342
2689
|
}
|
|
2343
|
-
var import_child_process,
|
|
2690
|
+
var import_child_process, import_fs4, import_os2, path7, BUILTIN_IDE_DEFINITIONS, registeredIDEs;
|
|
2344
2691
|
var init_ide_detector = __esm({
|
|
2345
2692
|
"../../oss/packages/daemon-core/src/detection/ide-detector.ts"() {
|
|
2346
2693
|
"use strict";
|
|
2347
2694
|
import_child_process = require("child_process");
|
|
2348
|
-
|
|
2695
|
+
import_fs4 = require("fs");
|
|
2349
2696
|
import_os2 = require("os");
|
|
2350
2697
|
path7 = __toESM(require("path"));
|
|
2351
2698
|
BUILTIN_IDE_DEFINITIONS = [];
|
|
@@ -2377,7 +2724,7 @@ function resolveCommandPath(command) {
|
|
|
2377
2724
|
if (isExplicitCommandPath(trimmed)) {
|
|
2378
2725
|
const expanded = expandHome(trimmed);
|
|
2379
2726
|
const candidate = path8.isAbsolute(expanded) ? expanded : path8.resolve(expanded);
|
|
2380
|
-
return (0,
|
|
2727
|
+
return (0, import_fs5.existsSync)(candidate) ? candidate : null;
|
|
2381
2728
|
}
|
|
2382
2729
|
return null;
|
|
2383
2730
|
}
|
|
@@ -2477,14 +2824,14 @@ async function detectCLI(cliId, providerLoader, options) {
|
|
|
2477
2824
|
const all = await detectCLIs(providerLoader, options);
|
|
2478
2825
|
return all.find((c) => c.id === resolvedId && c.installed) || null;
|
|
2479
2826
|
}
|
|
2480
|
-
var import_child_process2, os2, path8,
|
|
2827
|
+
var import_child_process2, os2, path8, import_fs5;
|
|
2481
2828
|
var init_cli_detector = __esm({
|
|
2482
2829
|
"../../oss/packages/daemon-core/src/detection/cli-detector.ts"() {
|
|
2483
2830
|
"use strict";
|
|
2484
2831
|
import_child_process2 = require("child_process");
|
|
2485
2832
|
os2 = __toESM(require("os"));
|
|
2486
2833
|
path8 = __toESM(require("path"));
|
|
2487
|
-
|
|
2834
|
+
import_fs5 = require("fs");
|
|
2488
2835
|
}
|
|
2489
2836
|
});
|
|
2490
2837
|
|
|
@@ -12494,14 +12841,14 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
|
|
|
12494
12841
|
} catch {
|
|
12495
12842
|
}
|
|
12496
12843
|
}
|
|
12497
|
-
var os9, path22, net,
|
|
12844
|
+
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
12845
|
var init_dist = __esm({
|
|
12499
12846
|
"../../oss/packages/session-host-core/dist/index.mjs"() {
|
|
12500
12847
|
"use strict";
|
|
12501
12848
|
os9 = __toESM(require("os"), 1);
|
|
12502
12849
|
path22 = __toESM(require("path"), 1);
|
|
12503
12850
|
net = __toESM(require("net"), 1);
|
|
12504
|
-
|
|
12851
|
+
import_crypto4 = require("crypto");
|
|
12505
12852
|
os22 = __toESM(require("os"), 1);
|
|
12506
12853
|
path32 = __toESM(require("path"), 1);
|
|
12507
12854
|
__require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -12572,7 +12919,7 @@ var init_dist = __esm({
|
|
|
12572
12919
|
async request(request) {
|
|
12573
12920
|
await this.connect();
|
|
12574
12921
|
if (!this.socket) throw new Error("Session host socket unavailable");
|
|
12575
|
-
const requestId = (0,
|
|
12922
|
+
const requestId = (0, import_crypto4.randomUUID)();
|
|
12576
12923
|
const envelope = {
|
|
12577
12924
|
kind: "request",
|
|
12578
12925
|
requestId,
|
|
@@ -33608,7 +33955,7 @@ function commandExists(command) {
|
|
|
33608
33955
|
const trimmed = command.trim();
|
|
33609
33956
|
if (!trimmed) return false;
|
|
33610
33957
|
if (isExplicitCommand(trimmed)) {
|
|
33611
|
-
return (0,
|
|
33958
|
+
return (0, import_fs6.existsSync)(expandExecutable(trimmed));
|
|
33612
33959
|
}
|
|
33613
33960
|
try {
|
|
33614
33961
|
(0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
@@ -33739,14 +34086,14 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
|
|
|
33739
34086
|
launchMode: "new"
|
|
33740
34087
|
};
|
|
33741
34088
|
}
|
|
33742
|
-
var os15, path16, crypto4,
|
|
34089
|
+
var os15, path16, crypto4, import_fs6, import_child_process6, chalkModule, chalkApi, DaemonCliManager;
|
|
33743
34090
|
var init_cli_manager = __esm({
|
|
33744
34091
|
"../../oss/packages/daemon-core/src/commands/cli-manager.ts"() {
|
|
33745
34092
|
"use strict";
|
|
33746
34093
|
os15 = __toESM(require("os"));
|
|
33747
34094
|
path16 = __toESM(require("path"));
|
|
33748
34095
|
crypto4 = __toESM(require("crypto"));
|
|
33749
|
-
|
|
34096
|
+
import_fs6 = require("fs");
|
|
33750
34097
|
import_child_process6 = require("child_process");
|
|
33751
34098
|
init_source();
|
|
33752
34099
|
init_provider_cli_adapter();
|
|
@@ -39964,6 +40311,142 @@ var init_router = __esm({
|
|
|
39964
40311
|
updateConfig({ machineNickname: nickname || null });
|
|
39965
40312
|
return { success: true };
|
|
39966
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
|
+
}
|
|
39967
40450
|
default:
|
|
39968
40451
|
break;
|
|
39969
40452
|
}
|
|
@@ -48102,6 +48585,7 @@ __export(src_exports, {
|
|
|
48102
48585
|
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
48103
48586
|
DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS: () => DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
48104
48587
|
DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
48588
|
+
DEFAULT_MESH_POLICY: () => DEFAULT_MESH_POLICY,
|
|
48105
48589
|
DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
|
|
48106
48590
|
DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
48107
48591
|
DEFAULT_SESSION_HOST_READY_TIMEOUT_MS: () => DEFAULT_SESSION_HOST_READY_TIMEOUT_MS,
|
|
@@ -48135,11 +48619,13 @@ __export(src_exports, {
|
|
|
48135
48619
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
48136
48620
|
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
48137
48621
|
VersionArchive: () => VersionArchive,
|
|
48622
|
+
addNode: () => addNode,
|
|
48138
48623
|
appendRecentActivity: () => appendRecentActivity,
|
|
48139
48624
|
buildAssistantChatMessage: () => buildAssistantChatMessage,
|
|
48140
48625
|
buildChatMessage: () => buildChatMessage,
|
|
48141
48626
|
buildChatMessageSignature: () => buildChatMessageSignature,
|
|
48142
48627
|
buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
|
|
48628
|
+
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
|
|
48143
48629
|
buildMachineInfo: () => buildMachineInfo,
|
|
48144
48630
|
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
48145
48631
|
buildRuntimeSystemChatMessage: () => buildRuntimeSystemChatMessage,
|
|
@@ -48162,6 +48648,8 @@ __export(src_exports, {
|
|
|
48162
48648
|
createGitSnapshotStore: () => createGitSnapshotStore,
|
|
48163
48649
|
createGitWorkspaceMonitor: () => createGitWorkspaceMonitor,
|
|
48164
48650
|
createInteractionId: () => createInteractionId,
|
|
48651
|
+
createMesh: () => createMesh,
|
|
48652
|
+
deleteMesh: () => deleteMesh,
|
|
48165
48653
|
detectAllVersions: () => detectAllVersions,
|
|
48166
48654
|
detectCLIs: () => detectCLIs,
|
|
48167
48655
|
detectIDEs: () => detectIDEs,
|
|
@@ -48180,6 +48668,8 @@ __export(src_exports, {
|
|
|
48180
48668
|
getGitRepoStatus: () => getGitRepoStatus,
|
|
48181
48669
|
getHostMemorySnapshot: () => getHostMemorySnapshot,
|
|
48182
48670
|
getLogLevel: () => getLogLevel,
|
|
48671
|
+
getMesh: () => getMesh,
|
|
48672
|
+
getMeshByRepo: () => getMeshByRepo,
|
|
48183
48673
|
getNpmExecOptions: () => getNpmExecOptions,
|
|
48184
48674
|
getRecentActivity: () => getRecentActivity,
|
|
48185
48675
|
getRecentCommands: () => getRecentCommands,
|
|
@@ -48210,6 +48700,7 @@ __export(src_exports, {
|
|
|
48210
48700
|
launchIDE: () => launchIDE,
|
|
48211
48701
|
launchWithCdp: () => launchWithCdp,
|
|
48212
48702
|
listHostedCliRuntimes: () => listHostedCliRuntimes,
|
|
48703
|
+
listMeshes: () => listMeshes,
|
|
48213
48704
|
loadConfig: () => loadConfig,
|
|
48214
48705
|
loadState: () => loadState,
|
|
48215
48706
|
logCommand: () => logCommand,
|
|
@@ -48225,6 +48716,7 @@ __export(src_exports, {
|
|
|
48225
48716
|
normalizeInputEnvelope: () => normalizeInputEnvelope,
|
|
48226
48717
|
normalizeManagedStatus: () => normalizeManagedStatus,
|
|
48227
48718
|
normalizeMessageParts: () => normalizeMessageParts,
|
|
48719
|
+
normalizeRepoIdentity: () => normalizeRepoIdentity,
|
|
48228
48720
|
normalizeSessionModalFields: () => normalizeSessionModalFields,
|
|
48229
48721
|
parsePorcelainV2Status: () => parsePorcelainV2Status,
|
|
48230
48722
|
parseProviderSourceConfigUpdate: () => parseProviderSourceConfigUpdate,
|
|
@@ -48236,6 +48728,7 @@ __export(src_exports, {
|
|
|
48236
48728
|
readChatHistory: () => readChatHistory,
|
|
48237
48729
|
recordDebugTrace: () => recordDebugTrace,
|
|
48238
48730
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
48731
|
+
removeNode: () => removeNode,
|
|
48239
48732
|
resetConfig: () => resetConfig,
|
|
48240
48733
|
resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
|
|
48241
48734
|
resetState: () => resetState,
|
|
@@ -48258,17 +48751,24 @@ __export(src_exports, {
|
|
|
48258
48751
|
spawnDetachedDaemonUpgradeHelper: () => spawnDetachedDaemonUpgradeHelper,
|
|
48259
48752
|
startDaemonDevSupport: () => startDaemonDevSupport,
|
|
48260
48753
|
summarizeGitStatus: () => summarizeGitStatus,
|
|
48754
|
+
syncMeshes: () => syncMeshes,
|
|
48261
48755
|
updateConfig: () => updateConfig,
|
|
48756
|
+
updateMesh: () => updateMesh,
|
|
48757
|
+
updateNode: () => updateNode,
|
|
48262
48758
|
upsertSavedProviderSession: () => upsertSavedProviderSession
|
|
48263
48759
|
});
|
|
48264
48760
|
var init_src = __esm({
|
|
48265
48761
|
"../../oss/packages/daemon-core/src/index.ts"() {
|
|
48266
48762
|
"use strict";
|
|
48763
|
+
init_repo_mesh_types();
|
|
48267
48764
|
init_git();
|
|
48268
48765
|
init_config();
|
|
48269
48766
|
init_workspaces();
|
|
48270
48767
|
init_recent_activity();
|
|
48271
48768
|
init_saved_sessions();
|
|
48769
|
+
init_mesh_config();
|
|
48770
|
+
init_coordinator_prompt();
|
|
48771
|
+
init_mesh_sync();
|
|
48272
48772
|
init_state_store();
|
|
48273
48773
|
init_ide_detector();
|
|
48274
48774
|
init_cli_detector();
|
|
@@ -50237,7 +50737,7 @@ var require_filesystem = __commonJS({
|
|
|
50237
50737
|
var LDD_PATH = "/usr/bin/ldd";
|
|
50238
50738
|
var SELF_PATH = "/proc/self/exe";
|
|
50239
50739
|
var MAX_LENGTH = 2048;
|
|
50240
|
-
var
|
|
50740
|
+
var readFileSync20 = (path33) => {
|
|
50241
50741
|
const fd = fs20.openSync(path33, "r");
|
|
50242
50742
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
50243
50743
|
const bytesRead = fs20.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -50262,7 +50762,7 @@ var require_filesystem = __commonJS({
|
|
|
50262
50762
|
module2.exports = {
|
|
50263
50763
|
LDD_PATH,
|
|
50264
50764
|
SELF_PATH,
|
|
50265
|
-
readFileSync:
|
|
50765
|
+
readFileSync: readFileSync20,
|
|
50266
50766
|
readFile: readFile2
|
|
50267
50767
|
};
|
|
50268
50768
|
}
|
|
@@ -50311,7 +50811,7 @@ var require_detect_libc = __commonJS({
|
|
|
50311
50811
|
"use strict";
|
|
50312
50812
|
var childProcess = require("child_process");
|
|
50313
50813
|
var { isLinux: isLinux2, getReport } = require_process();
|
|
50314
|
-
var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync:
|
|
50814
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync: readFileSync20 } = require_filesystem();
|
|
50315
50815
|
var { interpreterPath } = require_elf();
|
|
50316
50816
|
var cachedFamilyInterpreter;
|
|
50317
50817
|
var cachedFamilyFilesystem;
|
|
@@ -50403,7 +50903,7 @@ var require_detect_libc = __commonJS({
|
|
|
50403
50903
|
}
|
|
50404
50904
|
cachedFamilyFilesystem = null;
|
|
50405
50905
|
try {
|
|
50406
|
-
const lddContent =
|
|
50906
|
+
const lddContent = readFileSync20(LDD_PATH);
|
|
50407
50907
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
50408
50908
|
} catch (e) {
|
|
50409
50909
|
}
|
|
@@ -50428,7 +50928,7 @@ var require_detect_libc = __commonJS({
|
|
|
50428
50928
|
}
|
|
50429
50929
|
cachedFamilyInterpreter = null;
|
|
50430
50930
|
try {
|
|
50431
|
-
const selfContent =
|
|
50931
|
+
const selfContent = readFileSync20(SELF_PATH);
|
|
50432
50932
|
const path33 = interpreterPath(selfContent);
|
|
50433
50933
|
cachedFamilyInterpreter = familyFromInterpreterPath(path33);
|
|
50434
50934
|
} catch (e) {
|
|
@@ -50492,7 +50992,7 @@ var require_detect_libc = __commonJS({
|
|
|
50492
50992
|
}
|
|
50493
50993
|
cachedVersionFilesystem = null;
|
|
50494
50994
|
try {
|
|
50495
|
-
const lddContent =
|
|
50995
|
+
const lddContent = readFileSync20(LDD_PATH);
|
|
50496
50996
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
50497
50997
|
if (versionMatch) {
|
|
50498
50998
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -57903,25 +58403,25 @@ function resolvePackageVersion(options) {
|
|
|
57903
58403
|
const injectedVersion = options?.injectedVersion || "unknown";
|
|
57904
58404
|
const dir = options?.dirname || __dirname;
|
|
57905
58405
|
const possiblePaths = [
|
|
57906
|
-
(0,
|
|
57907
|
-
(0,
|
|
57908
|
-
(0,
|
|
58406
|
+
(0, import_path4.join)(dir, "..", "..", "package.json"),
|
|
58407
|
+
(0, import_path4.join)(dir, "..", "package.json"),
|
|
58408
|
+
(0, import_path4.join)(dir, "package.json")
|
|
57909
58409
|
];
|
|
57910
58410
|
for (const p of possiblePaths) {
|
|
57911
58411
|
try {
|
|
57912
|
-
const data = JSON.parse((0,
|
|
58412
|
+
const data = JSON.parse((0, import_fs7.readFileSync)(p, "utf-8"));
|
|
57913
58413
|
if (data.version) return data.version;
|
|
57914
58414
|
} catch {
|
|
57915
58415
|
}
|
|
57916
58416
|
}
|
|
57917
58417
|
return injectedVersion;
|
|
57918
58418
|
}
|
|
57919
|
-
var
|
|
58419
|
+
var import_fs7, import_path4;
|
|
57920
58420
|
var init_version = __esm({
|
|
57921
58421
|
"src/version.ts"() {
|
|
57922
58422
|
"use strict";
|
|
57923
|
-
|
|
57924
|
-
|
|
58423
|
+
import_fs7 = require("fs");
|
|
58424
|
+
import_path4 = require("path");
|
|
57925
58425
|
}
|
|
57926
58426
|
});
|
|
57927
58427
|
|
|
@@ -58250,7 +58750,7 @@ var init_adhdev_daemon = __esm({
|
|
|
58250
58750
|
init_version();
|
|
58251
58751
|
init_src();
|
|
58252
58752
|
init_runtime_defaults();
|
|
58253
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
58753
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.68" });
|
|
58254
58754
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
58255
58755
|
localHttpServer = null;
|
|
58256
58756
|
localWss = null;
|
|
@@ -74118,7 +74618,7 @@ var require_buffer_list = __commonJS({
|
|
|
74118
74618
|
}
|
|
74119
74619
|
}, {
|
|
74120
74620
|
key: "join",
|
|
74121
|
-
value: function
|
|
74621
|
+
value: function join32(s) {
|
|
74122
74622
|
if (this.length === 0) return "";
|
|
74123
74623
|
var p = this.head;
|
|
74124
74624
|
var ret = "" + p.data;
|
|
@@ -88177,13 +88677,13 @@ function splitStringBySpace(str) {
|
|
|
88177
88677
|
}
|
|
88178
88678
|
return pieces;
|
|
88179
88679
|
}
|
|
88180
|
-
var import_chardet, import_child_process14,
|
|
88680
|
+
var import_chardet, import_child_process14, import_fs8, import_node_path2, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
|
|
88181
88681
|
var init_esm2 = __esm({
|
|
88182
88682
|
"../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
|
|
88183
88683
|
"use strict";
|
|
88184
88684
|
import_chardet = __toESM(require_lib2(), 1);
|
|
88185
88685
|
import_child_process14 = require("child_process");
|
|
88186
|
-
|
|
88686
|
+
import_fs8 = require("fs");
|
|
88187
88687
|
import_node_path2 = __toESM(require("path"), 1);
|
|
88188
88688
|
import_node_os4 = __toESM(require("os"), 1);
|
|
88189
88689
|
import_node_crypto2 = require("crypto");
|
|
@@ -88259,14 +88759,14 @@ var init_esm2 = __esm({
|
|
|
88259
88759
|
if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
|
|
88260
88760
|
opt.mode = this.fileOptions.mode;
|
|
88261
88761
|
}
|
|
88262
|
-
(0,
|
|
88762
|
+
(0, import_fs8.writeFileSync)(this.tempFile, this.text, opt);
|
|
88263
88763
|
} catch (createFileError) {
|
|
88264
88764
|
throw new CreateFileError(createFileError);
|
|
88265
88765
|
}
|
|
88266
88766
|
}
|
|
88267
88767
|
readTemporaryFile() {
|
|
88268
88768
|
try {
|
|
88269
|
-
const tempFileBuffer = (0,
|
|
88769
|
+
const tempFileBuffer = (0, import_fs8.readFileSync)(this.tempFile);
|
|
88270
88770
|
if (tempFileBuffer.length === 0) {
|
|
88271
88771
|
this.text = "";
|
|
88272
88772
|
} else {
|
|
@@ -88282,7 +88782,7 @@ var init_esm2 = __esm({
|
|
|
88282
88782
|
}
|
|
88283
88783
|
removeTemporaryFile() {
|
|
88284
88784
|
try {
|
|
88285
|
-
(0,
|
|
88785
|
+
(0, import_fs8.unlinkSync)(this.tempFile);
|
|
88286
88786
|
} catch (removeFileError) {
|
|
88287
88787
|
throw new RemoveFileError(removeFileError);
|
|
88288
88788
|
}
|