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

chore: remove streaming from node-sdk since it's already in browser?

Louis Beaumonte081e2acdfed
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 5993e4440..d5fdc0b54 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5289,7 +5289,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.31.6"
+version = "0.31.7"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-js/node-sdk/tests/streamTranscriptions.test.ts b/screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts
similarity index 100%
rename from screenpipe-js/node-sdk/tests/streamTranscriptions.test.ts
rename to screenpipe-js/browser-sdk/tests/streamTranscriptions.test.ts
diff --git a/screenpipe-js/node-sdk/tests/streamVision.test.ts b/screenpipe-js/browser-sdk/tests/streamVision.test.ts
similarity index 97%
rename from screenpipe-js/node-sdk/tests/streamVision.test.ts
rename to screenpipe-js/browser-sdk/tests/streamVision.test.ts
index 18e425f3f..5505890a2 100644
--- a/screenpipe-js/node-sdk/tests/streamVision.test.ts
+++ b/screenpipe-js/browser-sdk/tests/streamVision.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
-import { pipe } from "../src/index";
+import { pipe } from "../../node-sdk/src/index";
describe("streamVision", () => {
test(
diff --git a/screenpipe-js/examples/basic-transcription/index.ts b/screenpipe-js/examples/basic-transcription/index.ts
index 1055389c0..d200ce486 100644
--- a/screenpipe-js/examples/basic-transcription/index.ts
+++ b/screenpipe-js/examples/basic-transcription/index.ts
@@ -1,4 +1,4 @@
-import { pipe } from "@screenpipe/js";
+import { pipe } from "@screenpipe/browser";
async function monitorTranscriptions() {
console.log("starting transcription monitor...");
diff --git a/screenpipe-js/node-sdk/package.json b/screenpipe-js/node-sdk/package.json
index 70989f131..b5bd423a6 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.10",
+ "version": "1.0.11",
"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 1c370376a..abd724dc5 100644
--- a/screenpipe-js/node-sdk/src/index.ts
+++ b/screenpipe-js/node-sdk/src/index.ts
@@ -3,17 +3,12 @@ import type {
InputControlResponse,
ScreenpipeQueryParams,
ScreenpipeResponse,
- TranscriptionStreamResponse,
- TranscriptionChunk,
- VisionEvent,
- VisionStreamResponse,
NotificationOptions,
} from "../../common/types";
import { toSnakeCase, convertToCamelCase } from "../../common/utils";
import { SettingsManager } from "./SettingsManager";
import { InboxManager } from "./InboxManager";
import { PipesManager } from "../../common/PipesManager";
-import { EventSource } from "eventsource";
import { captureEvent, captureMainFeatureEvent } from "../../common/analytics";
class NodePipe {
@@ -134,83 +129,6 @@ class NodePipe {
}
}
- public async *streamTranscriptions(): AsyncGenerator<
- TranscriptionStreamResponse,
- void,
- unknown
- > {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
- const eventSource = new EventSource(`${apiUrl}/sse/transcriptions`);
-
- try {
- while (true) {
- const chunk: TranscriptionChunk = await new Promise(
- (resolve, reject) => {
- eventSource.onmessage = (event) => {
- if (event.data.trim() === "keep-alive-text") {
- return;
- }
- resolve(JSON.parse(event.data));
- };
- eventSource.onerror = (error) => {
- reject(error);
- };
- }
- );
-
- yield {
- id: crypto.randomUUID(),
- object: "text_completion_chunk",
- created: Date.now(),
- model: "screenpipe-realtime",
- choices: [
- {
- text: chunk.transcription,
- index: 0,
- finish_reason: chunk.is_final ? "stop" : null,
- },
- ],
- metadata: {
- timestamp: chunk.timestamp,
- device: chunk.device,
- isInput: chunk.is_input,
- },
- };
- }
- } finally {
- eventSource.close();
- }
- }
-
- public async *streamVision(
- includeImages: boolean = false
- ): AsyncGenerator<VisionStreamResponse, void, unknown> {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
- const eventSource = new EventSource(
- `${apiUrl}/sse/vision?images=${includeImages}`
- );
-
- try {
- while (true) {
- const event: VisionEvent = await new Promise((resolve, reject) => {
- eventSource.onmessage = (event) => {
- resolve(JSON.parse(event.data));
- };
- eventSource.onerror = (error) => {
- reject(error);
- };
- });
-
- yield {
- type: "vision_stream",
- data: event,
- };
- }
- } finally {
- eventSource.close();
- }
- }
-
private async initAnalyticsIfNeeded() {
if (this.analyticsInitialized) return;