agent.libx.js 0.86.2 → 0.87.1
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 +15 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6107,6 +6107,19 @@ function initInstructions(cwd) {
|
|
|
6107
6107
|
err(green(` created ${path}
|
|
6108
6108
|
`) + dim(" edit it, then it auto-loads into every run.\n"));
|
|
6109
6109
|
}
|
|
6110
|
+
function persistModel(cwd, model) {
|
|
6111
|
+
const path = join8(cwd, ".agent", "settings.json");
|
|
6112
|
+
try {
|
|
6113
|
+
const obj = existsSync7(path) ? JSON.parse(readFileSync5(path, "utf8")) : {};
|
|
6114
|
+
if (obj.model === model) return;
|
|
6115
|
+
obj.model = model;
|
|
6116
|
+
mkdirSync6(dirname3(path), { recursive: true });
|
|
6117
|
+
writeFileSync6(path, JSON.stringify(obj, null, 2) + "\n");
|
|
6118
|
+
} catch (e) {
|
|
6119
|
+
err(yellow(` \u26A0 couldn't persist model to ${path} \u2014 ${e?.message ?? e}
|
|
6120
|
+
`));
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6110
6123
|
async function repl(args, ai, cfg, cwd) {
|
|
6111
6124
|
const oauth = new McpOAuth({ storePath: join8(cwd, ".agent", "mcp-auth.json") });
|
|
6112
6125
|
const mounted = await mountMcp(cfg, oauth);
|
|
@@ -6374,12 +6387,14 @@ ${extra}` : body, checkpoints, cwd);
|
|
|
6374
6387
|
run: async (a) => {
|
|
6375
6388
|
if (a[0]) {
|
|
6376
6389
|
agent.options.model = a[0];
|
|
6390
|
+
persistModel(cwd, a[0]);
|
|
6377
6391
|
err(dim(" model \u2192 " + a[0] + "\n"));
|
|
6378
6392
|
return;
|
|
6379
6393
|
}
|
|
6380
6394
|
const picked = await pickModel(agent.options.model);
|
|
6381
6395
|
if (picked) {
|
|
6382
6396
|
agent.options.model = picked;
|
|
6397
|
+
persistModel(cwd, picked);
|
|
6383
6398
|
err(dim(" model \u2192 " + picked + "\n"));
|
|
6384
6399
|
} else err(dim(" " + agent.options.model + "\n"));
|
|
6385
6400
|
}
|