@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.cjs
CHANGED
|
@@ -3381,8 +3381,29 @@ function detectAgentConversation(messages) {
|
|
|
3381
3381
|
}
|
|
3382
3382
|
return negative;
|
|
3383
3383
|
}
|
|
3384
|
-
function extractExchangeText(messages) {
|
|
3385
|
-
|
|
3384
|
+
function extractExchangeText(messages, otherAgentId) {
|
|
3385
|
+
const relevant = messages.filter((m) => m.role === "user" || m.role === "assistant");
|
|
3386
|
+
if (otherAgentId) {
|
|
3387
|
+
let lastAgentMsgIndex = -1;
|
|
3388
|
+
for (let i = relevant.length - 1; i >= 0; i--) {
|
|
3389
|
+
const msg = relevant[i];
|
|
3390
|
+
if (msg.role !== "user") continue;
|
|
3391
|
+
const text = contentToString(msg.content);
|
|
3392
|
+
if (msg.name === otherAgentId || text.includes(otherAgentId)) {
|
|
3393
|
+
lastAgentMsgIndex = i;
|
|
3394
|
+
break;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
if (lastAgentMsgIndex >= 0) {
|
|
3398
|
+
const slice = relevant.slice(lastAgentMsgIndex, lastAgentMsgIndex + 2);
|
|
3399
|
+
return slice.map((m) => {
|
|
3400
|
+
const speaker = m.name ?? m.role;
|
|
3401
|
+
const content = contentToString(m.content);
|
|
3402
|
+
return `[${speaker}]: ${content}`;
|
|
3403
|
+
}).join("\n").slice(0, 6e3);
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
return relevant.map((m) => {
|
|
3386
3407
|
const speaker = m.name ?? m.role;
|
|
3387
3408
|
const content = contentToString(m.content);
|
|
3388
3409
|
return `[${speaker}]: ${content}`;
|
|
@@ -3413,7 +3434,7 @@ var LessonExtractor = class {
|
|
|
3413
3434
|
const trustLevel = this.trust.getLevel(agentId);
|
|
3414
3435
|
if (trustLevel === "blocked") return;
|
|
3415
3436
|
if (!this.trust.canLearn(agentId)) return;
|
|
3416
|
-
const exchangeText = extractExchangeText(messages);
|
|
3437
|
+
const exchangeText = extractExchangeText(messages, agentId !== "unknown-agent" ? agentId : void 0);
|
|
3417
3438
|
if (exchangeText.length < 20) return;
|
|
3418
3439
|
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.
|
|
3419
3440
|
|