@zvec/zvec-grep 0.2.0 → 0.2.2

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 (94) hide show
  1. package/README.md +42 -9
  2. package/README_CN.md +39 -11
  3. package/dist/authorization/prompt.d.ts +1 -0
  4. package/dist/authorization/prompt.js +1 -0
  5. package/dist/authorization/prompt.js.map +1 -1
  6. package/dist/cli/args.js +5 -2
  7. package/dist/cli/args.js.map +1 -1
  8. package/dist/cli/commands.js +46 -1
  9. package/dist/cli/commands.js.map +1 -1
  10. package/dist/cli/errors.d.ts +3 -0
  11. package/dist/cli/errors.js +39 -6
  12. package/dist/cli/errors.js.map +1 -1
  13. package/dist/cli/format/status.d.ts +2 -0
  14. package/dist/cli/format/status.js +24 -6
  15. package/dist/cli/format/status.js.map +1 -1
  16. package/dist/cli/help.js +24 -8
  17. package/dist/cli/help.js.map +1 -1
  18. package/dist/cli/index.js +3 -1
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli/install.js +542 -34
  21. package/dist/cli/install.js.map +1 -1
  22. package/dist/cli/managed-rg.js +9 -1
  23. package/dist/cli/managed-rg.js.map +1 -1
  24. package/dist/daemon/backend.js +4 -0
  25. package/dist/daemon/backend.js.map +1 -1
  26. package/dist/daemon/config.d.ts +3 -0
  27. package/dist/daemon/config.js +19 -0
  28. package/dist/daemon/config.js.map +1 -1
  29. package/dist/daemon/job-scheduler.d.ts +7 -4
  30. package/dist/daemon/job-scheduler.js +80 -12
  31. package/dist/daemon/job-scheduler.js.map +1 -1
  32. package/dist/daemon/root-lease.js +18 -9
  33. package/dist/daemon/root-lease.js.map +1 -1
  34. package/dist/daemon/root-runtime.d.ts +1 -0
  35. package/dist/daemon/root-runtime.js +4 -1
  36. package/dist/daemon/root-runtime.js.map +1 -1
  37. package/dist/daemon/runtime-manager.d.ts +1 -0
  38. package/dist/daemon/runtime-manager.js +10 -4
  39. package/dist/daemon/runtime-manager.js.map +1 -1
  40. package/dist/daemon/runtime.js +3 -1
  41. package/dist/daemon/runtime.js.map +1 -1
  42. package/dist/daemon/server-controller.d.ts +0 -1
  43. package/dist/daemon/server-controller.js +37 -37
  44. package/dist/daemon/server-controller.js.map +1 -1
  45. package/dist/daemon/watch-manager.d.ts +1 -1
  46. package/dist/daemon/watch-manager.js +16 -9
  47. package/dist/daemon/watch-manager.js.map +1 -1
  48. package/dist/engine/errors.d.ts +1 -0
  49. package/dist/engine/errors.js +11 -0
  50. package/dist/engine/errors.js.map +1 -1
  51. package/dist/engine/models/artifact-cache-lock.d.ts +16 -0
  52. package/dist/engine/models/artifact-cache-lock.js +228 -0
  53. package/dist/engine/models/artifact-cache-lock.js.map +1 -0
  54. package/dist/engine/models/artifact-downloader.d.ts +77 -0
  55. package/dist/engine/models/artifact-downloader.js +766 -0
  56. package/dist/engine/models/artifact-downloader.js.map +1 -0
  57. package/dist/engine/models/backends/llama-cpp.d.ts +8 -8
  58. package/dist/engine/models/backends/llama-cpp.js +83 -21
  59. package/dist/engine/models/backends/llama-cpp.js.map +1 -1
  60. package/dist/engine/models/backends/model2vec.d.ts +6 -8
  61. package/dist/engine/models/backends/model2vec.js +142 -109
  62. package/dist/engine/models/backends/model2vec.js.map +1 -1
  63. package/dist/engine/models/backends/transformers-js.d.ts +9 -9
  64. package/dist/engine/models/backends/transformers-js.js +71 -27
  65. package/dist/engine/models/backends/transformers-js.js.map +1 -1
  66. package/dist/engine/models/catalog.d.ts +261 -2
  67. package/dist/engine/models/catalog.js +306 -2
  68. package/dist/engine/models/catalog.js.map +1 -1
  69. package/dist/engine/models/download-progress.d.ts +5 -4
  70. package/dist/engine/models/download-progress.js +26 -27
  71. package/dist/engine/models/download-progress.js.map +1 -1
  72. package/dist/engine/models/embeddings.d.ts +2 -0
  73. package/dist/engine/models/embeddings.js.map +1 -1
  74. package/dist/engine/pipeline/indexing/index.js +201 -45
  75. package/dist/engine/pipeline/indexing/index.js.map +1 -1
  76. package/dist/engine/utils/atomic-file.d.ts +3 -0
  77. package/dist/engine/utils/atomic-file.js +39 -0
  78. package/dist/engine/utils/atomic-file.js.map +1 -0
  79. package/dist/mcp/input-normalization.js +2 -2
  80. package/dist/mcp/input-normalization.js.map +1 -1
  81. package/dist/mcp/schemas.d.ts +13 -17
  82. package/dist/mcp/schemas.js +9 -3
  83. package/dist/mcp/schemas.js.map +1 -1
  84. package/dist/mcp/stdio-bridge.d.ts +4 -0
  85. package/dist/mcp/stdio-bridge.js +59 -3
  86. package/dist/mcp/stdio-bridge.js.map +1 -1
  87. package/dist/mcp/tools.d.ts +8 -8
  88. package/dist/mcp/tools.js +6 -0
  89. package/dist/mcp/tools.js.map +1 -1
  90. package/docs/01-agents.md +80 -9
  91. package/docs/02-cli.md +9 -4
  92. package/docs/06-server.md +13 -0
  93. package/docs/07-embedding.md +28 -1
  94. package/package.json +2 -2
package/docs/01-agents.md CHANGED
@@ -17,13 +17,22 @@ managed-rg route.
17
17
  | Codex | `codex` | `~/.codex/config.toml` and `~/.codex/AGENTS.md` |
18
18
  | Claude Code | `claude` | `~/.claude.json`, `~/.claude/settings.json`, and `~/.claude/CLAUDE.md` |
19
19
  | Qwen Code | `qwen` | `~/.qwen/settings.json` and `~/.qwen/QWEN.md` |
20
+ | Qoder CLI and IDE | `qoder` | `~/.qoder/settings.json`, `~/.qoder/AGENTS.md`, and the IDE user-level `~/.qoder/mcp.json` |
20
21
  | OpenCode | `opencode` | `~/.config/opencode/opencode.json` and the adjacent `AGENTS.md` |
21
22
  | Cursor | `cursor` | `~/.cursor/mcp.json` |
22
23
 
23
24
  The standard environment overrides used by each agent are respected, including
24
- `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `QWEN_HOME`, `OPENCODE_CONFIG`, and
25
+ `CODEX_HOME`, `CLAUDE_CONFIG_DIR`, `QWEN_HOME`, `QODER_CONFIG_DIR`,
26
+ `QODER_IDE_MCP_PATH`, `QODER_IDE_EXECUTABLE`, `OPENCODE_CONFIG`, and
25
27
  `CURSOR_CONFIG_DIR`.
26
28
 
29
+ The current Qoder CLI package exposes both `qoder` and `qodercli` commands, but
30
+ the installer exposes only the canonical `qoder` target. One Qoder install
31
+ configures both the CLI and IDE, and automatic detection recognizes either CLI
32
+ executable or the IDE. `QODER_CONFIG_DIR` overrides the Qoder CLI configuration
33
+ directory; `QODER_IDE_MCP_PATH` independently overrides the full IDE `mcp.json` path, and
34
+ `QODER_IDE_EXECUTABLE` overrides the IDE executable used by automatic detection.
35
+
27
36
  ## Install an integration
28
37
 
29
38
  Run the guided installer to select from detected agents:
@@ -38,6 +47,7 @@ For scripts or repeatable setup, select targets explicitly:
38
47
  zg install --target codex --yes
39
48
  zg install --target claude --target cursor --yes
40
49
  zg install --target qwen --yes
50
+ zg install --target qoder --yes
41
51
  zg install --target all --yes
42
52
  ```
43
53
 
@@ -45,16 +55,73 @@ The installer:
45
55
 
46
56
  1. adds a managed `zvec_grep` MCP entry;
47
57
  2. adds search guidance where the agent supports it;
48
- 3. adds local MCP tool approval for Codex and Claude Code, and managed server
49
- trust for Qwen Code;
58
+ 3. adds local MCP tool approval for Codex and Claude Code, managed server trust
59
+ for Qwen Code and Qoder CLI, and exact search/rg allow rules for Qoder's
60
+ CLI-backed runtime;
50
61
  4. starts the local zvec-grep server when possible.
51
62
 
52
63
  The [Server guide](./06-server.md) explains when the daemon is useful and how its
53
64
  lifecycle differs from Direct execution.
54
65
 
55
66
  Managed text blocks use `ZVEC_GREP_START` and `ZVEC_GREP_END` markers. Existing
56
- content outside those blocks is preserved. If an unmanaged `zvec_grep` entry
57
- already exists, inspect it before using `--force` to replace it.
67
+ content outside those blocks is preserved, as are unrelated settings and other
68
+ MCP servers. If an unmanaged `zvec_grep` entry already exists, inspect it before
69
+ using `--force` to replace it.
70
+
71
+ For Qoder CLI, `--mcp-transport` selects either a stdio or HTTP entry under
72
+ `mcpServers`; the installer also manages the timeout and trust fields. Search
73
+ guidance is written to `${QODER_CONFIG_DIR:-~/.qoder}/AGENTS.md` without
74
+ replacing unrelated guidance.
75
+
76
+ The same Qoder `settings.json`, used by Qoder CLI and CLI-backed Qoder clients,
77
+ receives exact `permissions.allow` rules for
78
+ `mcp__zvec_grep__zvec_grep_search` and `mcp__zvec_grep__zvec_grep_rg`, plus the
79
+ equivalent server-level `alwaysAllow` policy. This avoids repeated tool approval
80
+ prompts without allowing other MCP tools. Existing permission rules and JSONC
81
+ comments are preserved; uninstall removes only rules added by zg.
82
+
83
+ The same install writes the Qoder IDE MCP entry to its user-level
84
+ `~/.qoder/mcp.json`. Set `QODER_IDE_MCP_PATH` to override that complete file
85
+ path. The IDE entry uses
86
+ stdio when `--mcp-transport stdio` is selected. For HTTP it uses a `type: "sse"`
87
+ URL entry, from which Qoder IDE automatically detects the streamable HTTP MCP
88
+ endpoint. Qoder's platform `SharedClientCache` is runtime/cache state rather
89
+ than the user MCP configuration entry point, so the installer does not write
90
+ it. Qoder IDE has no supported global Rules file, so the installer does not
91
+ claim to create or manage IDE search guidance.
92
+
93
+ Both Qoder clients receive the same MCP form-based Remote Embedding
94
+ authorization request as other clients. If Qoder CLI reports that no handler is
95
+ registered for `elicitation/create`, or returns a decline or cancellation
96
+ without displaying the form, its installed `AGENTS.md` guidance supplies a
97
+ compatibility interaction through the exact `AskUserQuestion` tool. The CLI
98
+ agent must ask whether to allow Remote Embedding for the workspace, use local
99
+ FTS only, or cancel.
100
+
101
+ Qoder IDE uses the exact native tool name `ask_user_question`, but its official
102
+ integration does not provide a global Rules location where the installer can
103
+ persist the fallback. In stdio mode, the zvec-grep bridge turns a missing
104
+ `elicitation/create` handler into an actionable error that tells the top-level
105
+ IDE agent to present the same three choices with `ask_user_question`. This path
106
+ still needs an end-to-end smoke test in a real Qoder IDE session and should not
107
+ be treated as proof that every IDE build follows the instruction.
108
+
109
+ Only after explicit workspace approval may either client run the following
110
+ persistent grant and retry the original MCP search once:
111
+
112
+ ```bash
113
+ zg auth grant "/absolute/workspace" \
114
+ --capability embedding \
115
+ --scope workspace
116
+ ```
117
+
118
+ The local-FTS choice retries the search without `query`, `queries`, or `vector`
119
+ routes and with `autoUpdate: false` and `freshness: "eventual"`. It neither
120
+ refreshes the remote-embedding index nor sends query text or workspace content
121
+ to a remote Embedding provider. In a headless session where Qoder cannot ask the
122
+ user, the agent stops without granting access. Neither question tool should
123
+ collect a token, API key, or password. Provider credentials remain separate
124
+ from this data authorization.
58
125
 
59
126
  Restart the selected agent, or open a new session, after installation.
60
127
 
@@ -103,10 +170,13 @@ zg server status --check-ready
103
170
 
104
171
  Then start a new agent session and confirm that the client-specific search tool
105
172
  is available. It is `zvec_grep_search` in Codex and Claude Code,
106
- `mcp__zvec_grep__zvec_grep_search` in Qwen Code, and
107
- `zvec_grep_zvec_grep_search` in OpenCode. If the MCP connection is unavailable,
108
- the same indexed search and optional managed-rg route remain available from the
109
- shell:
173
+ `mcp__zvec_grep__zvec_grep_search` in Qwen Code and Qoder CLI, and
174
+ `zvec_grep_zvec_grep_search` in OpenCode. With the optional `full` MCP toolset,
175
+ Qoder CLI exposes managed rg as `mcp__zvec_grep__zvec_grep_rg`. For Qoder IDE,
176
+ confirm after restart that the `zvec_grep` server and its tools appear; the exact
177
+ host-qualified tool label remains part of the real-machine smoke test. If the
178
+ MCP connection is unavailable, the same indexed search and optional managed-rg
179
+ route remain available from the shell:
110
180
 
111
181
  ```bash
112
182
  zg query "where theme preferences are restored"
@@ -131,6 +201,7 @@ Use the same target names to remove only zvec-grep-managed entries:
131
201
  ```bash
132
202
  zg uninstall --target codex --yes
133
203
  zg uninstall --target qwen --yes
204
+ zg uninstall --target qoder --yes
134
205
  zg uninstall --target all --yes
135
206
  ```
136
207
 
package/docs/02-cli.md CHANGED
@@ -146,17 +146,18 @@ scripts.
146
146
  ## `zg install` and `zg uninstall`
147
147
 
148
148
  ```text
149
- zg install [--target codex|claude|qwen|opencode|cursor|all|auto] [--mcp-transport stdio|http] [--mcp-toolset agent|full] [--yes] [--force]
150
- zg uninstall [--target codex|claude|qwen|opencode|cursor|all|auto] [--yes]
149
+ zg install [--target codex|claude|qwen|qoder|opencode|cursor|all|auto] [--mcp-transport stdio|http] [--mcp-toolset agent|full] [--yes] [--force]
150
+ zg uninstall [--target codex|claude|qwen|qoder|opencode|cursor|all|auto] [--yes]
151
151
  ```
152
152
 
153
- `--target` is repeatable. `zg install` also accepts:
153
+ `--target` is repeatable. `qoder` is the single Qoder target and configures
154
+ Qoder CLI and Qoder IDE together. `zg install` also accepts:
154
155
 
155
156
  | Option | Meaning |
156
157
  | --- | --- |
157
158
  | `--mcp-transport <stdio\|http>` | MCP connection mode; default `stdio` |
158
159
  | `--mcp-toolset <agent\|full>` | Daemon MCP surface; default `agent` |
159
- | `--mcp-tool-timeout <seconds>` | Codex, Qwen Code, and OpenCode MCP timeout; default 600 seconds |
160
+ | `--mcp-tool-timeout <seconds>` | Codex, Qwen Code, both Qoder clients, and OpenCode MCP timeout; default 600 seconds |
160
161
  | `--mcp-token-env <name>` | Environment variable containing the server token |
161
162
  | `--force` | Replace a conflicting unmanaged `zvec_grep` entry |
162
163
 
@@ -221,6 +222,7 @@ refresh, authentication, and logs. See [MCP](./03-mcp.md) for the tool contract.
221
222
  | `ZVEC_GREP_SERVER_TOKEN` | Server/client Bearer token |
222
223
  | `ZVEC_GREP_SERVER_TOKEN_FILE` | File containing the server/client token |
223
224
  | `ZVEC_GREP_MCP_TOOLSET` | Default `agent` or `full` MCP surface |
225
+ | `ZVEC_GREP_WATCHER_IDLE_TIMEOUT_SECONDS` | Seconds of workspace inactivity before the server releases its watcher; default `14400`, `0` disables idle eviction |
224
226
  | `ZVEC_GREP_EMBEDDING` | Default model for new indexes |
225
227
  | `ZVEC_GREP_API_KEY` | Embedding provider API key |
226
228
  | `ZVEC_GREP_ENDPOINT` | Remote Embedding endpoint |
@@ -229,6 +231,9 @@ refresh, authentication, and logs. See [MCP](./03-mcp.md) for the tool contract.
229
231
  | `DASHSCOPE_API_KEY` | Qwen API-key fallback after `ZVEC_GREP_API_KEY` |
230
232
  | `QWEN_API_KEY` | Qwen API-key fallback after `DASHSCOPE_API_KEY` |
231
233
  | `QWEN_HOME` | Qwen Code configuration directory used by `zg install` |
234
+ | `QODER_CONFIG_DIR` | Qoder CLI configuration directory used by `zg install` |
235
+ | `QODER_IDE_MCP_PATH` | Full Qoder IDE `mcp.json` path used by `zg install` |
236
+ | `QODER_IDE_EXECUTABLE` | Qoder IDE executable used for automatic install-target detection |
232
237
 
233
238
  Run `zg help environment` for advanced variables, agent integration paths,
234
239
  scope, and detailed precedence. A new index selects its model in this order:
package/docs/06-server.md CHANGED
@@ -99,6 +99,19 @@ zg server off
99
99
  zg server on --mcp-toolset full
100
100
  ```
101
101
 
102
+ The Server releases a Workspace watcher and its lightweight runtime after four
103
+ hours without a client request or a relevant file-system change. Periodic
104
+ reconciliation does not extend this idle deadline. To select another timeout,
105
+ set the number of seconds before starting or restarting the Server:
106
+
107
+ ```bash
108
+ export ZVEC_GREP_WATCHER_IDLE_TIMEOUT_SECONDS=7200
109
+ zg server off
110
+ zg server on
111
+ ```
112
+
113
+ Set the value to `0` to keep activated watchers until the Server stops.
114
+
102
115
  ## Configure the mode
103
116
 
104
117
  Choose a mode for one command:
@@ -15,7 +15,13 @@ zg index --embedding local/potion-code-16m-v2
15
15
  ```
16
16
 
17
17
  Local models keep workspace content and query text on the machine. Their files
18
- are downloaded on first use and cached under `~/.zvec-grep/models` by default.
18
+ are downloaded from Hugging Face on first use and cached under
19
+ `~/.zvec-grep/models` by default. If a pinned Hugging Face artifact cannot be
20
+ downloaded, zvec-grep automatically falls back to its pinned, integrity-checked
21
+ ModelScope copy. A complete ModelScope snapshot is reused on later runs without
22
+ retrying Hugging Face. ModelScope downloads use a separate `modelscope` cache
23
+ subdirectory.
24
+
19
25
  Remote models avoid local inference but send disclosed query or workspace
20
26
  content to the configured provider after authorization.
21
27
 
@@ -152,6 +158,27 @@ Before granting access, confirm that the workspace content is permitted to be
152
158
  sent to the selected provider and endpoint. MCP tool approval is separate from
153
159
  this data authorization.
154
160
 
161
+ When Qoder CLI reports that it has no handler for `elicitation/create`, or
162
+ declines or cancels without displaying the form, the `AGENTS.md` guidance
163
+ installed by `zg install --target qoder` uses the exact `AskUserQuestion` tool
164
+ as a compatibility path. It offers workspace approval, local FTS only, or
165
+ cancel.
166
+
167
+ Qoder IDE uses the exact native tool name `ask_user_question`. Because Qoder IDE
168
+ does not provide a supported global Rules location, the installer does not
169
+ write equivalent IDE guidance. In stdio mode, the zvec-grep bridge instead
170
+ turns a missing `elicitation/create` handler into an actionable error directing
171
+ the top-level IDE agent to present the same choices with `ask_user_question`.
172
+ This path still requires an end-to-end smoke test in a real Qoder IDE session.
173
+
174
+ Either path runs the Workspace grant only after explicit approval and retries
175
+ the original MCP search once. Choosing local FTS instead removes
176
+ vector-producing query routes, sets `autoUpdate` to `false`, and keeps retrieval
177
+ local without refreshing the remote-embedding index; a headless session never
178
+ grants access automatically. Neither question tool should collect a token, API
179
+ key, or password. `--allow-remote` is not a substitute for this path because it
180
+ authorizes only the current CLI command, not a later MCP retry.
181
+
155
182
  ## Input length and truncation
156
183
 
157
184
  zvec-grep uses the selected model's input limit when it creates fragments, but
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zvec/zvec-grep",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Agent-friendly hybrid workspace search across code and non-code content.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -74,7 +74,7 @@
74
74
  "@modelcontextprotocol/node": "2.0.0",
75
75
  "@modelcontextprotocol/server": "2.0.0",
76
76
  "@vscode/ripgrep": "^1.18.0",
77
- "@zvec/zvec": "^0.7.0",
77
+ "@zvec/zvec": "^0.7.1",
78
78
  "jsonc-parser": "^3.3.1",
79
79
  "tree-sitter-wasms": "^0.1.13",
80
80
  "web-tree-sitter": "^0.20.8",