ework-daemon 0.4.12 → 0.4.13

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 +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
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
@@ -259,6 +259,22 @@ export class Engine {
259
259
  void this.recover();
260
260
  }
261
261
 
262
+ private daemonEndpoint(): string {
263
+ return this.cfg.daemon.endpoint || `${this.cfg.daemon.host}:${this.cfg.daemon.port}`;
264
+ }
265
+
266
+ private workdirLink(workdir: string): string {
267
+ const ep = encodeURIComponent(this.daemonEndpoint());
268
+ const p = encodeURIComponent(workdir);
269
+ return `[${workdir}](/file?path=${p}&daemon=${ep})`;
270
+ }
271
+
272
+ private sessionRef(session: { id: string; opencodeSessionId?: string | null }): string {
273
+ const ses = session.opencodeSessionId || session.id;
274
+ const ep = encodeURIComponent(this.daemonEndpoint());
275
+ return `[\`${ses}\`](/sessions/${encodeURIComponent(ses)}?daemon=${ep})`;
276
+ }
277
+
262
278
  /** Start the lease heartbeat. Must be called once after registerDaemon. */
263
279
  startHeartbeat(intervalMs: number): void {
264
280
  if (this.heartbeatTimer) clearInterval(this.heartbeatTimer);
@@ -498,7 +514,7 @@ export class Engine {
498
514
  const workdir = await this.resolveWorkdir(session, issue);
499
515
  log.info(`engine: session "${session.name}" created for ${k}, workdir=${workdir}`);
500
516
 
501
- await tracker.createComment(ref, `[system] 🔄 **${session.name}** picked up this issue.\n> session: \`${session.id}\` | workdir: \`${workdir}\``);
517
+ await tracker.createComment(ref, `[system] 🔄 **${session.name}** picked up this issue.\n> session: ${this.sessionRef(session)} | workdir: ${this.workdirLink(workdir)}`);
502
518
 
503
519
  const instructions = tracker.getTrackerInstructions(ref);
504
520
  const prompt = this.buildInitialPrompt(
@@ -580,7 +596,7 @@ export class Engine {
580
596
  );
581
597
 
582
598
  // Immediate ack
583
- await tracker.createComment(ref, `[system] ✓ Message forwarded to **${session.name}**${this.running.has(this.sessionKey(session, issue)) ? " (running)" : ""}.\n> session: \`${session.id}\` | workdir: \`${workdir}\``);
599
+ await tracker.createComment(ref, `[system] ✓ Message forwarded to **${session.name}**${this.running.has(this.sessionKey(session, issue)) ? " (running)" : ""}.\n> session: ${this.sessionRef(session)} | workdir: ${this.workdirLink(workdir)}`);
584
600
 
585
601
  await this.enqueueOrRun(session, issue, prompt, comment.id, model);
586
602
  } else {
@@ -627,7 +643,7 @@ export class Engine {
627
643
  session.name, this.handleLargeContent(workdir, comment.body, `comment-${comment.id}.txt`),
628
644
  comment.author, issueData.title, workdir, instructions
629
645
  );
630
- await tracker.createComment(ref, `[system] ✓ Message forwarded to **${session.name}**${this.running.has(this.sessionKey(session, issue)) ? " (running)" : ""}.\n> session: \`${session.id}\` | workdir: \`${workdir}\``);
646
+ await tracker.createComment(ref, `[system] ✓ Message forwarded to **${session.name}**${this.running.has(this.sessionKey(session, issue)) ? " (running)" : ""}.\n> session: ${this.sessionRef(session)} | workdir: ${this.workdirLink(workdir)}`);
631
647
  await this.enqueueOrRun(session, issue, prompt, comment.id, model);
632
648
  }
633
649
  } finally {