ework-daemon 0.4.47 → 0.4.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.47",
3
+ "version": "0.4.49",
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
@@ -717,7 +717,7 @@ export class Engine {
717
717
 
718
718
  if (event.type === "comment_created" && event.comment?.author) {
719
719
  const author = event.comment.author;
720
- const authorKind = event.comment.author_kind ?? "human";
720
+ const authorKind = event.comment.authorKind ?? "human";
721
721
  const d = this.cfg.daemon;
722
722
  const noWake = [...d.nonWakingAuthors, ...d.noWakeLogins];
723
723
  if (noWake.includes(author)) {
@@ -817,6 +817,8 @@ export class Engine {
817
817
  log.info(`engine: session "${session.name}" created for ${k}, workdir=${workdir}`);
818
818
 
819
819
  const instructions = tracker.getTrackerInstructions(ref);
820
+ const payloadClone = this.cloneUrls.get(`${ref.trackerType}:${scopeKey}#${ref.issueId}`);
821
+ if (payloadClone) instructions.clone = `git clone ${payloadClone} .`;
820
822
  const prompt = this.buildInitialPrompt(
821
823
  session.name, issueData.title,
822
824
  this.handleLargeContent(workdir, issueData.body, "issue-body.txt"),
@@ -892,7 +894,7 @@ export class Engine {
892
894
  const instructions = tracker.getTrackerInstructions(ref);
893
895
  const prompt = this.buildForwardPrompt(
894
896
  session.name, this.handleLargeContent(workdir, comment.body, `comment-${comment.id}.txt`),
895
- comment.author, issueData.title, workdir, instructions
897
+ comment.author, comment.authorKind, issueData.title, workdir, instructions
896
898
  );
897
899
 
898
900
  // Immediate ack
@@ -911,6 +913,8 @@ export class Engine {
911
913
  await tracker.createComment(ref, `[system] 🔄 **${session.name}** joined the conversation.`);
912
914
 
913
915
  const instructions = tracker.getTrackerInstructions(ref);
916
+ const payloadClone = this.cloneUrls.get(`${ref.trackerType}:${scopeKey}#${ref.issueId}`);
917
+ if (payloadClone) instructions.clone = `git clone ${payloadClone} .`;
914
918
  const prompt = this.buildInitialPrompt(
915
919
  session.name, issueData.title,
916
920
  this.handleLargeContent(workdir, issueData.body, "issue-body.txt"),
@@ -941,7 +945,7 @@ export class Engine {
941
945
  const instructions = tracker.getTrackerInstructions(ref);
942
946
  const prompt = this.buildForwardPrompt(
943
947
  session.name, this.handleLargeContent(workdir, comment.body, `comment-${comment.id}.txt`),
944
- comment.author, issueData.title, workdir, instructions
948
+ comment.author, comment.authorKind, issueData.title, workdir, instructions
945
949
  );
946
950
  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)}`);
947
951
  await this.enqueueOrRun(session, issue, prompt, comment.id, model);
@@ -1486,27 +1490,22 @@ export class Engine {
1486
1490
  instructions: { clone: string; issueRef: string; closeIssue?: string }
1487
1491
  ): string {
1488
1492
  return [
1489
- `You are ${opName}, an AI development assistant.`,
1490
- `Your identity is "${opName}" this name was assigned when you were initialized.`,
1493
+ `You are ${opName}, the AI agent for this project on ework (a self-hosted, issue-driven dev platform).`,
1494
+ `Who's who: issue comments come from the project's users (humans like @${author}; bots are labelled "bot") and are forwarded to you verbatim. Your \`reply\` tool posts a comment they read (prefixed \`[bot]\`). Lines starting with \`[system]\` are platform plumbing, not user speech.`,
1495
+ `The working directory below is your own clone of the repo. Only claim actions you actually performed — verify with tools (git status/log) before asserting any push, merge, or change.`,
1491
1496
  ``,
1492
1497
  `A new issue needs your attention:`,
1493
1498
  `- Issue: "${title}" (${instructions.issueRef})`,
1494
1499
  `- Author: @${author}`,
1495
- `- Working directory: ${workdir}`,
1496
1500
  ``,
1497
1501
  `### Issue Body`,
1498
1502
  body,
1499
1503
  ``,
1500
1504
  `### Repository`,
1501
1505
  `Working directory: \`${workdir}\``,
1502
- `If the directory is empty or doesn't contain the code, clone it:`,
1503
- `\`${instructions.clone}\``,
1506
+ `If it's empty, clone the repo: \`${instructions.clone}\``,
1504
1507
  ``,
1505
- `Read the issue, understand what's needed, work on it, and reply to the user.`,
1506
- ``,
1507
- `**IMPORTANT**: After finishing your work, you MUST post a reply using the \`reply\` tool. Do NOT skip this step. Users are waiting for your response.`,
1508
- `**IMPORTANT**: Reply as soon as possible, then continue working. Don't make users wait.`,
1509
- `**IMPORTANT**: Every reply MUST start with \`[bot]\` prefix.`,
1508
+ `Read the issue, work on it, and reply via the \`reply\` tool — every reply starts with \`[bot]\`. Post the reply as soon as possible, then continue working if needed.`,
1510
1509
  ].filter(Boolean).join("\n");
1511
1510
  }
1512
1511
 
@@ -1514,12 +1513,14 @@ export class Engine {
1514
1513
  opName: string,
1515
1514
  commentBody: string,
1516
1515
  commentUser: string,
1516
+ authorKind: string | undefined,
1517
1517
  issueTitle: string,
1518
1518
  workdir: string,
1519
1519
  instructions: { issueRef: string }
1520
1520
  ): string {
1521
+ const who = authorKind === "bot" ? `@${commentUser} (bot)` : `@${commentUser} (user)`;
1521
1522
  return [
1522
- `[SYSTEM FORWARD] User @${commentUser} posted a new comment on ${instructions.issueRef} "${issueTitle}":`,
1523
+ `New comment from ${who} on ${instructions.issueRef} "${issueTitle}":`,
1523
1524
  ``,
1524
1525
  `---`,
1525
1526
  commentBody,
@@ -1527,7 +1528,7 @@ export class Engine {
1527
1528
  ``,
1528
1529
  `Working directory: ${workdir}`,
1529
1530
  ``,
1530
- `Reply using the \`reply\` tool with \`[bot]\` prefix.`,
1531
+ `Reply with the \`reply\` tool (posted to the thread as a \`[bot]\` comment).`,
1531
1532
  ].join("\n");
1532
1533
  }
1533
1534
 
@@ -177,7 +177,7 @@ export class GiteaTracker implements IssueTracker {
177
177
  id: String(comment.id),
178
178
  body: comment.body as string,
179
179
  author: commentUser?.login ?? "",
180
- author_kind: (comment as Record<string, unknown>).author_kind as string | undefined,
180
+ authorKind: (comment as Record<string, unknown>).author_kind as string | undefined,
181
181
  },
182
182
  model,
183
183
  cloneUrl,
@@ -30,7 +30,7 @@ export interface TrackerEvent {
30
30
  id: string;
31
31
  body: string;
32
32
  author: string;
33
- author_kind?: string;
33
+ authorKind?: string;
34
34
  };
35
35
  // Resolved "provider/model" string from ework-web (project override or
36
36
  // global default). Empty/undefined = no override; engine omits --model
@@ -50,6 +50,7 @@ export interface TrackerComment {
50
50
  id: string;
51
51
  body: string;
52
52
  author: string;
53
+ authorKind?: string;
53
54
  createdAt?: string; // ISO timestamp
54
55
  }
55
56