@adhdev/daemon-core 0.9.74 → 0.9.75
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 +46 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -14
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +17 -4
- package/src/commands/mesh-coordinator.ts +5 -0
- package/src/commands/router.ts +40 -11
- package/src/config/config.ts +6 -0
|
@@ -106,6 +106,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
106
106
|
private getBufferState;
|
|
107
107
|
private recordBoundedAppendDrop;
|
|
108
108
|
private readTerminalScreenText;
|
|
109
|
+
private getParseScreenText;
|
|
109
110
|
private shouldReadTerminalScreenSnapshot;
|
|
110
111
|
private resetTerminalScreen;
|
|
111
112
|
private getFreshParsedStatusCache;
|
package/dist/config/config.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type { RecentActivityEntry } from './recent-activity.js';
|
|
|
9
9
|
export type { SavedProviderSessionEntry } from './saved-sessions.js';
|
|
10
10
|
export type { DaemonState } from './state-store.js';
|
|
11
11
|
export type ProviderSourceMode = 'normal' | 'no-upstream';
|
|
12
|
+
export type ReleaseChannel = 'stable' | 'preview';
|
|
12
13
|
export declare function resolveProviderSourceMode(providerSourceMode: unknown, legacyDisableUpstream: unknown): ProviderSourceMode;
|
|
13
14
|
export interface MachineProviderCheckResult {
|
|
14
15
|
ok: boolean;
|
|
@@ -70,6 +71,8 @@ export interface ADHDevConfig {
|
|
|
70
71
|
disableUpstream?: boolean;
|
|
71
72
|
providerSourceMode?: ProviderSourceMode;
|
|
72
73
|
providerDir?: string;
|
|
74
|
+
/** Preferred daemon update channel. Defaults to stable/latest. */
|
|
75
|
+
updateChannel?: ReleaseChannel;
|
|
73
76
|
/**
|
|
74
77
|
* Browser terminal sizing behavior for dashboard CLI panes.
|
|
75
78
|
* Default `measured` keeps terminal size daemon-authoritative.
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ function normalizeConfig(raw) {
|
|
|
129
129
|
ideSettings: isPlainObject(parsed.ideSettings) ? parsed.ideSettings : {},
|
|
130
130
|
providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
|
|
131
131
|
providerDir: asOptionalString(parsed.providerDir),
|
|
132
|
+
updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
|
|
132
133
|
terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
|
|
133
134
|
};
|
|
134
135
|
}
|
|
@@ -278,6 +279,7 @@ var init_config = __esm({
|
|
|
278
279
|
machineProviders: {},
|
|
279
280
|
ideSettings: {},
|
|
280
281
|
providerSourceMode: "normal",
|
|
282
|
+
updateChannel: "stable",
|
|
281
283
|
terminalSizingMode: "measured"
|
|
282
284
|
};
|
|
283
285
|
MACHINE_ID_PREFIX = "mach_";
|
|
@@ -1758,6 +1760,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
1758
1760
|
this.lastScreenSnapshotReadAt = now;
|
|
1759
1761
|
return screenText;
|
|
1760
1762
|
}
|
|
1763
|
+
getParseScreenText(screenText) {
|
|
1764
|
+
const currentSnapshot = normalizeScreenSnapshot(screenText);
|
|
1765
|
+
const lastSnapshot = this.lastScreenSnapshot;
|
|
1766
|
+
if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
|
|
1767
|
+
return `${screenText}
|
|
1768
|
+
${lastSnapshot}`;
|
|
1769
|
+
}
|
|
1761
1770
|
shouldReadTerminalScreenSnapshot(now) {
|
|
1762
1771
|
if (!this.lastScreenText) return true;
|
|
1763
1772
|
return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
|
|
@@ -2748,12 +2757,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
2748
2757
|
}
|
|
2749
2758
|
try {
|
|
2750
2759
|
const screenText = this.terminalScreen.getText();
|
|
2760
|
+
const parseScreenText = this.getParseScreenText(screenText);
|
|
2751
2761
|
const tail = this.recentOutputBuffer.slice(-500);
|
|
2752
2762
|
const input = buildCliParseInput({
|
|
2753
2763
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2754
2764
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
2755
2765
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2756
|
-
terminalScreenText:
|
|
2766
|
+
terminalScreenText: parseScreenText,
|
|
2757
2767
|
baseMessages: [],
|
|
2758
2768
|
partialResponse: this.responseBuffer,
|
|
2759
2769
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -2847,8 +2857,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
2847
2857
|
*/
|
|
2848
2858
|
getScriptParsedStatus() {
|
|
2849
2859
|
const screenText = this.readTerminalScreenText();
|
|
2860
|
+
const parseScreenText = this.getParseScreenText(screenText);
|
|
2850
2861
|
const cached = this.parsedStatusCache;
|
|
2851
|
-
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText ===
|
|
2862
|
+
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) {
|
|
2852
2863
|
return cached.result;
|
|
2853
2864
|
}
|
|
2854
2865
|
const parsed = this.runParseSession();
|
|
@@ -2876,7 +2887,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2876
2887
|
currentTurnScope: this.currentTurnScope,
|
|
2877
2888
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2878
2889
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2879
|
-
screenText,
|
|
2890
|
+
screenText: parseScreenText,
|
|
2880
2891
|
currentStatus: this.currentStatus,
|
|
2881
2892
|
activeModal: this.activeModal,
|
|
2882
2893
|
cliName: this.cliName,
|
|
@@ -2893,7 +2904,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2893
2904
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2894
2905
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
2895
2906
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
2896
|
-
terminalScreenText: this.terminalScreen.getText(),
|
|
2907
|
+
terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
|
|
2897
2908
|
baseMessages: [],
|
|
2898
2909
|
partialResponse: this.responseBuffer,
|
|
2899
2910
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -20092,6 +20103,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
|
20092
20103
|
addCandidate((0, import_node_path.resolve)(dir, "../vendor/mcp-server/index.js"));
|
|
20093
20104
|
addCandidate((0, import_node_path.resolve)(dir, "../../vendor/mcp-server/index.js"));
|
|
20094
20105
|
addCandidate((0, import_node_path.resolve)(dir, "../../../vendor/mcp-server/index.js"));
|
|
20106
|
+
addCandidate((0, import_node_path.resolve)(dir, "../../mcp-server/dist/index.js"));
|
|
20107
|
+
addCandidate((0, import_node_path.resolve)(dir, "../../../mcp-server/dist/index.js"));
|
|
20095
20108
|
};
|
|
20096
20109
|
addPackagedCandidates(process.argv[1]);
|
|
20097
20110
|
for (const candidate of candidates) {
|
|
@@ -20769,6 +20782,17 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
|
|
|
20769
20782
|
|
|
20770
20783
|
// src/commands/router.ts
|
|
20771
20784
|
var fs10 = __toESM(require("fs"));
|
|
20785
|
+
var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
|
|
20786
|
+
function normalizeReleaseChannel(value) {
|
|
20787
|
+
if (typeof value !== "string") return null;
|
|
20788
|
+
const normalized = value.trim().toLowerCase();
|
|
20789
|
+
if (normalized === "stable" || normalized === "latest") return "stable";
|
|
20790
|
+
if (normalized === "preview" || normalized === "next") return "preview";
|
|
20791
|
+
return null;
|
|
20792
|
+
}
|
|
20793
|
+
function resolveUpgradeChannel(args) {
|
|
20794
|
+
return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
|
|
20795
|
+
}
|
|
20772
20796
|
var CHAT_COMMANDS = [
|
|
20773
20797
|
"send_chat",
|
|
20774
20798
|
"new_chat",
|
|
@@ -21451,8 +21475,10 @@ var DaemonCommandRouter = class {
|
|
|
21451
21475
|
const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
|
|
21452
21476
|
const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
|
|
21453
21477
|
const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
|
|
21454
|
-
const
|
|
21455
|
-
|
|
21478
|
+
const channel = resolveUpgradeChannel(args);
|
|
21479
|
+
const npmTag = CHANNEL_NPM_TAG[channel];
|
|
21480
|
+
const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
21481
|
+
LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
|
|
21456
21482
|
let currentInstalled = null;
|
|
21457
21483
|
try {
|
|
21458
21484
|
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
@@ -21466,8 +21492,8 @@ var DaemonCommandRouter = class {
|
|
|
21466
21492
|
}
|
|
21467
21493
|
const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
|
|
21468
21494
|
if (currentInstalled === latest && runningVersion === latest) {
|
|
21469
|
-
LOG.info("Upgrade", `Already on
|
|
21470
|
-
return { success: true, upgraded: false, alreadyLatest: true, version: latest };
|
|
21495
|
+
LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
|
|
21496
|
+
return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
|
|
21471
21497
|
}
|
|
21472
21498
|
if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
|
|
21473
21499
|
LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
|
|
@@ -21480,12 +21506,12 @@ var DaemonCommandRouter = class {
|
|
|
21480
21506
|
cwd: process.cwd(),
|
|
21481
21507
|
sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
|
|
21482
21508
|
});
|
|
21483
|
-
LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
|
|
21509
|
+
LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
|
|
21484
21510
|
setTimeout(() => {
|
|
21485
21511
|
LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
|
|
21486
21512
|
process.exit(0);
|
|
21487
21513
|
}, 3e3);
|
|
21488
|
-
return { success: true, upgraded: true, version: latest, restarting: true };
|
|
21514
|
+
return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
|
|
21489
21515
|
} catch (e) {
|
|
21490
21516
|
LOG.error("Upgrade", `Failed: ${e.message}`);
|
|
21491
21517
|
return { success: false, error: e.message };
|
|
@@ -21649,14 +21675,20 @@ var DaemonCommandRouter = class {
|
|
|
21649
21675
|
} catch {
|
|
21650
21676
|
}
|
|
21651
21677
|
}
|
|
21678
|
+
const mcpServerEntry = {
|
|
21679
|
+
command: coordinatorSetup.mcpServer.command,
|
|
21680
|
+
args: coordinatorSetup.mcpServer.args
|
|
21681
|
+
};
|
|
21682
|
+
if (args?.inlineMesh) {
|
|
21683
|
+
mcpServerEntry.env = {
|
|
21684
|
+
ADHDEV_INLINE_MESH: JSON.stringify(mesh)
|
|
21685
|
+
};
|
|
21686
|
+
}
|
|
21652
21687
|
const mcpConfig = {
|
|
21653
21688
|
...existingMcpConfig,
|
|
21654
21689
|
mcpServers: {
|
|
21655
21690
|
...existingMcpConfig.mcpServers || {},
|
|
21656
|
-
[coordinatorSetup.serverName]:
|
|
21657
|
-
command: coordinatorSetup.mcpServer.command,
|
|
21658
|
-
args: coordinatorSetup.mcpServer.args
|
|
21659
|
-
}
|
|
21691
|
+
[coordinatorSetup.serverName]: mcpServerEntry
|
|
21660
21692
|
}
|
|
21661
21693
|
};
|
|
21662
21694
|
writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
|