Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: pipe.inbox

Louis Beaumont1b08db72085d
diff --git a/screenpipe-js/main.ts b/screenpipe-js/main.ts
index 277a6503b..8ca89152d 100644
--- a/screenpipe-js/main.ts
+++ b/screenpipe-js/main.ts
@@ -3,7 +3,7 @@ import process from "node:process";
// Type definitions
export interface PipeConfig {
- [key: string]: object | string | number | boolean;
+ [key: string]: any;
}
export interface NotificationOptions {
@@ -227,3 +227,37 @@ export function extractJsonFromLlmResponse(response: string): any {
}
}
}
+
+export interface InboxMessage {
+ title: string;
+ body: string;
+ actions?: InboxMessageAction[];
+}
+
+export interface InboxMessageAction {
+ label: string;
+ action: string;
+}
+
+export const pipe = {
+ sendDesktopNotification,
+ loadPipeConfig,
+ queryScreenpipe,
+ inbox: {
+ send: async (message: InboxMessage): Promise<boolean> => {
+ const notificationApiUrl =
+ process.env.SCREENPIPE_SERVER_URL || "http://localhost:11435";
+ try {
+ const response = await fetch(`${notificationApiUrl}/inbox`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ ...message, type: "inbox" }),
+ });
+ return response.ok;
+ } catch (error) {
+ console.error("failed to send inbox message:", error);
+ return false;
+ }
+ },
+ },
+};