@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 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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(doneLoop.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
84
+ this.store.delete(entry.id);
85
85
  this.timers.delete(entry.id);
86
86
  this.fireTimes.delete(entry.id);
87
87
  return;
@@ -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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
110
+ this.store.delete(entry.id);
111
111
  }
112
112
  }
113
113
  matchesFilter(data, filter) {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type LoopStatus = "active" | "paused" | "expired";
1
+ export type LoopStatus = "active" | "paused";
2
2
  export interface CronTrigger {
3
3
  type: "cron";
4
4
  schedule: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trevonistrevon/pi-loop",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A pi extension for cron/event-based agent re-wake loops and background process monitoring.",
5
5
  "author": "trevonistrevon",
6
6
  "license": "MIT",
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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(doneLoop.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
99
+ this.store.delete(entry.id);
100
100
  this.timers.delete(entry.id);
101
101
  this.fireTimes.delete(entry.id);
102
102
  return;
@@ -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.update(entry.id, { status: "expired" });
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.update(entry.id, { status: "expired" });
117
+ this.store.delete(entry.id);
118
118
  }
119
119
  }
120
120
 
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type LoopStatus = "active" | "paused" | "expired";
1
+ export type LoopStatus = "active" | "paused";
2
2
 
3
3
  export interface CronTrigger {
4
4
  type: "cron";