@trevonistrevon/pi-loop 0.2.3 → 0.2.4
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 +2 -13
- package/package.json +1 -1
- package/src/index.ts +2 -15
package/dist/index.js
CHANGED
|
@@ -167,16 +167,6 @@ export default function (pi) {
|
|
|
167
167
|
widget.setUICtx(ctx.ui);
|
|
168
168
|
upgradeStoreIfNeeded(ctx);
|
|
169
169
|
showPersistedLoops();
|
|
170
|
-
if (pendingReminders.length > 0) {
|
|
171
|
-
const reminder = pendingReminders.shift();
|
|
172
|
-
return {
|
|
173
|
-
message: {
|
|
174
|
-
customType: "pi-loop",
|
|
175
|
-
content: reminder,
|
|
176
|
-
display: false,
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
170
|
});
|
|
181
171
|
pi.on("session_switch", async (event, ctx) => {
|
|
182
172
|
_latestCtx = ctx;
|
|
@@ -191,8 +181,7 @@ export default function (pi) {
|
|
|
191
181
|
upgradeStoreIfNeeded(ctx);
|
|
192
182
|
showPersistedLoops(isResume);
|
|
193
183
|
});
|
|
194
|
-
// ──
|
|
195
|
-
const pendingReminders = [];
|
|
184
|
+
// ── Loop fire handler — sends a user message to re-wake the agent ──
|
|
196
185
|
pi.events.on("loop:fire", (data) => {
|
|
197
186
|
const triggerInfo = typeof data.trigger === "string"
|
|
198
187
|
? data.trigger
|
|
@@ -205,7 +194,7 @@ export default function (pi) {
|
|
|
205
194
|
.replace("%prompt%", data.prompt || "loop fired")
|
|
206
195
|
.replace("%trigger_info%", triggerInfo)
|
|
207
196
|
.replace("%loop_id%", data.loopId || "unknown");
|
|
208
|
-
|
|
197
|
+
pi.sendUserMessage(reminder);
|
|
209
198
|
});
|
|
210
199
|
// ──────────────────────────────────────────────────
|
|
211
200
|
// Tool 1: LoopCreate
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -174,17 +174,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
174
174
|
widget.setUICtx(ctx.ui as UICtx);
|
|
175
175
|
upgradeStoreIfNeeded(ctx);
|
|
176
176
|
showPersistedLoops();
|
|
177
|
-
|
|
178
|
-
if (pendingReminders.length > 0) {
|
|
179
|
-
const reminder = pendingReminders.shift()!;
|
|
180
|
-
return {
|
|
181
|
-
message: {
|
|
182
|
-
customType: "pi-loop",
|
|
183
|
-
content: reminder,
|
|
184
|
-
display: false,
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
177
|
});
|
|
189
178
|
|
|
190
179
|
pi.on("session_switch" as any, async (event: any, ctx: ExtensionContext) => {
|
|
@@ -204,9 +193,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
204
193
|
showPersistedLoops(isResume);
|
|
205
194
|
});
|
|
206
195
|
|
|
207
|
-
// ──
|
|
208
|
-
|
|
209
|
-
const pendingReminders: string[] = [];
|
|
196
|
+
// ── Loop fire handler — sends a user message to re-wake the agent ──
|
|
210
197
|
|
|
211
198
|
pi.events.on("loop:fire", (data: any) => {
|
|
212
199
|
const triggerInfo = typeof data.trigger === "string"
|
|
@@ -222,7 +209,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
222
209
|
.replace("%trigger_info%", triggerInfo)
|
|
223
210
|
.replace("%loop_id%", data.loopId || "unknown");
|
|
224
211
|
|
|
225
|
-
|
|
212
|
+
pi.sendUserMessage(reminder);
|
|
226
213
|
});
|
|
227
214
|
|
|
228
215
|
// ──────────────────────────────────────────────────
|