ework-daemon 0.4.36 → 0.4.38

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.36",
3
+ "version": "0.4.38",
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/config.ts CHANGED
@@ -26,6 +26,9 @@ export const configSchema = z.object({
26
26
  host: z.string().default("0.0.0.0"),
27
27
  endpoint: z.string().default(""),
28
28
  nonWakingAuthors: z.array(z.string()).default([]),
29
+ wakeKinds: z.array(z.string()).default(["human"]),
30
+ wakeLogins: z.array(z.string()).default([]),
31
+ noWakeLogins: z.array(z.string()).default([]),
29
32
  }),
30
33
  opencode: z.object({
31
34
  binary: z.string().default("opencode"),
@@ -144,6 +147,9 @@ export function loadConfig(): Config {
144
147
  host: process.env.DAEMON_HOST ?? TEST_DEFAULTS.daemon.host,
145
148
  endpoint: process.env.DAEMON_ENDPOINT ?? "",
146
149
  nonWakingAuthors: (process.env.WORK_NON_WAKING_AUTHORS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
150
+ wakeKinds: (process.env.WORK_WAKE_KINDS ?? "human").split(",").map((s) => s.trim()).filter(Boolean),
151
+ wakeLogins: (process.env.WORK_WAKE_LOGINS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
152
+ noWakeLogins: (process.env.WORK_NO_WAKE_LOGINS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
147
153
  },
148
154
  opencode: {
149
155
  binary: process.env.OPENCODE_BINARY ?? TEST_DEFAULTS.opencode.binary,
package/src/opencode.ts CHANGED
@@ -667,12 +667,28 @@ export class Engine {
667
667
  return;
668
668
  }
669
669
 
670
+ if (event.dispatch_off && event.type === "issue_opened") {
671
+ log.info(`engine: dispatch_off (global/project) — skipping issue_opened for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
672
+ return;
673
+ }
674
+
670
675
  if (event.type === "comment_created" && event.comment?.author) {
671
676
  const author = event.comment.author;
672
- if (this.cfg.daemon.nonWakingAuthors.includes(author)) {
677
+ const authorKind = event.comment.author_kind ?? "human";
678
+ const d = this.cfg.daemon;
679
+ const noWake = [...d.nonWakingAuthors, ...d.noWakeLogins];
680
+ if (noWake.includes(author)) {
673
681
  log.info(`engine: non-waking author ${author} — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
674
682
  return;
675
683
  }
684
+ if (d.wakeLogins.length > 0 && !d.wakeLogins.includes(author)) {
685
+ log.info(`engine: author ${author} not in wakeLogins — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
686
+ return;
687
+ }
688
+ if (!d.wakeKinds.includes(authorKind)) {
689
+ log.info(`engine: author kind ${authorKind} not in wakeKinds [${d.wakeKinds.join(",")}] — skipping comment_created for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
690
+ return;
691
+ }
676
692
  }
677
693
 
678
694
  const issueMapKey = `${ref.trackerType}:${scopeKey}#${ref.issueId}`;
@@ -141,11 +141,13 @@ export class GiteaTracker implements IssueTracker {
141
141
 
142
142
  const issueUser = issue.user as Record<string, string>;
143
143
  const aiStatus = typeof issue.ai_status === "string" ? issue.ai_status : "";
144
+ const dispatchOff = payload.dispatch_off === true;
144
145
 
145
146
  if (action === "opened" || action === "reopened") {
146
147
  return {
147
148
  type: "issue_opened",
148
149
  ref,
150
+ dispatch_off: dispatchOff,
149
151
  issue: {
150
152
  title: issue.title as string,
151
153
  body: (issue.body as string) ?? "",
@@ -175,6 +177,7 @@ export class GiteaTracker implements IssueTracker {
175
177
  id: String(comment.id),
176
178
  body: comment.body as string,
177
179
  author: commentUser?.login ?? "",
180
+ author_kind: (comment as Record<string, unknown>).author_kind as string | undefined,
178
181
  },
179
182
  model,
180
183
  cloneUrl,
@@ -18,6 +18,7 @@ export type TrackerEventType = "issue_opened" | "comment_created" | "issue_close
18
18
  export interface TrackerEvent {
19
19
  type: TrackerEventType;
20
20
  ref: TrackerRef;
21
+ dispatch_off?: boolean;
21
22
  issue: {
22
23
  title: string;
23
24
  body: string;
@@ -29,6 +30,7 @@ export interface TrackerEvent {
29
30
  id: string;
30
31
  body: string;
31
32
  author: string;
33
+ author_kind?: string;
32
34
  };
33
35
  // Resolved "provider/model" string from ework-web (project override or
34
36
  // global default). Empty/undefined = no override; engine omits --model