ework-web 0.10.66 → 0.10.68

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/webhooks.ts +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.66",
3
+ "version": "0.10.68",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
package/src/webhooks.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  // the full retry trail rather than an opaque final status.
17
17
 
18
18
  import { createHmac, randomUUID } from "node:crypto";
19
- import { getDB } from "./db";
19
+ import { getDB, getConfigAll } from "./db";
20
20
  import { log } from "./logger";
21
21
  import { loadConfig } from "./config";
22
22
  import {
@@ -312,6 +312,7 @@ interface IssueEventPayload {
312
312
  commit_id?: string;
313
313
  commit_url?: string;
314
314
  url?: string;
315
+ dispatch_off?: boolean;
315
316
  }
316
317
 
317
318
  interface CommentEventPayload {
@@ -638,9 +639,13 @@ export async function emitIssueEvent(
638
639
  const issue = await getIssueById(issueId);
639
640
  if (!issue) { log.warn(`emitIssueEvent: issue ${issueId} not found — silent skip prevented`); return; }
640
641
 
641
- // Web is a dumb message bus — always fan out. Wake policy is enforced
642
- // downstream (daemon handleEvent). Web only suppresses for subscription-
643
- // level concerns (none currently).
642
+ const cfg = await getConfigAll();
643
+ const scopeKey = `${project.owner}/${project.name}`;
644
+ const globalOff = cfg["dispatchEnabled"] === "false";
645
+ const projectOff = cfg[`dispatchOff:${scopeKey}`] === "1";
646
+ const issueOff = issue.ai_status === "dispatch_off" || issue.ai_status === "halted";
647
+ const dispatchOff = globalOff || projectOff || issueOff;
648
+
644
649
  const commentCount = await countCommentsSafe(issueId);
645
650
  // Resolve model: project override > global default. Empty string = no
646
651
  // override (daemon omits --model, lets opencode pick). globalDefault
@@ -650,6 +655,7 @@ export async function emitIssueEvent(
650
655
  const labels = await toPayloadLabels(issueId);
651
656
  const payload = buildIssuePayload(issue, project, commentCount, action, origin, model, labels);
652
657
  (payload as IssueEventPayload).event_id = randomUUID();
658
+ (payload as IssueEventPayload).dispatch_off = dispatchOff;
653
659
  const rawBody = JSON.stringify(payload);
654
660
  await fanOut(projectId, "issues", rawBody);
655
661
  } catch (e) {