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

small fixes on sdk and bump

Louis Beaumonte0143712b535
diff --git a/screenpipe-js/browser-sdk/package.json b/screenpipe-js/browser-sdk/package.json
index 6fd1936f8..557d74d0e 100644
--- a/screenpipe-js/browser-sdk/package.json
+++ b/screenpipe-js/browser-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@screenpipe/browser",
- "version": "0.1.26",
+ "version": "0.1.27",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
diff --git a/screenpipe-js/browser-sdk/src/index.ts b/screenpipe-js/browser-sdk/src/index.ts
index 25cb89fd2..9e489b81c 100644
--- a/screenpipe-js/browser-sdk/src/index.ts
+++ b/screenpipe-js/browser-sdk/src/index.ts
@@ -12,6 +12,7 @@ import type {
} from "../../common/types";
import { toSnakeCase, convertToCamelCase } from "../../common/utils";
import { captureEvent, captureMainFeatureEvent } from "../../common/analytics";
+import { PipesManager } from "../../common/PipesManager";
const WS_URL = "ws://localhost:3030/ws/events";
@@ -21,7 +22,7 @@ let wsWithoutImages: WebSocket | null = null;
// Update the wsEvents generator to accept includeImages parameter and manage connections
async function* wsEvents(
- includeImages: boolean = false,
+ includeImages: boolean = false
): AsyncGenerator<EventStreamResponse, void, unknown> {
// Reuse existing connection or create new one
let ws = includeImages ? wsWithImages : wsWithoutImages;
@@ -71,7 +72,7 @@ async function sendInputControl(action: InputAction): Promise<boolean> {
export interface BrowserPipe {
sendDesktopNotification(options: NotificationOptions): Promise<boolean>;
queryScreenpipe(
- params: ScreenpipeQueryParams,
+ params: ScreenpipeQueryParams
): Promise<ScreenpipeResponse | null>;
input: {
type: (text: string) => Promise<boolean>;
@@ -86,7 +87,7 @@ export interface BrowserPipe {
disable: (pipeId: string) => Promise<boolean>;
update: (
pipeId: string,
- config: { [key: string]: string },
+ config: { [key: string]: string }
) => Promise<boolean>;
};
streamTranscriptions(): AsyncGenerator<
@@ -95,18 +96,18 @@ export interface BrowserPipe {
unknown
>;
streamVision(
- includeImages?: boolean,
+ includeImages?: boolean
): AsyncGenerator<VisionStreamResponse, void, unknown>;
captureEvent: (
event: string,
- properties?: Record<string, any>,
+ properties?: Record<string, any>
) => Promise<void>;
captureMainFeatureEvent: (
name: string,
- properties?: Record<string, any>,
+ properties?: Record<string, any>
) => Promise<void>;
streamEvents(
- includeImages: boolean,
+ includeImages: boolean
): AsyncGenerator<EventStreamResponse, void, unknown>;
}
@@ -119,7 +120,7 @@ class BrowserPipeImpl implements BrowserPipe {
try {
// Connect to settings SSE stream
const settingsStream = new EventSource(
- "http://localhost:11435/sse/settings",
+ "http://localhost:11435/sse/settings"
);
// Get initial settings
@@ -165,7 +166,7 @@ class BrowserPipeImpl implements BrowserPipe {
} catch (error) {
console.error(
"failed to fetch settings, defaulting to analytics enabled:",
- error,
+ error
);
return {
analyticsEnabled: false,
@@ -175,7 +176,7 @@ class BrowserPipeImpl implements BrowserPipe {
}
async sendDesktopNotification(
- options: NotificationOptions,
+ options: NotificationOptions
): Promise<boolean> {
const { userId, email } = await this.initAnalyticsIfNeeded();
const notificationApiUrl = "http://localhost:11435";
@@ -203,7 +204,7 @@ class BrowserPipeImpl implements BrowserPipe {
}
async queryScreenpipe(
- params: ScreenpipeQueryParams,
+ params: ScreenpipeQueryParams
): Promise<ScreenpipeResponse | null> {
console.log("queryScreenpipe:", params);
const { userId, email } = await this.initAnalyticsIfNeeded();
@@ -282,7 +283,7 @@ class BrowserPipeImpl implements BrowserPipe {
disable: (pipeId: string) => Promise<boolean>;
update: (
pipeId: string,
- config: { [key: string]: string },
+ config: { [key: string]: string }
) => Promise<boolean>;
} = {
list: async () => {
@@ -403,7 +404,7 @@ class BrowserPipeImpl implements BrowserPipe {
}
async *streamVision(
- includeImages: boolean = false,
+ includeImages: boolean = false
): AsyncGenerator<VisionStreamResponse, void, unknown> {
try {
for await (const event of wsEvents(includeImages)) {
@@ -422,7 +423,7 @@ class BrowserPipeImpl implements BrowserPipe {
public async captureEvent(
eventName: string,
- properties?: Record<string, any>,
+ properties?: Record<string, any>
) {
const { analyticsEnabled } = await this.initAnalyticsIfNeeded();
if (!analyticsEnabled) return;
@@ -431,7 +432,7 @@ class BrowserPipeImpl implements BrowserPipe {
public async captureMainFeatureEvent(
featureName: string,
- properties?: Record<string, any>,
+ properties?: Record<string, any>
) {
const { analyticsEnabled } = await this.initAnalyticsIfNeeded();
if (!analyticsEnabled) return;
@@ -439,7 +440,7 @@ class BrowserPipeImpl implements BrowserPipe {
}
public async *streamEvents(
- includeImages: boolean = false,
+ includeImages: boolean = false
): AsyncGenerator<EventStreamResponse, void, unknown> {
for await (const event of wsEvents(includeImages)) {
yield event;
@@ -448,7 +449,9 @@ class BrowserPipeImpl implements BrowserPipe {
}
const pipeImpl = new BrowserPipeImpl();
+const pipeManager = new PipesManager();
export const pipe = pipeImpl;
+pipeImpl.pipes = pipeManager;
export * from "../../common/types";
export { getDefaultSettings } from "../../common/utils";
diff --git a/screenpipe-js/node-sdk/src/PipesManager.ts b/screenpipe-js/common/PipesManager.ts
similarity index 82%
rename from screenpipe-js/node-sdk/src/PipesManager.ts
rename to screenpipe-js/common/PipesManager.ts
index 2f06fcda9..8aaeb5ad1 100644
--- a/screenpipe-js/node-sdk/src/PipesManager.ts
+++ b/screenpipe-js/common/PipesManager.ts
@@ -1,7 +1,7 @@
export class PipesManager {
async list(): Promise<string[]> {
try {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ const apiUrl = "http://localhost:3030";
const response = await fetch(`${apiUrl}/pipes/list`, {
method: "GET",
headers: { "Content-Type": "application/json" },
@@ -17,7 +17,7 @@ export class PipesManager {
async download(url: string): Promise<boolean> {
try {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ const apiUrl = "http://localhost:3030";
const response = await fetch(`${apiUrl}/pipes/download`, {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -35,7 +35,7 @@ export class PipesManager {
async enable(pipeId: string): Promise<boolean> {
try {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ const apiUrl = "http://localhost:3030";
const response = await fetch(`${apiUrl}/pipes/enable`, {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -53,7 +53,7 @@ export class PipesManager {
async disable(pipeId: string): Promise<boolean> {
try {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ const apiUrl = "http://localhost:3030";
const response = await fetch(`${apiUrl}/pipes/disable`, {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -71,10 +71,10 @@ export class PipesManager {
async update(
pipeId: string,
- config: { [key: string]: string },
+ config: { [key: string]: string }
): Promise<boolean> {
try {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ const apiUrl = "http://localhost:3030";
const response = await fetch(`${apiUrl}/pipes/update`, {
method: "POST",
headers: { "Content-Type": "application/json" },
diff --git a/screenpipe-js/node-sdk/package.json b/screenpipe-js/node-sdk/package.json
index 18d0b9ce5..70989f131 100644
--- a/screenpipe-js/node-sdk/package.json
+++ b/screenpipe-js/node-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@screenpipe/js",
- "version": "1.0.9",
+ "version": "1.0.10",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
diff --git a/screenpipe-js/node-sdk/src/index.ts b/screenpipe-js/node-sdk/src/index.ts
index 29c7cb4cd..1c370376a 100644
--- a/screenpipe-js/node-sdk/src/index.ts
+++ b/screenpipe-js/node-sdk/src/index.ts
@@ -12,7 +12,7 @@ import type {
import { toSnakeCase, convertToCamelCase } from "../../common/utils";
import { SettingsManager } from "./SettingsManager";
import { InboxManager } from "./InboxManager";
-import { PipesManager } from "./PipesManager";
+import { PipesManager } from "../../common/PipesManager";
import { EventSource } from "eventsource";
import { captureEvent, captureMainFeatureEvent } from "../../common/analytics";