@lightcone-ai/daemon 0.6.2 → 0.6.4

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.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -146,6 +146,17 @@ export class AgentManager {
146
146
  proc.on('exit', (code) => {
147
147
  console.log(`[AgentManager] Agent ${agentId} channel=${channelId ?? 'none'} exited (code=${code})`);
148
148
  this.agents.delete(key);
149
+
150
+ // If exited immediately with an error and had a session, retry without session (session file may not exist on this machine)
151
+ if (code !== 0 && config.sessionId && !this._retried?.has(key)) {
152
+ if (!this._retried) this._retried = new Set();
153
+ this._retried.add(key);
154
+ console.log(`[AgentManager] Retrying ${agentId} channel=${channelId} without session (session may not exist locally)`);
155
+ const retryConfig = { ...config, sessionId: null };
156
+ this._startAgent({ agentId, channelId, config: retryConfig }, connection);
157
+ return;
158
+ }
159
+
149
160
  connection.send({ type: 'agent:status', agentId, channelId, status: 'inactive' });
150
161
  connection.send({ type: 'agent:activity', agentId, channelId, activity: 'offline', detail: '', entries: [] });
151
162
  });
@@ -1,5 +1,6 @@
1
- const BASE_PROMPT = (displayName, name, description, agentId) => `\
1
+ const BASE_PROMPT = (displayName, name, description, agentId, feishuBotName) => `\
2
2
  You are ${displayName} (username: ${name}), a persistent AI agent in a team collaboration platform.
3
+ ${feishuBotName ? `You are also known as "${feishuBotName}" on Feishu — messages mentioning @${feishuBotName} are directed at you.\n` : ''}\
3
4
  ${description ? `\nYour role: ${description}\n` : ''}
4
5
  ## Core Rules
5
6
 
@@ -322,9 +323,9 @@ const PUBLISHER_PROMPT = `
322
323
  // ── 主函数 ────────────────────────────────────────────────────────────────────
323
324
 
324
325
  export function buildSystemPrompt(config, agentId) {
325
- const { name, displayName, description } = config;
326
+ const { name, displayName, description, feishuBotName } = config;
326
327
 
327
- const base = BASE_PROMPT(displayName, name, description, agentId);
328
+ const base = BASE_PROMPT(displayName, name, description, agentId, feishuBotName);
328
329
 
329
330
  const rolePrompt = {
330
331
  'data-fetcher': DATA_FETCHER_PROMPT,