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

screenpipe-js 0.1.5: add speaker, etc to sdk

Louis Beaumont594c3914ff7f
diff --git a/screenpipe-js/main.ts b/screenpipe-js/main.ts
index f2f11994c..4540b940e 100644
--- a/screenpipe-js/main.ts
+++ b/screenpipe-js/main.ts
@@ -21,7 +21,14 @@ export interface NotificationOptions {
/**
* Types of content that can be queried in Screenpipe.
*/
-export type ContentType = "ocr" | "audio" | "all";
+export type ContentType =
+ | "all"
+ | "ocr"
+ | "audio"
+ | "ui"
+ | "audio+ui"
+ | "ocr+ui"
+ | "audio+ocr";
/**
* Parameters for querying Screenpipe.
@@ -38,6 +45,7 @@ export interface ScreenpipeQueryParams {
includeFrames?: boolean;
minLength?: number;
maxLength?: number;
+ speakerIds?: number[];
}
/**
@@ -67,6 +75,7 @@ export interface AudioContent {
tags: string[];
deviceName: string;
deviceType: string;
+ speaker?: Speaker;
}
/**
@@ -84,13 +93,36 @@ export interface FTSContent {
tags: string[];
}
+/**
+ * Structure of UI content.
+ */
+export interface UiContent {
+ id: number;
+ text: string;
+ timestamp: string;
+ appName: string;
+ windowName: string;
+ initialTraversalAt?: string;
+ filePath: string;
+ offsetIndex: number;
+}
+
+/**
+ * Speaker information
+ */
+export interface Speaker {
+ id: number;
+ name?: string;
+ metadata?: string;
+}
+
/**
* Union type for different types of content items.
*/
export type ContentItem =
| { type: "OCR"; content: OCRContent }
| { type: "Audio"; content: AudioContent }
- | { type: "FTS"; content: FTSContent };
+ | { type: "UI"; content: UiContent };
/**
* Pagination information for search results.
@@ -360,8 +392,13 @@ export async function queryScreenpipe(
const queryParams = new URLSearchParams();
Object.entries(params).forEach(([key, value]) => {
if (value !== undefined) {
- const snakeKey = toSnakeCase(key);
- queryParams.append(snakeKey, value.toString());
+ if (key === 'speakerIds' && Array.isArray(value)) {
+ // Convert speaker IDs array to comma-separated string
+ queryParams.append(toSnakeCase(key), value.join(','));
+ } else {
+ const snakeKey = toSnakeCase(key);
+ queryParams.append(snakeKey, value.toString());
+ }
}
});
diff --git a/screenpipe-js/package.json b/screenpipe-js/package.json
index 3010201b1..e6b6cc6cc 100644
--- a/screenpipe-js/package.json
+++ b/screenpipe-js/package.json
@@ -1,6 +1,6 @@
{
"name": "@screenpipe/js",
- "version": "0.1.4",
+ "version": "0.1.5",
"module": "main.ts",
"type": "module",
"files": [