opencode-plugin-apprise 1.2.2 → 1.2.3
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.
|
@@ -204,10 +204,17 @@ async function sendHookNotification(hookName, config, dedup, payload) {
|
|
|
204
204
|
|
|
205
205
|
// src/hooks/idle.ts
|
|
206
206
|
function extractText(parts) {
|
|
207
|
-
const
|
|
207
|
+
const textParts = parts.filter((p) => p.type === "text" && p.text);
|
|
208
|
+
const nonSynthetic = textParts.filter((p) => !p.synthetic);
|
|
209
|
+
const source = nonSynthetic.length > 0 ? nonSynthetic : textParts;
|
|
210
|
+
const texts = source.map((p) => p.text);
|
|
208
211
|
return texts.join(`
|
|
209
212
|
`).trim() || undefined;
|
|
210
213
|
}
|
|
214
|
+
function isFullySyntheticMessage(parts) {
|
|
215
|
+
const textParts = parts.filter((p) => p.type === "text");
|
|
216
|
+
return textParts.length > 0 && textParts.every((p) => p.synthetic === true);
|
|
217
|
+
}
|
|
211
218
|
function createIdleHook(ctx, config, dedup, delayMs = 30000) {
|
|
212
219
|
const pendingTimers = new Map;
|
|
213
220
|
return async ({ event }) => {
|
|
@@ -246,6 +253,8 @@ function createIdleHook(ctx, config, dedup, delayMs = 30000) {
|
|
|
246
253
|
for (let i = messages.length - 1;i >= 0; i--) {
|
|
247
254
|
const msg = messages[i];
|
|
248
255
|
if (msg?.info?.role === "user") {
|
|
256
|
+
if (isFullySyntheticMessage(msg.parts))
|
|
257
|
+
continue;
|
|
249
258
|
userRequest = extractText(msg.parts);
|
|
250
259
|
break;
|
|
251
260
|
}
|
package/package.json
CHANGED