ework-daemon 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/opencode.ts +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Issue-driven AI development daemon. Spawns opencode subprocesses to resolve Gitea issues.",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
package/src/opencode.ts CHANGED
@@ -481,10 +481,15 @@ export class Engine {
481
481
  // routing to the last-active lets the user continue without re-@mentioning,
482
482
  // while @mention switches to a different AI.
483
483
  const sessions = await this.store.getSessionsForIssue(issue.id);
484
- if (sessions.length === 0) return;
485
-
486
- const session = pickLastActive(sessions);
487
- if (!session) return;
484
+ let session: OpSession;
485
+ if (sessions.length === 0) {
486
+ log.info(`engine: no session for ${scopeKey}#${ref.issueId} — creating default "${this.cfg.bot.username}"`);
487
+ session = await this.store.createSession(issue.id, this.cfg.bot.username);
488
+ } else {
489
+ const picked = pickLastActive(sessions);
490
+ if (!picked) return;
491
+ session = picked;
492
+ }
488
493
  if (dirPath) {
489
494
  await this.store.updateSession(session.id, { workdir: dirPath });
490
495
  session.workdir = dirPath;