@emqo/claudebridge 0.1.7 → 0.1.9
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/adapters/discord.js +8 -3
- package/dist/adapters/telegram.js +10 -3
- package/dist/core/agent.js +11 -1
- package/dist/core/intent.js +2 -2
- package/package.json +1 -1
package/dist/adapters/discord.js
CHANGED
|
@@ -224,9 +224,14 @@ export class DiscordAdapter {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
if (intent.type === "memory" && intent.description) {
|
|
227
|
-
this
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
if (/上面|之前|刚才|这个|那个|above|previous|earlier|this|that/.test(intent.description)) {
|
|
228
|
+
// Fall through to Claude conversation for context resolution
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.store.addMemory(msg.author.id, intent.description, "nlp");
|
|
232
|
+
await msg.reply(t(this.locale, "intent_memory_saved", { desc: intent.description }));
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
230
235
|
}
|
|
231
236
|
if (intent.type === "forget") {
|
|
232
237
|
this.store.clearMemories(msg.author.id);
|
|
@@ -270,9 +270,16 @@ export class TelegramAdapter {
|
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
if (intent.type === "memory" && intent.description) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
// If description contains references to context ("上面", "this", "that", etc.),
|
|
274
|
+
// fall through to Claude conversation so it can resolve from session history
|
|
275
|
+
if (/上面|之前|刚才|这个|那个|above|previous|earlier|this|that/.test(intent.description)) {
|
|
276
|
+
// Don't intercept — let Claude handle it with full context
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.store.addMemory(String(uid), intent.description, "nlp");
|
|
280
|
+
await this.reply(chatId, t(this.locale, "intent_memory_saved", { desc: intent.description }));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
276
283
|
}
|
|
277
284
|
if (intent.type === "forget") {
|
|
278
285
|
this.store.clearMemories(String(uid));
|
package/dist/core/agent.js
CHANGED
|
@@ -196,9 +196,11 @@ export class AgentEngine {
|
|
|
196
196
|
args.push("--model", ep.model);
|
|
197
197
|
const child = spawn("claude", args, { env, stdio: ["pipe", "pipe", "pipe"] });
|
|
198
198
|
child.stdin.end();
|
|
199
|
+
console.log(`[agent] auto-summary spawned pid=${child.pid} for ${userId}`);
|
|
199
200
|
let result = "";
|
|
200
201
|
let cost = 0;
|
|
201
202
|
let buffer = "";
|
|
203
|
+
let stderr = "";
|
|
202
204
|
child.stdout.on("data", (data) => {
|
|
203
205
|
buffer += data.toString();
|
|
204
206
|
const lines = buffer.split("\n");
|
|
@@ -218,7 +220,11 @@ export class AgentEngine {
|
|
|
218
220
|
catch { }
|
|
219
221
|
}
|
|
220
222
|
});
|
|
221
|
-
child.on("
|
|
223
|
+
child.stderr.on("data", (data) => { stderr += data.toString(); });
|
|
224
|
+
child.on("close", (code) => {
|
|
225
|
+
if (code !== 0) {
|
|
226
|
+
console.warn(`[agent] auto-summary failed code=${code} stderr=${stderr.slice(0, 200)} for ${userId}`);
|
|
227
|
+
}
|
|
222
228
|
if (cost > 0) {
|
|
223
229
|
this.store.recordUsage(userId, "auto-summary", cost);
|
|
224
230
|
console.log(`[agent] auto-summary cost=$${cost.toFixed(4)} for ${userId}`);
|
|
@@ -231,6 +237,10 @@ export class AgentEngine {
|
|
|
231
237
|
else
|
|
232
238
|
console.log(`[agent] auto-summary skipped (duplicate) for ${userId}`);
|
|
233
239
|
}
|
|
240
|
+
else {
|
|
241
|
+
console.log(`[agent] auto-summary result=NONE for ${userId}`);
|
|
242
|
+
}
|
|
234
243
|
});
|
|
244
|
+
child.on("error", (err) => { console.warn(`[agent] auto-summary spawn error: ${err.message}`); });
|
|
235
245
|
}
|
|
236
246
|
}
|
package/dist/core/intent.js
CHANGED
|
@@ -4,7 +4,7 @@ const patterns = [
|
|
|
4
4
|
m => ({ type: "reminder", minutes: +m[1], description: m[2].trim() })],
|
|
5
5
|
[/^(?:添加|加个?|创建|add|create)\s*(?:一个)?(?:任务|task)[::\s]*(.+)/i,
|
|
6
6
|
m => ({ type: "task", description: m[1].trim() })],
|
|
7
|
-
[/^(
|
|
7
|
+
[/^(?:记住|记下|记忆|帮我记|remember)\s*(?:that|this)?[::\s]*(.+)/i,
|
|
8
8
|
m => ({ type: "memory", description: m[1].trim() })],
|
|
9
9
|
[/^(?:忘记所有|清除记忆|forget\s*all|clear\s*memo)/i,
|
|
10
10
|
() => ({ type: "forget" })],
|
|
@@ -15,7 +15,7 @@ const patterns = [
|
|
|
15
15
|
const hintPatterns = [
|
|
16
16
|
/提醒|醒我|remind/i,
|
|
17
17
|
/任务|待办|todo|task/i,
|
|
18
|
-
|
|
18
|
+
/记住|记下|记得|记忆|帮我记|remember/i,
|
|
19
19
|
/忘记|忘掉|forget/i,
|
|
20
20
|
/新会话|新对话|new\s*session|clear\s*session/i,
|
|
21
21
|
/\d+\s*(?:分钟|min|m|小时|hour|h)\s*(?:后|later)/i,
|