cumora 0.1.42 → 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 +21 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -292,6 +292,7 @@ var AgentRunner = class {
|
|
|
292
292
|
busy = false;
|
|
293
293
|
pendingRerun = false;
|
|
294
294
|
stopped = false;
|
|
295
|
+
lastWakeConvo = null;
|
|
295
296
|
adapter;
|
|
296
297
|
async start() {
|
|
297
298
|
await this.adapter.seedHome(this.home, { id: this.agent.id, name: this.agent.name, role: this.agent.role });
|
|
@@ -348,7 +349,16 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
348
349
|
this.pendingRerun = false;
|
|
349
350
|
await this.ensureToken();
|
|
350
351
|
const token = this.token;
|
|
352
|
+
const convo = this.lastWakeConvo;
|
|
351
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
|
+
}
|
|
352
362
|
const run = await runtimeBest(this.cfg.serverUrl, "/runs", token, {
|
|
353
363
|
trigger: { source: "byoa", engine: this.adapter.id }
|
|
354
364
|
});
|
|
@@ -368,6 +378,9 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
368
378
|
} catch (err) {
|
|
369
379
|
console.error(`[computer] ${this.agent.id} engine spawn failed:`, err instanceof Error ? err.message : err);
|
|
370
380
|
exitCode = 1;
|
|
381
|
+
} finally {
|
|
382
|
+
if (typingTimer) clearInterval(typingTimer);
|
|
383
|
+
if (convo) await runtimeBest(this.cfg.serverUrl, "/typing", token, { conversationId: convo, done: true });
|
|
371
384
|
}
|
|
372
385
|
if (run?.runId) {
|
|
373
386
|
await runtimeBest(this.cfg.serverUrl, `/runs/${run.runId}/finish`, token, {
|
|
@@ -397,7 +410,14 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
|
|
|
397
410
|
void this.runTurn();
|
|
398
411
|
for await (const evt of parseSseStream(res.body)) {
|
|
399
412
|
if (this.stopped) break;
|
|
400
|
-
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
|
+
}
|
|
401
421
|
}
|
|
402
422
|
} catch (err) {
|
|
403
423
|
if (this.stopped) break;
|