ework-daemon 0.4.46 → 0.4.47

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 +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.46",
3
+ "version": "0.4.47",
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
@@ -335,6 +335,7 @@ export class Engine {
335
335
  private lastOutputAt = new Map<string, number>();
336
336
  private startedAt = new Map<string, number>();
337
337
  private progressCommentId = new Map<string, string>();
338
+ private pickupCommentId = new Map<string, string>();
338
339
 
339
340
  private nudgeRounds = new Map<string, number>();
340
341
  private emptyResponseRounds = new Map<string, number>();
@@ -805,7 +806,12 @@ export class Engine {
805
806
 
806
807
  // Ack before resolving the workdir: a first-touch clone can take minutes
807
808
  // (or hit the 10-min cap), and the user must see pickup feedback immediately.
808
- await tracker.createComment(ref, `[system] 🔄 **${session.name}** picked up this issue preparing workspace…\n> session: ${this.sessionRef(session)}`);
809
+ // The session link is a placeholder until the backend reports its session id;
810
+ // the onSessionId callback rewrites this comment with the real reference.
811
+ await tracker.createComment(ref, `[system] 🔄 **${session.name}** picked up this issue — preparing workspace…`).then(
812
+ (c) => this.pickupCommentId.set(k, c.id),
813
+ () => {},
814
+ );
809
815
  void tracker.updateStatus(ref, "processing");
810
816
  const workdir = await this.resolveWorkdir(session, issue);
811
817
  log.info(`engine: session "${session.name}" created for ${k}, workdir=${workdir}`);
@@ -1210,6 +1216,13 @@ export class Engine {
1210
1216
  await this.store.updateSession(session.id, { opencodeSessionId: id });
1211
1217
  session.opencodeSessionId = id;
1212
1218
  log.info(`engine: captured sessionID=${id.slice(0, 8)} for ${k} (early persist)`);
1219
+ const pickupId = this.pickupCommentId.get(k);
1220
+ if (pickupId) {
1221
+ this.pickupCommentId.delete(k);
1222
+ await tracker
1223
+ .editComment(ref, pickupId, `[system] 🔄 **${session.name}** picked up this issue.\n> session: ${this.sessionRef(session)} | workdir: ${this.workdirLink(workdir)}`)
1224
+ .catch((err) => log.error(`engine: failed to rewrite pickup comment for ${k}:`, (err as Error).message));
1225
+ }
1213
1226
  }
1214
1227
  },
1215
1228
  },
@@ -1306,6 +1319,7 @@ export class Engine {
1306
1319
  return;
1307
1320
  }
1308
1321
  this.progressCommentId.delete(k);
1322
+ this.pickupCommentId.delete(k);
1309
1323
  this.currentPrompt.delete(k);
1310
1324
  await this.persistRuntimeState(session.id);
1311
1325