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-screen-to-crm

Louis Beaumont55d58ef3cceb
diff --git a/examples/typescript/pipe-screen-to-crm/README.md b/examples/typescript/pipe-screen-to-crm/README.md
new file mode 100644
index 000000000..dce8a831d
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/README.md
@@ -0,0 +1,88 @@
+
+in screenpipe we have a plugin system called "pipe store" or "pipes"
+
+think of it like this:
+
+screenpipe data -> your pipe like "AI annotate" or "send to salesforce"
+
+a more dev-friendly explanation:
+
+screenpipe | AI tag | notion update
+
+or
+
+screenpipe | AI tag | slack send report
+
+or
+
+screenpipe | fill salesforce
+
+or
+
+screenpipe | logs daily
+
+basically it would read, process, annotate, analyse, summarize, send, your data customisable to your desire, effortlessly
+
+### pipe-screen-to-crm
+
+this is an experimental, that will fill with notion table CRM while you work
+
+instructions to run this pipe:
+
+1. install screenpipe and git clone this repo
+ ```
+ git clone https://github.com/mediar-ai/screenpipe.git
+ cd screenpipe
+ ```
+
+2. install and run ollama:
+ - follow instructions at https://github.com/jmorganca/ollama
+ - run `ollama run phi3.5:3.8b-mini-instruct-q4_K_M`
+
+3. set up notion:
+ - create a notion integration: https://www.notion.so/my-integrations - copy the API key
+ - create a database with properties: Name (text), Company (text), Position (text), LinkedIn URL (url), Last Interaction (text), Potential Opportunity (text), Date (date)
+ - share database with your integration - copy the database ID eg https://www.notion.so/<THIS>?<NOTTHIS>
+
+4. set environment variables:
+ ```
+ export SCREENPIPE_NOTION_API_KEY=your_notion_api_key
+ export SCREENPIPE_NOTION_DATABASE_ID=your_notion_database_id
+ ```
+
+5. run the pipe:
+ ```
+ screenpipe pipe download ./examples/typescript/pipe-screen-to-crm
+ screenpipe pipe enable screen-to-crm
+ screenpipe
+ ```
+
+### tech details
+
+we run deno runtime (a JS/TS engine) within the rust code, which host your pipes, its 99.9% similar to normal JS code
+
+### dev mode
+
+if you're in dev mode you can run the cli like this:
+
+```bash
+screenpipe pipe download https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript/pipe-stream-ocr-text
+screenpipe pipe enable pipe-stream-ocr-text
+```
+
+this would download the pipe in your local files and enable it
+
+then you need to restart screenpipe backend
+
+### get featured in the pipe store
+
+<img width="1312" alt="Screenshot 2024-08-27 at 17 06 45" src="https://github.com/user-attachments/assets/b6856bf4-2cfd-4888-be11-ee7baae6b84b">
+
+just ask @louis030195
+
+### what's next for pipes
+
+- use dependencies (like vercel/ai so cool)
+- access to screenpipe desktop api (control your computer, embedded LLM, better UI feedback API, etc.)
+- easier to publish your pipes (like obsidian store)
+- everything frictionless, effortless, and maximize the value you get out of screenpipe
diff --git a/examples/typescript/pipe-screen-to-crm/pipe.js b/examples/typescript/pipe-screen-to-crm/pipe.js
new file mode 100644
index 000000000..109cd348e
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/pipe.js
@@ -0,0 +1,64 @@
+"use strict";
+let INTERVAL = 10 * 1000; // 10 seconds in milliseconds
+async function queryScreenpipe() {
+ try {
+ const now = new Date();
+ const oneMinuteAgo = new Date(now.getTime() - INTERVAL);
+ const queryParams = `start_time=${oneMinuteAgo.toISOString()}&end_time=${now.toISOString()}&limit=50&content_type=ocr`;
+ const result = await fetch(`http://localhost:3030/search?${queryParams}`).then((r) => r.json());
+ console.log("Retrieved", result.data.length, "items from screenpipe");
+ return result.data;
+ }
+ catch (error) {
+ console.error("Error querying screenpipe:", error);
+ return [];
+ }
+}
+async function writeToMarkdown(data) {
+ console.log("Writing to markdown", JSON.stringify(data));
+ const fileName = `screen-ocr-${new Date()
+ .toISOString()
+ .replace(/[:.]/g, "-")}.md`;
+ const content = data
+ .map((item) => `## ${item.content.timestamp}\n\n${item.content.text}\n\n---\n`)
+ .join("\n");
+ const dir = path.join(process.env.PIPE_DIR, fileName);
+ console.log("Writing to", dir);
+ fs.writeFileSync(dir, content);
+ console.log(`Written OCR data to ${fileName}`);
+}
+async function runOCRTracker() {
+ console.log("Starting OCR Tracker");
+ // wait 2 seocnds
+ await new Promise((resolve) => setTimeout(resolve, 1000));
+ console.log(pipe);
+ await pipe.loadConfig();
+ INTERVAL = pipe.config.interval * 1000;
+ console.log("INTERVAL", INTERVAL);
+ while (true) {
+ try {
+ const screenData = await queryScreenpipe();
+ await writeToMarkdown(screenData);
+ }
+ catch (error) {
+ console.error("Error in OCR tracking:", error);
+ }
+ finally {
+ await new Promise((resolve) => setTimeout(resolve, INTERVAL));
+ }
+ // const isEnabled = await pipe.isEnabled();
+ // if (!isEnabled) {
+ // console.log("pipe is disabled");
+ // break;
+ // }
+ }
+}
+// Self-invoking async function to run the OCR tracker
+(async () => {
+ try {
+ await runOCRTracker();
+ }
+ catch (error) {
+ console.error("Fatal error in OCR Tracker:", error);
+ }
+})();
diff --git a/examples/typescript/pipe-screen-to-crm/pipe.json b/examples/typescript/pipe-screen-to-crm/pipe.json
new file mode 100644
index 000000000..4fc31a3fc
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/pipe.json
@@ -0,0 +1,40 @@
+{
+ "fields": [
+ {
+ "name": "interval",
+ "type": "number",
+ "default": 60,
+ "description": "Interval in seconds to stream data"
+ },
+ {
+ "name": "notionDatabaseId",
+ "type": "string",
+ "default": "<fill your notion database id here>",
+ "description": "Notion Database ID"
+ },
+ {
+ "name": "notionApiKey",
+ "type": "string",
+ "default": "<fill your notion api key here>",
+ "description": "Notion API Key"
+ },
+ {
+ "name": "ollamaApiUrl",
+ "type": "string",
+ "default": "http://localhost:11434/api",
+ "description": "Ollama API URL"
+ },
+ {
+ "name": "ollamaModel",
+ "type": "string",
+ "default": "phi3.5:3.8b-mini-instruct-q4_K_M",
+ "description": "Ollama Model"
+ },
+ {
+ "name": "pageSize",
+ "type": "number",
+ "default": 100,
+ "description": "Number of records to retrieve from Screenpipe per page"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/typescript/pipe-screen-to-crm/pipe.ts b/examples/typescript/pipe-screen-to-crm/pipe.ts
new file mode 100644
index 000000000..316d02e49
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/pipe.ts
@@ -0,0 +1,321 @@
+const DEFAULT_INTERVAL = 60; // 1 minute in seconds
+const DEFAULT_OLLAMA_API_URL = "http://localhost:11434/api/chat";
+const DEFAULT_OLLAMA_MODEL = "phi3.5:3.8b-mini-instruct-q4_K_M";
+const NOTION_API_BASE = "https://api.notion.com/v1";
+const DEFAULT_NOTION_DATABASE_ID = process.env.NOTION_DATABASE_ID;
+const DEFAULT_NOTION_API_KEY = process.env.NOTION_API_KEY;
+const DEFAULT_PAGE_SIZE = 100;
+
+/*
+Instructions to run this pipe:
+
+1. install screenpipe and git clone this repo
+ ```
+ git clone https://github.com/mediar-ai/screenpipe.git
+ cd screenpipe
+ ```
+
+2. install and run ollama:
+ - follow instructions at https://github.com/jmorganca/ollama
+ - run `ollama run phi3.5:3.8b-mini-instruct-q4_K_M`
+
+3. set up notion:
+ - create a notion integration: https://www.notion.so/my-integrations - copy the API key
+ - create a database with properties: Name (text), Company (text), Position (text), LinkedIn URL (url), Last Interaction (text), Potential Opportunity (text), Date (date)
+ - share database with your integration - copy the database ID eg https://www.notion.so/<THIS>?<NOTTHIS>
+
+4. set environment variables:
+ ```
+ export SCREENPIPE_NOTION_API_KEY=your_notion_api_key
+ export SCREENPIPE_NOTION_DATABASE_ID=your_notion_database_id
+ ```
+
+5. run the pipe:
+ ```
+ screenpipe pipe download ./examples/typescript/pipe-screen-to-crm
+ screenpipe pipe enable screen-to-crm
+ screenpipe
+ ```
+
+*/
+
+async function queryScreenpipe(interval: number, pageSize: number) {
+ try {
+ const now = new Date();
+ const oneMinuteAgo = new Date(now.getTime() - interval);
+
+ const queryParams = `start_time=${oneMinuteAgo.toISOString()}&end_time=${now.toISOString()}&limit=${pageSize}&content_type=ocr`;
+
+ console.log(`querying screenpipe with params: ${queryParams}`);
+ const result = await fetch(
+ `http://localhost:3030/search?${queryParams}`
+ ).then((r) => r.json());
+ console.log("retrieved", result.data.length, "items from screenpipe");
+ return result.data;
+ } catch (error) {
+ console.error("error querying screenpipe:", error);
+ return [];
+ }
+}
+
+async function extractLinkedInData(
+ screenData: any,
+ ollamaApiUrl: string,
+ ollamaModel: string
+) {
+ console.log(
+ "extracting linkedin data from",
+ screenData.length,
+ "screen data items"
+ );
+ const prompt = `
+You are an AI assistant tasked with extracting LinkedIn sales-related information from screen data (OCR).
+Analyze the following screen data and extract relevant information about potential sales leads or customers.
+Only extract information if you are highly confident it is related to LinkedIn and sales activities.
+
+Screen Data:
+${JSON.stringify(screenData)}
+
+Return a JSON array of objects with the following structure:
+[
+ {
+ "name": "Full name of the person",
+ "company": "Company name",
+ "position": "Job title",
+ "linkedInUrl": "LinkedIn profile URL",
+ "lastInteraction": "Brief description of last interaction",
+ "potentialOpportunity": "Brief description of potential sales opportunity",
+ "confidence": 0.95 // Your confidence level in the extracted information (0.0 to 1.0)
+ }
+]
+
+Rules:
+- Do not add backticks to the JSON eg \`\`\`json\`\`\` is WRONG
+- If no relevant information is found, return an empty array. NOTHING ELSE.
+- DO NOT RETURN ANYTHING BUT JSON. NO COMMENTS BELOW THE JSON.
+- In the potentialOpportunity field, feel free to say you should follow up with the lead at specific date in the future (provide the date).
+`;
+
+ try {
+ console.log(`sending request to ollama api: ${ollamaApiUrl}`);
+ const response = await fetch(ollamaApiUrl + "/chat", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ model: ollamaModel,
+ messages: [{ role: "user", content: prompt }],
+ stream: false,
+ response_format: { type: "json_object" },
+ }),
+ });
+
+ if (!response.ok) {
+ console.log("ollama response:", await response.text());
+ throw new Error(`http error! status: ${response.status}`);
+ }
+
+ const result = await response.json();
+ console.log("ollama result:", JSON.stringify(result, null, 2));
+
+ // remove backticks from the result
+ const cleanedResult = result.message.content
+ .trim()
+ .replace(/```json\n/g, "")
+ .replace(/\n```/g, "");
+ const extractedData = JSON.parse(cleanedResult);
+ console.log(
+ "extracted linkedin data:",
+ JSON.stringify(extractedData, null, 2)
+ );
+ return extractedData;
+ } catch (error) {
+ console.error("error extracting linkedin data:", error);
+ return [];
+ }
+}
+
+async function readFromNotion(databaseId: string, apiKey: string) {
+ const url = `${NOTION_API_BASE}/databases/${databaseId}/query`;
+ console.log("reading from notion:", url);
+ const response = await fetch(url, {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${apiKey}`,
+ "Notion-Version": "2022-06-28",
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({}),
+ });
+ if (!response.ok) {
+ console.log("notion response:", await response.text());
+ throw new Error(`http error! status: ${response.status}`);
+ }
+
+ const data = await response.json();
+ console.log("notion data:", JSON.stringify(data, null, 2));
+ return data.results.map((page: any) => page.properties);
+}
+
+async function updateNotion(
+ databaseId: string,
+ records: any[],
+ apiKey: string
+) {
+ const url = `${NOTION_API_BASE}/pages`;
+ const updatedRecords = [];
+
+ for (const record of records) {
+ console.log("updating record:", JSON.stringify(record, null, 2));
+ const response = await fetch(url, {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${apiKey}`,
+ "Notion-Version": "2022-06-28",
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ parent: { database_id: databaseId },
+ properties: record,
+ }),
+ });
+ if (!response.ok) {
+ console.log("notion response:", await response.text());
+ throw new Error(`http error! status: ${response.status}`);
+ }
+ updatedRecords.push(await response.json());
+ console.log("updated record:", JSON.stringify(updatedRecords[0], null, 2));
+ }
+
+ return updatedRecords;
+}
+
+async function updateNotionWithLinkedInData(
+ existingData: any[],
+ linkedInData: any[]
+) {
+ console.log(
+ "updating notion with",
+ linkedInData.length,
+ "linkedin data items"
+ );
+ const updatedRecords = [];
+
+ for (const item of linkedInData) {
+ console.log("processing item:", item);
+ const existingRecord = existingData.find(
+ (record) => record.Name.title[0]?.plain_text === item.name
+ );
+ console.log("existing record:", existingRecord);
+
+ const linkedInUrl =
+ item.linkedInUrl && item.linkedInUrl.trim() !== ""
+ ? item.linkedInUrl
+ : null;
+
+ if (existingRecord) {
+ // update existing record
+ updatedRecords.push({
+ Name: { title: [{ text: { content: item.name } }] },
+ Company: { rich_text: [{ text: { content: item.company || "" } }] },
+ Position: { rich_text: [{ text: { content: item.position || "" } }] },
+ "LinkedIn URL": { url: linkedInUrl },
+ "Last Interaction": {
+ rich_text: [{ text: { content: item.lastInteraction || "" } }],
+ },
+ "Potential Opportunity": {
+ rich_text: [{ text: { content: item.potentialOpportunity || "" } }],
+ },
+ Date: { date: { start: new Date().toISOString() } },
+ });
+ } else {
+ // add new record
+ updatedRecords.push({
+ Name: { title: [{ text: { content: item.name } }] },
+ Company: { rich_text: [{ text: { content: item.company || "" } }] },
+ Position: { rich_text: [{ text: { content: item.position || "" } }] },
+ "LinkedIn URL": { url: linkedInUrl },
+ "Last Interaction": {
+ rich_text: [{ text: { content: item.lastInteraction || "" } }],
+ },
+ "Potential Opportunity": {
+ rich_text: [{ text: { content: item.potentialOpportunity || "" } }],
+ },
+ Date: { date: { start: new Date().toISOString() } },
+ });
+ }
+ }
+
+ return updatedRecords;
+}
+
+async function enrichCRM(
+ linkedInData: any,
+ databaseId: string,
+ apiKey: string
+) {
+ console.log("enriching crm with", linkedInData.length, "linkedin data items");
+ try {
+ // read existing data from notion
+ const existingData = await readFromNotion(databaseId, apiKey);
+ console.log("existing data records:", existingData.length);
+
+ // update notion with linkedin data
+ const updatedRecords = await updateNotionWithLinkedInData(
+ existingData,
+ linkedInData
+ );
+
+ console.log("updating notion with", updatedRecords.length, "records");
+ // update the notion database
+ await updateNotion(databaseId, updatedRecords, apiKey);
+ console.log("updated notion with linkedin data");
+ } catch (error) {
+ console.error("error enriching crm:", error);
+ }
+}
+
+async function runLinkedInCRMEnricher() {
+ console.log("starting linkedin crm enricher");
+ const config = await pipe.loadConfig();
+ console.log("loaded config:", JSON.stringify(config, null, 2));
+ const interval = (config.interval || DEFAULT_INTERVAL) * 1000;
+ const databaseId = config.notionDatabaseId || DEFAULT_NOTION_DATABASE_ID;
+ const apiKey = config.notionApiKey || DEFAULT_NOTION_API_KEY;
+ const ollamaApiUrl = config.ollamaApiUrl || DEFAULT_OLLAMA_API_URL;
+ const ollamaModel = config.ollamaModel || DEFAULT_OLLAMA_MODEL;
+ const pageSize = config.pageSize || DEFAULT_PAGE_SIZE;
+ while (true) {
+ try {
+ console.log("starting new enrichment cycle");
+ const screenData = await queryScreenpipe(interval, pageSize);
+ if (screenData.length === 0) {
+ console.log("no screen data found in this interval");
+ continue;
+ }
+ const linkedInData = await extractLinkedInData(
+ screenData,
+ ollamaApiUrl,
+ ollamaModel
+ );
+ if (linkedInData.length > 0) {
+ await enrichCRM(linkedInData, databaseId, apiKey);
+ } else {
+ console.log("no relevant linkedin data found in this interval");
+ }
+ } catch (error) {
+ console.error("error in linkedin crm enrichment cycle:", error);
+ } finally {
+ console.log(`waiting ${interval / 1000} seconds before next cycle`);
+ }
+ await new Promise((resolve) => setTimeout(resolve, interval));
+ }
+}
+
+// Self-invoking async function to run the LinkedIn CRM enricher
+(async () => {
+ try {
+ await runLinkedInCRMEnricher();
+ } catch (error) {
+ console.error("fatal error in linkedin crm enricher:", error);
+ }
+})();
diff --git a/examples/typescript/pipe-screen-to-crm/screenpipe.d.ts b/examples/typescript/pipe-screen-to-crm/screenpipe.d.ts
new file mode 100644
index 000000000..ed848b812
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/screenpipe.d.ts
@@ -0,0 +1,44 @@
+declare global {
+ const pipe: {
+ readFile: (path: string) => Promise<string>;
+ writeFile: (path: string, contents: string) => Promise<void>;
+ removeFile: (path: string) => Promise<void>;
+ get: (url: string) => Promise<any>;
+ post: (url: string, body: string) => Promise<any>;
+ fetch: (url: string, options?: RequestInit) => Promise<Response>;
+ sendNotification: (options: {
+ title: string;
+ body: string;
+ }) => Promise<any>;
+ loadConfig: () => Promise<Record<string, any>>;
+ config: Record<string, any>;
+ metadata: {
+ id: string;
+ };
+ };
+
+ const fs: {
+ readFileSync: (path: string) => string;
+ writeFileSync: (path: string, contents: string) => void;
+ };
+
+ const path: {
+ join: (...paths: string[]) => string;
+ };
+
+ namespace NodeJS {
+ interface ProcessEnv {
+ SCREENPIPE_DIR: string;
+ SCREENPIPE_LOG_API_URL?: string;
+ SCREENPIPE_SERVER_URL?: string;
+ PIPE_DIR: string;
+ NOTION_DATABASE_ID: string;
+ NOTION_API_KEY: string;
+ }
+ }
+ const process: {
+ env: NodeJS.ProcessEnv;
+ };
+}
+
+export {};
diff --git a/examples/typescript/pipe-screen-to-crm/tsconfig.json b/examples/typescript/pipe-screen-to-crm/tsconfig.json
new file mode 100644
index 000000000..c4e6dfdd7
--- /dev/null
+++ b/examples/typescript/pipe-screen-to-crm/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "es2018",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "outDir": "./",
+ "rootDir": "./",
+ "strict": true,
+ "esModuleInterop": true
+ },
+ "include": [
+ "./**/*.ts"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}
\ No newline at end of file
diff --git a/examples/typescript/pipe-stream-ocr-text/.gitignore b/examples/typescript/pipe-stream-ocr-text/.gitignore
deleted file mode 100644
index b512c09d4..000000000
--- a/examples/typescript/pipe-stream-ocr-text/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
\ No newline at end of file
diff --git a/examples/typescript/pipe-stream-ocr-text/README.md b/examples/typescript/pipe-stream-ocr-text/README.md
index b8f3e8d6c..a740c1e91 100644
--- a/examples/typescript/pipe-stream-ocr-text/README.md
+++ b/examples/typescript/pipe-stream-ocr-text/README.md
@@ -42,14 +42,13 @@ we run deno runtime (a JS/TS engine) within the rust code, which host your pipes
if you're in dev mode you can run the cli like this:
```bash
-curl -X POST "http://localhost:3030/pipes/download" \
- -H "Content-Type: application/json" \
- -d '{"url": "https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript/pipe-stream-ocr-text"}' | jq
+screenpipe pipe download https://github.com/mediar-ai/screenpipe/tree/main/examples/typescript/pipe-stream-ocr-text
+screenpipe pipe enable pipe-stream-ocr-text
```
-this would download the pip in your local files
+this would download the pipe in your local files and enable it
-check `server.rs` to see how it works (copy paste in AI and ask questions)
+then you need to restart screenpipe backend
### get featured in the pipe store
@@ -60,7 +59,6 @@ just ask @louis030195
### what's next for pipes
- use dependencies (like vercel/ai so cool)
-- TS
-- access to screenpipe desktop api (e.g. trigger notifications, customise what cursor-like @ are in the chat, etc.)
+- access to screenpipe desktop api (control your computer, embedded LLM, better UI feedback API, etc.)
- easier to publish your pipes (like obsidian store)
- everything frictionless, effortless, and maximize the value you get out of screenpipe
diff --git a/examples/typescript/pipe-stream-ocr-text/bun.lockb b/examples/typescript/pipe-stream-ocr-text/bun.lockb
deleted file mode 100755
index eed5e28b3..000000000
Binary files a/examples/typescript/pipe-stream-ocr-text/bun.lockb and /dev/null differ
diff --git a/examples/typescript/pipe-stream-ocr-text/package-lock.json b/examples/typescript/pipe-stream-ocr-text/package-lock.json
deleted file mode 100644
index a3c721524..000000000
--- a/examples/typescript/pipe-stream-ocr-text/package-lock.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "pipe-stream-ocr-text",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {
- "": {
- "dependencies": {
- "@types/node": "^22.6.1"
- }
- },
- "node_modules/@types/node": {
- "version": "22.6.1",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.6.1.tgz",
- "integrity": "sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==",
- "dependencies": {
- "undici-types": "~6.19.2"
- }
- },
- "node_modules/undici-types": {
- "version": "6.19.8",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
- "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
- }
- }
-}
diff --git a/examples/typescript/pipe-stream-ocr-text/package.json b/examples/typescript/pipe-stream-ocr-text/package.json
deleted file mode 100644
index 0dd6d62a9..000000000
--- a/examples/typescript/pipe-stream-ocr-text/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "dependencies": {
- "@types/node": "^22.6.1"
- },
- "scripts": {
- "build": "tsc"
- }
-}
\ No newline at end of file
diff --git a/examples/typescript/pipe-stream-ocr-text/screenpipe.d.ts b/examples/typescript/pipe-stream-ocr-text/screenpipe.d.ts
index fe1bb5343..836e68817 100644
--- a/examples/typescript/pipe-stream-ocr-text/screenpipe.d.ts
+++ b/examples/typescript/pipe-stream-ocr-text/screenpipe.d.ts
@@ -34,6 +34,10 @@ declare global {
PIPE_DIR: string;
}
}
+
+ const process: {
+ env: NodeJS.ProcessEnv;
+ };
}
export {};
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index 931986dd9..b238da801 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -58,7 +58,7 @@ const PipeDialog: React.FC = () => {
const { health } = useHealthCheck();
useEffect(() => {
fetchInstalledPipes();
- }, [health]);
+ }, [health?.status]);
const handleResetAllPipes = async () => {
try {
@@ -264,6 +264,9 @@ const PipeDialog: React.FC = () => {
description: "Please check the URL and try again.",
variant: "destructive",
});
+ } finally {
+ setNewRepoUrl("");
+ setSelectedPipe(null);
}
}
};
@@ -456,6 +459,7 @@ const PipeDialog: React.FC = () => {
))}
<Card className="mb-2 p-2">
<Input
+ type="url"
placeholder="Enter repo URL"
value={newRepoUrl}
onChange={(e) => setNewRepoUrl(e.target.value)}
diff --git a/screenpipe-app-tauri/components/ui/input.tsx b/screenpipe-app-tauri/components/ui/input.tsx
index 1bad6f42c..5b1a01aff 100644
--- a/screenpipe-app-tauri/components/ui/input.tsx
+++ b/screenpipe-app-tauri/components/ui/input.tsx
@@ -5,17 +5,12 @@ export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
const Input = React.forwardRef<HTMLInputElement, InputProps>(
- ({ className, type, ...props }, ref) => {
+ ({ className, type, onKeyDown, ...props }, ref) => {
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
- if (type === "url" && e.key === "/") {
- e.preventDefault();
- const input = e.currentTarget;
- const start = input.selectionStart || 0;
- const end = input.selectionEnd || 0;
- const value = input.value;
- input.value = value.slice(0, start) + "/" + value.slice(end);
- input.setSelectionRange(start + 1, start + 1);
+ if (e.key === '/') {
+ e.stopPropagation();
}
+ onKeyDown?.(e);
};
return (
diff --git a/screenpipe-core/src/pipes.rs b/screenpipe-core/src/pipes.rs
index f3285d8f7..4f7f0cdff 100644
--- a/screenpipe-core/src/pipes.rs
+++ b/screenpipe-core/src/pipes.rs
@@ -479,6 +479,7 @@ mod pipes {
if file_type.is_file() {
if let Some(file_name_str) = file_name.clone().to_str() {
if file_name_str == "pipe.js"
+ || file_name_str == "pipe.ts"
|| file_name_str == "pipe.json"
|| file_name_str == "README.md"
{
@@ -541,7 +542,7 @@ mod pipes {
let file_name = item["name"].as_str().unwrap();
let download_url = item["download_url"].as_str().unwrap();
- if file_name == "pipe.js" || file_name == "pipe.json" || file_name == "README.md" {
+ if file_name == "pipe.js" || file_name == "pipe.ts" || file_name == "pipe.json" || file_name == "README.md" {
let file_content = client.get(download_url).send().await?.bytes().await?;
let file_path = pipe_dir.join(file_name);
tokio::fs::write(&file_path, &file_content).await?;
@@ -595,11 +596,11 @@ mod pipes {
let entry = entry?;
let file_name = entry.file_name();
let file_name_str = file_name.to_str().unwrap();
- if file_name_str == "pipe.js" {
+ if file_name_str == "pipe.js" || file_name_str == "pipe.ts" {
return Ok(entry.path());
}
}
- anyhow::bail!("No pipe.js found in the pipe/dist directory")
+ anyhow::bail!("No pipe.js/pipe.ts found in the pipe/dist directory")
}
}