@openclawcity/become 1.0.1 → 1.0.2
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 +25 -3
- package/dist/cli.cjs +46 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +46 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Install become. It sits between your agent and its LLM. When your agent talks to
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/@openclawcity/become)
|
|
12
12
|
[](LICENSE)
|
|
13
|
-
[]()
|
|
13
|
+
[](https://github.com/openclawcity/become)
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -127,7 +127,7 @@ Open `http://localhost:30002` when the proxy is running.
|
|
|
127
127
|
| **On/off switch** | `become off` — your agent bypasses the proxy completely. |
|
|
128
128
|
| **Local only** | Everything stored in `~/.become/` on your machine. |
|
|
129
129
|
| **No data sent** | become never phones home. Only talks to the LLM you configured. |
|
|
130
|
-
| **Open source** | MIT license.
|
|
130
|
+
| **Open source** | MIT license. 492 tests. |
|
|
131
131
|
|
|
132
132
|
---
|
|
133
133
|
|
|
@@ -195,6 +195,28 @@ Yes. The LLM that analyzes conversations can be different from your agent's LLM.
|
|
|
195
195
|
|
|
196
196
|
---
|
|
197
197
|
|
|
198
|
+
## Update, downgrade, uninstall
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Update to latest version
|
|
202
|
+
npm update -g @openclawcity/become
|
|
203
|
+
|
|
204
|
+
# Check which version you have
|
|
205
|
+
become --version
|
|
206
|
+
|
|
207
|
+
# Uninstall completely (removes CLI, keeps your learned skills)
|
|
208
|
+
npm uninstall -g @openclawcity/become
|
|
209
|
+
|
|
210
|
+
# Uninstall and remove all data (skills, config, trust, everything)
|
|
211
|
+
npm uninstall -g @openclawcity/become && rm -rf ~/.become
|
|
212
|
+
|
|
213
|
+
# If become was ON when you uninstall, restore your agent first
|
|
214
|
+
become off # restores original agent config
|
|
215
|
+
npm uninstall -g @openclawcity/become
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
198
220
|
## Also included (library mode)
|
|
199
221
|
|
|
200
222
|
become also exports a TypeScript library for programmatic use:
|
|
@@ -215,7 +237,7 @@ Plus: skill scoring (Dreyfus stages), peer review protocol, teaching protocol, l
|
|
|
215
237
|
|
|
216
238
|
```bash
|
|
217
239
|
git clone https://github.com/openclawcity/become.git
|
|
218
|
-
cd become && npm install && npm test #
|
|
240
|
+
cd become && npm install && npm test # 492 tests
|
|
219
241
|
```
|
|
220
242
|
|
|
221
243
|
---
|
package/dist/cli.cjs
CHANGED
|
@@ -1265,18 +1265,24 @@ function patchOpenClaw(config) {
|
|
|
1265
1265
|
const raw = (0, import_node_fs4.readFileSync)(OPENCLAW_CONFIG, "utf-8");
|
|
1266
1266
|
const clawConfig = JSON.parse(raw);
|
|
1267
1267
|
(0, import_node_fs4.mkdirSync)((0, import_node_path4.join)((0, import_node_os2.homedir)(), ".become", "state"), { recursive: true });
|
|
1268
|
-
(
|
|
1268
|
+
if (!clawConfig.models?.providers?.become) {
|
|
1269
|
+
(0, import_node_fs4.writeFileSync)(BACKUP_PATH, raw, "utf-8");
|
|
1270
|
+
}
|
|
1271
|
+
const originalModel = clawConfig.agents?.defaults?.model?.primary ?? "";
|
|
1272
|
+
const originalModelPath = (0, import_node_path4.join)((0, import_node_os2.homedir)(), ".become", "state", "original_model.txt");
|
|
1273
|
+
(0, import_node_fs4.writeFileSync)(originalModelPath, originalModel, "utf-8");
|
|
1274
|
+
const modelId = originalModel.includes("/") ? originalModel.split("/").slice(1).join("/") : originalModel;
|
|
1269
1275
|
if (!clawConfig.models) clawConfig.models = {};
|
|
1270
1276
|
if (!clawConfig.models.providers) clawConfig.models.providers = {};
|
|
1271
1277
|
clawConfig.models.providers.become = {
|
|
1272
|
-
api: "anthropic-messages",
|
|
1278
|
+
api: config.llm_provider === "openai" ? "openai-completions" : "anthropic-messages",
|
|
1273
1279
|
baseUrl: `http://127.0.0.1:${config.proxy_port}`,
|
|
1274
|
-
apiKey: config.llm_api_key
|
|
1280
|
+
apiKey: config.llm_api_key,
|
|
1281
|
+
models: [
|
|
1282
|
+
{ id: modelId, name: `${modelId} via become` }
|
|
1283
|
+
]
|
|
1275
1284
|
};
|
|
1276
|
-
if (
|
|
1277
|
-
const original = clawConfig.agents.defaults.model.primary;
|
|
1278
|
-
clawConfig.models.providers.become._originalModel = original;
|
|
1279
|
-
const modelId = original.includes("/") ? original.split("/").slice(1).join("/") : original;
|
|
1285
|
+
if (originalModel) {
|
|
1280
1286
|
clawConfig.agents.defaults.model.primary = `become/${modelId}`;
|
|
1281
1287
|
}
|
|
1282
1288
|
(0, import_node_fs4.writeFileSync)(OPENCLAW_CONFIG, JSON.stringify(clawConfig, null, 2), "utf-8");
|
|
@@ -1287,17 +1293,46 @@ function patchOpenClaw(config) {
|
|
|
1287
1293
|
}
|
|
1288
1294
|
}
|
|
1289
1295
|
function restoreOpenClaw() {
|
|
1290
|
-
if (!(0, import_node_fs4.existsSync)(
|
|
1291
|
-
throw new Error(
|
|
1296
|
+
if (!(0, import_node_fs4.existsSync)(OPENCLAW_CONFIG)) {
|
|
1297
|
+
throw new Error(`OpenClaw config not found at ${OPENCLAW_CONFIG}`);
|
|
1298
|
+
}
|
|
1299
|
+
if ((0, import_node_fs4.existsSync)(BACKUP_PATH)) {
|
|
1300
|
+
const backup = (0, import_node_fs4.readFileSync)(BACKUP_PATH, "utf-8");
|
|
1301
|
+
const backupConfig = JSON.parse(backup);
|
|
1302
|
+
if (!backupConfig.models?.providers?.become) {
|
|
1303
|
+
(0, import_node_fs4.writeFileSync)(OPENCLAW_CONFIG, backup, "utf-8");
|
|
1304
|
+
} else {
|
|
1305
|
+
manualRestore();
|
|
1306
|
+
}
|
|
1307
|
+
} else {
|
|
1308
|
+
manualRestore();
|
|
1292
1309
|
}
|
|
1293
|
-
const backup = (0, import_node_fs4.readFileSync)(BACKUP_PATH, "utf-8");
|
|
1294
|
-
(0, import_node_fs4.writeFileSync)(OPENCLAW_CONFIG, backup, "utf-8");
|
|
1295
1310
|
try {
|
|
1296
1311
|
(0, import_node_child_process.execSync)("openclaw gateway restart", { stdio: "pipe", timeout: 15e3 });
|
|
1297
1312
|
} catch {
|
|
1298
1313
|
console.log("Warning: Could not restart OpenClaw gateway. Restart it manually: openclaw gateway restart");
|
|
1299
1314
|
}
|
|
1300
1315
|
}
|
|
1316
|
+
function manualRestore() {
|
|
1317
|
+
const raw = (0, import_node_fs4.readFileSync)(OPENCLAW_CONFIG, "utf-8");
|
|
1318
|
+
const config = JSON.parse(raw);
|
|
1319
|
+
const originalModelPath = (0, import_node_path4.join)((0, import_node_os2.homedir)(), ".become", "state", "original_model.txt");
|
|
1320
|
+
if ((0, import_node_fs4.existsSync)(originalModelPath)) {
|
|
1321
|
+
const originalModel = (0, import_node_fs4.readFileSync)(originalModelPath, "utf-8").trim();
|
|
1322
|
+
if (originalModel && config.agents?.defaults?.model) {
|
|
1323
|
+
config.agents.defaults.model.primary = originalModel;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (config.models?.providers?.become) {
|
|
1327
|
+
delete config.models.providers.become;
|
|
1328
|
+
}
|
|
1329
|
+
for (const provider of Object.values(config.models?.providers ?? {})) {
|
|
1330
|
+
if (provider && typeof provider === "object" && "_originalModel" in provider) {
|
|
1331
|
+
delete provider._originalModel;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
(0, import_node_fs4.writeFileSync)(OPENCLAW_CONFIG, JSON.stringify(config, null, 2), "utf-8");
|
|
1335
|
+
}
|
|
1301
1336
|
|
|
1302
1337
|
// src/cli/adapter/ironclaw.ts
|
|
1303
1338
|
var import_node_fs5 = require("fs");
|