@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.js CHANGED
@@ -769,8 +769,29 @@ function detectAgentConversation(messages) {
769
769
  }
770
770
  return negative;
771
771
  }
772
- function extractExchangeText(messages) {
773
- return messages.filter((m) => m.role === "user" || m.role === "assistant").map((m) => {
772
+ function extractExchangeText(messages, otherAgentId) {
773
+ const relevant = messages.filter((m) => m.role === "user" || m.role === "assistant");
774
+ if (otherAgentId) {
775
+ let lastAgentMsgIndex = -1;
776
+ for (let i = relevant.length - 1; i >= 0; i--) {
777
+ const msg = relevant[i];
778
+ if (msg.role !== "user") continue;
779
+ const text = contentToString(msg.content);
780
+ if (msg.name === otherAgentId || text.includes(otherAgentId)) {
781
+ lastAgentMsgIndex = i;
782
+ break;
783
+ }
784
+ }
785
+ if (lastAgentMsgIndex >= 0) {
786
+ const slice = relevant.slice(lastAgentMsgIndex, lastAgentMsgIndex + 2);
787
+ return slice.map((m) => {
788
+ const speaker = m.name ?? m.role;
789
+ const content = contentToString(m.content);
790
+ return `[${speaker}]: ${content}`;
791
+ }).join("\n").slice(0, 6e3);
792
+ }
793
+ }
794
+ return relevant.map((m) => {
774
795
  const speaker = m.name ?? m.role;
775
796
  const content = contentToString(m.content);
776
797
  return `[${speaker}]: ${content}`;
@@ -801,7 +822,7 @@ var LessonExtractor = class {
801
822
  const trustLevel = this.trust.getLevel(agentId);
802
823
  if (trustLevel === "blocked") return;
803
824
  if (!this.trust.canLearn(agentId)) return;
804
- const exchangeText = extractExchangeText(messages);
825
+ const exchangeText = extractExchangeText(messages, agentId !== "unknown-agent" ? agentId : void 0);
805
826
  if (exchangeText.length < 20) return;
806
827
  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.
807
828
 
@@ -1310,7 +1331,7 @@ function renderPendingCard(l) {
1310
1331
  return '<div class="card" id="card-' + l.id + '">' +
1311
1332
  '<div class="card-instruction">' + esc(l.instruction) + '</div>' +
1312
1333
  '<div class="card-meta">' +
1313
- '<span>From: <strong>' + esc(l.learned_from) + '</strong></span>' +
1334
+ '<span>From: <a href="https://openclawcity.ai/' + encodeURIComponent(l.learned_from) + '" target="_blank" rel="noopener" style="color:var(--accent);text-decoration:none;font-weight:600">' + esc(l.learned_from) + '</a></span>' +
1314
1335
  '<span>Source: ' + esc(l.source) + '</span>' +
1315
1336
  '<span>Confidence: ' + (l.confidence * 100).toFixed(0) + '%</span>' +
1316
1337
  '<span>Skill: ' + esc(l.name) + '</span>' +
@@ -1364,7 +1385,7 @@ async function loadSkills() {
1364
1385
  html += '<div class="card" id="card-' + s.id + '">' +
1365
1386
  '<div class="card-header"><div class="card-instruction">' + esc(s.instruction) + '</div>' +
1366
1387
  '<button class="btn btn-disable btn-small" onclick="doDisable(\\''+s.id+'\\')">Disable</button></div>' +
1367
- '<div class="card-meta"><span>From: ' + esc(s.learned_from) + '</span><span>Source: ' + esc(s.source) + '</span></div>' +
1388
+ '<div class="card-meta"><span>From: <a href="https://openclawcity.ai/' + encodeURIComponent(s.learned_from) + '" target="_blank" rel="noopener" style="color:var(--accent);text-decoration:none">' + esc(s.learned_from) + '</a></span><span>Source: ' + esc(s.source) + '</span></div>' +
1368
1389
  '</div>';
1369
1390
  }
1370
1391
  html += '</div>';