@lightcone-ai/daemon 0.9.25 → 0.9.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.9.25",
3
+ "version": "0.9.26",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -107,6 +107,8 @@ export class AgentManager {
107
107
  headers: { 'Authorization': `Bearer ${this.machineApiKey}` },
108
108
  });
109
109
  if (res.ok) skills = await res.json();
110
+ const mcpSkills = skills.filter(s => s.mcpConfig);
111
+ console.log(`[AgentManager] Skills loaded for ${config.displayName ?? agentId}: ${skills.length} total, ${mcpSkills.length} with MCP (${mcpSkills.map(s => s.name).join(', ') || 'none'})`);
110
112
  } catch (err) {
111
113
  console.log(`[AgentManager] Skills fetch failed for ${agentId} (non-fatal): ${err.message}`);
112
114
  }
@@ -118,6 +120,7 @@ export class AgentManager {
118
120
  headers: { 'Authorization': `Bearer ${this.machineApiKey}` },
119
121
  });
120
122
  if (res.ok) credentialGrants = await res.json();
123
+ console.log(`[AgentManager] Credential grants for ${config.displayName ?? agentId}: ${credentialGrants.map(g => `${g.platform}(${Object.keys(g.envVars ?? {}).join(',')})`).join(', ') || 'none'}`);
121
124
  } catch (err) {
122
125
  console.log(`[AgentManager] Credential grants fetch failed for ${agentId} (non-fatal): ${err.message}`);
123
126
  }
@@ -279,6 +282,10 @@ export class AgentManager {
279
282
  }
280
283
 
281
284
  const mcpConfig = { mcpServers };
285
+ console.log(`[AgentManager] MCP servers for ${config.displayName ?? agentId}: ${Object.keys(mcpServers).join(', ')}`);
286
+ for (const [name, mc] of Object.entries(mcpServers)) {
287
+ console.log(`[AgentManager] mcp:${name} → ${mc.command} ${(mc.args ?? []).join(' ')}`);
288
+ }
282
289
 
283
290
  const args = [
284
291
  '--print',
@@ -333,12 +340,12 @@ export class AgentManager {
333
340
 
334
341
  proc.stderr.on('data', (data) => {
335
342
  const text = data.toString().trim();
336
- if (text) console.error(`[AgentManager][${agentId}][${teamId}] stderr:`, text.slice(0, 300));
343
+ if (text) console.error(`[AgentManager][${config.displayName ?? agentId}] stderr: ${text.slice(0, 500)}`);
337
344
  });
338
345
 
339
346
  proc.on('exit', (code) => {
340
347
  const agent = this.agents.get(key);
341
- console.log(`[AgentManager] Agent ${agentId} team=${teamId ?? 'none'} exited (code=${code})`);
348
+ console.log(`[AgentManager] Agent ${config.displayName ?? agentId} team=${teamName ?? teamId ?? 'none'} exited (code=${code})`);
342
349
  this.agents.delete(key);
343
350
 
344
351
  if (code === 0 && runtime === 'codex' && this._pendingMessages?.get(key)?.length) {
@@ -368,6 +375,7 @@ export class AgentManager {
368
375
  this._write(key, 'You have just started. Follow your startup sequence: first call read_memory with path="MEMORY.md" to load your memory index, then call check_messages.');
369
376
  }
370
377
 
378
+ console.log(`[AgentManager] Agent ${config.displayName ?? agentId} is now active (team=${teamName ?? teamId ?? 'none'})`);
371
379
  connection.send({ type: 'agent:status', agentId, teamId, status: 'active' });
372
380
  connection.send({ type: 'agent:activity', agentId, teamId, activity: 'online', detail: '', entries: [] });
373
381
 
@@ -559,11 +567,13 @@ export class AgentManager {
559
567
  const hasToolUse = event.message?.content?.some?.(c => c.type === 'tool_use');
560
568
  if (hasToolUse) {
561
569
  const toolName = event.message.content.find(c => c.type === 'tool_use')?.name ?? 'tool';
570
+ console.log(`[AgentManager][${config.displayName ?? agentId}] tool_use: ${toolName}`);
562
571
  connection.send({ type: 'agent:activity', agentId, teamId, activity: 'working', detail: toolName, entries: [] });
563
572
  } else {
564
573
  connection.send({ type: 'agent:activity', agentId, teamId, activity: 'thinking', detail: '', entries: [] });
565
574
  }
566
575
  } else if (event.type === 'result') {
576
+ console.log(`[AgentManager][${config.displayName ?? agentId}] turn done (stop_reason=${event.stop_reason ?? '?'})`);
567
577
  connection.send({ type: 'agent:activity', agentId, teamId, activity: 'online', detail: '', entries: [] });
568
578
  }
569
579
  }
package/src/connection.js CHANGED
@@ -1,11 +1,25 @@
1
1
  import WebSocket from 'ws';
2
2
  import os from 'os';
3
3
  import { execSync } from 'child_process';
4
+ import { readFileSync } from 'fs';
5
+ import { fileURLToPath } from 'url';
6
+ import { join, dirname } from 'path';
4
7
 
5
8
  const RECONNECT_INITIAL = 1000;
6
9
  const RECONNECT_MAX = 30000;
7
10
  const KNOWN_RUNTIMES = ['claude', 'codex', 'kimi'];
8
11
 
12
+ function readDaemonVersion() {
13
+ try {
14
+ const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
15
+ return JSON.parse(readFileSync(pkgPath, 'utf8')).version ?? '0.0.0';
16
+ } catch {
17
+ return '0.0.0';
18
+ }
19
+ }
20
+
21
+ const DAEMON_VERSION = readDaemonVersion();
22
+
9
23
  function detectRuntimes() {
10
24
  const cmd = process.platform === 'win32' ? 'where' : 'which';
11
25
  const runtimes = [];
@@ -34,7 +48,7 @@ export class DaemonConnection {
34
48
  this.ws = new WebSocket(url);
35
49
 
36
50
  this.ws.on('open', () => {
37
- console.log('[Connection] Connected');
51
+ console.log(`[Connection] Connected (daemon v${DAEMON_VERSION})`);
38
52
  this.reconnectDelay = RECONNECT_INITIAL;
39
53
  this._sendReady();
40
54
  });
@@ -43,6 +57,9 @@ export class DaemonConnection {
43
57
  let msg;
44
58
  try { msg = JSON.parse(raw.toString()); }
45
59
  catch { return; }
60
+ if (msg.type !== 'pong') {
61
+ console.log(`[Connection] ← ${msg.type}${msg.agentId ? ` agent=${msg.agentId.slice(0,8)}` : ''}${msg.teamId ? ` team=${msg.teamId.slice(0,8)}` : ''}${msg.seq != null ? ` seq=${msg.seq}` : ''}`);
62
+ }
46
63
  this.onMessage(msg);
47
64
  });
48
65
 
@@ -68,12 +85,14 @@ export class DaemonConnection {
68
85
  }
69
86
 
70
87
  _sendReady() {
88
+ const runtimes = detectRuntimes();
89
+ console.log(`[Connection] Ready — host=${os.hostname()} runtimes=[${runtimes.join(',')}] v${DAEMON_VERSION}`);
71
90
  this.send({
72
91
  type: 'ready',
73
92
  hostname: os.hostname(),
74
93
  os: `${os.platform()} ${os.arch()}`,
75
- runtimes: detectRuntimes(),
76
- daemonVersion: '0.1.0',
94
+ runtimes,
95
+ daemonVersion: DAEMON_VERSION,
77
96
  });
78
97
  }
79
98