@trevonistrevon/pi-loop 0.3.0 → 0.3.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.
- package/dist/index.js +3 -3
- package/dist/scheduler.js +3 -3
- package/dist/trigger-system.js +2 -2
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -3
- package/src/scheduler.ts +3 -3
- package/src/trigger-system.ts +2 -2
- package/src/types.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -132,7 +132,7 @@ export default function (pi) {
|
|
|
132
132
|
debug(`loop:fire #${entry.id}`, { prompt: entry.prompt.slice(0, 50) });
|
|
133
133
|
if (entry.maxFires && (entry.fireCount ?? 0) >= entry.maxFires) {
|
|
134
134
|
debug(`loop #${entry.id} — reached maxFires ${entry.maxFires}, expiring`);
|
|
135
|
-
store.
|
|
135
|
+
store.delete(entry.id);
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
store.update(entry.id, { fireCount: (entry.fireCount ?? 0) + 1 });
|
|
@@ -345,7 +345,7 @@ Skip this tool when the task is a one-off check (just do it directly) or when th
|
|
|
345
345
|
if (monitor && monitor.status !== "running") {
|
|
346
346
|
debug(`loop #${entry.id} — monitor #${monitorId} already ${monitor.status}, expiring`);
|
|
347
347
|
triggerSystem.remove(entry.id);
|
|
348
|
-
store.
|
|
348
|
+
store.delete(entry.id);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
@@ -371,7 +371,7 @@ Skip this tool when the task is a one-off check (just do it directly) or when th
|
|
|
371
371
|
if (monitor && monitor.status !== "running") {
|
|
372
372
|
debug(`onDone loop #${doneLoop.id} — monitor #${monitorId} already ${monitor.status}, expiring`);
|
|
373
373
|
triggerSystem.remove(doneLoop.id);
|
|
374
|
-
store.
|
|
374
|
+
store.delete(doneLoop.id);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
function validateTrigger(trigger) {
|
package/dist/scheduler.js
CHANGED
|
@@ -55,7 +55,7 @@ export class CronScheduler {
|
|
|
55
55
|
const fireTime = nextFire.getTime() + jitter;
|
|
56
56
|
const now = Date.now();
|
|
57
57
|
if (fireTime > entry.expiresAt) {
|
|
58
|
-
this.store.
|
|
58
|
+
this.store.delete(entry.id);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
const delay = Math.max(0, fireTime - now);
|
|
@@ -72,7 +72,7 @@ export class CronScheduler {
|
|
|
72
72
|
}
|
|
73
73
|
const now2 = Date.now();
|
|
74
74
|
if (now2 >= current.expiresAt) {
|
|
75
|
-
this.store.
|
|
75
|
+
this.store.delete(entry.id);
|
|
76
76
|
this.timers.delete(entry.id);
|
|
77
77
|
this.fireTimes.delete(entry.id);
|
|
78
78
|
return;
|
|
@@ -81,7 +81,7 @@ export class CronScheduler {
|
|
|
81
81
|
if (current.recurring) {
|
|
82
82
|
const fresh = this.store.get(entry.id);
|
|
83
83
|
if (fresh?.maxFires && (fresh.fireCount ?? 0) >= fresh.maxFires) {
|
|
84
|
-
this.store.
|
|
84
|
+
this.store.delete(entry.id);
|
|
85
85
|
this.timers.delete(entry.id);
|
|
86
86
|
this.fireTimes.delete(entry.id);
|
|
87
87
|
return;
|
package/dist/trigger-system.js
CHANGED
|
@@ -90,7 +90,7 @@ export class TriggerSystem {
|
|
|
90
90
|
}
|
|
91
91
|
fireLoop(entry) {
|
|
92
92
|
if (entry.maxFires && (entry.fireCount ?? 0) >= entry.maxFires) {
|
|
93
|
-
this.store.
|
|
93
|
+
this.store.delete(entry.id);
|
|
94
94
|
this.remove(entry.id);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
@@ -107,7 +107,7 @@ export class TriggerSystem {
|
|
|
107
107
|
});
|
|
108
108
|
if (!entry.recurring) {
|
|
109
109
|
this.remove(entry.id);
|
|
110
|
-
this.store.
|
|
110
|
+
this.store.delete(entry.id);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
matchesFilter(data, filter) {
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -147,7 +147,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
147
147
|
|
|
148
148
|
if (entry.maxFires && (entry.fireCount ?? 0) >= entry.maxFires) {
|
|
149
149
|
debug(`loop #${entry.id} — reached maxFires ${entry.maxFires}, expiring`);
|
|
150
|
-
store.
|
|
150
|
+
store.delete(entry.id);
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
store.update(entry.id, { fireCount: (entry.fireCount ?? 0) + 1 });
|
|
@@ -382,7 +382,7 @@ Skip this tool when the task is a one-off check (just do it directly) or when th
|
|
|
382
382
|
if (monitor && monitor.status !== "running") {
|
|
383
383
|
debug(`loop #${entry.id} — monitor #${monitorId} already ${monitor.status}, expiring`);
|
|
384
384
|
triggerSystem.remove(entry.id);
|
|
385
|
-
store.
|
|
385
|
+
store.delete(entry.id);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
} catch { /* filter parse failure, ignore */ }
|
|
@@ -413,7 +413,7 @@ Skip this tool when the task is a one-off check (just do it directly) or when th
|
|
|
413
413
|
if (monitor && monitor.status !== "running") {
|
|
414
414
|
debug(`onDone loop #${doneLoop.id} — monitor #${monitorId} already ${monitor.status}, expiring`);
|
|
415
415
|
triggerSystem.remove(doneLoop.id);
|
|
416
|
-
store.
|
|
416
|
+
store.delete(doneLoop.id);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
package/src/scheduler.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class CronScheduler {
|
|
|
65
65
|
const now = Date.now();
|
|
66
66
|
|
|
67
67
|
if (fireTime > entry.expiresAt) {
|
|
68
|
-
this.store.
|
|
68
|
+
this.store.delete(entry.id);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -85,7 +85,7 @@ export class CronScheduler {
|
|
|
85
85
|
|
|
86
86
|
const now2 = Date.now();
|
|
87
87
|
if (now2 >= current.expiresAt) {
|
|
88
|
-
this.store.
|
|
88
|
+
this.store.delete(entry.id);
|
|
89
89
|
this.timers.delete(entry.id);
|
|
90
90
|
this.fireTimes.delete(entry.id);
|
|
91
91
|
return;
|
|
@@ -96,7 +96,7 @@ export class CronScheduler {
|
|
|
96
96
|
if (current.recurring) {
|
|
97
97
|
const fresh = this.store.get(entry.id);
|
|
98
98
|
if (fresh?.maxFires && (fresh.fireCount ?? 0) >= fresh.maxFires) {
|
|
99
|
-
this.store.
|
|
99
|
+
this.store.delete(entry.id);
|
|
100
100
|
this.timers.delete(entry.id);
|
|
101
101
|
this.fireTimes.delete(entry.id);
|
|
102
102
|
return;
|
package/src/trigger-system.ts
CHANGED
|
@@ -95,7 +95,7 @@ export class TriggerSystem {
|
|
|
95
95
|
|
|
96
96
|
private fireLoop(entry: LoopEntry): void {
|
|
97
97
|
if (entry.maxFires && (entry.fireCount ?? 0) >= entry.maxFires) {
|
|
98
|
-
this.store.
|
|
98
|
+
this.store.delete(entry.id);
|
|
99
99
|
this.remove(entry.id);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
@@ -114,7 +114,7 @@ export class TriggerSystem {
|
|
|
114
114
|
|
|
115
115
|
if (!entry.recurring) {
|
|
116
116
|
this.remove(entry.id);
|
|
117
|
-
this.store.
|
|
117
|
+
this.store.delete(entry.id);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
package/src/types.ts
CHANGED