ework-daemon 0.4.40 → 0.4.42

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.40",
3
+ "version": "0.4.42",
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
@@ -193,6 +193,10 @@ export function loadConfig(): Config {
193
193
  port: process.env.DAEMON_PORT ?? 3101,
194
194
  host: process.env.DAEMON_HOST ?? "0.0.0.0",
195
195
  endpoint: process.env.DAEMON_ENDPOINT ?? "",
196
+ nonWakingAuthors: (process.env.WORK_NON_WAKING_AUTHORS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
197
+ wakeKinds: (process.env.WORK_WAKE_KINDS ?? "human").split(",").map((s) => s.trim()).filter(Boolean),
198
+ wakeLogins: (process.env.WORK_WAKE_LOGINS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
199
+ noWakeLogins: (process.env.WORK_NO_WAKE_LOGINS ?? "").split(",").map((s) => s.trim()).filter(Boolean),
196
200
  },
197
201
  opencode: {
198
202
  binary: process.env.OPENCODE_BINARY ?? "opencode",
package/src/op.ts CHANGED
@@ -520,7 +520,7 @@ export class Store {
520
520
  `SELECT m.* FROM {{messages}} m
521
521
  INNER JOIN {{op_sessions}} s ON s.uid = m.session_id
522
522
  INNER JOIN {{issues}} i ON i.uid = s.issue_id
523
- WHERE i.owner_daemon_id = ? AND m.status IN ('pending', 'running')
523
+ WHERE i.owner_daemon_id = ? AND m.status IN ('pending', 'running', 'interrupted')
524
524
  ORDER BY m.created_at ASC`,
525
525
  [daemonId]
526
526
  );
package/src/opencode.ts CHANGED
@@ -1813,7 +1813,7 @@ export class Engine {
1813
1813
  // Reset running messages to pending
1814
1814
  for (const msg of stuck) {
1815
1815
  if (msg.status === "running") {
1816
- await this.store.updateMessageStatus(msg.id, "pending");
1816
+ await this.store.updateMessageStatus(msg.id, "interrupted");
1817
1817
  }
1818
1818
  }
1819
1819
 
@@ -1831,16 +1831,26 @@ export class Engine {
1831
1831
  const issue = await this.store.getIssue(session.issueId);
1832
1832
  if (!issue || issue.state === "closed") continue;
1833
1833
 
1834
- const gate = await this.webGateAllows(issue);
1834
+ const gate = await this.gateChecker(issue);
1835
1835
  if (!gate.allowed) {
1836
- log.info(`engine: recover — web gate blocked ${issue.trackerScopeKey}#${issue.trackerIssueId} (${gate.reason}), marking pending messages as skipped`);
1837
- for (const m of msgs) await this.store.updateMessageStatus(m.id, "failed", `web gate: ${gate.reason}`);
1836
+ log.info(`engine: recover — web gate blocked ${issue.trackerScopeKey}#${issue.trackerIssueId} (${gate.reason}), discarding queued (pending) messages`);
1837
+ for (const m of msgs) {
1838
+ if (m.status === "pending") {
1839
+ await this.store.updateMessageStatus(m.id, "failed", `web gate: ${gate.reason}`);
1840
+ }
1841
+ }
1838
1842
  continue;
1839
1843
  }
1840
1844
 
1841
1845
  const k = this.sessionKey(session, issue);
1842
1846
  if (this.running.has(k)) continue;
1843
1847
 
1848
+ for (const m of msgs) {
1849
+ if (m.status === "running") {
1850
+ await this.store.updateMessageStatus(m.id, "pending");
1851
+ }
1852
+ }
1853
+
1844
1854
  const first = msgs.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())[0]!;
1845
1855
 
1846
1856
  // Check if AI already replied before the crash — skip re-running if so