@runfusion/fusion 0.43.0 → 0.43.1

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 (91) hide show
  1. package/dist/bin.js +167 -27
  2. package/dist/client/.vite/manifest.json +70 -70
  3. package/dist/client/assets/AgentDetailView-BGN03dyz.css +1 -0
  4. package/dist/client/assets/{AgentDetailView-FUKwQxBP.js → AgentDetailView-DKMz3r04.js} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-DMDUhF1n.js → AgentPermissionPolicyEditor-BiY1a4KR.js} +1 -1
  6. package/dist/client/assets/{AgentsView-BrQLd-yI.js → AgentsView-Co-k4vjh.js} +3 -3
  7. package/dist/client/assets/{ChatView-Wz_0goif.js → ChatView-BkAG99bj.js} +1 -1
  8. package/dist/client/assets/{DevServerView-DRqQpHsc.js → DevServerView-C6DC0URX.js} +1 -1
  9. package/dist/client/assets/{DirectoryPicker-BFot4CVM.js → DirectoryPicker-CkcGjyv0.js} +1 -1
  10. package/dist/client/assets/{DocumentsView-hamhUcvL.js → DocumentsView-OCK1Vsw_.js} +1 -1
  11. package/dist/client/assets/{EvalsView-DAXqDqn2.js → EvalsView-CUfyj5GW.js} +1 -1
  12. package/dist/client/assets/{ExperimentalAgentOnboardingModal-B4aZ1y0n.js → ExperimentalAgentOnboardingModal-Dau9RTU_.js} +1 -1
  13. package/dist/client/assets/{GoalsView-2QOp9DA0.js → GoalsView-CNLTn0rX.js} +1 -1
  14. package/dist/client/assets/{InsightsView-D5fzFy-F.js → InsightsView-BQPxHxKI.js} +1 -1
  15. package/dist/client/assets/{MemoryView-B082KoR-.js → MemoryView-D3xQIFjj.js} +1 -1
  16. package/dist/client/assets/{NodesView-BA3pKMZu.js → NodesView-CSMvGwDU.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-C4I11iKm.js → PiExtensionsManager-BtqXF3fl.js} +1 -1
  18. package/dist/client/assets/{PluginManager-BzTzTMXZ.js → PluginManager-CSSDb3VO.js} +1 -1
  19. package/dist/client/assets/{PullRequestView-11xJ565q.js → PullRequestView-Bjyfffdu.js} +1 -1
  20. package/dist/client/assets/{ReliabilityView-CpELpGqw.js → ReliabilityView-QKMUDebT.js} +1 -1
  21. package/dist/client/assets/{ResearchView-BHiXfjzE.js → ResearchView-CRU_NPho.js} +1 -1
  22. package/dist/client/assets/{SecretsView-CC5OYoCn.js → SecretsView-Bs8ySyC5.js} +1 -1
  23. package/dist/client/assets/SecretsView-Djo1rahi.css +1 -0
  24. package/dist/client/assets/{SessionTerminal-G70Jwkzs.js → SessionTerminal-Dk1NgmN2.js} +1 -1
  25. package/dist/client/assets/{SettingsModal-C0M1CqOu.js → SettingsModal-JCaNvdAb.js} +3 -3
  26. package/dist/client/assets/{SettingsModal-BKEbtdqR.js → SettingsModal-Nw5cTKAK.js} +1 -1
  27. package/dist/client/assets/{SetupWizardModal-CBfItlP6.js → SetupWizardModal-CE79myEy.js} +1 -1
  28. package/dist/client/assets/{SkillsView-DbcW87-E.js → SkillsView-Dc8YskAX.js} +1 -1
  29. package/dist/client/assets/{StashRecoveryView-CH9RPtzX.js → StashRecoveryView-CqKOFiXT.js} +1 -1
  30. package/dist/client/assets/{TodoView-ToviJ0SV.js → TodoView-BqIRwcZw.js} +1 -1
  31. package/dist/client/assets/{WorkflowNodeEditor-BTu0D9c5.js → WorkflowNodeEditor-2jDuk2FR.js} +1 -1
  32. package/dist/client/assets/{dashboard-view-DtgLZ_LM.js → dashboard-view-BhbN8LPh.js} +1 -1
  33. package/dist/client/assets/{folder-open-BlPyIWyf.js → folder-open-Bw1mxVfa.js} +1 -1
  34. package/dist/client/assets/{index-bZCpHtGq.js → index-CpTBp1RG.js} +192 -192
  35. package/dist/client/assets/{upload-B-qmm1NH.js → upload-BCmd-1I0.js} +1 -1
  36. package/dist/client/assets/{users-D6C5TXf2.js → users-DO_t3V1p.js} +1 -1
  37. package/dist/client/index.html +1 -1
  38. package/dist/client/version.json +1 -1
  39. package/dist/droid-cli/package.json +1 -1
  40. package/dist/extension.js +166 -27
  41. package/dist/pi-claude-cli/package.json +1 -1
  42. package/dist/plugin-sdk/index.d.ts +2 -0
  43. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  44. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  45. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  46. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  47. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  48. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  49. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  50. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  51. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  52. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  53. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  54. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  55. package/package.json +1 -1
  56. package/dist/automation-store-EKXXEE2S.js +0 -10
  57. package/dist/automation-store-PLNG3X72.js +0 -10
  58. package/dist/automation-store-RDDYZFUJ.js +0 -10
  59. package/dist/chunk-2JI3F6MG.js +0 -948
  60. package/dist/chunk-4L6CLWJC.js +0 -8345
  61. package/dist/chunk-4VNS5WPM.js +0 -42
  62. package/dist/chunk-5RGECGQL.js +0 -1139
  63. package/dist/chunk-6JDLN7IL.js +0 -409
  64. package/dist/chunk-AICJATVW.js +0 -948
  65. package/dist/chunk-AWKNRUOR.js +0 -1148
  66. package/dist/chunk-BHM3UYWS.js +0 -4651
  67. package/dist/chunk-BMUXDSBF.js +0 -4647
  68. package/dist/chunk-GETECT6V.js +0 -353
  69. package/dist/chunk-GUV4QQT3.js +0 -1143
  70. package/dist/chunk-JKQO7YYZ.js +0 -8369
  71. package/dist/chunk-LYZVU6UV.js +0 -409
  72. package/dist/chunk-MAN4WYHO.js +0 -353
  73. package/dist/chunk-MCUG2Z7M.js +0 -4651
  74. package/dist/chunk-PSDYB45U.js +0 -948
  75. package/dist/chunk-RR2HM46R.js +0 -8345
  76. package/dist/chunk-RXMQ5OMY.js +0 -9226
  77. package/dist/chunk-S2EVJUY3.js +0 -353
  78. package/dist/chunk-UXR5XZFZ.js +0 -409
  79. package/dist/client/assets/AgentDetailView-DiWELtb1.css +0 -1
  80. package/dist/client/assets/SecretsView-D5bHZ-wM.css +0 -1
  81. package/dist/extract-zip-WL55Z3AU.js +0 -2497
  82. package/dist/index.min-CHQ3ABYJ.js +0 -2926
  83. package/dist/memory-dreams-7USISKVE.js +0 -32
  84. package/dist/memory-dreams-PBPISUDD.js +0 -32
  85. package/dist/memory-dreams-XNO2B2QF.js +0 -32
  86. package/dist/migration-EH2YOCYQ.js +0 -15
  87. package/dist/migration-PLGTTKL5.js +0 -15
  88. package/dist/migration-WZEZK22R.js +0 -15
  89. package/dist/routine-store-GIJ6MXWY.js +0 -10
  90. package/dist/routine-store-HTVC2PUQ.js +0 -10
  91. package/dist/routine-store-KGHZBPDF.js +0 -10
@@ -1,409 +0,0 @@
1
- import {
2
- assertProjectRootDir,
3
- require_dist
4
- } from "./chunk-RXMQ5OMY.js";
5
- import {
6
- Database,
7
- fromJson
8
- } from "./chunk-BHM3UYWS.js";
9
- import {
10
- __toESM
11
- } from "./chunk-4VNS5WPM.js";
12
-
13
- // ../core/dist/routine-store.js
14
- var import_cron_parser = __toESM(require_dist(), 1);
15
- import { EventEmitter } from "events";
16
- import { randomUUID } from "crypto";
17
-
18
- // ../core/dist/routine.js
19
- function isCronTrigger(trigger) {
20
- return trigger.type === "cron";
21
- }
22
- var MAX_ROUTINE_RUN_HISTORY = 50;
23
-
24
- // ../core/dist/routine-store.js
25
- var CRON_TIMEZONE = "UTC";
26
- var RoutineStore = class _RoutineStore extends EventEmitter {
27
- rootDir;
28
- /** SQLite database instance (lazy init). */
29
- _db = null;
30
- /** Per-routine promise chain for serializing writes. */
31
- routineLocks = /* @__PURE__ */ new Map();
32
- inMemoryDb;
33
- constructor(rootDir, options) {
34
- super();
35
- this.rootDir = rootDir;
36
- assertProjectRootDir(rootDir, "RoutineStore");
37
- this.inMemoryDb = options?.inMemoryDb === true;
38
- }
39
- // ── Database Access ────────────────────────────────────────────────
40
- /**
41
- * Get the SQLite database, initializing it on first access.
42
- */
43
- get db() {
44
- if (!this._db) {
45
- const fusionDir = `${this.rootDir}/.fusion`;
46
- this._db = new Database(fusionDir, { inMemory: this.inMemoryDb });
47
- this._db.init();
48
- }
49
- return this._db;
50
- }
51
- /** Initialize the store (no-op, DB is lazily initialized). */
52
- async init() {
53
- const _ = this.db;
54
- }
55
- // ── Row Conversion ─────────────────────────────────────────────────
56
- rowToRoutine(row) {
57
- const triggerConfig = fromJson(row.triggerConfig);
58
- let trigger;
59
- switch (row.triggerType) {
60
- case "cron":
61
- trigger = {
62
- type: "cron",
63
- cronExpression: triggerConfig?.cronExpression ?? "0 * * * *",
64
- timezone: triggerConfig?.timezone
65
- };
66
- break;
67
- case "webhook":
68
- trigger = {
69
- type: "webhook",
70
- webhookPath: triggerConfig?.webhookPath ?? "",
71
- secret: triggerConfig?.secret
72
- };
73
- break;
74
- case "api":
75
- trigger = {
76
- type: "api",
77
- endpoint: triggerConfig?.endpoint ?? ""
78
- };
79
- break;
80
- case "manual":
81
- default:
82
- trigger = { type: "manual" };
83
- break;
84
- }
85
- return {
86
- id: row.id,
87
- agentId: row.agentId || "",
88
- name: row.name,
89
- description: row.description || void 0,
90
- trigger,
91
- command: row.command || void 0,
92
- steps: fromJson(row.steps),
93
- timeoutMs: row.timeoutMs ?? void 0,
94
- catchUpPolicy: row.catchUpPolicy || "run_one",
95
- executionPolicy: row.executionPolicy || "queue",
96
- enabled: row.enabled === 1,
97
- lastRunAt: row.lastRunAt || void 0,
98
- lastRunResult: fromJson(row.lastRunResult),
99
- nextRunAt: row.nextRunAt || void 0,
100
- runCount: row.runCount || 0,
101
- runHistory: fromJson(row.runHistory) || [],
102
- catchUpLimit: row.catchUpLimit ?? 5,
103
- cronExpression: isCronTrigger(trigger) ? trigger.cronExpression : void 0,
104
- scope: row.scope || "project",
105
- createdAt: row.createdAt,
106
- updatedAt: row.updatedAt
107
- };
108
- }
109
- upsertRoutine(routine) {
110
- const trigger = routine.trigger;
111
- let triggerConfig = {};
112
- if (isCronTrigger(trigger)) {
113
- triggerConfig = {
114
- cronExpression: trigger.cronExpression,
115
- timezone: trigger.timezone
116
- };
117
- } else if (trigger.type === "webhook") {
118
- triggerConfig = {
119
- webhookPath: trigger.webhookPath,
120
- secret: trigger.secret
121
- };
122
- } else if (trigger.type === "api") {
123
- triggerConfig = {
124
- endpoint: trigger.endpoint
125
- };
126
- }
127
- this.db.prepare(`
128
- INSERT OR REPLACE INTO routines (
129
- id, agentId, name, description, triggerType, triggerConfig,
130
- command, steps, timeoutMs,
131
- catchUpPolicy, executionPolicy, catchUpLimit, enabled,
132
- lastRunAt, lastRunResult, nextRunAt,
133
- runCount, runHistory, scope, createdAt, updatedAt
134
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
135
- `).run(routine.id, routine.agentId, routine.name, routine.description ?? null, trigger.type, JSON.stringify(triggerConfig), routine.command ?? null, routine.steps ? JSON.stringify(routine.steps) : null, routine.timeoutMs ?? null, routine.catchUpPolicy, routine.executionPolicy, routine.catchUpLimit ?? 5, routine.enabled ? 1 : 0, routine.lastRunAt ?? null, routine.lastRunResult ? JSON.stringify(routine.lastRunResult) : null, routine.nextRunAt ?? null, routine.runCount || 0, JSON.stringify(routine.runHistory || []), routine.scope ?? "project", routine.createdAt, routine.updatedAt);
136
- this.db.bumpLastModified();
137
- }
138
- // ── Locking ───────────────────────────────────────────────────────
139
- /**
140
- * Serialize all mutations to a given routine by chaining promises.
141
- * Concurrent callers for the same ID will queue behind each other.
142
- */
143
- withRoutineLock(id, fn) {
144
- const prev = this.routineLocks.get(id) ?? Promise.resolve();
145
- let resolve;
146
- const next = new Promise((r) => {
147
- resolve = r;
148
- });
149
- this.routineLocks.set(id, next);
150
- return prev.then(async () => {
151
- try {
152
- return await fn();
153
- } finally {
154
- if (this.routineLocks.get(id) === next) {
155
- this.routineLocks.delete(id);
156
- }
157
- resolve();
158
- }
159
- });
160
- }
161
- // ── Cron Utilities ────────────────────────────────────────────────
162
- /**
163
- * Compute the next run time from a cron expression.
164
- * @param cronExpression - A valid cron expression (5 fields).
165
- * @param fromDate - The date to compute from. Defaults to now.
166
- * @returns ISO-8601 timestamp of the next run.
167
- */
168
- computeNextRun(cronExpression, fromDate) {
169
- const interval = import_cron_parser.CronExpressionParser.parse(cronExpression, {
170
- currentDate: fromDate ?? /* @__PURE__ */ new Date(),
171
- tz: CRON_TIMEZONE
172
- });
173
- const next = interval.next();
174
- return new Date(next.getTime()).toISOString();
175
- }
176
- /**
177
- * Validate a cron expression. Returns true if valid.
178
- */
179
- static isValidCron(cronExpression) {
180
- try {
181
- import_cron_parser.CronExpressionParser.parse(cronExpression);
182
- return true;
183
- } catch {
184
- return false;
185
- }
186
- }
187
- // ── CRUD ──────────────────────────────────────────────────────────
188
- /**
189
- * Create a new routine.
190
- */
191
- async createRoutine(input) {
192
- if (!input.name?.trim()) {
193
- throw new Error("Name is required and cannot be empty");
194
- }
195
- if (isCronTrigger(input.trigger)) {
196
- if (!_RoutineStore.isValidCron(input.trigger.cronExpression)) {
197
- throw new Error(`Invalid cron expression: "${input.trigger.cronExpression}"`);
198
- }
199
- }
200
- const id = randomUUID();
201
- const now = (/* @__PURE__ */ new Date()).toISOString();
202
- const enabled = input.enabled !== void 0 ? input.enabled : true;
203
- const routine = {
204
- id,
205
- agentId: input.agentId,
206
- name: input.name.trim(),
207
- description: input.description?.trim() || void 0,
208
- trigger: input.trigger,
209
- command: input.command?.trim() || void 0,
210
- steps: input.steps && input.steps.length > 0 ? input.steps : void 0,
211
- timeoutMs: input.timeoutMs,
212
- catchUpPolicy: input.catchUpPolicy ?? "run_one",
213
- executionPolicy: input.executionPolicy ?? "queue",
214
- enabled,
215
- runCount: 0,
216
- runHistory: [],
217
- scope: input.scope ?? "project",
218
- createdAt: now,
219
- updatedAt: now
220
- };
221
- if (enabled && isCronTrigger(routine.trigger)) {
222
- routine.nextRunAt = this.computeNextRun(routine.trigger.cronExpression);
223
- }
224
- this.upsertRoutine(routine);
225
- this.emit("routine:created", routine);
226
- return routine;
227
- }
228
- /**
229
- * Get a routine by ID.
230
- */
231
- async getRoutine(id) {
232
- const row = this.db.prepare("SELECT * FROM routines WHERE id = ?").get(id);
233
- if (!row) {
234
- throw Object.assign(new Error(`Routine '${id}' not found`), { code: "ENOENT" });
235
- }
236
- return this.rowToRoutine(row);
237
- }
238
- /**
239
- * List all routines.
240
- */
241
- async listRoutines() {
242
- const rows = this.db.prepare("SELECT * FROM routines ORDER BY createdAt ASC").all();
243
- return rows.map((row) => this.rowToRoutine(row));
244
- }
245
- /**
246
- * Update an existing routine.
247
- */
248
- async updateRoutine(id, updates) {
249
- return this.withRoutineLock(id, async () => {
250
- const routine = await this.getRoutine(id);
251
- if (updates.name !== void 0) {
252
- if (!updates.name.trim())
253
- throw new Error("Name cannot be empty");
254
- routine.name = updates.name.trim();
255
- }
256
- if (updates.description !== void 0) {
257
- routine.description = updates.description?.trim() || void 0;
258
- }
259
- if (updates.trigger !== void 0) {
260
- if (isCronTrigger(updates.trigger)) {
261
- if (!_RoutineStore.isValidCron(updates.trigger.cronExpression)) {
262
- throw new Error(`Invalid cron expression: "${updates.trigger.cronExpression}"`);
263
- }
264
- }
265
- routine.trigger = updates.trigger;
266
- }
267
- if (updates.command !== void 0) {
268
- routine.command = updates.command?.trim() || void 0;
269
- }
270
- if (updates.steps !== void 0) {
271
- routine.steps = updates.steps.length > 0 ? updates.steps : void 0;
272
- }
273
- if (updates.timeoutMs !== void 0) {
274
- routine.timeoutMs = updates.timeoutMs;
275
- }
276
- if (updates.catchUpPolicy !== void 0) {
277
- routine.catchUpPolicy = updates.catchUpPolicy;
278
- }
279
- if (updates.executionPolicy !== void 0) {
280
- routine.executionPolicy = updates.executionPolicy;
281
- }
282
- if (updates.enabled !== void 0) {
283
- routine.enabled = updates.enabled;
284
- }
285
- if (routine.enabled && isCronTrigger(routine.trigger)) {
286
- routine.nextRunAt = this.computeNextRun(routine.trigger.cronExpression);
287
- } else if (!routine.enabled || !isCronTrigger(routine.trigger)) {
288
- routine.nextRunAt = void 0;
289
- }
290
- routine.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
291
- this.upsertRoutine(routine);
292
- this.emit("routine:updated", routine);
293
- return routine;
294
- });
295
- }
296
- /**
297
- * Delete a routine.
298
- */
299
- async deleteRoutine(id) {
300
- return this.withRoutineLock(id, async () => {
301
- const routine = await this.getRoutine(id);
302
- this.db.prepare("DELETE FROM routines WHERE id = ?").run(id);
303
- this.db.bumpLastModified();
304
- this.emit("routine:deleted", routine);
305
- return routine;
306
- });
307
- }
308
- // ── Run Tracking ─────────────────────────────────────────────────
309
- /**
310
- * Record a run result for a routine. Updates lastRunAt, lastRunResult,
311
- * nextRunAt, runCount, and appends to runHistory.
312
- */
313
- async recordRun(id, result) {
314
- return this.withRoutineLock(id, async () => {
315
- const routine = await this.getRoutine(id);
316
- routine.lastRunAt = result.startedAt;
317
- routine.lastRunResult = result;
318
- routine.runCount += 1;
319
- routine.runHistory.unshift(result);
320
- if (routine.runHistory.length > MAX_ROUTINE_RUN_HISTORY) {
321
- routine.runHistory = routine.runHistory.slice(0, MAX_ROUTINE_RUN_HISTORY);
322
- }
323
- if (routine.enabled && isCronTrigger(routine.trigger)) {
324
- routine.nextRunAt = this.computeNextRun(routine.trigger.cronExpression);
325
- }
326
- routine.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
327
- this.upsertRoutine(routine);
328
- this.emit("routine:run", { routine, result });
329
- return routine;
330
- });
331
- }
332
- /**
333
- * Mark a routine execution as started (pre-run bookkeeping).
334
- */
335
- async startRoutineExecution(id, meta) {
336
- await this.withRoutineLock(id, async () => {
337
- const routine = await this.getRoutine(id);
338
- routine.lastRunAt = meta.triggeredAt;
339
- routine.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
340
- this.upsertRoutine(routine);
341
- });
342
- }
343
- /**
344
- * Record the completion (success or failure) of a routine execution.
345
- */
346
- async completeRoutineExecution(id, meta) {
347
- await this.withRoutineLock(id, async () => {
348
- const routine = await this.getRoutine(id);
349
- const result = {
350
- routineId: id,
351
- success: meta.success,
352
- output: meta.output ?? (meta.success ? JSON.stringify(meta.resultJson ?? {}) : ""),
353
- error: meta.error,
354
- startedAt: routine.lastRunAt ?? meta.completedAt,
355
- completedAt: meta.completedAt,
356
- triggerType: meta.triggerType,
357
- stepResults: meta.stepResults
358
- };
359
- routine.lastRunAt = result.startedAt;
360
- routine.lastRunResult = result;
361
- routine.runCount += 1;
362
- routine.runHistory.unshift(result);
363
- if (routine.runHistory.length > MAX_ROUTINE_RUN_HISTORY) {
364
- routine.runHistory = routine.runHistory.slice(0, MAX_ROUTINE_RUN_HISTORY);
365
- }
366
- if (routine.enabled && isCronTrigger(routine.trigger)) {
367
- routine.nextRunAt = this.computeNextRun(routine.trigger.cronExpression);
368
- }
369
- routine.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
370
- this.upsertRoutine(routine);
371
- this.emit("routine:run", { routine, result });
372
- });
373
- }
374
- /**
375
- * Cancel a routine execution (no result recorded, just reset state).
376
- */
377
- async cancelRoutineExecution(id) {
378
- await this.withRoutineLock(id, async () => {
379
- const routine = await this.getRoutine(id);
380
- if (routine.enabled && isCronTrigger(routine.trigger)) {
381
- routine.nextRunAt = this.computeNextRun(routine.trigger.cronExpression);
382
- }
383
- routine.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
384
- this.upsertRoutine(routine);
385
- });
386
- }
387
- /**
388
- * Get all routines that are due to run (nextRunAt <= now and enabled).
389
- * Filters by scope: "global" or "project".
390
- */
391
- async getDueRoutines(scope) {
392
- const now = (/* @__PURE__ */ new Date()).toISOString();
393
- const rows = this.db.prepare("SELECT * FROM routines WHERE enabled = 1 AND nextRunAt IS NOT NULL AND nextRunAt <= ? AND scope = ?").all(now, scope);
394
- return rows.map((row) => this.rowToRoutine(row));
395
- }
396
- /**
397
- * Get all routines that are due to run (nextRunAt <= now and enabled) for both scopes.
398
- * Returns routines from both "global" and "project" scopes.
399
- */
400
- async getDueRoutinesAllScopes() {
401
- const now = (/* @__PURE__ */ new Date()).toISOString();
402
- const rows = this.db.prepare("SELECT * FROM routines WHERE enabled = 1 AND nextRunAt IS NOT NULL AND nextRunAt <= ?").all(now);
403
- return rows.map((row) => this.rowToRoutine(row));
404
- }
405
- };
406
-
407
- export {
408
- RoutineStore
409
- };