@openclawcity/become 1.0.20 → 1.0.24
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/README.md +12 -8
- package/dist/cli.cjs +30 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +30 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -718,9 +718,12 @@ Rules:
|
|
|
718
718
|
- Max 3 lessons per conversation
|
|
719
719
|
- If no real learning happened, return []`;
|
|
720
720
|
try {
|
|
721
|
+
console.log(`[become] extracting lessons from ${agentId} (${detection.exchangeType}), text length: ${exchangeText.length}`);
|
|
721
722
|
const response = await this.analyzer.analyze(prompt);
|
|
722
723
|
const lessons = this.parseLessons(response);
|
|
724
|
+
console.log(`[become] LLM returned ${lessons.length} lessons`);
|
|
723
725
|
for (const lesson of lessons.slice(0, 3)) {
|
|
726
|
+
console.log(`[become] saving lesson: ${lesson.skill} (confidence: ${lesson.confidence})`);
|
|
724
727
|
const saved = this.store.savePending({
|
|
725
728
|
name: lesson.skill,
|
|
726
729
|
instruction: lesson.instruction.slice(0, 500),
|
|
@@ -730,13 +733,18 @@ Rules:
|
|
|
730
733
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
731
734
|
});
|
|
732
735
|
if (saved) {
|
|
736
|
+
console.log(`[become] lesson saved: ${saved.id}`);
|
|
733
737
|
this.trust.recordLesson(agentId);
|
|
734
738
|
if (trustLevel === "trusted") {
|
|
735
739
|
this.store.approve(saved.id);
|
|
740
|
+
console.log(`[become] auto-approved (trusted agent)`);
|
|
736
741
|
}
|
|
742
|
+
} else {
|
|
743
|
+
console.log(`[become] lesson NOT saved (duplicate or store error)`);
|
|
737
744
|
}
|
|
738
745
|
}
|
|
739
|
-
} catch {
|
|
746
|
+
} catch (err) {
|
|
747
|
+
console.log(`[become] extraction error: ${err instanceof Error ? err.message : String(err)}`);
|
|
740
748
|
}
|
|
741
749
|
}
|
|
742
750
|
parseLessons(response) {
|
|
@@ -1449,6 +1457,7 @@ import { homedir as homedir3 } from "os";
|
|
|
1449
1457
|
import { execSync as execSync2 } from "child_process";
|
|
1450
1458
|
var IRONCLAW_ENV = join5(process.env.IRONCLAW_BASE_DIR ?? join5(homedir3(), ".ironclaw"), ".env");
|
|
1451
1459
|
var BACKUP_PATH2 = join5(homedir3(), ".become", "state", "original_ironclaw.env");
|
|
1460
|
+
var ORIGINAL_URL_PATH2 = join5(homedir3(), ".become", "state", "original_base_url.txt");
|
|
1452
1461
|
function patchIronClaw(config) {
|
|
1453
1462
|
if (!existsSync5(IRONCLAW_ENV)) {
|
|
1454
1463
|
throw new Error(`IronClaw .env not found at ${IRONCLAW_ENV}`);
|
|
@@ -1480,6 +1489,12 @@ function patchIronClaw(config) {
|
|
|
1480
1489
|
vars["LLM_BASE_URL"] = proxyUrl;
|
|
1481
1490
|
break;
|
|
1482
1491
|
}
|
|
1492
|
+
const urlVarName = Object.keys(vars)[0];
|
|
1493
|
+
const originalUrlMatch = content.match(new RegExp(`^${urlVarName}=(.+)$`, "m"));
|
|
1494
|
+
const originalUrl = originalUrlMatch?.[1]?.trim() ?? "";
|
|
1495
|
+
if (originalUrl) {
|
|
1496
|
+
writeFileSync5(ORIGINAL_URL_PATH2, originalUrl, "utf-8");
|
|
1497
|
+
}
|
|
1483
1498
|
patchDotEnv(IRONCLAW_ENV, vars);
|
|
1484
1499
|
console.log(` backend: ${backend}`);
|
|
1485
1500
|
console.log(` patched: ${Object.keys(vars).join(", ")} -> localhost:${config.proxy_port}`);
|
|
@@ -1541,6 +1556,7 @@ import { homedir as homedir4 } from "os";
|
|
|
1541
1556
|
import { execSync as execSync3 } from "child_process";
|
|
1542
1557
|
var BACKUP_PATH3 = join6(homedir4(), ".become", "state", "original_nanoclaw.env");
|
|
1543
1558
|
var PATCHED_ENV_PATH_FILE = join6(homedir4(), ".become", "state", "nanoclaw_env_path.txt");
|
|
1559
|
+
var ORIGINAL_URL_PATH3 = join6(homedir4(), ".become", "state", "original_base_url.txt");
|
|
1544
1560
|
var NANOCLAW_URL_VAR = "ANTHROPIC_BASE_URL";
|
|
1545
1561
|
function patchNanoClaw(config) {
|
|
1546
1562
|
const envPath = findNanoClawEnv();
|
|
@@ -1558,6 +1574,12 @@ Set ${NANOCLAW_URL_VAR}=http://127.0.0.1:${config.proxy_port} manually in your N
|
|
|
1558
1574
|
mkdirSync6(join6(homedir4(), ".become", "state"), { recursive: true });
|
|
1559
1575
|
copyFileSync2(envPath, BACKUP_PATH3);
|
|
1560
1576
|
writeFileSync6(PATCHED_ENV_PATH_FILE, envPath, "utf-8");
|
|
1577
|
+
const content = readFileSync6(envPath, "utf-8");
|
|
1578
|
+
const originalMatch = content.match(new RegExp(`^${NANOCLAW_URL_VAR}=(.+)$`, "m"));
|
|
1579
|
+
const originalUrl = originalMatch?.[1]?.trim() ?? "";
|
|
1580
|
+
if (originalUrl) {
|
|
1581
|
+
writeFileSync6(ORIGINAL_URL_PATH3, originalUrl, "utf-8");
|
|
1582
|
+
}
|
|
1561
1583
|
patchDotEnv2(envPath, {
|
|
1562
1584
|
[NANOCLAW_URL_VAR]: `http://127.0.0.1:${config.proxy_port}`
|
|
1563
1585
|
});
|
|
@@ -1842,6 +1864,13 @@ async function start() {
|
|
|
1842
1864
|
max_skills_per_call: config.max_skills_per_call,
|
|
1843
1865
|
auto_extract: config.auto_extract
|
|
1844
1866
|
};
|
|
1867
|
+
if (config.state !== "on") {
|
|
1868
|
+
try {
|
|
1869
|
+
turnOn();
|
|
1870
|
+
} catch (e) {
|
|
1871
|
+
console.error("Warning: could not auto-connect agent:", e instanceof Error ? e.message : e);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1845
1874
|
const originalUrlPath = join7(homedir5(), ".become", "state", "original_base_url.txt");
|
|
1846
1875
|
let originalUpstreamUrl;
|
|
1847
1876
|
if (existsSync7(originalUrlPath)) {
|
|
@@ -1872,13 +1901,6 @@ async function start() {
|
|
|
1872
1901
|
}
|
|
1873
1902
|
});
|
|
1874
1903
|
await dashboard.listen(config.dashboard_port);
|
|
1875
|
-
if (config.state !== "on") {
|
|
1876
|
-
try {
|
|
1877
|
-
turnOn();
|
|
1878
|
-
} catch (e) {
|
|
1879
|
-
console.error("Warning: could not auto-connect agent:", e instanceof Error ? e.message : e);
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
1904
|
const approved = proxy.store.listApproved().length;
|
|
1883
1905
|
const pending = proxy.store.listPending().length;
|
|
1884
1906
|
const trustConfig = proxy.trust.getConfig();
|