@wahooks/channel 2.2.1 → 2.3.0
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 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -723,7 +723,8 @@ async function main() {
|
|
|
723
723
|
const transport = new StdioServerTransport();
|
|
724
724
|
transport.onclose = () => {
|
|
725
725
|
claudeConnected = false;
|
|
726
|
-
console.error("[wahooks-channel] Claude disconnected");
|
|
726
|
+
console.error("[wahooks-channel] Claude disconnected — exiting");
|
|
727
|
+
process.exit(0);
|
|
727
728
|
};
|
|
728
729
|
await mcp.connect(transport);
|
|
729
730
|
claudeConnected = true;
|
|
@@ -754,15 +755,11 @@ async function main() {
|
|
|
754
755
|
fs.writeFileSync(PENDING_FILE, "[]", { mode: 0o600 });
|
|
755
756
|
return;
|
|
756
757
|
}
|
|
757
|
-
const debugLog = path.join(WAHOOKS_DIR, "channel-debug.log");
|
|
758
|
-
const log = (msg) => fs.appendFileSync(debugLog, `${new Date().toISOString()} ${msg}\n`);
|
|
759
|
-
log(`Found ${active.length} pending, claudeConnected=${claudeConnected}`);
|
|
760
758
|
console.error(`[wahooks-channel] Found ${active.length} pending reminder(s), delivering...`);
|
|
761
759
|
for (const item of active) {
|
|
762
|
-
log(`Delivering: ${item.reminderId}`);
|
|
763
760
|
console.error(`[wahooks-channel] Delivering: ${item.reminderId}`);
|
|
764
761
|
try {
|
|
765
|
-
|
|
762
|
+
await mcp.notification({
|
|
766
763
|
method: "notifications/claude/channel",
|
|
767
764
|
params: {
|
|
768
765
|
content: `[Scheduled Reminder] ${item.task}\n\nTarget chat: ${item.chatId}\nScheduled for: ${item.scheduledFor}\n\nPlease execute this task now and send the results to the target chat using wahooks_reply.`,
|
|
@@ -772,11 +769,9 @@ async function main() {
|
|
|
772
769
|
},
|
|
773
770
|
},
|
|
774
771
|
});
|
|
775
|
-
log(`Delivered: ${item.reminderId}, result=${JSON.stringify(result)}`);
|
|
776
772
|
console.error(`[wahooks-channel] Delivered: ${item.reminderId}`);
|
|
777
773
|
}
|
|
778
774
|
catch (err) {
|
|
779
|
-
log(`FAILED: ${item.reminderId}, error=${err}`);
|
|
780
775
|
console.error(`[wahooks-channel] Delivery failed: ${err}`);
|
|
781
776
|
claudeConnected = false;
|
|
782
777
|
return;
|
|
@@ -784,7 +779,6 @@ async function main() {
|
|
|
784
779
|
}
|
|
785
780
|
// Clear queue after all delivered
|
|
786
781
|
fs.writeFileSync(PENDING_FILE, "[]", { mode: 0o600 });
|
|
787
|
-
log("Queue cleared");
|
|
788
782
|
}
|
|
789
783
|
// Poll every 10s
|
|
790
784
|
setInterval(pollPending, 10_000);
|