@adhdev/daemon-core 0.6.68 → 0.6.70
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.d.ts +50 -9
- package/dist/index.js +178 -59
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/agent-stream/forward.ts +29 -0
- package/src/cli-adapters/provider-cli-adapter.ts +34 -3
- package/src/config/config.ts +51 -16
- package/src/index.ts +3 -1
- package/src/status/reporter.ts +18 -48
- package/src/status/snapshot.ts +123 -0
package/dist/index.d.ts
CHANGED
|
@@ -170,6 +170,7 @@ interface ADHDevConfig {
|
|
|
170
170
|
machineNickname: string | null;
|
|
171
171
|
machineId?: string;
|
|
172
172
|
machineSecret?: string | null;
|
|
173
|
+
registeredMachineId?: string;
|
|
173
174
|
cliHistory: CliHistoryEntry[];
|
|
174
175
|
providerSettings: Record<string, Record<string, any>>;
|
|
175
176
|
ideSettings: Record<string, {
|
|
@@ -2264,15 +2265,8 @@ interface StatusReporterDeps {
|
|
|
2264
2265
|
resolve(type: string): any;
|
|
2265
2266
|
getAll(): any[];
|
|
2266
2267
|
};
|
|
2267
|
-
adapters: Map<string, {
|
|
2268
|
-
cliType: string;
|
|
2269
|
-
cliName: string;
|
|
2270
|
-
workingDir: string;
|
|
2271
|
-
getStatus(): any;
|
|
2272
|
-
getPartialResponse(): string;
|
|
2273
|
-
}>;
|
|
2274
2268
|
detectedIdes: any[];
|
|
2275
|
-
|
|
2269
|
+
instanceId: string;
|
|
2276
2270
|
daemonVersion?: string;
|
|
2277
2271
|
instanceManager: {
|
|
2278
2272
|
collectAllStates(): ProviderState[];
|
|
@@ -2378,6 +2372,44 @@ declare function buildAllManagedEntries(allStates: ProviderState[], cdpManagers:
|
|
|
2378
2372
|
managedAcps: ManagedAcpEntry[];
|
|
2379
2373
|
};
|
|
2380
2374
|
|
|
2375
|
+
/**
|
|
2376
|
+
* Shared status snapshot builders.
|
|
2377
|
+
*
|
|
2378
|
+
* Used by:
|
|
2379
|
+
* - DaemonStatusReporter (cloud)
|
|
2380
|
+
* - daemon-standalone HTTP/WS status responses
|
|
2381
|
+
*/
|
|
2382
|
+
|
|
2383
|
+
interface StatusSnapshotOptions {
|
|
2384
|
+
allStates: ProviderState[];
|
|
2385
|
+
cdpManagers: Map<string, unknown>;
|
|
2386
|
+
providerLoader: {
|
|
2387
|
+
getAll(): Array<{
|
|
2388
|
+
type: string;
|
|
2389
|
+
icon?: string;
|
|
2390
|
+
displayName?: string;
|
|
2391
|
+
category: 'ide' | 'extension' | 'cli' | 'acp';
|
|
2392
|
+
}>;
|
|
2393
|
+
};
|
|
2394
|
+
detectedIdes: Array<{
|
|
2395
|
+
id: string;
|
|
2396
|
+
name?: string;
|
|
2397
|
+
displayName?: string;
|
|
2398
|
+
installed?: boolean;
|
|
2399
|
+
path?: string;
|
|
2400
|
+
}>;
|
|
2401
|
+
instanceId: string;
|
|
2402
|
+
version: string;
|
|
2403
|
+
daemonMode: boolean;
|
|
2404
|
+
timestamp?: number;
|
|
2405
|
+
p2p?: StatusReportPayload['p2p'];
|
|
2406
|
+
machineNickname?: string | null;
|
|
2407
|
+
}
|
|
2408
|
+
interface StatusSnapshot extends StatusReportPayload {
|
|
2409
|
+
availableProviders: AvailableProviderInfo[];
|
|
2410
|
+
}
|
|
2411
|
+
declare function buildStatusSnapshot(options: StatusSnapshotOptions): StatusSnapshot;
|
|
2412
|
+
|
|
2381
2413
|
/**
|
|
2382
2414
|
* ADHDev Daemon — unified logger (v2)
|
|
2383
2415
|
*
|
|
@@ -2534,6 +2566,15 @@ declare function getAvailableIdeIds(): string[];
|
|
|
2534
2566
|
declare const DEFAULT_DAEMON_PORT = 19222;
|
|
2535
2567
|
declare const DAEMON_WS_PATH = "/ipc";
|
|
2536
2568
|
|
|
2569
|
+
/**
|
|
2570
|
+
* Shared helper for forwarding agent stream snapshots into the IDE instance.
|
|
2571
|
+
*
|
|
2572
|
+
* Both cloud and standalone daemons use the same InstanceManager wiring.
|
|
2573
|
+
*/
|
|
2574
|
+
declare function forwardAgentStreamsToIdeInstance(instanceManager: {
|
|
2575
|
+
getInstance: (key: string) => any;
|
|
2576
|
+
}, ideType: string, streams: any[]): void;
|
|
2577
|
+
|
|
2537
2578
|
/**
|
|
2538
2579
|
* ProviderCliAdapter — Script-based CLI Adapter
|
|
2539
2580
|
*
|
|
@@ -3121,4 +3162,4 @@ declare function initDaemonComponents(config: DaemonInitConfig): Promise<DaemonC
|
|
|
3121
3162
|
*/
|
|
3122
3163
|
declare function shutdownDaemonComponents(components: DaemonComponents): Promise<void>;
|
|
3123
3164
|
|
|
3124
|
-
export { type AcpConfigOption, type AcpMode, AcpProviderInstance, type AcpProviderState, type ActiveChatData, type AgentEntry, AgentStreamPoller, type AgentStreamPollerDeps, type AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, type CdpTargetFilter, type ChatMessage, type CliAdapter, CliProviderInstance, type CliProviderState, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, type CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, type DetectedIde, type DetectedIdeInfo, DevServer, type ExtensionInfo$1 as ExtensionInfo, type ExtensionProviderState, type HostMemorySnapshot, type IDEInfo, type IDaemonCore, IdeProviderInstance, type IdeProviderState, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, type MachineInfo, type ManagedAcpEntry, type ManagedAgentStream, type ManagedCliEntry, type ManagedIdeEntry, ProviderCliAdapter, type ProviderConfig, type ProviderErrorReason, type ProviderInfo, ProviderInstanceManager, ProviderLoader, type ProviderModule, type ProviderStatus, type ProviderVersionInfo, type ScopedLogger, type SetupIdeInstanceOptions, type StatusReportPayload, type StatusResponse, type SystemInfo, VersionArchive, type VersionHistory, type WorkspaceActivity, type WorkspaceEntry, addCliHistory, buildAllManagedEntries, buildManagedAcps, buildManagedClis, buildManagedIdes, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, getWorkspaceActivity, getWorkspaceState, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, isSetupComplete, killIdeProcess, launchIDE, launchWithCdp, loadConfig, logCommand, markSetupComplete, probeCdpPort, readChatHistory, registerExtensionProviders, resetConfig, saveConfig, setLogLevel, setupIdeInstance, shutdownDaemonComponents, updateConfig };
|
|
3165
|
+
export { type AcpConfigOption, type AcpMode, AcpProviderInstance, type AcpProviderState, type ActiveChatData, type AgentEntry, AgentStreamPoller, type AgentStreamPollerDeps, type AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, type CdpTargetFilter, type ChatMessage, type CliAdapter, CliProviderInstance, type CliProviderState, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, type CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, type DetectedIde, type DetectedIdeInfo, DevServer, type ExtensionInfo$1 as ExtensionInfo, type ExtensionProviderState, type HostMemorySnapshot, type IDEInfo, type IDaemonCore, IdeProviderInstance, type IdeProviderState, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, type MachineInfo, type ManagedAcpEntry, type ManagedAgentStream, type ManagedCliEntry, type ManagedIdeEntry, ProviderCliAdapter, type ProviderConfig, type ProviderErrorReason, type ProviderInfo, ProviderInstanceManager, ProviderLoader, type ProviderModule, type ProviderStatus, type ProviderVersionInfo, type ScopedLogger, type SetupIdeInstanceOptions, type StatusReportPayload, type StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, type SystemInfo, VersionArchive, type VersionHistory, type WorkspaceActivity, type WorkspaceEntry, addCliHistory, buildAllManagedEntries, buildManagedAcps, buildManagedClis, buildManagedIdes, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, getWorkspaceActivity, getWorkspaceState, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, isSetupComplete, killIdeProcess, launchIDE, launchWithCdp, loadConfig, logCommand, markSetupComplete, probeCdpPort, readChatHistory, registerExtensionProviders, resetConfig, saveConfig, setLogLevel, setupIdeInstance, shutdownDaemonComponents, updateConfig };
|
package/dist/index.js
CHANGED
|
@@ -217,14 +217,36 @@ var config_exports = {};
|
|
|
217
217
|
__export(config_exports, {
|
|
218
218
|
addCliHistory: () => addCliHistory,
|
|
219
219
|
generateConnectionToken: () => generateConnectionToken,
|
|
220
|
+
generateMachineId: () => generateMachineId,
|
|
220
221
|
getConfigDir: () => getConfigDir,
|
|
221
222
|
isSetupComplete: () => isSetupComplete,
|
|
223
|
+
isStableMachineId: () => isStableMachineId,
|
|
222
224
|
loadConfig: () => loadConfig,
|
|
223
225
|
markSetupComplete: () => markSetupComplete,
|
|
224
226
|
resetConfig: () => resetConfig,
|
|
225
227
|
saveConfig: () => saveConfig,
|
|
226
228
|
updateConfig: () => updateConfig
|
|
227
229
|
});
|
|
230
|
+
function generateMachineId() {
|
|
231
|
+
return `${MACHINE_ID_PREFIX}${(0, import_crypto2.randomUUID)().replace(/-/g, "")}`;
|
|
232
|
+
}
|
|
233
|
+
function isStableMachineId(machineId) {
|
|
234
|
+
return typeof machineId === "string" && machineId.startsWith(MACHINE_ID_PREFIX);
|
|
235
|
+
}
|
|
236
|
+
function ensureMachineId(config) {
|
|
237
|
+
if (isStableMachineId(config.machineId)) {
|
|
238
|
+
return { config, changed: false };
|
|
239
|
+
}
|
|
240
|
+
const legacyRegisteredMachineId = !config.registeredMachineId && config.machineSecret && config.machineId ? config.machineId : config.registeredMachineId;
|
|
241
|
+
return {
|
|
242
|
+
config: {
|
|
243
|
+
...config,
|
|
244
|
+
machineId: generateMachineId(),
|
|
245
|
+
registeredMachineId: legacyRegisteredMachineId
|
|
246
|
+
},
|
|
247
|
+
changed: true
|
|
248
|
+
};
|
|
249
|
+
}
|
|
228
250
|
function getConfigDir() {
|
|
229
251
|
const dir = (0, import_path.join)((0, import_os.homedir)(), ".adhdev");
|
|
230
252
|
if (!(0, import_fs.existsSync)(dir)) {
|
|
@@ -238,7 +260,12 @@ function getConfigPath() {
|
|
|
238
260
|
function loadConfig() {
|
|
239
261
|
const configPath = getConfigPath();
|
|
240
262
|
if (!(0, import_fs.existsSync)(configPath)) {
|
|
241
|
-
|
|
263
|
+
const initialized = ensureMachineId({ ...DEFAULT_CONFIG });
|
|
264
|
+
try {
|
|
265
|
+
saveConfig(initialized.config);
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
return initialized.config;
|
|
242
269
|
}
|
|
243
270
|
try {
|
|
244
271
|
const raw = (0, import_fs.readFileSync)(configPath, "utf-8");
|
|
@@ -249,28 +276,23 @@ function loadConfig() {
|
|
|
249
276
|
}
|
|
250
277
|
delete merged.activeWorkspaceId;
|
|
251
278
|
const hadStoredWorkspaces = Array.isArray(parsed.workspaces) && parsed.workspaces.length > 0;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const safeHostname = os15.hostname().replace(/[^a-zA-Z0-9]/g, "_");
|
|
258
|
-
const machineHash = crypto5.createHash("md5").update(os15.hostname() + os15.homedir()).digest("hex").slice(0, 8);
|
|
259
|
-
merged.machineId = `${safeHostname}_${machineHash}`;
|
|
260
|
-
configChanged = true;
|
|
261
|
-
}
|
|
262
|
-
if (!hadStoredWorkspaces && (merged.workspaces?.length || 0) > 0) {
|
|
279
|
+
const ensured = ensureMachineId(merged);
|
|
280
|
+
const normalized = ensured.config;
|
|
281
|
+
migrateWorkspacesFromRecent(normalized);
|
|
282
|
+
let configChanged = ensured.changed;
|
|
283
|
+
if (!hadStoredWorkspaces && (normalized.workspaces?.length || 0) > 0) {
|
|
263
284
|
configChanged = true;
|
|
264
285
|
}
|
|
265
286
|
if (configChanged) {
|
|
266
287
|
try {
|
|
267
|
-
saveConfig(
|
|
288
|
+
saveConfig(normalized);
|
|
268
289
|
} catch {
|
|
269
290
|
}
|
|
270
291
|
}
|
|
271
|
-
return
|
|
292
|
+
return normalized;
|
|
272
293
|
} catch {
|
|
273
|
-
|
|
294
|
+
const initialized = ensureMachineId({ ...DEFAULT_CONFIG });
|
|
295
|
+
return initialized.config;
|
|
274
296
|
}
|
|
275
297
|
}
|
|
276
298
|
function saveConfig(config) {
|
|
@@ -344,13 +366,14 @@ function addCliHistory(entry) {
|
|
|
344
366
|
config.cliHistory = filtered.slice(0, 20);
|
|
345
367
|
saveConfig(config);
|
|
346
368
|
}
|
|
347
|
-
var import_os, import_path, import_fs, DEFAULT_CONFIG;
|
|
369
|
+
var import_os, import_path, import_fs, import_crypto2, DEFAULT_CONFIG, MACHINE_ID_PREFIX;
|
|
348
370
|
var init_config = __esm({
|
|
349
371
|
"src/config/config.ts"() {
|
|
350
372
|
"use strict";
|
|
351
373
|
import_os = require("os");
|
|
352
374
|
import_path = require("path");
|
|
353
375
|
import_fs = require("fs");
|
|
376
|
+
import_crypto2 = require("crypto");
|
|
354
377
|
init_workspaces();
|
|
355
378
|
DEFAULT_CONFIG = {
|
|
356
379
|
serverUrl: "https://api.adhf.dev",
|
|
@@ -374,11 +397,13 @@ var init_config = __esm({
|
|
|
374
397
|
machineNickname: null,
|
|
375
398
|
machineId: void 0,
|
|
376
399
|
machineSecret: null,
|
|
400
|
+
registeredMachineId: void 0,
|
|
377
401
|
cliHistory: [],
|
|
378
402
|
providerSettings: {},
|
|
379
403
|
ideSettings: {},
|
|
380
404
|
disableUpstream: false
|
|
381
405
|
};
|
|
406
|
+
MACHINE_ID_PREFIX = "mach_";
|
|
382
407
|
}
|
|
383
408
|
});
|
|
384
409
|
|
|
@@ -1092,7 +1117,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
1092
1117
|
/Do you trust the files/i,
|
|
1093
1118
|
/Quick safety check/i,
|
|
1094
1119
|
/Is this a project/i,
|
|
1095
|
-
/Enter to confirm/i
|
|
1120
|
+
/Enter to confirm/i,
|
|
1121
|
+
/be able to read, edit, and execute/i,
|
|
1122
|
+
/Security guide/i
|
|
1096
1123
|
];
|
|
1097
1124
|
if (dialogPatterns.some((p) => p.test(this.startupBuffer))) {
|
|
1098
1125
|
setTimeout(() => this.ptyProcess?.write("\r"), this.timeouts.dialogAccept);
|
|
@@ -1149,15 +1176,41 @@ var init_provider_cli_adapter = __esm({
|
|
|
1149
1176
|
}, 6e4);
|
|
1150
1177
|
}
|
|
1151
1178
|
evaluateSettled() {
|
|
1152
|
-
|
|
1153
|
-
if (this.responseSettleIgnoreUntil >
|
|
1179
|
+
const now = Date.now();
|
|
1180
|
+
if (this.submitPendingUntil > now || this.responseSettleIgnoreUntil > now) {
|
|
1181
|
+
const delayTime = Math.max(this.submitPendingUntil - now, this.responseSettleIgnoreUntil - now) + 50;
|
|
1182
|
+
if (this.settleTimer) clearTimeout(this.settleTimer);
|
|
1183
|
+
this.settleTimer = setTimeout(() => {
|
|
1184
|
+
this.settleTimer = null;
|
|
1185
|
+
this.settledBuffer = this.recentOutputBuffer;
|
|
1186
|
+
this.evaluateSettled();
|
|
1187
|
+
}, delayTime);
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1154
1190
|
const tail = this.settledBuffer;
|
|
1155
1191
|
const modal = this.runParseApproval(tail);
|
|
1156
1192
|
const rawScriptStatus = this.runDetectStatus(tail);
|
|
1157
|
-
const scriptStatus = rawScriptStatus
|
|
1193
|
+
const scriptStatus = rawScriptStatus;
|
|
1158
1194
|
if (!scriptStatus) return;
|
|
1159
1195
|
const prevStatus = this.currentStatus;
|
|
1160
1196
|
if (scriptStatus === "waiting_approval") {
|
|
1197
|
+
const modalMessage = modal?.message || "";
|
|
1198
|
+
const screenText = this.terminalScreen.getText() || this.accumulatedBuffer;
|
|
1199
|
+
const autoAcceptPatterns = [
|
|
1200
|
+
/be able to read, edit, and execute/i,
|
|
1201
|
+
/Security guide/i,
|
|
1202
|
+
/Enter to confirm/i,
|
|
1203
|
+
/Quick safety check/i,
|
|
1204
|
+
/Do you trust the files/i,
|
|
1205
|
+
/Is this a project/i
|
|
1206
|
+
];
|
|
1207
|
+
if (autoAcceptPatterns.some((p) => p.test(modalMessage) || p.test(screenText))) {
|
|
1208
|
+
LOG.info("CLI", `[${this.cliType}] Auto-accepting startup dialog: ${modalMessage.slice(0, 80)}`);
|
|
1209
|
+
setTimeout(() => this.ptyProcess?.write("\r"), 200);
|
|
1210
|
+
this.lastApprovalResolvedAt = Date.now();
|
|
1211
|
+
this.activeModal = null;
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1161
1214
|
const inCooldown = this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
|
|
1162
1215
|
if (!inCooldown) {
|
|
1163
1216
|
this.isWaitingForResponse = true;
|
|
@@ -1666,11 +1719,13 @@ __export(index_exports, {
|
|
|
1666
1719
|
buildManagedAcps: () => buildManagedAcps,
|
|
1667
1720
|
buildManagedClis: () => buildManagedClis,
|
|
1668
1721
|
buildManagedIdes: () => buildManagedIdes,
|
|
1722
|
+
buildStatusSnapshot: () => buildStatusSnapshot,
|
|
1669
1723
|
connectCdpManager: () => connectCdpManager,
|
|
1670
1724
|
detectAllVersions: () => detectAllVersions,
|
|
1671
1725
|
detectCLIs: () => detectCLIs,
|
|
1672
1726
|
detectIDEs: () => detectIDEs,
|
|
1673
1727
|
findCdpManager: () => findCdpManager,
|
|
1728
|
+
forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance,
|
|
1674
1729
|
getAIExtensions: () => getAIExtensions,
|
|
1675
1730
|
getAvailableIdeIds: () => getAvailableIdeIds,
|
|
1676
1731
|
getHostMemorySnapshot: () => getHostMemorySnapshot,
|
|
@@ -8061,10 +8116,76 @@ var DaemonCommandRouter = class {
|
|
|
8061
8116
|
};
|
|
8062
8117
|
|
|
8063
8118
|
// src/status/reporter.ts
|
|
8119
|
+
init_logger();
|
|
8120
|
+
|
|
8121
|
+
// src/status/snapshot.ts
|
|
8064
8122
|
var os10 = __toESM(require("os"));
|
|
8065
8123
|
init_config();
|
|
8066
8124
|
init_workspaces();
|
|
8067
|
-
|
|
8125
|
+
function buildDetectedIdeInfos(detectedIdes, cdpManagers) {
|
|
8126
|
+
return detectedIdes.filter((ide) => ide.installed !== false).map((ide) => ({
|
|
8127
|
+
id: ide.id,
|
|
8128
|
+
type: ide.id,
|
|
8129
|
+
name: ide.displayName || ide.name || ide.id,
|
|
8130
|
+
running: isCdpConnected(cdpManagers, ide.id),
|
|
8131
|
+
...ide.path ? { path: ide.path } : {}
|
|
8132
|
+
}));
|
|
8133
|
+
}
|
|
8134
|
+
function buildAvailableProviders(providerLoader) {
|
|
8135
|
+
return providerLoader.getAll().map((provider) => ({
|
|
8136
|
+
type: provider.type,
|
|
8137
|
+
name: provider.displayName || provider.type,
|
|
8138
|
+
displayName: provider.displayName || provider.type,
|
|
8139
|
+
icon: provider.icon || "\u{1F4BB}",
|
|
8140
|
+
category: provider.category
|
|
8141
|
+
}));
|
|
8142
|
+
}
|
|
8143
|
+
function buildStatusSnapshot(options) {
|
|
8144
|
+
const cfg = loadConfig();
|
|
8145
|
+
const wsState = getWorkspaceState(cfg);
|
|
8146
|
+
const memSnap = getHostMemorySnapshot();
|
|
8147
|
+
const { managedIdes, managedClis, managedAcps } = buildAllManagedEntries(
|
|
8148
|
+
options.allStates,
|
|
8149
|
+
options.cdpManagers,
|
|
8150
|
+
{
|
|
8151
|
+
detectedIdes: options.detectedIdes.map((ide) => ({
|
|
8152
|
+
id: ide.id,
|
|
8153
|
+
installed: ide.installed !== false
|
|
8154
|
+
}))
|
|
8155
|
+
}
|
|
8156
|
+
);
|
|
8157
|
+
return {
|
|
8158
|
+
instanceId: options.instanceId,
|
|
8159
|
+
version: options.version,
|
|
8160
|
+
daemonMode: options.daemonMode,
|
|
8161
|
+
machine: {
|
|
8162
|
+
hostname: os10.hostname(),
|
|
8163
|
+
platform: os10.platform(),
|
|
8164
|
+
arch: os10.arch(),
|
|
8165
|
+
cpus: os10.cpus().length,
|
|
8166
|
+
totalMem: memSnap.totalMem,
|
|
8167
|
+
freeMem: memSnap.freeMem,
|
|
8168
|
+
availableMem: memSnap.availableMem,
|
|
8169
|
+
loadavg: os10.loadavg(),
|
|
8170
|
+
uptime: os10.uptime(),
|
|
8171
|
+
release: os10.release()
|
|
8172
|
+
},
|
|
8173
|
+
machineNickname: options.machineNickname ?? cfg.machineNickname ?? null,
|
|
8174
|
+
timestamp: options.timestamp ?? Date.now(),
|
|
8175
|
+
detectedIdes: buildDetectedIdeInfos(options.detectedIdes, options.cdpManagers),
|
|
8176
|
+
...options.p2p ? { p2p: options.p2p } : {},
|
|
8177
|
+
managedIdes,
|
|
8178
|
+
managedClis,
|
|
8179
|
+
managedAcps,
|
|
8180
|
+
workspaces: wsState.workspaces,
|
|
8181
|
+
defaultWorkspaceId: wsState.defaultWorkspaceId,
|
|
8182
|
+
defaultWorkspacePath: wsState.defaultWorkspacePath,
|
|
8183
|
+
workspaceActivity: getWorkspaceActivity(cfg, 15),
|
|
8184
|
+
availableProviders: buildAvailableProviders(options.providerLoader)
|
|
8185
|
+
};
|
|
8186
|
+
}
|
|
8187
|
+
|
|
8188
|
+
// src/status/reporter.ts
|
|
8068
8189
|
var DaemonStatusReporter = class {
|
|
8069
8190
|
deps;
|
|
8070
8191
|
log;
|
|
@@ -8171,46 +8292,25 @@ var DaemonStatusReporter = class {
|
|
|
8171
8292
|
allStates,
|
|
8172
8293
|
this.deps.cdpManagers
|
|
8173
8294
|
);
|
|
8174
|
-
const cfg = loadConfig();
|
|
8175
|
-
const wsState = getWorkspaceState(cfg);
|
|
8176
|
-
const memSnap = getHostMemorySnapshot();
|
|
8177
8295
|
const payload = {
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
},
|
|
8195
|
-
managedIdes,
|
|
8196
|
-
managedClis,
|
|
8197
|
-
managedAcps,
|
|
8198
|
-
p2p: {
|
|
8199
|
-
available: p2p?.isAvailable || false,
|
|
8200
|
-
state: p2p?.connectionState || "unavailable",
|
|
8201
|
-
peers: p2p?.connectedPeerCount || 0,
|
|
8202
|
-
screenshotActive: p2p?.screenshotActive || false
|
|
8203
|
-
},
|
|
8296
|
+
...buildStatusSnapshot({
|
|
8297
|
+
allStates,
|
|
8298
|
+
cdpManagers: this.deps.cdpManagers,
|
|
8299
|
+
providerLoader: this.deps.providerLoader,
|
|
8300
|
+
detectedIdes: this.deps.detectedIdes || [],
|
|
8301
|
+
instanceId: this.deps.instanceId,
|
|
8302
|
+
version: this.deps.daemonVersion || "unknown",
|
|
8303
|
+
daemonMode: true,
|
|
8304
|
+
timestamp: now,
|
|
8305
|
+
p2p: {
|
|
8306
|
+
available: p2p?.isAvailable || false,
|
|
8307
|
+
state: p2p?.connectionState || "unavailable",
|
|
8308
|
+
peers: p2p?.connectedPeerCount || 0,
|
|
8309
|
+
screenshotActive: p2p?.screenshotActive || false
|
|
8310
|
+
}
|
|
8311
|
+
}),
|
|
8204
8312
|
screenshotUsage: this.deps.getScreenshotUsage?.() || null,
|
|
8205
|
-
connectedExtensions: []
|
|
8206
|
-
detectedIdes: this.deps.detectedIdes || [],
|
|
8207
|
-
availableProviders: this.deps.providerLoader.getAll().map((p) => ({
|
|
8208
|
-
type: p.type,
|
|
8209
|
-
icon: p.icon || "\u{1F4BB}",
|
|
8210
|
-
displayName: p.displayName || p.type,
|
|
8211
|
-
category: p.category
|
|
8212
|
-
})),
|
|
8213
|
-
timestamp: now
|
|
8313
|
+
connectedExtensions: []
|
|
8214
8314
|
};
|
|
8215
8315
|
const p2pSent = this.sendP2PPayload(payload);
|
|
8216
8316
|
if (p2pSent) {
|
|
@@ -10246,6 +10346,23 @@ var AgentStreamPoller = class {
|
|
|
10246
10346
|
}
|
|
10247
10347
|
};
|
|
10248
10348
|
|
|
10349
|
+
// src/agent-stream/forward.ts
|
|
10350
|
+
function forwardAgentStreamsToIdeInstance(instanceManager, ideType, streams) {
|
|
10351
|
+
const ideInstance = instanceManager.getInstance(`ide:${ideType}`);
|
|
10352
|
+
if (!ideInstance?.onEvent) return;
|
|
10353
|
+
for (const stream of streams) {
|
|
10354
|
+
ideInstance.onEvent("stream_update", {
|
|
10355
|
+
extensionType: stream.agentType,
|
|
10356
|
+
streams: [stream],
|
|
10357
|
+
messages: stream.messages || [],
|
|
10358
|
+
status: stream.status || "idle",
|
|
10359
|
+
activeModal: stream.activeModal || null,
|
|
10360
|
+
model: stream.model || void 0,
|
|
10361
|
+
mode: stream.mode || void 0
|
|
10362
|
+
});
|
|
10363
|
+
}
|
|
10364
|
+
}
|
|
10365
|
+
|
|
10249
10366
|
// src/providers/provider-instance-manager.ts
|
|
10250
10367
|
init_logger();
|
|
10251
10368
|
var ProviderInstanceManager = class {
|
|
@@ -14267,11 +14384,13 @@ async function shutdownDaemonComponents(components) {
|
|
|
14267
14384
|
buildManagedAcps,
|
|
14268
14385
|
buildManagedClis,
|
|
14269
14386
|
buildManagedIdes,
|
|
14387
|
+
buildStatusSnapshot,
|
|
14270
14388
|
connectCdpManager,
|
|
14271
14389
|
detectAllVersions,
|
|
14272
14390
|
detectCLIs,
|
|
14273
14391
|
detectIDEs,
|
|
14274
14392
|
findCdpManager,
|
|
14393
|
+
forwardAgentStreamsToIdeInstance,
|
|
14275
14394
|
getAIExtensions,
|
|
14276
14395
|
getAvailableIdeIds,
|
|
14277
14396
|
getHostMemorySnapshot,
|