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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
add exqmaple
Louis Beaumont22bc080484a1
diff --git a/examples/typescript/agent-multi-turn-rag/.gitignore b/examples/typescript/agent-multi-turn-rag/.gitignorenew file mode 100644index 000000000..a56a7ef43--- /dev/null+++ b/examples/typescript/agent-multi-turn-rag/.gitignore@@ -0,0 +1,2 @@+node_modules+diff --git a/examples/typescript/agent-multi-turn-rag/README.md b/examples/typescript/agent-multi-turn-rag/README.mdnew file mode 100644index 000000000..364a50d7f--- /dev/null+++ b/examples/typescript/agent-multi-turn-rag/README.md@@ -0,0 +1,8 @@++++```bash+pnpm i+export OPENAI_API_KEY="<your key>"+npx tsx screenpipe.ts+```diff --git a/examples/typescript/agent-multi-turn-rag/package.json b/examples/typescript/agent-multi-turn-rag/package.jsonnew file mode 100644index 000000000..94de2fb43--- /dev/null+++ b/examples/typescript/agent-multi-turn-rag/package.json@@ -0,0 +1,11 @@+{+ "dependencies": {+ "@ai-sdk/openai": "^0.0.40",+ "ai": "^3.3.0",+ "readline": "^1.3.0",+ "zod": "^3.23.8"+ },+ "devDependencies": {+ "@types/node": "^22.1.0"+ }+}diff --git a/examples/typescript/agent-multi-turn-rag/pnpm-lock.yaml b/examples/typescript/agent-multi-turn-rag/pnpm-lock.yamlnew file mode 100644index 000000000..f78cdcad6--- /dev/null+++ b/examples/typescript/agent-multi-turn-rag/pnpm-lock.yaml@@ -0,0 +1,614 @@+lockfileVersion: '6.0'++settings:+ autoInstallPeers: true+ excludeLinksFromLockfile: false++dependencies:+ '@ai-sdk/openai':+ specifier: ^0.0.40+ version: 0.0.40([email protected])+ ai:+ specifier: ^3.3.0+ readline:+ specifier: ^1.3.0+ version: 1.3.0+ zod:+ specifier: ^3.23.8+ version: 3.23.8++devDependencies:+ '@types/node':+ specifier: ^22.1.0+ version: 22.1.0++packages:++ /@ai-sdk/[email protected]([email protected]):+ resolution: {integrity: sha512-9Iq1UaBHA5ZzNv6j3govuKGXrbrjuWvZIgWNJv4xzXlDMHu9P9hnqlBr/Aiay54WwCuTVNhTzAUTfFgnTs2kbQ==}+ engines: {node: '>=18'}+ peerDependencies:+ zod: ^3.0.0+ dependencies:+ '@ai-sdk/provider': 0.0.14+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ zod: 3.23.8+ dev: false++ /@ai-sdk/[email protected]([email protected]):+ resolution: {integrity: sha512-XfOawxk95X3S43arn2iQIFyWGMi0DTxsf9ETc6t7bh91RPWOOPYN1tsmS5MTKD33OGJeaDQ/gnVRzXUCRBrckQ==}+ engines: {node: '>=18'}+ peerDependencies:+ zod: ^3.0.0+ peerDependenciesMeta:+ zod:+ optional: true+ dependencies:+ '@ai-sdk/provider': 0.0.14+ eventsource-parser: 1.1.2+ nanoid: 3.3.6+ secure-json-parse: 2.7.0+ zod: 3.23.8+ dev: false++ /@ai-sdk/[email protected]:+ resolution: {integrity: sha512-gaQ5Y033nro9iX1YUjEDFDRhmMcEiCk56LJdIUbX5ozEiCNCfpiBpEqrjSp/Gp5RzBS2W0BVxfG7UGW6Ezcrzg==}+ engines: {node: '>=18'}+ dependencies:+ json-schema: 0.4.0+ dev: false++ resolution: {integrity: sha512-LAxFLtHKN1BajTNP8YzyVIwXn45LSunmvm2Svrfq5oPOyJ2gUEjtaONnbme4mwRXJ1kk6b63SLrgOIXbz6XF/g==}+ engines: {node: '>=18'}+ peerDependencies:+ react: ^18 || ^19+ zod: ^3.0.0+ peerDependenciesMeta:+ react:+ optional: true+ zod:+ optional: true+ dependencies:+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ '@ai-sdk/ui-utils': 0.0.24([email protected])+ react: 18.3.1+ swr: 2.2.5([email protected])+ zod: 3.23.8+ dev: false++ /@ai-sdk/[email protected]([email protected]):+ resolution: {integrity: sha512-uEvlT7MBkRRZxk7teDgtrGe7G3U9tspgSJUvupdOE2d0a4vLlHrMqHb07ao97/Xo1aVHh7oBF9XIgRzKnFtbIQ==}+ engines: {node: '>=18'}+ peerDependencies:+ solid-js: ^1.7.7+ peerDependenciesMeta:+ solid-js:+ optional: true+ dependencies:+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ '@ai-sdk/ui-utils': 0.0.24([email protected])+ transitivePeerDependencies:+ - zod+ dev: false++ resolution: {integrity: sha512-7vrh61wXPVfy19nS4CqyAC3UWjsOgj/b94PCccVTGFoqbmVSa0VptXPYoFfgPTP/W71v7TjXqeq1ygLc4noTZw==}+ engines: {node: '>=18'}+ peerDependencies:+ svelte: ^3.0.0 || ^4.0.0+ peerDependenciesMeta:+ svelte:+ optional: true+ dependencies:+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ '@ai-sdk/ui-utils': 0.0.24([email protected])+ sswr: 2.1.0([email protected])+ svelte: 4.2.18+ transitivePeerDependencies:+ - zod+ dev: false++ /@ai-sdk/[email protected]([email protected]):+ resolution: {integrity: sha512-NBhhICWJ5vAkN4BJnP/MyT+fOB6rTlGlsKGQwvjlhNxdrY1/jXqe2ikNkCbCSEz20IDk82bmg2JJBM96g1O3Ig==}+ engines: {node: '>=18'}+ peerDependencies:+ zod: ^3.0.0+ peerDependenciesMeta:+ zod:+ optional: true+ dependencies:+ '@ai-sdk/provider': 0.0.14+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ secure-json-parse: 2.7.0+ zod: 3.23.8+ dev: false++ resolution: {integrity: sha512-ZnDjkkUH/9xoXqJEmyrG9Z8z7DKBnp2uyCd9ZVI8QSqKOaP0jOwhv8THUXlIqDEF+ULLGMWm0XeY/L7i3CMYTA==}+ engines: {node: '>=18'}+ peerDependencies:+ vue: ^3.3.4+ peerDependenciesMeta:+ vue:+ optional: true+ dependencies:+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ '@ai-sdk/ui-utils': 0.0.24([email protected])+ swrv: 1.0.4([email protected])+ vue: 3.4.35+ transitivePeerDependencies:+ - zod+ dev: false++ /@ampproject/[email protected]:+ resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==}+ engines: {node: '>=6.0.0'}+ dependencies:+ '@jridgewell/gen-mapping': 0.3.5+ '@jridgewell/trace-mapping': 0.3.25+ dev: false++ /@babel/[email protected]:+ resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==}+ engines: {node: '>=6.9.0'}+ dev: false++ /@babel/[email protected]:+ resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==}+ engines: {node: '>=6.9.0'}+ dev: false++ /@babel/[email protected]:+ resolution: {integrity: sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==}+ engines: {node: '>=6.0.0'}+ hasBin: true+ dependencies:+ '@babel/types': 7.25.2+ dev: false++ /@babel/[email protected]:+ resolution: {integrity: sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==}+ engines: {node: '>=6.9.0'}+ dependencies:+ '@babel/helper-string-parser': 7.24.8+ '@babel/helper-validator-identifier': 7.24.7+ to-fast-properties: 2.0.0+ dev: false++ /@jridgewell/[email protected]:+ resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==}+ engines: {node: '>=6.0.0'}+ dependencies:+ '@jridgewell/set-array': 1.2.1+ '@jridgewell/sourcemap-codec': 1.5.0+ '@jridgewell/trace-mapping': 0.3.25+ dev: false++ /@jridgewell/[email protected]:+ resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}+ engines: {node: '>=6.0.0'}+ dev: false++ /@jridgewell/[email protected]:+ resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==}+ engines: {node: '>=6.0.0'}+ dev: false++ /@jridgewell/[email protected]:+ resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}+ dev: false++ /@jridgewell/[email protected]:+ resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}+ dependencies:+ '@jridgewell/resolve-uri': 3.1.2+ '@jridgewell/sourcemap-codec': 1.5.0+ dev: false++ /@opentelemetry/[email protected]:+ resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==}+ engines: {node: '>=8.0.0'}+ dev: false++ /@types/[email protected]:+ resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==}+ dev: false++ /@types/[email protected]:+ resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}+ dev: false++ /@types/[email protected]:+ resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==}+ dependencies:+ undici-types: 6.13.0+ dev: true++ /@vue/[email protected]:+ resolution: {integrity: sha512-gKp0zGoLnMYtw4uS/SJRRO7rsVggLjvot3mcctlMXunYNsX+aRJDqqw/lV5/gHK91nvaAAlWFgdVl020AW1Prg==}+ dependencies:+ '@babel/parser': 7.25.3+ '@vue/shared': 3.4.35+ entities: 4.5.0+ estree-walker: 2.0.2+ source-map-js: 1.2.0+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-pWIZRL76/oE/VMhdv/ovZfmuooEni6JPG1BFe7oLk5DZRo/ImydXijoZl/4kh2406boRQ7lxTYzbZEEXEhj9NQ==}+ dependencies:+ '@vue/compiler-core': 3.4.35+ '@vue/shared': 3.4.35+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-xacnRS/h/FCsjsMfxBkzjoNxyxEyKyZfBch/P4vkLRvYJwe5ChXmZZrj8Dsed/752H2Q3JE8kYu9Uyha9J6PgA==}+ dependencies:+ '@babel/parser': 7.25.3+ '@vue/compiler-core': 3.4.35+ '@vue/compiler-dom': 3.4.35+ '@vue/compiler-ssr': 3.4.35+ '@vue/shared': 3.4.35+ estree-walker: 2.0.2+ magic-string: 0.30.11+ postcss: 8.4.40+ source-map-js: 1.2.0+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-7iynB+0KB1AAJKk/biENTV5cRGHRdbdaD7Mx3nWcm1W8bVD6QmnH3B4AHhQQ1qZHhqFwzEzMwiytXm3PX1e60A==}+ dependencies:+ '@vue/compiler-dom': 3.4.35+ '@vue/shared': 3.4.35+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-Ggtz7ZZHakriKioveJtPlStYardwQH6VCs9V13/4qjHSQb/teE30LVJNrbBVs4+aoYGtTQKJbTe4CWGxVZrvEw==}+ dependencies:+ '@vue/shared': 3.4.35+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-D+BAjFoWwT5wtITpSxwqfWZiBClhBbR+bm0VQlWYFOadUUXFo+5wbe9ErXhLvwguPiLZdEF13QAWi2vP3ZD5tA==}+ dependencies:+ '@vue/reactivity': 3.4.35+ '@vue/shared': 3.4.35+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-yGOlbos+MVhlS5NWBF2HDNgblG8e2MY3+GigHEyR/dREAluvI5tuUUgie3/9XeqhPE4LF0i2wjlduh5thnfOqw==}+ dependencies:+ '@vue/reactivity': 3.4.35+ '@vue/runtime-core': 3.4.35+ '@vue/shared': 3.4.35+ csstype: 3.1.3+ dev: false++ /@vue/[email protected]([email protected]):+ resolution: {integrity: sha512-iZ0e/u9mRE4T8tNhlo0tbA+gzVkgv8r5BX6s1kRbOZqfpq14qoIvCZ5gIgraOmYkMYrSEZgkkojFPr+Nyq/Mnw==}+ peerDependencies:+ vue: 3.4.35+ dependencies:+ '@vue/compiler-ssr': 3.4.35+ '@vue/shared': 3.4.35+ vue: 3.4.35+ dev: false++ /@vue/[email protected]:+ resolution: {integrity: sha512-hvuhBYYDe+b1G8KHxsQ0diDqDMA8D9laxWZhNAjE83VZb5UDaXl9Xnz7cGdDSyiHM90qqI/CyGMcpBpiDy6VVQ==}+ dev: false++ resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==}+ engines: {node: '>=0.4.0'}+ hasBin: true+ dev: false++ resolution: {integrity: sha512-ndW4G9jw8ImIsTWK2iderOWMVn4H3B6u+KHlZ7hJEvFBdBYTFQ62qTw10AmHsQefjwHRC/2evr9qf79EkSwo9Q==}+ engines: {node: '>=18'}+ peerDependencies:+ openai: ^4.42.0+ react: ^18 || ^19+ sswr: ^2.1.0+ svelte: ^3.0.0 || ^4.0.0+ zod: ^3.0.0+ peerDependenciesMeta:+ openai:+ optional: true+ react:+ optional: true+ sswr:+ optional: true+ svelte:+ optional: true+ zod:+ optional: true+ dependencies:+ '@ai-sdk/provider': 0.0.14+ '@ai-sdk/provider-utils': 1.0.5([email protected])+ '@ai-sdk/react': 0.0.36([email protected])([email protected])+ '@ai-sdk/solid': 0.0.27([email protected])+ '@ai-sdk/svelte': 0.0.29([email protected])([email protected])+ '@ai-sdk/ui-utils': 0.0.24([email protected])+ '@ai-sdk/vue': 0.0.28([email protected])([email protected])+ '@opentelemetry/api': 1.9.0+ eventsource-parser: 1.1.2+ json-schema: 0.4.0+ jsondiffpatch: 0.6.0+ nanoid: 3.3.6+ react: 18.3.1+ secure-json-parse: 2.7.0+ svelte: 4.2.18+ zod: 3.23.8+ zod-to-json-schema: 3.22.5([email protected])+ transitivePeerDependencies:+ - solid-js+ - vue+ dev: false++ resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}+ dependencies:+ dequal: 2.0.3+ dev: false++ resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}+ engines: {node: '>= 0.4'}+ dev: false++ resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==}+ engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}+ dev: false++ resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}+ dev: false++ resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==}+ dependencies:+ '@jridgewell/sourcemap-codec': 1.5.0+ '@types/estree': 1.0.5+ acorn: 8.12.1+ estree-walker: 3.0.3+ periscopic: 3.1.0+ dev: false++ resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==}+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}+ dependencies:+ mdn-data: 2.0.30+ source-map-js: 1.2.0+ dev: false++ resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}+ dev: false++ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}+ engines: {node: '>=6'}+ dev: false++ resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==}+ dev: false++ resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}+ engines: {node: '>=0.12'}+ dev: false++ resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}+ dev: false++ resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}+ dependencies:+ '@types/estree': 1.0.5+ dev: false++ resolution: {integrity: sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA==}+ engines: {node: '>=14.18'}+ dev: false++ resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==}+ dependencies:+ '@types/estree': 1.0.5+ dev: false++ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}+ dev: false++ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}+ dev: false++ resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==}+ engines: {node: ^18.0.0 || >=20.0.0}+ hasBin: true+ dependencies:+ '@types/diff-match-patch': 1.0.36+ chalk: 5.3.0+ diff-match-patch: 1.0.5+ dev: false++ resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==}+ dev: false++ resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}+ hasBin: true+ dependencies:+ js-tokens: 4.0.0+ dev: false++ resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==}+ dependencies:+ '@jridgewell/sourcemap-codec': 1.5.0+ dev: false++ resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}+ dev: false++ resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}+ hasBin: true+ dev: false++ resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}+ hasBin: true+ dev: false++ resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==}+ dependencies:+ '@types/estree': 1.0.5+ estree-walker: 3.0.3+ is-reference: 3.0.2+ dev: false++ resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}+ dev: false++ resolution: {integrity: sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==}+ engines: {node: ^10 || ^12 || >=14}+ dependencies:+ nanoid: 3.3.7+ picocolors: 1.0.1+ source-map-js: 1.2.0+ dev: false++ resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}+ engines: {node: '>=0.10.0'}+ dependencies:+ loose-envify: 1.4.0+ dev: false++ resolution: {integrity: sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==}+ dev: false++ resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}+ dev: false++ resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}+ engines: {node: '>=0.10.0'}+ dev: false++ resolution: {integrity: sha512-Cqc355SYlTAaUt8iDPaC/4DPPXK925PePLMxyBKuWd5kKc5mwsG3nT9+Mq2tyguL5s7b4Jg+IRMpTRsNTAfpSQ==}+ peerDependencies:+ svelte: ^4.0.0 || ^5.0.0-next.0+ dependencies:+ svelte: 4.2.18+ swrev: 4.0.0+ dev: false++ resolution: {integrity: sha512-d0FdzYIiAePqRJEb90WlJDkjUEx42xhivxN8muUBmfZnP+tzUgz12DJ2hRJi8sIHCME7jeK1PTMgKPSfTd8JrA==}+ engines: {node: '>=16'}+ dependencies:+ '@ampproject/remapping': 2.3.0+ '@jridgewell/sourcemap-codec': 1.5.0+ '@jridgewell/trace-mapping': 0.3.25+ '@types/estree': 1.0.5+ acorn: 8.12.1+ aria-query: 5.3.0+ axobject-query: 4.1.0+ code-red: 1.0.4+ css-tree: 2.3.1+ estree-walker: 3.0.3+ is-reference: 3.0.2+ locate-character: 3.0.0+ magic-string: 0.30.11+ periscopic: 3.1.0+ dev: false++ resolution: {integrity: sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg==}+ peerDependencies:+ react: ^16.11.0 || ^17.0.0 || ^18.0.0+ dependencies:+ client-only: 0.0.1+ react: 18.3.1+ use-sync-external-store: 1.2.2([email protected])+ dev: false++ resolution: {integrity: sha512-LqVcOHSB4cPGgitD1riJ1Hh4vdmITOp+BkmfmXRh4hSF/t7EnS4iD+SOTmq7w5pPm/SiPeto4ADbKS6dHUDWFA==}+ dev: false++ resolution: {integrity: sha512-zjEkcP8Ywmj+xOJW3lIT65ciY/4AL4e/Or7Gj0MzU3zBJNMdJiT8geVZhINavnlHRMMCcJLHhraLTAiDOTmQ9g==}+ peerDependencies:+ vue: '>=3.2.26 < 4'+ dependencies:+ vue: 3.4.35+ dev: false++ resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}+ engines: {node: '>=4'}+ dev: false++ resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==}+ dev: true++ resolution: {integrity: sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0+ dependencies:+ react: 18.3.1+ dev: false++ resolution: {integrity: sha512-+fl/GLmI4GPileHftVlCdB7fUL4aziPcqTudpTGXCT8s+iZWuOCeNEB5haX6Uz2IpRrbEXOgIFbe+XciCuGbNQ==}+ peerDependencies:+ typescript: '*'+ peerDependenciesMeta:+ typescript:+ optional: true+ dependencies:+ '@vue/compiler-dom': 3.4.35+ '@vue/compiler-sfc': 3.4.35+ '@vue/runtime-dom': 3.4.35+ '@vue/server-renderer': 3.4.35([email protected])+ '@vue/shared': 3.4.35+ dev: false++ resolution: {integrity: sha512-+akaPo6a0zpVCCseDed504KBJUQpEW5QZw7RMneNmKw+fGaML1Z9tUNLnHHAC8x6dzVRO1eB2oEMyZRnuBZg7Q==}+ peerDependencies:+ zod: ^3.22.4+ dependencies:+ zod: 3.23.8+ dev: false++ resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}+ dev: falsediff --git a/examples/typescript/agent-multi-turn-rag/screenpipe.ts b/examples/typescript/agent-multi-turn-rag/screenpipe.tsnew file mode 100644index 000000000..714c0f217--- /dev/null+++ b/examples/typescript/agent-multi-turn-rag/screenpipe.ts@@ -0,0 +1,194 @@+import { z } from "zod";+import { openai } from "@ai-sdk/openai";+import { generateText, streamText } from "ai";+import * as readline from "readline";++// example use:+// can you create a bullet list for me to share with my colleagues+// my changes in the code of screenpipe? Use the queries like "lldb", "gdp", "discord"++const screenpipeQuery = z.object({+ q: z+ .string()+ .describe(+ "The search query matching exact keywords. Use a single keyword that best matches the user intent. This would match either audio transcription or OCR screen text. Example: do not use 'discuss' the user ask about conversation, this is dumb, won't return any result"+ )+ .optional(),+ content_type: z+ .enum(["ocr", "audio", "all"])+ .default("all")+ .describe(+ "The type of content to search for: screenshot data or audio transcriptions"+ ),+ limit: z+ .number()+ .default(5)+ .describe(+ "Number of results to return (default: 5). Don't return more than 50 results as it will be fed to an LLM"+ ),+ offset: z.number().default(0).describe("Offset for pagination (default: 0)"),+ start_time: z+ .string()+ // 1 hour ago+ .default(new Date(Date.now() - 3600000).toISOString())+ .describe("Start time for search range in ISO 8601 format"),+ end_time: z+ .string()+ .default(new Date().toISOString())+ .describe("End time for search range in ISO 8601 format"),+ app_name: z+ .string()+ .describe(+ "The name of the app the user was using. This filter out all audio conversations. Only works with screen text. Use this to filter on the app context that would give context matching the user intent. For example 'cursor'. Use lower case. Browser is usually 'arc', 'chrome', 'safari', etc."+ )+ .optional(),+});+const screenpipeMultiQuery = z.object({+ queries: z.array(screenpipeQuery),+});++async function queryScreenpipeNtimes(+ params: z.infer<typeof screenpipeMultiQuery>+) {+ console.log(+ "Using tool queryScreenpipeNtimes with params:",+ JSON.stringify(params)+ );+ return Promise.all(params.queries.map(queryScreenpipe));+}++// Add this new function to handle screenpipe requests+async function queryScreenpipe(params: z.infer<typeof screenpipeQuery>) {+ try {+ console.log("params", params);+ const queryParams = new URLSearchParams(+ Object.entries({+ q: params.q,+ offset: params.offset.toString(),+ limit: params.limit.toString(),+ start_date: params.start_time,+ end_date: params.end_time,+ content_type: params.content_type,+ app_name: params.app_name,+ }).filter(([_, v]) => v != null) as [string, string][]+ );+ console.log("calling screenpipe", JSON.stringify(params));+ const response = await fetch(`http://localhost:3030/search?${queryParams}`);+ if (!response.ok) {+ const text = await response.text();+ throw new Error(`HTTP error! status: ${response.status} ${text}`);+ }+ const result = await response.json();+ console.log("result", result);+ return result;+ } catch (error) {+ console.error("Error querying screenpipe:", error);+ return null;+ }+}++const screenpipe = async () => {+ console.log("Hi! How can I help you?");+ const rl = readline.createInterface({+ input: process.stdin,+ output: process.stdout,+ });++ const inputMessage = await new Promise<string>((resolve) => {+ rl.question("Enter your message: ", (answer) => {+ rl.close();+ resolve(answer);+ });+ });++ const text = await generateText({+ model: openai("gpt-4o"),+ tools: {+ query_screenpipe: {+ description:+ "Query the local screenpipe instance for relevant information. You will return multiple queries under the key 'queries'.",+ parameters: screenpipeMultiQuery,+ execute: queryScreenpipeNtimes,+ },+ stream_response: {+ description: "Stream the final response to the user",+ parameters: z.object({+ response: z+ .string()+ .describe("The final response to stream to the user"),+ }),+ execute: async ({ response }) => {+ const { textStream } = await streamText({+ model: openai("gpt-4o"),+ messages: [+ {+ role: "user",+ content: response,+ },+ ],+ });+ for await (const chunk of textStream) {+ console.log(chunk);+ }+ return { success: true };+ },+ },+ },+ toolChoice: "required",+ messages: [+ {+ role: "system",+ content: `You are a helpful assistant.+ The user is using a product called "screenpipe" which records+ his screen and mics 24/7. The user ask you questions+ and you use his screenpipe recordings to answer him.+ Based on the user request, use tools to query screenpipe to best help the user.+ Each query should have "q", "offset", "limit", "start_date", "end_date", and "content_type" fields.+ Rules:+ - q should be a single keyword that would properly find in the text found on the user screen some infomation that would help answering the user question.+ Return a list of objects with the key "queries"+ - q contains a single query, again, for example instead of "life plan" just use "life"+ - Respond with only the updated JSON object+ - If you return something else than JSON the universe will come to an end+ - DO NOT add \`\`\`json at the beginning or end of your response+ - Do not use '"' around your response+ - Date & time now is ${new Date().toISOString()}. Adjust start_date and end_date to properly match the user intent time range.+ - If the user ask about his morning do not use morning as query that's dumb, try to infer some keywords from the user question+ - Very important: your output will be given to another LLM so make sure not to return too much data (typically each row returns lot of data)+ - Use between 2-5 queries with very different keywords that could maximally match the user's screen text or audio transcript+ - Use "all" for querying the same keyword over vision and audio+ - MAKE SURE TO RETURN AN ARRAY OF QUERIES e.g. {"queries": [ ... ]}+ - MAKE SURE TO RETURN AN ARRAY OF QUERIES e.g. {"queries": [ ... ]}+ - MAKE SURE TO RETURN AN ARRAY OF QUERIES e.g. {"queries": [ ... ]}+ - You typically always query screenpipe in the first user message++ Example answers from you:+ "{+ "queries": [+ {"q": "goal", "offset": 0, "limit": 10, "content_type": "all", "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z", "app_name": "arc"},+ {"offset": 0, "limit": 50, "content_type": "ocr", "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},+ {"q": "customer", "offset": 0, "limit": 20, "content_type": "audio", "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"}+ ]+ }"++ or+ "{+ "queries": [+ {"q": "sales", "offset": 0, "limit": 10, "content_type": "all", "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z"},+ {"q": "customer", "offset": 0, "limit": 20, "content_type": "all", "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},+ {"offset": 0, "limit": 10, "content_type": "all", "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z", "app_name": "notes"}+ ]+ }"++ `,+ },+ {+ role: "user",+ content: inputMessage,+ },+ ],+ maxToolRoundtrips: 3,+ });+};++screenpipe();diff --git a/examples/typescript/time-tracker/README.md b/examples/typescript/time-tracker/README.mddeleted file mode 100644index 63d07a682..000000000--- a/examples/typescript/time-tracker/README.md+++ /dev/null@@ -1,17 +0,0 @@-----https://github.com/user-attachments/assets/41c0d4cb-5ce5-4011-93b8-fa71363e6c48----https://github.com/louis030195/screen-pipe/assets/25003283/f730cc55-933b-4ddb-a89a-d6607783704a----how to setup:-https://youtu.be/xyvdOfXwRgg--need help? [i'll install this with you in less than 10 minutes](https://cal.com/louis030195/screenpipe)-diff --git a/examples/typescript/time-tracker/screenpipe.js b/examples/typescript/time-tracker/screenpipe.jsdeleted file mode 100644index 77c4cd735..000000000--- a/examples/typescript/time-tracker/screenpipe.js+++ /dev/null@@ -1,154 +0,0 @@-const OPENAI_API_URL = 'https://api.openai.com/v1/chat/completions';-const OPENAI_MODEL = 'gpt-4o';-// to use ollama just comment out the above and uncomment below:-// const OPENAI_API_URL = 'http://localhost:11434/api/chat';-// const OPENAI_MODEL = 'phi3:medium-128k';-// make sure to run "ollama run phi3:medium-128k"--// example use:-// can you create a bullet list for me to share with my colleagues-// my changes in the code of screenpipe? Use the queries like "lldb", "gdp", "discord"--const screenpipe = async (conf) => {- const openAIKey = conf.openai;- document.body.style.cursor = "wait";- const msg = window.getSelection().toString();-- // Generate parameters for 3 different queries- const paramsResponse = await fetch(OPENAI_API_URL, {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- 'Authorization': `Bearer ${openAIKey}`,- },- body: JSON.stringify({- 'response_format': { type: 'json_object' },- 'messages': [- {- 'role': 'user',- 'content': `Based on this user selection: "${msg}", generate parameters as JSON for 3 different queries to screenpipe.- Each query should have "q", "offset", "limit", and start_date, end_date fields.- Rules:- - q should be a single keyword that would properly find in the text found on the user screen some infomation that would help answering the user question.- Return a list of objects with the key "queries"- - q contains a single query, again, for example instead of "life plan" just use "life"- - Respond with only the updated JSON object- - If you return something else than JSON the universe will come to an end- - DO NOT add \`\`\`json at the beginning or end of your response- - Do not use '"' around your response- - Date & time now is ${new Date().toISOString()}-- Example answers from you:- "{- "queries": [- {"q": "goal", "offset": 0, "limit": 10, "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z"},- {"q": "stripe", "offset": 0, "limit": 50, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},- {"q": "customer", "offset": 0, "limit": 20, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"}- ]- }"-- or- "{- "queries": [- {"q": "sales", "offset": 0, "limit": 10, "start_date": "2024-07-21T11:30:25Z", "end_date": "2024-07-21T11:35:25Z"},- {"q": "customer", "offset": 0, "limit": 20, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"},- {"q": "goal", "offset": 0, "limit": 10, "start_date": "2024-07-19T08:00:25Z", "end_date": "2024-07-20T09:00:25Z"}- ]- }"-- Bad example- "Here's the JSON you wanted:- [- {- "queries": [{"q": "sales", "offset": 0, "limit": 10}]- },- {- "queries": [{"q": "customer", "offset": 0, "limit": 20}]- },- {- "queries": [{"q": "goal", "offset": 0, "limit": 10}]- }- ]"- or- "\`\`\`json- [- {- "queries": [- {"q": "goals", "offset": 0, "limit": 3}- ]- },- {- "queries": [- {"q": "life plans", "offset": 0, "limit": 5}- ]- },- {- "queries": [- {"q": "ambitions", "offset": 0, "limit": 3}- ]- }- ]- \`\`\`"- JSON?- `- },- ],- 'model': OPENAI_MODEL,- 'stream': false,- })- }).then(res => res.json());-- console.log(paramsResponse);---- // phi3 models are drunk af thats why- const { queries } = JSON.parse((paramsResponse.choices?.[0]?.message?.content ||- // ollama not respecting openai api- paramsResponse.message?.content).trim()- // remove " at the start and end- .replace(/^"|"$/g, "")- // remove ```json at the start and end- .replace(/^```json\n/, "")- .replace(/\n```$/, "")- );-- console.log("queries", queries);-- // Query screenpipe 3 times with generated parameters- const screenpipeResults = await Promise.all(queries.map(async (query) => {- const response = await fetch(`http://localhost:3030/search?q=${encodeURIComponent(query.q)}&offset=${query.offset}&limit=${query.limit}`);- return response.json();- }));-- console.log("screenpipeResults", screenpipeResults);-- // Ask ChatGPT to write an answer based on screenpipe results- const finalResponse = await fetch(OPENAI_API_URL, {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- 'Authorization': `Bearer ${openAIKey}`,- },- body: JSON.stringify({- 'messages': [- { 'role': 'user', 'content': `Based on the user question "${msg}" and these data which corresponds to what has been seen on the user screen or through his mic: ${JSON.stringify(screenpipeResults)}, provide a comprehensive answer to the user intent.` },- ],- 'model': OPENAI_MODEL,- 'stream': false,- })- }).then(res => res.json());-- document.body.style.cursor = "default";- console.log(finalResponse);-- const txtResponse = finalResponse.choices?.[0]?.message?.content || finalResponse?.message?.content.trim()- if (!txtResponse) {- new Notice('Error from OpenAI');- new Notice(JSON.stringify(finalResponse));- }-- return `${msg}${txtResponse}`;-}--module.exports = screenpipe;