ework-daemon 0.4.52 → 0.4.54
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/gitea.ts +9 -0
- package/src/opencode.ts +9 -4
- package/src/trackers/gitea-tracker.ts +6 -0
- package/src/trackers/types.ts +1 -0
package/package.json
CHANGED
package/src/gitea.ts
CHANGED
|
@@ -134,6 +134,15 @@ export class GiteaClient {
|
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
async setCommentModel(owner: string, repo: string, commentId: number, model: string) {
|
|
138
|
+
return this.request(
|
|
139
|
+
"POST",
|
|
140
|
+
`/repos/${owner}/${repo}/issues/comments/${commentId}/model`,
|
|
141
|
+
{ model },
|
|
142
|
+
true
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
async addCommentReaction(owner: string, repo: string, commentId: number, content: string) {
|
|
138
147
|
return this.request(
|
|
139
148
|
"POST",
|
package/src/opencode.ts
CHANGED
|
@@ -1299,11 +1299,11 @@ export class Engine {
|
|
|
1299
1299
|
const superseded = () => this.generation.get(k) !== gen;
|
|
1300
1300
|
|
|
1301
1301
|
// running.delete deferred to dequeuePending
|
|
1302
|
-
this.currentMessage.delete(k);
|
|
1303
|
-
this.currentModel.delete(k);
|
|
1304
|
-
|
|
1305
1302
|
const started = this.startedAt.get(k);
|
|
1306
1303
|
this.startedAt.delete(k);
|
|
1304
|
+
const usedModel = this.currentModel.get(k) ?? "";
|
|
1305
|
+
this.currentMessage.delete(k);
|
|
1306
|
+
this.currentModel.delete(k);
|
|
1307
1307
|
|
|
1308
1308
|
const progressId = this.progressCommentId.get(k);
|
|
1309
1309
|
const ref = this.sessionToRef(session, issue);
|
|
@@ -1361,8 +1361,13 @@ export class Engine {
|
|
|
1361
1361
|
const hasRecent = this.hasRecentBotReply(commentsNow, tracker, started ?? undefined);
|
|
1362
1362
|
|
|
1363
1363
|
if (hasRecent) {
|
|
1364
|
-
|
|
1364
|
+
// oldest-first comment lists would match a pre-run bot reply when started
|
|
1365
|
+
// is undefined; pick the LAST qualifying comment instead.
|
|
1366
|
+
const matched = [...commentsNow].reverse().find(c => tracker.isBotUser(c.author) && !this.isSystemComment(c) && c.createdAt && new Date(c.createdAt).getTime() > (started ?? 0));
|
|
1365
1367
|
log.info(`engine: [bot] reply found for ${k} after prompt (comment ${matched?.id ?? "?"} createdAt ${matched?.createdAt ?? "?"}), marking done`);
|
|
1368
|
+
if (matched && usedModel) {
|
|
1369
|
+
void tracker.setCommentModel(ref, matched.id, usedModel).catch(() => { /* display-only */ });
|
|
1370
|
+
}
|
|
1366
1371
|
this.nudgeRounds.delete(k);
|
|
1367
1372
|
this.emptyResponseRounds.delete(k);
|
|
1368
1373
|
await this.persistRuntimeState(session.id);
|
|
@@ -71,6 +71,12 @@ export class GiteaTracker implements IssueTracker {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
async setCommentModel(ref: TrackerRef, commentId: string, model: string) {
|
|
75
|
+
await this.client.setCommentModel(
|
|
76
|
+
this.owner(ref), this.repo(ref), Number(commentId), model
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
async setReaction(ref: TrackerRef, commentId: string, content: string, remove = false) {
|
|
75
81
|
if (remove) {
|
|
76
82
|
await this.client.removeCommentReaction(
|
package/src/trackers/types.ts
CHANGED
|
@@ -138,6 +138,7 @@ export interface IssueTracker {
|
|
|
138
138
|
updateStatus(ref: TrackerRef, status: string, detail?: string): Promise<void>;
|
|
139
139
|
|
|
140
140
|
setReaction(ref: TrackerRef, commentId: string, content: string, remove?: boolean): Promise<void>;
|
|
141
|
+
setCommentModel(ref: TrackerRef, commentId: string, model: string): Promise<void>;
|
|
141
142
|
|
|
142
143
|
getTrackerInstructions(ref: TrackerRef): TrackerInstructions;
|
|
143
144
|
|