@adhdev/daemon-core 0.9.74 → 0.9.76-rc.1
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-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/config/config.d.ts +3 -0
- package/dist/index.js +57 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -19
- package/dist/index.mjs.map +1 -1
- package/dist/repo-mesh-types.d.ts +1 -0
- package/package.json +2 -2
- package/src/cli-adapters/provider-cli-adapter.ts +23 -4
- package/src/commands/mesh-coordinator.ts +5 -0
- package/src/commands/router.ts +40 -11
- package/src/config/config.ts +6 -0
- package/src/mesh/coordinator-prompt.ts +7 -5
- package/src/repo-mesh-types.ts +1 -0
- package/node_modules/@adhdev/session-host-core/dist/defaults.d.mts +0 -6
- package/node_modules/@adhdev/session-host-core/dist/defaults.d.ts +0 -6
- package/node_modules/@adhdev/session-host-core/dist/defaults.js +0 -49
- package/node_modules/@adhdev/session-host-core/dist/defaults.js.map +0 -1
- package/node_modules/@adhdev/session-host-core/dist/defaults.mjs +0 -21
- package/node_modules/@adhdev/session-host-core/dist/defaults.mjs.map +0 -1
- package/node_modules/@adhdev/session-host-core/dist/index.d.mts +0 -444
- package/node_modules/@adhdev/session-host-core/dist/index.d.ts +0 -444
- package/node_modules/@adhdev/session-host-core/dist/index.js +0 -702
- package/node_modules/@adhdev/session-host-core/dist/index.js.map +0 -1
- package/node_modules/@adhdev/session-host-core/dist/index.mjs +0 -648
- package/node_modules/@adhdev/session-host-core/dist/index.mjs.map +0 -1
- package/node_modules/@adhdev/session-host-core/package.json +0 -49
package/dist/index.mjs
CHANGED
|
@@ -128,6 +128,7 @@ function normalizeConfig(raw) {
|
|
|
128
128
|
ideSettings: isPlainObject(parsed.ideSettings) ? parsed.ideSettings : {},
|
|
129
129
|
providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
|
|
130
130
|
providerDir: asOptionalString(parsed.providerDir),
|
|
131
|
+
updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
|
|
131
132
|
terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
|
|
132
133
|
};
|
|
133
134
|
}
|
|
@@ -273,6 +274,7 @@ var init_config = __esm({
|
|
|
273
274
|
machineProviders: {},
|
|
274
275
|
ideSettings: {},
|
|
275
276
|
providerSourceMode: "normal",
|
|
277
|
+
updateChannel: "stable",
|
|
276
278
|
terminalSizingMode: "measured"
|
|
277
279
|
};
|
|
278
280
|
MACHINE_ID_PREFIX = "mach_";
|
|
@@ -485,7 +487,7 @@ function buildNodeConfigSection(mesh) {
|
|
|
485
487
|
for (const n of mesh.nodes) {
|
|
486
488
|
const labels = [];
|
|
487
489
|
if (n.isLocalWorktree) labels.push("worktree");
|
|
488
|
-
if (n.policy
|
|
490
|
+
if (n.policy?.readOnly) labels.push("read-only");
|
|
489
491
|
const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
|
|
490
492
|
lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
|
|
491
493
|
}
|
|
@@ -531,18 +533,20 @@ var init_coordinator_prompt = __esm({
|
|
|
531
533
|
3. **Delegate** \u2014 For each task:
|
|
532
534
|
a. Pick the best node (consider: health, dirty state, current workload).
|
|
533
535
|
b. If no session exists, call \`mesh_launch_session\` to start one.
|
|
534
|
-
c. Call \`mesh_send_task\` with a
|
|
536
|
+
c. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
|
|
535
537
|
4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
|
|
536
538
|
5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
|
|
537
539
|
6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
|
|
538
540
|
7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
|
|
539
541
|
RULES_SECTION = `## Rules
|
|
540
542
|
|
|
541
|
-
- **
|
|
542
|
-
- **
|
|
543
|
+
- **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
|
|
544
|
+
- **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to a node. Do not do it yourself.
|
|
545
|
+
- **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
|
|
546
|
+
- **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
|
|
543
547
|
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
|
|
544
548
|
- **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
|
|
545
|
-
- **Keep the user informed.** Report progress after each delegation round.
|
|
549
|
+
- **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
|
|
546
550
|
- **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
|
|
547
551
|
- **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
|
|
548
552
|
}
|
|
@@ -1754,6 +1758,17 @@ var init_provider_cli_adapter = __esm({
|
|
|
1754
1758
|
this.lastScreenSnapshotReadAt = now;
|
|
1755
1759
|
return screenText;
|
|
1756
1760
|
}
|
|
1761
|
+
getParseScreenText(screenText) {
|
|
1762
|
+
const currentSnapshot = normalizeScreenSnapshot(screenText);
|
|
1763
|
+
const lastSnapshot = this.lastScreenSnapshot;
|
|
1764
|
+
if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
|
|
1765
|
+
const staleSnapshotLooksActive = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(lastSnapshot);
|
|
1766
|
+
const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:\n|\r|$)/.test(screenText) && !/\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(screenText);
|
|
1767
|
+
if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
|
|
1768
|
+
if (currentSnapshot.length >= lastSnapshot.length) return screenText;
|
|
1769
|
+
return `${screenText}
|
|
1770
|
+
${lastSnapshot}`;
|
|
1771
|
+
}
|
|
1757
1772
|
shouldReadTerminalScreenSnapshot(now) {
|
|
1758
1773
|
if (!this.lastScreenText) return true;
|
|
1759
1774
|
return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
|
|
@@ -2744,12 +2759,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
2744
2759
|
}
|
|
2745
2760
|
try {
|
|
2746
2761
|
const screenText = this.terminalScreen.getText();
|
|
2762
|
+
const parseScreenText = this.getParseScreenText(screenText);
|
|
2747
2763
|
const tail = this.recentOutputBuffer.slice(-500);
|
|
2748
2764
|
const input = buildCliParseInput({
|
|
2749
2765
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2750
2766
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
2751
2767
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2752
|
-
terminalScreenText:
|
|
2768
|
+
terminalScreenText: parseScreenText,
|
|
2753
2769
|
baseMessages: [],
|
|
2754
2770
|
partialResponse: this.responseBuffer,
|
|
2755
2771
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -2843,8 +2859,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
2843
2859
|
*/
|
|
2844
2860
|
getScriptParsedStatus() {
|
|
2845
2861
|
const screenText = this.readTerminalScreenText();
|
|
2862
|
+
const parseScreenText = this.getParseScreenText(screenText);
|
|
2846
2863
|
const cached = this.parsedStatusCache;
|
|
2847
|
-
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText ===
|
|
2864
|
+
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText === parseScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
|
|
2848
2865
|
return cached.result;
|
|
2849
2866
|
}
|
|
2850
2867
|
const parsed = this.runParseSession();
|
|
@@ -2872,7 +2889,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2872
2889
|
currentTurnScope: this.currentTurnScope,
|
|
2873
2890
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2874
2891
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2875
|
-
screenText,
|
|
2892
|
+
screenText: parseScreenText,
|
|
2876
2893
|
currentStatus: this.currentStatus,
|
|
2877
2894
|
activeModal: this.activeModal,
|
|
2878
2895
|
cliName: this.cliName,
|
|
@@ -2889,7 +2906,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2889
2906
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2890
2907
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
2891
2908
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2892
|
-
terminalScreenText: this.terminalScreen.getText(),
|
|
2909
|
+
terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
|
|
2893
2910
|
baseMessages: [],
|
|
2894
2911
|
partialResponse: this.responseBuffer,
|
|
2895
2912
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -19905,6 +19922,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
|
19905
19922
|
addCandidate(resolve13(dir, "../vendor/mcp-server/index.js"));
|
|
19906
19923
|
addCandidate(resolve13(dir, "../../vendor/mcp-server/index.js"));
|
|
19907
19924
|
addCandidate(resolve13(dir, "../../../vendor/mcp-server/index.js"));
|
|
19925
|
+
addCandidate(resolve13(dir, "../../mcp-server/dist/index.js"));
|
|
19926
|
+
addCandidate(resolve13(dir, "../../../mcp-server/dist/index.js"));
|
|
19908
19927
|
};
|
|
19909
19928
|
addPackagedCandidates(process.argv[1]);
|
|
19910
19929
|
for (const candidate of candidates) {
|
|
@@ -20582,6 +20601,17 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
|
|
|
20582
20601
|
|
|
20583
20602
|
// src/commands/router.ts
|
|
20584
20603
|
import * as fs10 from "fs";
|
|
20604
|
+
var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
|
|
20605
|
+
function normalizeReleaseChannel(value) {
|
|
20606
|
+
if (typeof value !== "string") return null;
|
|
20607
|
+
const normalized = value.trim().toLowerCase();
|
|
20608
|
+
if (normalized === "stable" || normalized === "latest") return "stable";
|
|
20609
|
+
if (normalized === "preview" || normalized === "next") return "preview";
|
|
20610
|
+
return null;
|
|
20611
|
+
}
|
|
20612
|
+
function resolveUpgradeChannel(args) {
|
|
20613
|
+
return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
|
|
20614
|
+
}
|
|
20585
20615
|
var CHAT_COMMANDS = [
|
|
20586
20616
|
"send_chat",
|
|
20587
20617
|
"new_chat",
|
|
@@ -21264,8 +21294,10 @@ var DaemonCommandRouter = class {
|
|
|
21264
21294
|
const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
|
|
21265
21295
|
const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
|
|
21266
21296
|
const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
|
|
21267
|
-
const
|
|
21268
|
-
|
|
21297
|
+
const channel = resolveUpgradeChannel(args);
|
|
21298
|
+
const npmTag = CHANNEL_NPM_TAG[channel];
|
|
21299
|
+
const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
21300
|
+
LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
|
|
21269
21301
|
let currentInstalled = null;
|
|
21270
21302
|
try {
|
|
21271
21303
|
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
@@ -21279,8 +21311,8 @@ var DaemonCommandRouter = class {
|
|
|
21279
21311
|
}
|
|
21280
21312
|
const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
|
|
21281
21313
|
if (currentInstalled === latest && runningVersion === latest) {
|
|
21282
|
-
LOG.info("Upgrade", `Already on
|
|
21283
|
-
return { success: true, upgraded: false, alreadyLatest: true, version: latest };
|
|
21314
|
+
LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
|
|
21315
|
+
return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
|
|
21284
21316
|
}
|
|
21285
21317
|
if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
|
|
21286
21318
|
LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
|
|
@@ -21293,12 +21325,12 @@ var DaemonCommandRouter = class {
|
|
|
21293
21325
|
cwd: process.cwd(),
|
|
21294
21326
|
sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
|
|
21295
21327
|
});
|
|
21296
|
-
LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
|
|
21328
|
+
LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
|
|
21297
21329
|
setTimeout(() => {
|
|
21298
21330
|
LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
|
|
21299
21331
|
process.exit(0);
|
|
21300
21332
|
}, 3e3);
|
|
21301
|
-
return { success: true, upgraded: true, version: latest, restarting: true };
|
|
21333
|
+
return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
|
|
21302
21334
|
} catch (e) {
|
|
21303
21335
|
LOG.error("Upgrade", `Failed: ${e.message}`);
|
|
21304
21336
|
return { success: false, error: e.message };
|
|
@@ -21462,14 +21494,20 @@ var DaemonCommandRouter = class {
|
|
|
21462
21494
|
} catch {
|
|
21463
21495
|
}
|
|
21464
21496
|
}
|
|
21497
|
+
const mcpServerEntry = {
|
|
21498
|
+
command: coordinatorSetup.mcpServer.command,
|
|
21499
|
+
args: coordinatorSetup.mcpServer.args
|
|
21500
|
+
};
|
|
21501
|
+
if (args?.inlineMesh) {
|
|
21502
|
+
mcpServerEntry.env = {
|
|
21503
|
+
ADHDEV_INLINE_MESH: JSON.stringify(mesh)
|
|
21504
|
+
};
|
|
21505
|
+
}
|
|
21465
21506
|
const mcpConfig = {
|
|
21466
21507
|
...existingMcpConfig,
|
|
21467
21508
|
mcpServers: {
|
|
21468
21509
|
...existingMcpConfig.mcpServers || {},
|
|
21469
|
-
[coordinatorSetup.serverName]:
|
|
21470
|
-
command: coordinatorSetup.mcpServer.command,
|
|
21471
|
-
args: coordinatorSetup.mcpServer.args
|
|
21472
|
-
}
|
|
21510
|
+
[coordinatorSetup.serverName]: mcpServerEntry
|
|
21473
21511
|
}
|
|
21474
21512
|
};
|
|
21475
21513
|
writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
|