cumora 0.1.49 → 0.1.50

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.
Files changed (2) hide show
  1. package/dist/cli.js +25 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -98,11 +98,19 @@ function spawnEngine(bin, args, { home, env, onLog, signal }) {
98
98
  signal.addEventListener("abort", onAbort, { once: true });
99
99
  const stderrTail = [];
100
100
  const stdoutTail = [];
101
+ let sessionId = null;
101
102
  const pump = (stream, buf) => {
102
103
  for (const line of buf.toString("utf8").split("\n")) {
103
104
  const cleaned = cleanLine(line);
104
105
  if (!cleaned) continue;
105
106
  pushTail(stream === "stderr" ? stderrTail : stdoutTail, cleaned);
107
+ if (stream === "stdout" && cleaned.startsWith("{") && cleaned.includes('"session_id"')) {
108
+ try {
109
+ const sid = JSON.parse(cleaned).session_id;
110
+ if (typeof sid === "string" && sid) sessionId = sid;
111
+ } catch {
112
+ }
113
+ }
106
114
  onLog(cleaned);
107
115
  }
108
116
  };
@@ -117,7 +125,8 @@ function spawnEngine(bin, args, { home, env, onLog, signal }) {
117
125
  const exitCode = code ?? (signalName ? 128 : 1);
118
126
  resolve({
119
127
  exitCode,
120
- error: exitCode === 0 ? void 0 : failurePreview({ exitCode, signalName, stderr: stderrTail, stdout: stdoutTail })
128
+ error: exitCode === 0 ? void 0 : failurePreview({ exitCode, signalName, stderr: stderrTail, stdout: stdoutTail }),
129
+ sessionId
121
130
  });
122
131
  });
123
132
  });
@@ -180,7 +189,8 @@ var ClaudeAdapter = class {
180
189
  run(args) {
181
190
  const flags = extraArgs("CUMORA_CLAUDE_ARGS");
182
191
  const model = args.model ? ["--model", args.model] : [];
183
- const argv = flags.length ? [...flags, "-p", args.prompt] : ["-p", args.prompt, ...model, "--output-format", "stream-json", "--verbose", "--dangerously-skip-permissions"];
192
+ const resume = args.resumeSessionId ? ["--resume", args.resumeSessionId] : [];
193
+ const argv = flags.length ? [...flags, ...resume, "-p", args.prompt] : ["-p", args.prompt, ...resume, ...model, "--output-format", "stream-json", "--verbose", "--dangerously-skip-permissions"];
184
194
  const env = {
185
195
  ...args.env,
186
196
  MAX_THINKING_TOKENS: args.env.MAX_THINKING_TOKENS ?? "0"
@@ -384,6 +394,11 @@ var AgentRunner = class {
384
394
  pendingRerun = false;
385
395
  stopped = false;
386
396
  lastWakeConvo = null;
397
+ /** The engine session id to `--resume` next wake, so the agent keeps
398
+ * continuous context (its place in a running task) instead of waking cold
399
+ * on a frozen inbox snapshot. Captured from each run's stream-json output;
400
+ * cleared if a resume fails so the next wake starts a clean session. */
401
+ sessionId = null;
387
402
  pollTimer;
388
403
  adapter;
389
404
  async start() {
@@ -604,17 +619,24 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
604
619
  this.memoryDigest(),
605
620
  Promise.resolve(this.formatTriageNote(triage))
606
621
  ]);
622
+ const resumeSessionId = this.sessionId;
607
623
  const result = await this.adapter.run({
608
624
  home: this.home,
609
625
  prompt: this.prompt(memoryDigest, triageNote),
610
626
  env: this.engineEnv(),
611
627
  model: this.agent.model,
612
628
  fastModel: this.agent.fastModel,
629
+ resumeSessionId,
613
630
  onLog: (line) => console.log(`[${this.agent.id}/${this.adapter.id}] ${line.slice(0, 500)}`),
614
631
  signal: controller.signal
615
632
  });
616
633
  exitCode = result.exitCode;
617
634
  if (result.error) engineError = this.visibleEngineError(exitCode, result.error);
635
+ if (result.sessionId) this.sessionId = result.sessionId;
636
+ else if (engineError && resumeSessionId && /resume|session|conversation/i.test(engineError)) {
637
+ console.warn(`[computer] ${this.agent.id} resume failed; starting a fresh session next wake`);
638
+ this.sessionId = null;
639
+ }
618
640
  } catch (err) {
619
641
  console.error(`[computer] ${this.agent.id} engine spawn failed:`, err instanceof Error ? err.message : err);
620
642
  exitCode = 1;
@@ -665,7 +687,7 @@ If nothing genuinely needs you, it's fine to do nothing and stop. When finished,
665
687
  void this.runTurn();
666
688
  for await (const evt of parseSseStream(res.body)) {
667
689
  if (this.stopped) break;
668
- if (evt.event === "wake") {
690
+ if (evt.event === "wake" || evt.event === "steer") {
669
691
  try {
670
692
  const convo = evt.data ? JSON.parse(evt.data).conversationId : null;
671
693
  if (convo) this.lastWakeConvo = convo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cumora",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Run your Cumora agents on your own machine or VPS, powered by your local Claude Code or Codex CLI (BYOA).",
5
5
  "type": "module",
6
6
  "bin": {