ework-daemon 0.4.60 → 0.4.61
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 +20 -15
package/package.json
CHANGED
package/src/opencode.ts
CHANGED
|
@@ -316,6 +316,20 @@ function createBackendFor(cfg: Config, runtime: string): RuntimeBackend {
|
|
|
316
316
|
return new OpencodeBackend(cfg.opencode.binary, cfg.opencode.dbPath, cfg.childEnvDeny);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
// Wake policy shared by issue_opened and comment_created: blacklist wins,
|
|
320
|
+
// then an explicit login whitelist (which replaces the kind check), then
|
|
321
|
+
// author kind. Issue openers carry no kind and default to human.
|
|
322
|
+
export function wakePolicySkips(
|
|
323
|
+
d: { nonWakingAuthors: string[]; noWakeLogins: string[]; wakeLogins: string[]; wakeKinds: string[] },
|
|
324
|
+
author: string,
|
|
325
|
+
authorKind: string,
|
|
326
|
+
): string | null {
|
|
327
|
+
if ([...d.nonWakingAuthors, ...d.noWakeLogins].includes(author)) return `non-waking author ${author}`;
|
|
328
|
+
if (d.wakeLogins.length > 0 && !d.wakeLogins.includes(author)) return `author ${author} not in wakeLogins`;
|
|
329
|
+
if (!d.wakeKinds.includes(authorKind)) return `author kind ${authorKind} not in wakeKinds [${d.wakeKinds.join(",")}]`;
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
|
|
319
333
|
export class Engine {
|
|
320
334
|
private cfg: Config;
|
|
321
335
|
private store: Store;
|
|
@@ -751,21 +765,12 @@ export class Engine {
|
|
|
751
765
|
return;
|
|
752
766
|
}
|
|
753
767
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
log.info(`engine: non-waking author ${author} — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
if (d.wakeLogins.length > 0 && !d.wakeLogins.includes(author)) {
|
|
764
|
-
log.info(`engine: author ${author} not in wakeLogins — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
if (!d.wakeKinds.includes(authorKind)) {
|
|
768
|
-
log.info(`engine: author kind ${authorKind} not in wakeKinds [${d.wakeKinds.join(",")}] — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
|
|
768
|
+
const wakeAuthor = event.type === "comment_created" ? event.comment?.author : event.type === "issue_opened" ? event.issue?.author : undefined;
|
|
769
|
+
const wakeKind = event.type === "comment_created" ? event.comment?.authorKind ?? "human" : "human";
|
|
770
|
+
if (wakeAuthor) {
|
|
771
|
+
const skip = wakePolicySkips(this.cfg.daemon, wakeAuthor, wakeKind);
|
|
772
|
+
if (skip) {
|
|
773
|
+
log.info(`engine: ${skip} — skipping ${event.type} for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
|
|
769
774
|
return;
|
|
770
775
|
}
|
|
771
776
|
}
|