cumora 0.1.43 → 0.1.44
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 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -302,6 +302,14 @@ var AgentRunner = class {
|
|
|
302
302
|
stop() {
|
|
303
303
|
this.stopped = true;
|
|
304
304
|
}
|
|
305
|
+
/** Does this runner's live config still match the latest server state? The
|
|
306
|
+
* engine + model + persona are captured at construction (the adapter is
|
|
307
|
+
* fixed, and seedHome runs once in start()), so when any of them changes in
|
|
308
|
+
* Cumora, sync() must tear this runner down and build a fresh one — otherwise
|
|
309
|
+
* e.g. a Claude→Codex switch wouldn't take effect until a daemon restart. */
|
|
310
|
+
configMatches(agent, engine) {
|
|
311
|
+
return this.adapter.id === engine && this.agent.name === agent.name && this.agent.role === agent.role && this.agent.model === agent.model && this.agent.fastModel === agent.fastModel;
|
|
312
|
+
}
|
|
305
313
|
async ensureToken() {
|
|
306
314
|
if (this.token && Date.now() < this.tokenExpiresAt - TOKEN_REFRESH_SKEW_MS) return this.token;
|
|
307
315
|
const minted = await api(
|
|
@@ -455,9 +463,15 @@ async function doRun(serverOverride) {
|
|
|
455
463
|
return;
|
|
456
464
|
}
|
|
457
465
|
for (const agent of agents) {
|
|
458
|
-
if (runners.has(agent.id)) continue;
|
|
459
466
|
const engine = agent.engine && available.includes(agent.engine) ? agent.engine : available[0] ?? null;
|
|
460
467
|
if (!engine) continue;
|
|
468
|
+
const existing = runners.get(agent.id);
|
|
469
|
+
if (existing) {
|
|
470
|
+
if (existing.configMatches(agent, engine)) continue;
|
|
471
|
+
console.log(`[computer] agent ${agent.name} (${agent.id}) config changed \u2192 restarting on ${engine}`);
|
|
472
|
+
existing.stop();
|
|
473
|
+
runners.delete(agent.id);
|
|
474
|
+
}
|
|
461
475
|
const runner = new AgentRunner(cfg, agent, engine);
|
|
462
476
|
runners.set(agent.id, runner);
|
|
463
477
|
console.log(`[computer] hosting agent ${agent.name} (${agent.id}) on ${engine}`);
|