ework-daemon 0.4.46 → 0.4.48
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 +1 -1
- package/src/opencode.ts +21 -11
package/package.json
CHANGED
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,12 +806,19 @@ 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
|
-
|
|
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}`);
|
|
812
818
|
|
|
813
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} .`;
|
|
814
822
|
const prompt = this.buildInitialPrompt(
|
|
815
823
|
session.name, issueData.title,
|
|
816
824
|
this.handleLargeContent(workdir, issueData.body, "issue-body.txt"),
|
|
@@ -905,6 +913,8 @@ export class Engine {
|
|
|
905
913
|
await tracker.createComment(ref, `[system] 🔄 **${session.name}** joined the conversation.`);
|
|
906
914
|
|
|
907
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} .`;
|
|
908
918
|
const prompt = this.buildInitialPrompt(
|
|
909
919
|
session.name, issueData.title,
|
|
910
920
|
this.handleLargeContent(workdir, issueData.body, "issue-body.txt"),
|
|
@@ -1210,6 +1220,13 @@ export class Engine {
|
|
|
1210
1220
|
await this.store.updateSession(session.id, { opencodeSessionId: id });
|
|
1211
1221
|
session.opencodeSessionId = id;
|
|
1212
1222
|
log.info(`engine: captured sessionID=${id.slice(0, 8)} for ${k} (early persist)`);
|
|
1223
|
+
const pickupId = this.pickupCommentId.get(k);
|
|
1224
|
+
if (pickupId) {
|
|
1225
|
+
this.pickupCommentId.delete(k);
|
|
1226
|
+
await tracker
|
|
1227
|
+
.editComment(ref, pickupId, `[system] 🔄 **${session.name}** picked up this issue.\n> session: ${this.sessionRef(session)} | workdir: ${this.workdirLink(workdir)}`)
|
|
1228
|
+
.catch((err) => log.error(`engine: failed to rewrite pickup comment for ${k}:`, (err as Error).message));
|
|
1229
|
+
}
|
|
1213
1230
|
}
|
|
1214
1231
|
},
|
|
1215
1232
|
},
|
|
@@ -1306,6 +1323,7 @@ export class Engine {
|
|
|
1306
1323
|
return;
|
|
1307
1324
|
}
|
|
1308
1325
|
this.progressCommentId.delete(k);
|
|
1326
|
+
this.pickupCommentId.delete(k);
|
|
1309
1327
|
this.currentPrompt.delete(k);
|
|
1310
1328
|
await this.persistRuntimeState(session.id);
|
|
1311
1329
|
|
|
@@ -1473,26 +1491,18 @@ export class Engine {
|
|
|
1473
1491
|
): string {
|
|
1474
1492
|
return [
|
|
1475
1493
|
`You are ${opName}, an AI development assistant.`,
|
|
1476
|
-
`Your identity is "${opName}" — this name was assigned when you were initialized.`,
|
|
1477
|
-
``,
|
|
1478
1494
|
`A new issue needs your attention:`,
|
|
1479
1495
|
`- Issue: "${title}" (${instructions.issueRef})`,
|
|
1480
1496
|
`- Author: @${author}`,
|
|
1481
|
-
`- Working directory: ${workdir}`,
|
|
1482
1497
|
``,
|
|
1483
1498
|
`### Issue Body`,
|
|
1484
1499
|
body,
|
|
1485
1500
|
``,
|
|
1486
1501
|
`### Repository`,
|
|
1487
1502
|
`Working directory: \`${workdir}\``,
|
|
1488
|
-
`If
|
|
1489
|
-
`\`${instructions.clone}\``,
|
|
1490
|
-
``,
|
|
1491
|
-
`Read the issue, understand what's needed, work on it, and reply to the user.`,
|
|
1503
|
+
`If it's empty, clone the repo: \`${instructions.clone}\``,
|
|
1492
1504
|
``,
|
|
1493
|
-
|
|
1494
|
-
`**IMPORTANT**: Reply as soon as possible, then continue working. Don't make users wait.`,
|
|
1495
|
-
`**IMPORTANT**: Every reply MUST start with \`[bot]\` prefix.`,
|
|
1505
|
+
`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.`,
|
|
1496
1506
|
].filter(Boolean).join("\n");
|
|
1497
1507
|
}
|
|
1498
1508
|
|