@karmaniverous/jeeves-watcher 0.19.1 → 0.20.0
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.
- package/LICENSE +28 -0
- package/README.md +22 -16
- package/config.schema.json +267 -115
- package/dist/cli/jeeves-watcher/{index-C_bf9c9m.js → index-C9-xTM7k.js} +7720 -3114
- package/dist/cli/jeeves-watcher/index.js +773 -1147
- package/dist/index.d.ts +713 -209
- package/dist/index.js +10169 -5871
- package/package.json +22 -20
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Jason Williscroft
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -4,18 +4,20 @@ Filesystem watcher that keeps a [Qdrant](https://qdrant.tech/) vector store in s
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
- **Node.js** ≥ 22
|
|
7
|
+
- **Node.js** ≥ 22.13
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- **Filesystem watching** — monitors directories for file changes via [chokidar](https://github.com/paulmillr/chokidar)
|
|
12
|
-
- **Multi-format extraction** — PDF, HTML, DOCX, Markdown, plain text
|
|
13
|
-
- **Configurable chunking** —
|
|
12
|
+
- **Multi-format extraction** — PDF, HTML, DOCX, Markdown, JSON and plain text (other extensions are read as plain text)
|
|
13
|
+
- **Configurable chunking** — character-based text splitting with overlap control
|
|
14
14
|
- **Embedding providers** — Gemini (default) or mock (for testing); extensible via provider registry
|
|
15
15
|
- **Qdrant sync** — automatic upsert/delete keeps the vector store current
|
|
16
16
|
- **Rules engine** — glob-based inference rules for metadata enrichment
|
|
17
|
-
- **REST API** — Fastify server for search, status, config, and management
|
|
18
|
-
- **
|
|
17
|
+
- **REST API** — Fastify server for search, status, config, and management, with optional bearer API key (`api.apiKey`)
|
|
18
|
+
- **Source documents** — index records owned by another application, retrieved by HTTP callback on notification (`sources` config, `POST /documents`); see the [Source Documents guide](https://docs.karmanivero.us/jeeves-watcher/documents/Service_Guides.Source_Documents.html)
|
|
19
|
+
- **SDK** — [`@karmaniverous/jeeves-watcher-sdk`](https://www.npmjs.com/package/@karmaniverous/jeeves-watcher-sdk), a typed TypeScript client for the application-facing API
|
|
20
|
+
- **CLI** — `jeeves-watcher init`, `config validate`, `start`, and more
|
|
19
21
|
|
|
20
22
|
## Version Control (VCS)
|
|
21
23
|
|
|
@@ -51,6 +53,7 @@ Add a `vcs` block to your config:
|
|
|
51
53
|
| Property | Default | Description |
|
|
52
54
|
| --- | --- | --- |
|
|
53
55
|
| `vcs.enabled` | `false` | Enable git-backed version control globally |
|
|
56
|
+
| `vcs.author.name` / `vcs.author.email` | `"jeeves-watcher"` / `"watcher@localhost"` | Git commit author identity |
|
|
54
57
|
| `vcs.commitThrottleMs` | `30000` | Throttle interval (ms) for batching file changes into commits. Min: 1000 |
|
|
55
58
|
| `vcs.maxBatchSize` | `1000` | Maximum files per commit batch. Flushes immediately when exceeded. Min: 1 |
|
|
56
59
|
| `vcs.branch` | `"master"` | Git branch name for VCS operations. Squash retention and startup recovery target this branch |
|
|
@@ -62,6 +65,9 @@ Add a `vcs` block to your config:
|
|
|
62
65
|
| `vcs.retention.maxVersions` | `100` | Maximum commits retained per root (older ones squashed) |
|
|
63
66
|
| `vcs.retention.squashCron` | `"0 0 * * *"` | Cron schedule for squash retention (5-field, checked every 60s) |
|
|
64
67
|
| `vcs.defaultAccessToken` | — | Fallback git access token for all roots. Supports env var substitution |
|
|
68
|
+
| `vcs.staleLockThresholdMs` | `60000` | Age (ms) after which a git `index.lock` is considered stale and removed. Min: 5000 |
|
|
69
|
+
| `vcs.maxConsecutiveFailures` | `5` | Commit circuit breaker: trips after this many consecutive commit failures. Min: 1 |
|
|
70
|
+
| `vcs.circuitBreakerCooldownMs` | `300000` | Cooldown (ms) before a tripped breaker allows one recovery attempt; pending files are kept. Min: 1000 |
|
|
65
71
|
|
|
66
72
|
### Per-Root Overrides via `watch.paths`
|
|
67
73
|
|
|
@@ -71,15 +77,15 @@ Watch path entries can be objects with per-root VCS overrides:
|
|
|
71
77
|
{
|
|
72
78
|
"watch": {
|
|
73
79
|
"paths": [
|
|
74
|
-
"
|
|
80
|
+
"/data/notes/**/*.md",
|
|
75
81
|
{
|
|
76
|
-
"path": "
|
|
82
|
+
"path": "/data/tickets/**/*.json",
|
|
77
83
|
"vcs": {
|
|
78
84
|
"enabled": false
|
|
79
85
|
}
|
|
80
86
|
},
|
|
81
87
|
{
|
|
82
|
-
"path": "
|
|
88
|
+
"path": "/data/email/**/*.json",
|
|
83
89
|
"vcs": {
|
|
84
90
|
"remote": "https://github.com/org/email-archive.git",
|
|
85
91
|
"accessToken": "${GITHUB_TOKEN}",
|
|
@@ -99,7 +105,7 @@ Per-root properties (`remote`, `accessToken`) are only available in per-root ove
|
|
|
99
105
|
### Deployment Notes
|
|
100
106
|
|
|
101
107
|
- **Git dependency:** `git` must be on the system PATH. The watcher initializes a git repository in each VCS-enabled watch root automatically.
|
|
102
|
-
- **stateDir:**
|
|
108
|
+
- **stateDir:** With VCS enabled, `stateDir` (default `.jeeves-metadata`) must not overlap any watch root (equal, parent or child): startup fails otherwise. The `.gitignore` the watcher maintains in each VCS root always lists `.git/`, `node_modules/`, `.jeeves-watcher/` and `.jeeves-metadata/`. VCS state (git repos) lives inside the watch roots themselves, not in stateDir.
|
|
103
109
|
- **Filesystem constraints:** Each VCS-enabled watch path entry must resolve to a single directory root (not a glob with wildcards in directory segments).
|
|
104
110
|
|
|
105
111
|
### Remote Push
|
|
@@ -115,7 +121,7 @@ When `remote` is set on a per-root VCS config, the watcher pushes to the remote
|
|
|
115
121
|
"watch": {
|
|
116
122
|
"paths": [
|
|
117
123
|
{
|
|
118
|
-
"path": "
|
|
124
|
+
"path": "/data/notes",
|
|
119
125
|
"vcs": {
|
|
120
126
|
"remote": "https://github.com/org/notes-archive.git"
|
|
121
127
|
}
|
|
@@ -165,11 +171,11 @@ The following helpers are available in every JsonMap `lib` context:
|
|
|
165
171
|
|
|
166
172
|
### `fetchSiblings`
|
|
167
173
|
|
|
168
|
-
Retrieves
|
|
174
|
+
Retrieves text from sibling files (same directory, same extension) around the current file, useful for contextual embedding (e.g., injecting surrounding email thread messages). JSON siblings use the JSON text derivation; other files are read raw.
|
|
169
175
|
|
|
170
176
|
**Options:** `{ before?: number (default 3), after?: number (default 1), sort?: "name" | "mtime" (default "name") }`
|
|
171
177
|
|
|
172
|
-
Returns `string[]` of
|
|
178
|
+
Returns `string[]` of sibling text. Files that cannot be read are silently skipped. For a source document there is no file to read around, so `fetchSiblings` returns `[]`.
|
|
173
179
|
|
|
174
180
|
## Install
|
|
175
181
|
|
|
@@ -180,14 +186,14 @@ npm install @karmaniverous/jeeves-watcher
|
|
|
180
186
|
## Quick Start
|
|
181
187
|
|
|
182
188
|
```bash
|
|
183
|
-
# Generate a
|
|
184
|
-
npx jeeves-watcher init --output ./
|
|
189
|
+
# Generate ./config/config.json (--output is a directory)
|
|
190
|
+
npx jeeves-watcher init --output ./config
|
|
185
191
|
|
|
186
192
|
# Validate it
|
|
187
|
-
npx jeeves-watcher validate --config ./
|
|
193
|
+
npx jeeves-watcher config validate --config ./config/config.json
|
|
188
194
|
|
|
189
195
|
# Start the watcher
|
|
190
|
-
npx jeeves-watcher start --config ./
|
|
196
|
+
npx jeeves-watcher start --config ./config/config.json
|
|
191
197
|
```
|
|
192
198
|
|
|
193
199
|
## Documentation
|