streamembed 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. streamembed-0.3.1/PKG-INFO +96 -0
  2. streamembed-0.3.1/PYPI.md +66 -0
  3. streamembed-0.3.1/README.md +77 -0
  4. streamembed-0.3.0/README.md → streamembed-0.3.1/docs/reference.md +24 -80
  5. {streamembed-0.3.0 → streamembed-0.3.1}/pyproject.toml +2 -2
  6. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/__init__.py +1 -1
  7. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/api.py +94 -6
  8. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/capture.py +34 -13
  9. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/cli.py +54 -7
  10. streamembed-0.3.1/src/streamembed/encoder.py +218 -0
  11. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/llm.py +2 -0
  12. streamembed-0.3.1/src/streamembed/engine/pause.py +23 -0
  13. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/vit.py +2 -0
  14. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/service.py +2 -0
  15. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/static/results.html +58 -12
  16. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/visualize.py +3 -1
  17. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/webui.py +2 -1
  18. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_api.py +9 -3
  19. streamembed-0.3.1/tests/test_defer.py +50 -0
  20. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_front.py +11 -0
  21. streamembed-0.3.1/tests/test_idle.py +76 -0
  22. streamembed-0.3.1/tests/test_pause.py +54 -0
  23. streamembed-0.3.1/tests/test_search_wait.py +53 -0
  24. streamembed-0.3.0/PKG-INFO +0 -86
  25. streamembed-0.3.0/PYPI.md +0 -56
  26. streamembed-0.3.0/src/streamembed/encoder.py +0 -128
  27. {streamembed-0.3.0 → streamembed-0.3.1}/.gitignore +0 -0
  28. {streamembed-0.3.0 → streamembed-0.3.1}/.hgignore +0 -0
  29. {streamembed-0.3.0 → streamembed-0.3.1}/LICENSE +0 -0
  30. {streamembed-0.3.0 → streamembed-0.3.1}/NOTICE +0 -0
  31. {streamembed-0.3.0 → streamembed-0.3.1}/examples/main.py +0 -0
  32. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/__main__.py +0 -0
  33. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/ann.py +0 -0
  34. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/config.py +0 -0
  35. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/defaults.toml +0 -0
  36. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/__init__.py +0 -0
  37. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/config.py +0 -0
  38. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/engine.py +0 -0
  39. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/macs.py +0 -0
  40. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/model.py +0 -0
  41. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/qwen_embedder.py +0 -0
  42. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/spatial.py +0 -0
  43. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/engine/temporal.py +0 -0
  44. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/gate.py +0 -0
  45. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/index.py +0 -0
  46. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/models.py +0 -0
  47. {streamembed-0.3.0 → streamembed-0.3.1}/src/streamembed/queryserver.py +0 -0
  48. {streamembed-0.3.0 → streamembed-0.3.1}/tests/conftest.py +0 -0
  49. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_config.py +0 -0
  50. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_encoder_order.py +0 -0
  51. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_models.py +0 -0
  52. {streamembed-0.3.0 → streamembed-0.3.1}/tests/test_prune.py +0 -0
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: streamembed
3
+ Version: 0.3.1
4
+ Summary: Search your own screen history by describing what you saw, from screenshots, on your machine
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: embeddings,on-device,retrieval,screen-history,screenshots
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
14
+ Requires-Python: >=3.12
15
+ Requires-Dist: huggingface-hub>=0.30
16
+ Requires-Dist: mss<11,>=9
17
+ Requires-Dist: numpy>=2.2
18
+ Requires-Dist: pillow>=11
19
+ Requires-Dist: pyobjc-framework-quartz>=10; sys_platform == 'darwin'
20
+ Requires-Dist: qwen-vl-utils==0.0.14
21
+ Requires-Dist: safetensors>=0.4
22
+ Requires-Dist: torch==2.8.0
23
+ Requires-Dist: torchvision==0.23.0
24
+ Requires-Dist: transformers==5.17.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Provides-Extra: hnsw
28
+ Requires-Dist: chroma-hnswlib==0.7.6; extra == 'hnsw'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # StreamEmbed
32
+
33
+ Search your own screen history by describing what you saw. StreamEmbed indexes the screenshots you already have and keeps capturing your screen as you work, then finds a past screen from a sentence such as "the flight search page to Denver". Everything runs on your machine.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ uv tool install streamembed # the streamembed command, in an environment of its own
39
+ uv pip install streamembed # or into your project's environment
40
+ ```
41
+
42
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
43
+
44
+ ## Quick Start
45
+
46
+ ### From the terminal
47
+
48
+ ```bash
49
+ streamembed start --folder ~/Desktop # index the screenshots there, then capture every 5 s, now and after every login
50
+ streamembed search "the flight search page to Denver" # a minute or more after start: open the search page with this question
51
+ streamembed status # also: pause, resume, stop
52
+ ```
53
+
54
+ `--folder` is where your screenshots are saved: `~/Desktop` on macOS, `~/Pictures/Screenshots` on Windows and Ubuntu. `streamembed --help` shows more examples, and `streamembed COMMAND -h` the options of a command.
55
+
56
+ ### From Python
57
+
58
+ ```python
59
+ import time
60
+ import streamembed as se
61
+
62
+ se.build_index_from_directory("~/Desktop") # screenshots you already have
63
+ capture = se.build_index_from_now() # capture the screen every 5 s, in the background
64
+ time.sleep(60) # let it capture for a minute
65
+
66
+ results = se.query_index("the flight search page to Denver")
67
+ se.visualize_results(results) # each match with the screens before and after it
68
+ capture.stop()
69
+ ```
70
+
71
+ ## Settings
72
+
73
+ `streamembed config` lists every setting and its value; `streamembed config set KEY VALUE` changes one. The background capture reads them when it starts, so run `streamembed start` again after a change.
74
+
75
+ | Setting | Default | What it does |
76
+ |---|---|---|
77
+ | `index_dir` | `~/screenshot_index` | The index folder; live captures go in `captures/` inside it |
78
+ | `interval` | 5 | Seconds between captures. A screen that did not change is not stored |
79
+ | `capture_max_gb` | 20 | Live captures are kept under this size; past it, the oldest are removed (0: no limit) |
80
+ | `capture_keep_days` | 0 | Live captures older than this many days are removed (0: kept however old) |
81
+ | `exclude_apps` | password managers | Nothing is captured while one of these apps is in front (macOS) |
82
+ | `model` | `qwen3-vl-2b` | `qwen3-vl-8b` needs a GPU with about 20 GB |
83
+
84
+ ## Privacy
85
+
86
+ - The index and the captures stay in the index folder, readable only by you and not encrypted. Nothing is sent over the network after the model download.
87
+ - On macOS, nothing is captured while the screen is locked or a password manager or private browsing window is in front. On Linux and Windows these checks are not implemented yet.
88
+ - The search page is painted gray in the captures, so a search does not find earlier results.
89
+
90
+ ## Requirements
91
+
92
+ Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.8.0 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
93
+
94
+ ## License
95
+
96
+ Apache-2.0. See `LICENSE` and `NOTICE`; the model weights are downloaded under their own licenses.
@@ -0,0 +1,66 @@
1
+ # StreamEmbed
2
+
3
+ Search your own screen history by describing what you saw. StreamEmbed indexes the screenshots you already have and keeps capturing your screen as you work, then finds a past screen from a sentence such as "the flight search page to Denver". Everything runs on your machine.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv tool install streamembed # the streamembed command, in an environment of its own
9
+ uv pip install streamembed # or into your project's environment
10
+ ```
11
+
12
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
13
+
14
+ ## Quick Start
15
+
16
+ ### From the terminal
17
+
18
+ ```bash
19
+ streamembed start --folder ~/Desktop # index the screenshots there, then capture every 5 s, now and after every login
20
+ streamembed search "the flight search page to Denver" # a minute or more after start: open the search page with this question
21
+ streamembed status # also: pause, resume, stop
22
+ ```
23
+
24
+ `--folder` is where your screenshots are saved: `~/Desktop` on macOS, `~/Pictures/Screenshots` on Windows and Ubuntu. `streamembed --help` shows more examples, and `streamembed COMMAND -h` the options of a command.
25
+
26
+ ### From Python
27
+
28
+ ```python
29
+ import time
30
+ import streamembed as se
31
+
32
+ se.build_index_from_directory("~/Desktop") # screenshots you already have
33
+ capture = se.build_index_from_now() # capture the screen every 5 s, in the background
34
+ time.sleep(60) # let it capture for a minute
35
+
36
+ results = se.query_index("the flight search page to Denver")
37
+ se.visualize_results(results) # each match with the screens before and after it
38
+ capture.stop()
39
+ ```
40
+
41
+ ## Settings
42
+
43
+ `streamembed config` lists every setting and its value; `streamembed config set KEY VALUE` changes one. The background capture reads them when it starts, so run `streamembed start` again after a change.
44
+
45
+ | Setting | Default | What it does |
46
+ |---|---|---|
47
+ | `index_dir` | `~/screenshot_index` | The index folder; live captures go in `captures/` inside it |
48
+ | `interval` | 5 | Seconds between captures. A screen that did not change is not stored |
49
+ | `capture_max_gb` | 20 | Live captures are kept under this size; past it, the oldest are removed (0: no limit) |
50
+ | `capture_keep_days` | 0 | Live captures older than this many days are removed (0: kept however old) |
51
+ | `exclude_apps` | password managers | Nothing is captured while one of these apps is in front (macOS) |
52
+ | `model` | `qwen3-vl-2b` | `qwen3-vl-8b` needs a GPU with about 20 GB |
53
+
54
+ ## Privacy
55
+
56
+ - The index and the captures stay in the index folder, readable only by you and not encrypted. Nothing is sent over the network after the model download.
57
+ - On macOS, nothing is captured while the screen is locked or a password manager or private browsing window is in front. On Linux and Windows these checks are not implemented yet.
58
+ - The search page is painted gray in the captures, so a search does not find earlier results.
59
+
60
+ ## Requirements
61
+
62
+ Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.8.0 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
63
+
64
+ ## License
65
+
66
+ Apache-2.0. See `LICENSE` and `NOTICE`; the model weights are downloaded under their own licenses.
@@ -0,0 +1,77 @@
1
+ # StreamEmbed
2
+
3
+ Search your own screen history by describing what you saw. StreamEmbed indexes the screenshots you already have and keeps capturing your screen as you work, then finds a past screen from a sentence such as "the flight search page to Denver". Everything runs on your machine.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv tool install streamembed # the streamembed command, in an environment of its own
9
+ uv pip install streamembed # or into your project's environment
10
+ ```
11
+
12
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
13
+
14
+ ## Quick Start
15
+
16
+ ### From the terminal
17
+
18
+ ```bash
19
+ streamembed start --folder ~/Desktop # index the screenshots there, then capture every 5 s, now and after every login
20
+ streamembed search "the flight search page to Denver" # a minute or more after start: open the search page with this question
21
+ streamembed status # also: pause, resume, stop
22
+ ```
23
+
24
+ `--folder` is where your screenshots are saved: `~/Desktop` on macOS, `~/Pictures/Screenshots` on Windows and Ubuntu. `streamembed --help` shows more examples, and `streamembed COMMAND -h` the options of a command.
25
+
26
+ ### From Python
27
+
28
+ ```python
29
+ import time
30
+ import streamembed as se
31
+
32
+ se.build_index_from_directory("~/Desktop") # screenshots you already have
33
+ capture = se.build_index_from_now() # capture the screen every 5 s, in the background
34
+ time.sleep(60) # let it capture for a minute
35
+
36
+ results = se.query_index("the flight search page to Denver")
37
+ se.visualize_results(results) # each match with the screens before and after it
38
+ capture.stop()
39
+ ```
40
+
41
+ ## Settings
42
+
43
+ `streamembed config` lists every setting and its value; `streamembed config set KEY VALUE` changes one. The background capture reads them when it starts, so run `streamembed start` again after a change.
44
+
45
+ | Setting | Default | What it does |
46
+ |---|---|---|
47
+ | `index_dir` | `~/screenshot_index` | The index folder; live captures go in `captures/` inside it |
48
+ | `interval` | 5 | Seconds between captures. A screen that did not change is not stored |
49
+ | `capture_max_gb` | 20 | Live captures are kept under this size; past it, the oldest are removed (0: no limit) |
50
+ | `capture_keep_days` | 0 | Live captures older than this many days are removed (0: kept however old) |
51
+ | `exclude_apps` | password managers | Nothing is captured while one of these apps is in front (macOS) |
52
+ | `model` | `qwen3-vl-2b` | `qwen3-vl-8b` needs a GPU with about 20 GB |
53
+
54
+ ## Privacy
55
+
56
+ - The index and the captures stay in the index folder, readable only by you and not encrypted. Nothing is sent over the network after the model download.
57
+ - On macOS, nothing is captured while the screen is locked or a password manager or private browsing window is in front. On Linux and Windows these checks are not implemented yet.
58
+ - The search page is painted gray in the captures, so a search does not find earlier results.
59
+
60
+ ## Requirements
61
+
62
+ Tested on macOS 15 (Apple silicon), Ubuntu 24.04 under X11 and Windows Server 2025; Wayland is not supported. Encoding needs about 8 GB of memory. StreamEmbed pins torch 2.8.0 and transformers 5.17.0, so install it in an environment of its own if your project needs other versions.
63
+
64
+ ## Reference
65
+
66
+ [`docs/reference.md`](docs/reference.md): every command and function, all settings, the index folder, the index types and the models.
67
+
68
+ ## Development
69
+
70
+ ```bash
71
+ uv venv && uv pip install -e ".[dev,hnsw]"
72
+ .venv/bin/python -m pytest # tests use a stand-in encoder; no model needed
73
+ ```
74
+
75
+ ## License
76
+
77
+ Apache-2.0. See `LICENSE` and `NOTICE`; the model weights are downloaded under their own licenses.
@@ -1,72 +1,24 @@
1
- # StreamEmbed
1
+ # StreamEmbed reference
2
2
 
3
- Search your own screen history by describing what you saw. StreamEmbed indexes screenshots, from a folder or from your screen as you work, and finds a past screen from a sentence. Everything runs on your machine.
4
-
5
- It embeds the pixels with Qwen3-VL-Embedding-2B and encodes screenshots as a stream, so that it keeps up on a laptop: blocks that repeat a neighbor are skipped (spatial pruning), and the keys and values of blocks that did not change are reused from the previous frame (temporal reuse).
6
-
7
- ## Installation
8
-
9
- ```bash
10
- uv venv && source .venv/bin/activate
11
- uv pip install streamembed
12
-
13
- # or only the `streamembed` command, in an environment of its own
14
- uv tool install streamembed
15
-
16
- # with the "hnsw" index type (Python 3.12)
17
- uv pip install "streamembed[hnsw]"
18
- ```
19
-
20
- The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for your terminal or Python when asked, then run `streamembed start` again. On Windows, the `hnsw` extra needs the Microsoft C++ Build Tools: it has no prebuilt wheel there. See Requirements for the tested systems.
21
-
22
- ## Quick Start
23
-
24
- From a terminal:
25
-
26
- ```bash
27
- streamembed start --folder ~/Desktop # index the screenshots there, then capture every 5 s, now and after every login
28
- streamembed search "the flight search page to Denver" # prints the matches and opens a results page
29
- streamembed status # also: pause, resume, stop
30
- streamembed config set interval 10 # change a default
31
- ```
32
-
33
- `--folder` is the folder your screenshots are saved in: `~/Desktop` on macOS (unless you changed it in the Screenshot app), `~/Pictures/Screenshots` on Windows and Ubuntu. Every image in it and in its subfolders is indexed. macOS protects `~/Desktop`: if the terminal (or, for `start`, the service's Python) has no access to it, indexing stops with a permission error; allow it in System Settings > Privacy & Security > Files and Folders.
34
-
35
- Or, instead of `streamembed start`, from Python. It cannot write to an index that `streamembed start` is capturing into (stop that first, or use another `index_dir`); `query_index` and `visualize_results` work alongside it.
36
-
37
- ```python
38
- import streamembed as se
39
-
40
- se.build_index_from_directory("~/Desktop") # screenshots you already have
41
- capture = se.build_index_from_now() # capture the screen every 5 s, in the background
42
-
43
- results = se.query_index("the flight search page to Denver")
44
- se.visualize_results(results) # an HTML page with each match and the screens before and after it
45
- capture.stop()
46
- ```
47
-
48
- `streamembed config` lists every setting, its value and where the value comes from.
49
-
50
- The index type (`flat`, `binary`, `hnsw`, `ivf` or `pq`) is a setting, not an install choice: `streamembed config set index_type pq` switches an existing index without indexing again. Only `hnsw` needs the extra above.
3
+ Everything the README leaves out: every command and function, all settings, the index folder, the index types and the models.
51
4
 
52
5
  ## Requirements
53
6
 
54
- Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs Screen Recording permission for the app that runs Python; `build_index_from_now` raises `PermissionError` until it is granted. On Windows, capture needs a logged-in desktop session: while the screen is locked, captures fail and are retried.
7
+ Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs Screen Recording permission for the app that runs Python; `build_index_from_now` raises `PermissionError` until it is granted. On Windows, capture needs a logged-in desktop session: while the screen is locked, captures fail and are retried. Indexing `~/Desktop` on macOS needs access to it for the terminal (or, for `streamembed start --folder`, the service's Python): allow it in System Settings > Privacy & Security > Files and Folders; without it, indexing stops with a permission error.
55
8
 
56
9
  Dependencies are pinned to torch 2.8.0 and transformers 5.17.0: the stream encoder re-implements parts of the Qwen3-VL forward pass against transformers internals, and its outputs were checked for equality with these versions. Install StreamEmbed in its own environment (for example `uv tool`, `pipx`, or a venv) if your project needs other versions.
57
10
 
58
- The `hnsw` index type needs the `hnsw` extra (`pip install "streamembed[hnsw]"`), which installs chroma-hnswlib 0.7.6: hnswlib with prebuilt wheels (the `hnswlib` package itself is a source package that needs a C++ compiler). Its wheels cover Python 3.12; on later Python versions it is built from source. It does not use OpenMP and runs in one process with torch (checked on macOS with torch 2.8.0 on MPS). The other types need only numpy.
11
+ The `hnsw` index type needs the `hnsw` extra (`pip install "streamembed[hnsw]"`), which installs chroma-hnswlib 0.7.6: hnswlib with prebuilt wheels (the `hnswlib` package itself is a source package that needs a C++ compiler). Its wheels cover Python 3.12; on later Python versions it is built from source. It does not use OpenMP and runs in one process with torch (checked on macOS with torch 2.8.0 on MPS). The other types need only numpy. On Windows, the `hnsw` extra needs the Microsoft C++ Build Tools: it has no prebuilt wheel there. The index type is a setting, not an install choice: `streamembed config set index_type pq` switches an existing index without indexing again.
59
12
 
60
13
  ## Privacy
61
14
 
62
15
  - Vectors and metadata stay in the index folder (owner-only). Live captures are written to `capture_dir` (by default `captures/` in the index folder, also owner-only) as plain image files (WebP by default). If you set `capture_dir` to a folder that a cloud service syncs (iCloud Desktop & Documents, Dropbox, OneDrive), your screen history is uploaded with it.
63
16
  - On macOS, capture is skipped when the screen is locked, when the frontmost app is a password manager, and when the frontmost window is a private browsing window. Other windows on screen are not checked; use `capture.pause()` for sensitive work. On Linux and Windows these checks are not implemented yet: everything on screen is captured.
64
- - While the search page is shown, its browser window is painted gray in the captures, so a search does not find the results of earlier ones. Everything else is captured as usual, including a window over part of the page (macOS). A display with nothing on it but the page is not stored. On Windows and Linux, the window is painted only while the page has focus.
17
+ - While the search page or a results page written to a file is shown, its browser window is painted gray in the captures, so a search does not find the results of earlier ones. On macOS the window is also found by its title ("… – StreamEmbed"), which the browser shows while the page is the window's tab. Everything else is captured as usual, including a window over part of the page (macOS). A display with nothing on it but the page is not stored. On Windows and Linux, the window is painted only while the page has focus.
65
18
  - Nothing is sent over the network after the model download.
66
19
 
67
- ## Reference
68
20
 
69
- ### Commands
21
+ ## Commands
70
22
 
71
23
  | Command | What it does |
72
24
  |---|---|
@@ -74,12 +26,12 @@ The `hnsw` index type needs the `hnsw` extra (`pip install "streamembed[hnsw]"`)
74
26
  | `streamembed status`, `pause`, `resume`, `stop` | The background capture: its state and number of screens; pause and resume (in every process, in the service's index folder); stop and remove |
75
27
  | `streamembed index DIR [--interval S] [--keep-unchanged]` | Index a folder now and print the progress. Ctrl-C stops it; running it again reads only screenshots not read before (also ones added since). The index folder is left out of the scan |
76
28
  | `streamembed capture [--interval S] [--monitors ...] [--keep-unchanged] [--model M] [--index-type T]` | Capture in this terminal until Ctrl-C |
77
- | `streamembed search ["QUESTION"] [--top-k N] [--since DATE] [--until DATE] [--no-open]` | Print the best matches and open the results page. While the background capture runs, the page is served by it (a search box, answers in under a second, no second model); `streamembed search` alone opens that page empty. Otherwise the model loads here (20-60 s) and the page is written to `results.html` |
29
+ | `streamembed search ["QUESTION"] [--top-k N] [--since DATE] [--until DATE] [--no-open]` | While the background capture runs: open its search page with the question in the search box, searched there as if typed (one search; no second model); `streamembed search` alone opens the page empty; with `--no-open`, search here and print the best matches. While the background capture is still loading its model, it waits for it (up to 150 s) rather than load a second one. With no background capture, the model loads here (20-60 s) and the page is written to `results.html` |
78
30
  | `streamembed config [show \| set KEY VALUE ... \| reset [KEY ...] \| path]` | Show (the default), change or reset the settings, or print where the settings files are. After `set` or `reset`, a line says when `$STREAMEMBED_INDEX` or `$STREAMEMBED_MODELS` overrides the value |
79
31
 
80
32
  Options go after the command: `streamembed search --index-dir DIR "QUESTION"`. Every command except `config` takes `--index-dir`. `streamembed COMMAND --help` lists all the options of a command, and `streamembed --version` prints the version. A mistake in a setting, a path or a date prints one line that starts with `streamembed: error:`; a mistake in an option prints the command's usage and an error naming the option. Both exit with status 2. `python -m streamembed` is the same command.
81
33
 
82
- ### Python
34
+ ## Python
83
35
 
84
36
  `examples/main.py` is a complete script.
85
37
 
@@ -97,7 +49,7 @@ Options go after the command: `streamembed search --index-dir DIR "QUESTION"`. E
97
49
 
98
50
  Arguments left as None come from the settings. Screens that did not change are not stored again: a capture is encoded when more than 10 % of its kept blocks changed since the last stored one, or, when it changed less than that, once `heartbeat` seconds (300 by default) have passed since then.
99
51
 
100
- #### Indexing a folder
52
+ ### Indexing a folder
101
53
 
102
54
  - Every `.jpg`, `.jpeg`, `.png` and `.webp` file in the folder and its subfolders is read.
103
55
  - A screenshot's time comes from its file name (macOS screenshot names, Unix times, dates), else its EXIF data, else the file time.
@@ -106,10 +58,10 @@ Arguments left as None come from the settings. Screens that did not change are n
106
58
  - Ctrl-C stops it. Running it again reads only the screenshots not read before, stored or not (`handled.jsonl` records those that were not), and also ones added since, whatever their time. When there is nothing new it returns before the model loads. The folder is recorded by its full path, so `shots` and `/Users/me/shots` are the same folder.
107
59
  - The index folder is left out of the scan. Giving the index folder itself, or a folder inside it, raises `ValueError`.
108
60
  - The index's write lock is taken while it indexes and released when it returns, so a Python session left open does not keep `streamembed start` from writing.
109
- - A folder with no screenshots returns zero counts. A missing folder raises `FileNotFoundError`, a file `NotADirectoryError`, and a folder that cannot be read `PermissionError` (on macOS, see Files and Folders in Quick Start). A subfolder that cannot be read is named on stderr and left out.
61
+ - A folder with no screenshots returns zero counts. A missing folder raises `FileNotFoundError`, a file `NotADirectoryError`, and a folder that cannot be read `PermissionError` (on macOS, allow it in System Settings > Privacy & Security > Files and Folders). A subfolder that cannot be read is named on stderr and left out.
110
62
  - It returns the counts: `found` (files), `skipped` (left out by `interval`), `done` (read in earlier runs), `todo` (read in this run), `captured`, `encoded` (stored), `idle` (unchanged, not stored), `minor` (changed too little to store), `errors` (not readable as images, or not stored) and `stopped`. When it ends, `found` is the sum of `skipped`, `done`, `encoded`, `idle`, `minor` and `errors`. `progress`, if given, is called with these counts after each screenshot.
111
63
 
112
- #### Capturing the screen
64
+ ### Capturing the screen
113
65
 
114
66
  - `monitors`: `"all"` (a display connected meanwhile is captured from then on), `"primary"` or display numbers (1 = primary). Each display is its own stream.
115
67
  - At least 0.5 s passes between captures, also with `interval=0`. `duration` stops the capture after that many seconds. The index's write lock is held until the capture ends.
@@ -117,8 +69,12 @@ Arguments left as None come from the settings. Screens that did not change are n
117
69
  - It returns a `Capture`: `stop()`, `pause()`, `resume()`, `wait()` (until it stops, or Ctrl-C), `running`, `stalled`, and `stats` (`captured`, `encoded`, `idle`, `minor`, `skipped`, `errors`).
118
70
  - A screen grab that has not returned for 60 s (seen on macOS, outside StreamEmbed) sets `stalled` and is printed to stderr. `wait()` then returns. `stop()` finishes a screenshot being encoded, gives up on a grab that has not returned after 30 s and returns `False`; nothing more is stored from that capture, and `build_index_from_now()` can start a new one. The background service exits in this case, and the service manager starts it again.
119
71
  - While the index is paused (`streamembed pause`), capturing and folder indexing wait and say so once on stderr.
72
+ - A question does not wait for a frame being encoded: every 4 layers the frame lets a waiting question go first (75 ms median, 211 ms at most, while frames were encoded back to back on an M2 Pro).
73
+ - While macOS reports critical memory pressure, and while the model loads again, captures are stored but encoded later, in order (24 kept in memory, then read back from their files, at most 2,000).
74
+ - After 10 minutes with nothing captured (the screen locked), the background capture frees the model (5.8 GB to 0.7 GB) and loads it again, in the background, when capture resumes (about 6-20 s; captures wait meanwhile). A question while it is freed loads it.
75
+ - While a search page has focus, new captures are stored but encoded only after it has not (at most 24 wait; then they are encoded at once), so a search does not wait for a screen being encoded. They are encoded in order, and any left when the capture stops are encoded before it ends.
120
76
 
121
- #### Searching
77
+ ### Searching
122
78
 
123
79
  `query_index` returns `Results`, a list of `Result`, best first. It also carries the question (`query`; `text` is the same) and the time window from `since`/`until` (`window`), and a slice of it keeps them:
124
80
 
@@ -137,7 +93,7 @@ Arguments left as None come from the settings. Screens that did not change are n
137
93
  - `since` and `until` (Unix seconds, `"YYYY-MM-DD"` or `"YYYY-MM-DD HH:MM"`) limit the search to that time; the question is searched as written. A date alone as `until` includes that day. `since` at or after `until` raises `ValueError`.
138
94
  - An empty index, or a time window with no screens in it, returns `[]` without loading the model.
139
95
 
140
- #### The results page
96
+ ### The results page
141
97
 
142
98
  `visualize_results` writes an HTML page, `results.html` in the index folder unless `path` is given.
143
99
 
@@ -146,11 +102,12 @@ The background capture also serves this page with a search box, at `http://127.0
146
102
  - It shows each screenshot from where it is: a folder screenshot from its original file, a live capture from `capture_dir`. Match thumbnails are made in `thumbs/` in the index folder. The page needs no server and works on this machine while those files are there; a moved or deleted original shows its path instead of an image.
147
103
  - Its heading is `query` if given, else the question and the time window the results came with. A list you built yourself has no heading unless you give `query`.
148
104
  - It shows the best 10, with Show more for the next 10. A card gives the day and time of its screen (the match score shows on hover). A match within 5 minutes of a better one from the same screen is left out: only the best of them is shown.
149
- - A date chip (the 7 most recent days with results; the others behind a toggle) keeps the results from that day; `--since`/`--until` search a range. Pass more results (`query_index(..., top_k=100)`, as `streamembed search` does) to have more to pick from.
105
+ - A date chip (the 7 most recent days with results; the others behind a toggle) keeps the results from that day, and From/to keeps a range of days; both list only days with results, in the page's language. `--since`/`--until` search a range before the results are picked.
106
+ - Sort shows the results by best match (the default), newest first or oldest first; the choice is kept in the browser. Pass more results (`query_index(..., top_k=100)`, as `streamembed search` does) to have more to pick from.
150
107
  - A card opens full size, with up to `context` frames of the same screen before and after it in time order. The match is marked with a dot and its score; a gap in the strip marks a pause, a new day, or frames left out. Arrow keys, or a swipe on a phone, step through the frames. Full size opens the image file.
151
108
  - Cards open from the keyboard (Tab, then Enter).
152
109
 
153
- ### Settings
110
+ ## Settings
154
111
 
155
112
  Every setting has a default in `defaults.toml` in the package.
156
113
 
@@ -180,7 +137,7 @@ A value given to a function or a command takes precedence for that call. Then co
180
137
  | `top_k` | 10 | Results per question |
181
138
  | `page_results`, `context` | 100, 15 | Results put on the results page (to pick dates among); frames shown before and after each |
182
139
 
183
- ### Capturing in the background
140
+ ## Capturing in the background
184
141
 
185
142
  `build_index_from_now` captures while its Python process runs: `examples/main.py` keeps capturing until Ctrl-C or until the terminal closes. To keep capturing with no terminal open and after every login, install it as a service. It uses the system's own service manager:
186
143
 
@@ -204,7 +161,7 @@ se.uninstall_service() # stops it and removes it; the
204
161
 
205
162
  One process writes an index at a time. While the service runs, other processes open its index read-only: `query_index` and `visualize_results` work and see newly captured screens, and `build_index_*` on that folder raises until the service is stopped. The other way round, while a Python session is indexing or capturing into the folder, the service writes a line saying so to `service.log`, and the service manager starts it again a minute later. A `directory` that is the index folder or inside it is refused before the service is installed.
206
163
 
207
- ### The index folder
164
+ ## The index folder
208
165
 
209
166
  | File | Content |
210
167
  |---|---|
@@ -227,7 +184,7 @@ One process writes an index at a time. While the service runs, other processes o
227
184
 
228
185
  A process takes `writer.lock` when it first writes (indexing or capturing), not when it only searches, and releases it when the indexing or the capture ends. A line cut short by a crash is left out when the folder is next opened, and a vector written just before a crash without its line is dropped. If `vectors.f16` holds more than one vector beyond the lines of `frames.jsonl` (an older `frames.jsonl` restored, for example), the extra vectors are moved to `vectors.f16.orphan-<time>` instead, and stderr says so.
229
186
 
230
- ### Index types
187
+ ## Index types
231
188
 
232
189
  | Type | Search |
233
190
  |---|---|
@@ -243,7 +200,7 @@ Measured on an M2 Pro (16 GB) with 200,000 2048-d frames (132,221 stored Qwen3-V
243
200
 
244
201
  An index folder can be reopened with any other type. It also records the encoder, and refuses vectors from a different one.
245
202
 
246
- ### Models
203
+ ## Models
247
204
 
248
205
  A model is a base model from its own Hugging Face repository, pinned to a commit, plus two LoRAs from the StreamEmbed model repository: one for screenshots (a consistency adapter that keeps pruned, streamed frames close to full frames) and one for questions. Only the LoRAs live in the StreamEmbed repository; its `models.json` names each model's base repository, commit and files.
249
206
 
@@ -258,16 +215,3 @@ The model repository also holds LoRAs for SigLIP2 So400m, SigLIP2 Base and Vultr
258
215
  `configure(models_repo=...)` or `$STREAMEMBED_MODELS` points to another Hugging Face repository or a local folder with the same layout. An index records its model and refuses vectors from another one.
259
216
 
260
217
  The first run of `qwen3-vl-2b` downloads the base model (about 4 GB) and the LoRAs (70 MB each); after that nothing is downloaded. Encoding needs about 8 GB of memory and takes 0.7 to 1.3 s per 1280-px frame on an M2 Pro GPU that nothing else uses; while another process (the background capture, for example) encodes on the same GPU, expect about twice that. Loading the model takes about 20 to 60 s (stderr says when it loads, and says it downloads only when the model is not cached yet), so `build_index_from_now()`, `streamembed index` and the first search in a process wait that long before they start. The change gate skips screens that did not change.
261
-
262
- ## Development
263
-
264
- ```bash
265
- uv venv && uv pip install -e ".[dev,hnsw]"
266
- .venv/bin/python -m pytest # API tests with a stand-in encoder; no model needed (hnsw tests are skipped without the extra)
267
- ```
268
-
269
- `src/streamembed/engine/` is the stream encoder. It keeps older names in places: Token Pruning is spatial pruning, KV Reuse is temporal reuse.
270
-
271
- ## License
272
-
273
- Apache-2.0. See `LICENSE` and `NOTICE`; the model weights are downloaded under their own license.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "streamembed"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Search your own screen history by describing what you saw, from screenshots, on your machine"
5
5
  readme = "PYPI.md"
6
6
  license = "Apache-2.0"
@@ -46,7 +46,7 @@ streamembed = "streamembed.cli:main"
46
46
  packages = ["src/streamembed"]
47
47
 
48
48
  [tool.hatch.build.targets.sdist]
49
- include = ["src/streamembed", "tests", "examples", "README.md", "PYPI.md", "pyproject.toml", "LICENSE", "NOTICE"]
49
+ include = ["src/streamembed", "tests", "examples", "README.md", "PYPI.md", "docs", "pyproject.toml", "LICENSE", "NOTICE"]
50
50
 
51
51
  [tool.pytest.ini_options]
52
52
  testpaths = ["tests"]
@@ -4,7 +4,7 @@ from .api import (Capture, Result, Results, available_index_types, available_mod
4
4
  from .config import get_config, reset_config, set_config
5
5
  from .service import install_service, service_status, uninstall_service
6
6
 
7
- __version__ = "0.3.0"
7
+ __version__ = "0.3.1"
8
8
  __all__ = ["Capture", "Result", "Results", "available_index_types", "available_models", "build_index_from_directory", "build_index_from_now", "configure", "query_index",
9
9
  "visualize_results", "install_service", "service_status", "uninstall_service", "pause", "resume", "is_paused",
10
10
  "get_config", "set_config", "reset_config"]