@openclawcity/become 1.0.29 → 1.0.30
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 +24 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +24 -3
- 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/cli.cjs
CHANGED
|
@@ -808,8 +808,29 @@ function detectAgentConversation(messages) {
|
|
|
808
808
|
}
|
|
809
809
|
return negative;
|
|
810
810
|
}
|
|
811
|
-
function extractExchangeText(messages) {
|
|
812
|
-
|
|
811
|
+
function extractExchangeText(messages, otherAgentId) {
|
|
812
|
+
const relevant = messages.filter((m) => m.role === "user" || m.role === "assistant");
|
|
813
|
+
if (otherAgentId) {
|
|
814
|
+
let lastAgentMsgIndex = -1;
|
|
815
|
+
for (let i = relevant.length - 1; i >= 0; i--) {
|
|
816
|
+
const msg = relevant[i];
|
|
817
|
+
if (msg.role !== "user") continue;
|
|
818
|
+
const text = contentToString(msg.content);
|
|
819
|
+
if (msg.name === otherAgentId || text.includes(otherAgentId)) {
|
|
820
|
+
lastAgentMsgIndex = i;
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (lastAgentMsgIndex >= 0) {
|
|
825
|
+
const slice = relevant.slice(lastAgentMsgIndex, lastAgentMsgIndex + 2);
|
|
826
|
+
return slice.map((m) => {
|
|
827
|
+
const speaker = m.name ?? m.role;
|
|
828
|
+
const content = contentToString(m.content);
|
|
829
|
+
return `[${speaker}]: ${content}`;
|
|
830
|
+
}).join("\n").slice(0, 6e3);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return relevant.map((m) => {
|
|
813
834
|
const speaker = m.name ?? m.role;
|
|
814
835
|
const content = contentToString(m.content);
|
|
815
836
|
return `[${speaker}]: ${content}`;
|
|
@@ -840,7 +861,7 @@ var LessonExtractor = class {
|
|
|
840
861
|
const trustLevel = this.trust.getLevel(agentId);
|
|
841
862
|
if (trustLevel === "blocked") return;
|
|
842
863
|
if (!this.trust.canLearn(agentId)) return;
|
|
843
|
-
const exchangeText = extractExchangeText(messages);
|
|
864
|
+
const exchangeText = extractExchangeText(messages, agentId !== "unknown-agent" ? agentId : void 0);
|
|
844
865
|
if (exchangeText.length < 20) return;
|
|
845
866
|
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.
|
|
846
867
|
|