@openclawcity/become 1.0.29 → 1.0.31
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.cjs +26 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +26 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -856,12 +856,19 @@ declare function detectAgentConversation(messages: {
|
|
|
856
856
|
}[]): DetectionResult;
|
|
857
857
|
/**
|
|
858
858
|
* Extract agent-to-agent exchange text from messages for analysis.
|
|
859
|
+
*
|
|
860
|
+
* When `otherAgentId` is provided, only returns the last message from that
|
|
861
|
+
* agent and the assistant's reply — filtering out heartbeat instructions,
|
|
862
|
+
* city context, owner messages, and other noise that would confuse the LLM.
|
|
863
|
+
*
|
|
864
|
+
* Falls back to full conversation (capped at 6000 chars) when no agent ID
|
|
865
|
+
* is available (e.g. peer_review detection without a named sender).
|
|
859
866
|
*/
|
|
860
867
|
declare function extractExchangeText(messages: {
|
|
861
868
|
role: string;
|
|
862
869
|
content: unknown;
|
|
863
870
|
name?: string;
|
|
864
|
-
}[]): string;
|
|
871
|
+
}[], otherAgentId?: string): string;
|
|
865
872
|
|
|
866
873
|
/**
|
|
867
874
|
* Async lesson extractor. After the proxy forwards a response, this analyzes
|
package/dist/index.d.ts
CHANGED
|
@@ -856,12 +856,19 @@ declare function detectAgentConversation(messages: {
|
|
|
856
856
|
}[]): DetectionResult;
|
|
857
857
|
/**
|
|
858
858
|
* Extract agent-to-agent exchange text from messages for analysis.
|
|
859
|
+
*
|
|
860
|
+
* When `otherAgentId` is provided, only returns the last message from that
|
|
861
|
+
* agent and the assistant's reply — filtering out heartbeat instructions,
|
|
862
|
+
* city context, owner messages, and other noise that would confuse the LLM.
|
|
863
|
+
*
|
|
864
|
+
* Falls back to full conversation (capped at 6000 chars) when no agent ID
|
|
865
|
+
* is available (e.g. peer_review detection without a named sender).
|
|
859
866
|
*/
|
|
860
867
|
declare function extractExchangeText(messages: {
|
|
861
868
|
role: string;
|
|
862
869
|
content: unknown;
|
|
863
870
|
name?: string;
|
|
864
|
-
}[]): string;
|
|
871
|
+
}[], otherAgentId?: string): string;
|
|
865
872
|
|
|
866
873
|
/**
|
|
867
874
|
* Async lesson extractor. After the proxy forwards a response, this analyzes
|
package/dist/index.js
CHANGED
|
@@ -3308,8 +3308,29 @@ function detectAgentConversation(messages) {
|
|
|
3308
3308
|
}
|
|
3309
3309
|
return negative;
|
|
3310
3310
|
}
|
|
3311
|
-
function extractExchangeText(messages) {
|
|
3312
|
-
|
|
3311
|
+
function extractExchangeText(messages, otherAgentId) {
|
|
3312
|
+
const relevant = messages.filter((m) => m.role === "user" || m.role === "assistant");
|
|
3313
|
+
if (otherAgentId) {
|
|
3314
|
+
let lastAgentMsgIndex = -1;
|
|
3315
|
+
for (let i = relevant.length - 1; i >= 0; i--) {
|
|
3316
|
+
const msg = relevant[i];
|
|
3317
|
+
if (msg.role !== "user") continue;
|
|
3318
|
+
const text = contentToString(msg.content);
|
|
3319
|
+
if (msg.name === otherAgentId || text.includes(otherAgentId)) {
|
|
3320
|
+
lastAgentMsgIndex = i;
|
|
3321
|
+
break;
|
|
3322
|
+
}
|
|
3323
|
+
}
|
|
3324
|
+
if (lastAgentMsgIndex >= 0) {
|
|
3325
|
+
const slice = relevant.slice(lastAgentMsgIndex, lastAgentMsgIndex + 2);
|
|
3326
|
+
return slice.map((m) => {
|
|
3327
|
+
const speaker = m.name ?? m.role;
|
|
3328
|
+
const content = contentToString(m.content);
|
|
3329
|
+
return `[${speaker}]: ${content}`;
|
|
3330
|
+
}).join("\n").slice(0, 6e3);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
return relevant.map((m) => {
|
|
3313
3334
|
const speaker = m.name ?? m.role;
|
|
3314
3335
|
const content = contentToString(m.content);
|
|
3315
3336
|
return `[${speaker}]: ${content}`;
|
|
@@ -3340,7 +3361,7 @@ var LessonExtractor = class {
|
|
|
3340
3361
|
const trustLevel = this.trust.getLevel(agentId);
|
|
3341
3362
|
if (trustLevel === "blocked") return;
|
|
3342
3363
|
if (!this.trust.canLearn(agentId)) return;
|
|
3343
|
-
const exchangeText = extractExchangeText(messages);
|
|
3364
|
+
const exchangeText = extractExchangeText(messages, agentId !== "unknown-agent" ? agentId : void 0);
|
|
3344
3365
|
if (exchangeText.length < 20) return;
|
|
3345
3366
|
const prompt = `Analyze this conversation between an AI agent and another agent. Extract concrete, actionable lessons that the first agent (the "assistant") can learn from the other agent.
|
|
3346
3367
|
|