cumora 0.1.41 → 0.1.43
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 +22 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -275,8 +275,7 @@ async function doPair(code, serverUrl) {
|
|
|
275
275
|
{ method: "POST", body: JSON.stringify({ code, hostName: await detectHostName(), engines }) }
|
|
276
276
|
);
|
|
277
277
|
await saveConfig({ serverUrl, computerId: paired.computerId, deviceToken: paired.deviceToken });
|
|
278
|
-
console.log(`[computer] paired as ${paired.computerId} (engines: ${engines.join(", ") || "none"})`);
|
|
279
|
-
console.log(`[computer] run \`npx cumora agent computer\` to start hosting your agents.`);
|
|
278
|
+
console.log(`[computer] paired as ${paired.computerId} (engines: ${engines.join(", ") || "none"}) \u2014 starting\u2026`);
|
|
280
279
|
}
|
|
281
280
|
var AgentRunner = class {
|
|
282
281
|
constructor(cfg, agent, engine) {
|
|
@@ -293,6 +292,7 @@ var AgentRunner = class {
|
|
|
293
292
|
busy = false;
|
|
294
293
|
pendingRerun = false;
|
|
295
294
|
stopped = false;
|
|
295
|
+
lastWakeConvo = null;
|
|
296
296
|
adapter;
|
|
297
297
|
async start() {
|
|
298
298
|
await this.adapter.seedHome(this.home, { id: this.agent.id, name: this.agent.name, role: this.agent.role });
|
|
@@ -349,7 +349,16 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
349
349
|
this.pendingRerun = false;
|
|
350
350
|
await this.ensureToken();
|
|
351
351
|
const token = this.token;
|
|
352
|
+
const convo = this.lastWakeConvo;
|
|
352
353
|
await runtimeBest(this.cfg.serverUrl, "/status", token, { status: "thinking" });
|
|
354
|
+
let typingTimer;
|
|
355
|
+
if (convo) {
|
|
356
|
+
const ping = () => {
|
|
357
|
+
void runtimeBest(this.cfg.serverUrl, "/typing", token, { conversationId: convo, done: false });
|
|
358
|
+
};
|
|
359
|
+
ping();
|
|
360
|
+
typingTimer = setInterval(ping, 6e3);
|
|
361
|
+
}
|
|
353
362
|
const run = await runtimeBest(this.cfg.serverUrl, "/runs", token, {
|
|
354
363
|
trigger: { source: "byoa", engine: this.adapter.id }
|
|
355
364
|
});
|
|
@@ -369,6 +378,9 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
369
378
|
} catch (err) {
|
|
370
379
|
console.error(`[computer] ${this.agent.id} engine spawn failed:`, err instanceof Error ? err.message : err);
|
|
371
380
|
exitCode = 1;
|
|
381
|
+
} finally {
|
|
382
|
+
if (typingTimer) clearInterval(typingTimer);
|
|
383
|
+
if (convo) await runtimeBest(this.cfg.serverUrl, "/typing", token, { conversationId: convo, done: true });
|
|
372
384
|
}
|
|
373
385
|
if (run?.runId) {
|
|
374
386
|
await runtimeBest(this.cfg.serverUrl, `/runs/${run.runId}/finish`, token, {
|
|
@@ -398,7 +410,14 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
398
410
|
void this.runTurn();
|
|
399
411
|
for await (const evt of parseSseStream(res.body)) {
|
|
400
412
|
if (this.stopped) break;
|
|
401
|
-
if (evt.event === "wake")
|
|
413
|
+
if (evt.event === "wake") {
|
|
414
|
+
try {
|
|
415
|
+
const convo = evt.data ? JSON.parse(evt.data).conversationId : null;
|
|
416
|
+
if (convo) this.lastWakeConvo = convo;
|
|
417
|
+
} catch {
|
|
418
|
+
}
|
|
419
|
+
void this.runTurn();
|
|
420
|
+
}
|
|
402
421
|
}
|
|
403
422
|
} catch (err) {
|
|
404
423
|
if (this.stopped) break;
|
|
@@ -488,7 +507,6 @@ async function runComputerDaemon(argv) {
|
|
|
488
507
|
const serverUrl = (args.server || DEFAULT_SERVER).replace(/\/+$/, "");
|
|
489
508
|
if (args.pair) {
|
|
490
509
|
await doPair(args.pair, serverUrl);
|
|
491
|
-
return;
|
|
492
510
|
}
|
|
493
511
|
await doRun(args.server ? serverUrl : void 0);
|
|
494
512
|
}
|