droid-patch 0.4.1 → 0.6.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/README.md +116 -55
- package/README.zh-CN.md +116 -55
- package/dist/{alias-BGsm9wXL.js → alias-DKVU8DM_.mjs} +248 -41
- package/dist/alias-DKVU8DM_.mjs.map +1 -0
- package/dist/{cli.js → cli.mjs} +273 -302
- package/dist/cli.mjs.map +1 -0
- package/dist/{index.d.ts → index.d.mts} +4 -12
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/package.json +8 -8
- package/dist/alias-BGsm9wXL.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- /package/dist/{cli.d.ts → cli.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -26,6 +26,9 @@ npx droid-patch --skip-login droid-nologin
|
|
|
26
26
|
# Patch with --websearch to enable local search proxy
|
|
27
27
|
npx droid-patch --websearch droid-search
|
|
28
28
|
|
|
29
|
+
# Patch with --websearch --standalone for fully local mode (mock non-LLM APIs)
|
|
30
|
+
npx droid-patch --websearch --standalone droid-local
|
|
31
|
+
|
|
29
32
|
# Patch with --reasoning-effort to enable reasoning for custom models
|
|
30
33
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
31
34
|
|
|
@@ -54,23 +57,25 @@ npx droid-patch --skip-login -o /path/to/dir my-droid
|
|
|
54
57
|
|
|
55
58
|
### Available Options
|
|
56
59
|
|
|
57
|
-
| Option
|
|
58
|
-
|
|
59
|
-
| `--is-custom`
|
|
60
|
-
| `--skip-login`
|
|
61
|
-
| `--api-base <url>`
|
|
62
|
-
| `--websearch`
|
|
63
|
-
| `--
|
|
64
|
-
| `--
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| `-
|
|
60
|
+
| Option | Description |
|
|
61
|
+
| --------------------- | ------------------------------------------------------------------------------------ |
|
|
62
|
+
| `--is-custom` | Patch `isCustom:!0` to `isCustom:!1` (enables context compression for custom models) |
|
|
63
|
+
| `--skip-login` | Bypass login by injecting a fake `FACTORY_API_KEY` into the binary |
|
|
64
|
+
| `--api-base <url>` | Replace Factory API URL with a custom server (max 22 chars) |
|
|
65
|
+
| `--websearch` | Inject local WebSearch proxy with multiple search providers |
|
|
66
|
+
| `--standalone` | Standalone mode: mock non-LLM Factory APIs (use with `--websearch`) |
|
|
67
|
+
| `--reasoning-effort` | Enable reasoning effort UI selector for custom models (set to high) |
|
|
68
|
+
| `--disable-telemetry` | Disable telemetry and Sentry error reporting |
|
|
69
|
+
| `--dry-run` | Verify patches without actually modifying the binary |
|
|
70
|
+
| `-p, --path <path>` | Path to the droid binary (default: `~/.droid/bin/droid`) |
|
|
71
|
+
| `-o, --output <dir>` | Output directory for patched binary (creates file without alias) |
|
|
72
|
+
| `--no-backup` | Skip creating backup of original binary |
|
|
73
|
+
| `-v, --verbose` | Enable verbose output |
|
|
69
74
|
|
|
70
75
|
### Manage Aliases and Files
|
|
71
76
|
|
|
72
77
|
```bash
|
|
73
|
-
# List all aliases
|
|
78
|
+
# List all aliases (shows versions, flags, creation time)
|
|
74
79
|
npx droid-patch list
|
|
75
80
|
|
|
76
81
|
# Remove an alias
|
|
@@ -80,8 +85,13 @@ npx droid-patch remove <alias-name>
|
|
|
80
85
|
npx droid-patch remove ./my-droid
|
|
81
86
|
npx droid-patch remove /path/to/patched-binary
|
|
82
87
|
|
|
83
|
-
#
|
|
84
|
-
npx droid-patch
|
|
88
|
+
# Remove aliases by filter
|
|
89
|
+
npx droid-patch remove --patch-version=0.4.0 # by droid-patch version
|
|
90
|
+
npx droid-patch remove --droid-version=1.0.40 # by droid version
|
|
91
|
+
npx droid-patch remove --flag=websearch # by feature flag
|
|
92
|
+
|
|
93
|
+
# Clear all droid-patch data (aliases, binaries, metadata)
|
|
94
|
+
npx droid-patch clear
|
|
85
95
|
```
|
|
86
96
|
|
|
87
97
|
### Update Aliases
|
|
@@ -147,6 +157,7 @@ Replaces all `process.env.FACTORY_API_KEY` references in the binary with a hardc
|
|
|
147
157
|
**Purpose**: Bypass the login/authentication requirement without needing to set the `FACTORY_API_KEY` environment variable.
|
|
148
158
|
|
|
149
159
|
**How it works**:
|
|
160
|
+
|
|
150
161
|
- The original code checks `process.env.FACTORY_API_KEY` to authenticate
|
|
151
162
|
- After patching, the code directly uses the fake key string, bypassing the env check
|
|
152
163
|
- This is a binary-level patch, so it works across all terminal sessions without any environment setup
|
|
@@ -160,6 +171,7 @@ Replaces the Factory API base URL (`https://api.factory.ai`) with a custom URL.
|
|
|
160
171
|
**Limitation**: URL must be 22 characters or less (same length as original URL).
|
|
161
172
|
|
|
162
173
|
**Examples**:
|
|
174
|
+
|
|
163
175
|
```bash
|
|
164
176
|
# Valid URLs (<=22 chars)
|
|
165
177
|
npx droid-patch --api-base "http://127.0.0.1:3000" droid-local
|
|
@@ -176,16 +188,21 @@ Enables WebSearch functionality through a local proxy server that intercepts `/a
|
|
|
176
188
|
**Purpose**: Enable WebSearch functionality without Factory.ai authentication.
|
|
177
189
|
|
|
178
190
|
**Features**:
|
|
191
|
+
|
|
179
192
|
- **Multiple search providers** with automatic fallback
|
|
180
|
-
- **
|
|
181
|
-
- **Auto-
|
|
182
|
-
- **
|
|
193
|
+
- **Per-instance proxy**: Each droid instance runs its own proxy on an auto-assigned port
|
|
194
|
+
- **Auto-cleanup**: Proxy automatically stops when droid exits
|
|
195
|
+
- **Forward target**: Use `--api-base` with `--websearch` to forward non-search requests to a custom backend
|
|
183
196
|
|
|
184
197
|
**Usage**:
|
|
198
|
+
|
|
185
199
|
```bash
|
|
186
|
-
# Create alias with websearch
|
|
200
|
+
# Create alias with websearch (uses official Factory API)
|
|
187
201
|
npx droid-patch --websearch droid-search
|
|
188
202
|
|
|
203
|
+
# Create alias with websearch + custom backend
|
|
204
|
+
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
205
|
+
|
|
189
206
|
# Just run it - everything is automatic!
|
|
190
207
|
droid-search
|
|
191
208
|
```
|
|
@@ -193,6 +210,7 @@ droid-search
|
|
|
193
210
|
### `--reasoning-effort`
|
|
194
211
|
|
|
195
212
|
Enables reasoning effort control for custom models by patching the binary to:
|
|
213
|
+
|
|
196
214
|
1. Set `supportedReasoningEfforts` from `["none"]` to `["high"]`
|
|
197
215
|
2. Set `defaultReasoningEffort` from `"none"` to `"high"`
|
|
198
216
|
3. Enable the reasoning effort UI selector (normally hidden for custom models)
|
|
@@ -201,12 +219,14 @@ Enables reasoning effort control for custom models by patching the binary to:
|
|
|
201
219
|
**Purpose**: Allow custom models to use reasoning effort features that are normally only available for official models.
|
|
202
220
|
|
|
203
221
|
**How it works**:
|
|
222
|
+
|
|
204
223
|
- The droid UI shows a reasoning effort selector when `supportedReasoningEfforts.length > 1`
|
|
205
224
|
- Custom models are hardcoded with `["none"]`, hiding the selector
|
|
206
225
|
- This patch changes the value to `["high"]` and modifies the UI condition to show the selector
|
|
207
226
|
- The reasoning effort setting will be sent to your custom model's API
|
|
208
227
|
|
|
209
228
|
**Usage**:
|
|
229
|
+
|
|
210
230
|
```bash
|
|
211
231
|
# Enable reasoning effort for custom models
|
|
212
232
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
@@ -238,6 +258,52 @@ Available values:
|
|
|
238
258
|
|
|
239
259
|
**Note**: The `xhigh` value bypasses validation and is sent directly to your API. Make sure your custom model/proxy supports this parameter.
|
|
240
260
|
|
|
261
|
+
### `--standalone`
|
|
262
|
+
|
|
263
|
+
Enables standalone mode when used with `--websearch`. In this mode, non-LLM Factory APIs are mocked locally instead of being forwarded to Factory servers.
|
|
264
|
+
|
|
265
|
+
**Purpose**: Reduce unnecessary network requests and enable fully local operation (except for LLM API calls).
|
|
266
|
+
|
|
267
|
+
**How it works**:
|
|
268
|
+
|
|
269
|
+
- **Whitelist approach**: Only `/api/llm/a/*` (Anthropic) and `/api/llm/o/*` (OpenAI) are forwarded to upstream
|
|
270
|
+
- All other Factory APIs are mocked:
|
|
271
|
+
- `/api/sessions/create` → Returns unique local session ID
|
|
272
|
+
- `/api/cli/whoami` → Returns 401 (triggers local token fallback)
|
|
273
|
+
- `/api/tools/get-url-contents` → Returns 404 (triggers local URL fetch)
|
|
274
|
+
- Other APIs → Returns empty `{}` response
|
|
275
|
+
|
|
276
|
+
**Usage**:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Standalone mode with websearch
|
|
280
|
+
npx droid-patch --websearch --standalone droid-local
|
|
281
|
+
|
|
282
|
+
# Combine with other patches for fully local setup
|
|
283
|
+
npx droid-patch --is-custom --skip-login --websearch --standalone droid-full-local
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### `--disable-telemetry`
|
|
287
|
+
|
|
288
|
+
Disables telemetry data uploads and Sentry error reporting.
|
|
289
|
+
|
|
290
|
+
**Purpose**: Prevent droid from sending usage data and error reports to Factory servers.
|
|
291
|
+
|
|
292
|
+
**How it works**:
|
|
293
|
+
|
|
294
|
+
- Breaks Sentry environment variable checks (`ENABLE_SENTRY`, `VITE_VERCEL_ENV`)
|
|
295
|
+
- Makes `flushToWeb()` always return early, preventing any telemetry fetch requests
|
|
296
|
+
|
|
297
|
+
**Usage**:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# Disable telemetry only
|
|
301
|
+
npx droid-patch --disable-telemetry droid-private
|
|
302
|
+
|
|
303
|
+
# Combine with other patches
|
|
304
|
+
npx droid-patch --is-custom --skip-login --disable-telemetry droid-private
|
|
305
|
+
```
|
|
306
|
+
|
|
241
307
|
---
|
|
242
308
|
|
|
243
309
|
## WebSearch Configuration Guide
|
|
@@ -248,14 +314,14 @@ The `--websearch` feature supports multiple search providers. Configure them usi
|
|
|
248
314
|
|
|
249
315
|
The proxy tries providers in this order and uses the first one that succeeds:
|
|
250
316
|
|
|
251
|
-
| Priority | Provider
|
|
252
|
-
|
|
253
|
-
| 1
|
|
254
|
-
| 2
|
|
255
|
-
| 3
|
|
256
|
-
| 4
|
|
257
|
-
| 5
|
|
258
|
-
| 6
|
|
317
|
+
| Priority | Provider | Quality | Free Tier | Setup Difficulty |
|
|
318
|
+
| -------- | ------------ | --------- | --------------------- | ---------------- |
|
|
319
|
+
| 1 | Smithery Exa | Excellent | Free (via Smithery) | Easy |
|
|
320
|
+
| 2 | Google PSE | Very Good | 10,000/day | Medium |
|
|
321
|
+
| 3 | Serper | Very Good | 2,500 free credits | Easy |
|
|
322
|
+
| 4 | Brave Search | Good | 2,000/month | Easy |
|
|
323
|
+
| 5 | SearXNG | Good | Unlimited (self-host) | Hard |
|
|
324
|
+
| 6 | DuckDuckGo | Basic | Unlimited | None |
|
|
259
325
|
|
|
260
326
|
---
|
|
261
327
|
|
|
@@ -417,6 +483,7 @@ Find public instances at [searx.space](https://searx.space/)
|
|
|
417
483
|
#### Option B: Self-Host with Docker
|
|
418
484
|
|
|
419
485
|
1. **Run SearXNG with Docker**
|
|
486
|
+
|
|
420
487
|
```bash
|
|
421
488
|
docker run -d \
|
|
422
489
|
--name searxng \
|
|
@@ -504,31 +571,7 @@ export BRAVE_API_KEY="your_brave_key"
|
|
|
504
571
|
|
|
505
572
|
---
|
|
506
573
|
|
|
507
|
-
##
|
|
508
|
-
|
|
509
|
-
### Auto-Shutdown
|
|
510
|
-
|
|
511
|
-
The proxy automatically shuts down after 5 minutes of inactivity to save resources.
|
|
512
|
-
|
|
513
|
-
```bash
|
|
514
|
-
# Customize timeout (in seconds)
|
|
515
|
-
export DROID_PROXY_IDLE_TIMEOUT=600 # 10 minutes
|
|
516
|
-
export DROID_PROXY_IDLE_TIMEOUT=0 # Disable auto-shutdown
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### Check Proxy Status
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
npx droid-patch proxy-status
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
Output shows:
|
|
526
|
-
- Proxy running status
|
|
527
|
-
- Process ID
|
|
528
|
-
- Droid process detection
|
|
529
|
-
- Idle timeout settings
|
|
530
|
-
|
|
531
|
-
### Debug Mode
|
|
574
|
+
## Debug Mode
|
|
532
575
|
|
|
533
576
|
Enable detailed logging to troubleshoot search issues:
|
|
534
577
|
|
|
@@ -547,15 +590,33 @@ npx droid-patch --websearch droid-search
|
|
|
547
590
|
droid-search # Just works!
|
|
548
591
|
|
|
549
592
|
# Full-featured droid
|
|
550
|
-
npx droid-patch --is-custom --skip-login --websearch droid-full
|
|
593
|
+
npx droid-patch --is-custom --skip-login --websearch --reasoning-effort droid-full
|
|
594
|
+
|
|
595
|
+
# Standalone mode: websearch + mock non-LLM APIs
|
|
596
|
+
npx droid-patch --websearch --standalone droid-local
|
|
597
|
+
|
|
598
|
+
# Privacy mode: disable telemetry
|
|
599
|
+
npx droid-patch --disable-telemetry droid-private
|
|
600
|
+
|
|
601
|
+
# Full local setup: all features combined
|
|
602
|
+
npx droid-patch --is-custom --skip-login --websearch --standalone --disable-telemetry droid-full-local
|
|
603
|
+
|
|
604
|
+
# Websearch with custom backend
|
|
605
|
+
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
551
606
|
|
|
552
607
|
# Create a standalone patched binary in current directory
|
|
553
608
|
npx droid-patch --skip-login -o . my-droid
|
|
554
609
|
./my-droid --version
|
|
555
610
|
|
|
611
|
+
# List all aliases with version info
|
|
612
|
+
npx droid-patch list
|
|
613
|
+
|
|
556
614
|
# Clean up
|
|
557
|
-
npx droid-patch remove droid-search
|
|
558
|
-
npx droid-patch remove
|
|
615
|
+
npx droid-patch remove droid-search # remove single alias
|
|
616
|
+
npx droid-patch remove --flag=websearch # remove all websearch aliases
|
|
617
|
+
npx droid-patch remove --flag=standalone # remove all standalone aliases
|
|
618
|
+
npx droid-patch remove --patch-version=0.4.0 # remove by droid-patch version
|
|
619
|
+
npx droid-patch clear # remove everything
|
|
559
620
|
```
|
|
560
621
|
|
|
561
622
|
## License
|
package/README.zh-CN.md
CHANGED
|
@@ -26,6 +26,9 @@ npx droid-patch --skip-login droid-nologin
|
|
|
26
26
|
# 使用 --websearch 启用本地搜索代理
|
|
27
27
|
npx droid-patch --websearch droid-search
|
|
28
28
|
|
|
29
|
+
# 使用 --websearch --standalone 启用完全本地模式(mock 非 LLM API)
|
|
30
|
+
npx droid-patch --websearch --standalone droid-local
|
|
31
|
+
|
|
29
32
|
# 使用 --reasoning-effort 为自定义模型启用推理功能
|
|
30
33
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
31
34
|
|
|
@@ -54,23 +57,25 @@ npx droid-patch --skip-login -o /path/to/dir my-droid
|
|
|
54
57
|
|
|
55
58
|
### 可用选项
|
|
56
59
|
|
|
57
|
-
| 选项
|
|
58
|
-
|
|
59
|
-
| `--is-custom`
|
|
60
|
-
| `--skip-login`
|
|
61
|
-
| `--api-base <url>`
|
|
62
|
-
| `--websearch`
|
|
63
|
-
| `--
|
|
64
|
-
| `--
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| `-
|
|
60
|
+
| 选项 | 说明 |
|
|
61
|
+
| --------------------- | ------------------------------------------------------------------- |
|
|
62
|
+
| `--is-custom` | 将 `isCustom:!0` 修改为 `isCustom:!1`(为自定义模型启用上下文压缩) |
|
|
63
|
+
| `--skip-login` | 通过注入假的 `FACTORY_API_KEY` 跳过登录验证 |
|
|
64
|
+
| `--api-base <url>` | 将 Factory API URL 替换为自定义服务器(最多 22 个字符) |
|
|
65
|
+
| `--websearch` | 注入本地 WebSearch 代理,支持多个搜索提供商 |
|
|
66
|
+
| `--standalone` | 独立模式:mock 非 LLM 的 Factory API(与 `--websearch` 配合使用) |
|
|
67
|
+
| `--reasoning-effort` | 为自定义模型启用推理强度 UI 选择器(设置为 high) |
|
|
68
|
+
| `--disable-telemetry` | 禁用遥测数据上传和 Sentry 错误报告 |
|
|
69
|
+
| `--dry-run` | 验证修补但不实际修改二进制文件 |
|
|
70
|
+
| `-p, --path <path>` | droid 二进制文件路径(默认:`~/.droid/bin/droid`) |
|
|
71
|
+
| `-o, --output <dir>` | 修补后二进制文件的输出目录(直接创建文件,不创建别名) |
|
|
72
|
+
| `--no-backup` | 跳过创建原始二进制文件的备份 |
|
|
73
|
+
| `-v, --verbose` | 启用详细输出 |
|
|
69
74
|
|
|
70
75
|
### 管理别名和文件
|
|
71
76
|
|
|
72
77
|
```bash
|
|
73
|
-
#
|
|
78
|
+
# 列出所有别名(显示版本、flags、创建时间)
|
|
74
79
|
npx droid-patch list
|
|
75
80
|
|
|
76
81
|
# 删除别名
|
|
@@ -80,8 +85,13 @@ npx droid-patch remove <alias-name>
|
|
|
80
85
|
npx droid-patch remove ./my-droid
|
|
81
86
|
npx droid-patch remove /path/to/patched-binary
|
|
82
87
|
|
|
83
|
-
#
|
|
84
|
-
npx droid-patch
|
|
88
|
+
# 按条件删除别名
|
|
89
|
+
npx droid-patch remove --patch-version=0.4.0 # 按 droid-patch 版本
|
|
90
|
+
npx droid-patch remove --droid-version=1.0.40 # 按 droid 版本
|
|
91
|
+
npx droid-patch remove --flag=websearch # 按功能 flag
|
|
92
|
+
|
|
93
|
+
# 清除所有 droid-patch 数据(别名、二进制文件、元数据)
|
|
94
|
+
npx droid-patch clear
|
|
85
95
|
```
|
|
86
96
|
|
|
87
97
|
### 更新别名
|
|
@@ -147,6 +157,7 @@ export PATH="$HOME/.droid-patch/aliases:$PATH"
|
|
|
147
157
|
**用途**:无需设置 `FACTORY_API_KEY` 环境变量即可跳过登录/认证要求。
|
|
148
158
|
|
|
149
159
|
**工作原理**:
|
|
160
|
+
|
|
150
161
|
- 原始代码通过检查 `process.env.FACTORY_API_KEY` 进行认证
|
|
151
162
|
- 修补后,代码直接使用假密钥字符串,绕过环境变量检查
|
|
152
163
|
- 这是二进制级别的修补,因此在所有终端会话中都有效,无需任何环境设置
|
|
@@ -160,6 +171,7 @@ export PATH="$HOME/.droid-patch/aliases:$PATH"
|
|
|
160
171
|
**限制**:URL 必须不超过 22 个字符(与原始 URL 长度相同)。
|
|
161
172
|
|
|
162
173
|
**示例**:
|
|
174
|
+
|
|
163
175
|
```bash
|
|
164
176
|
# 有效的 URL(<=22 个字符)
|
|
165
177
|
npx droid-patch --api-base "http://127.0.0.1:3000" droid-local
|
|
@@ -176,16 +188,21 @@ npx droid-patch --api-base "http://my-long-domain.com:3000" droid # 错误!
|
|
|
176
188
|
**用途**:无需 Factory.ai 认证即可使用 WebSearch 功能。
|
|
177
189
|
|
|
178
190
|
**特性**:
|
|
191
|
+
|
|
179
192
|
- **多搜索提供商**:支持自动降级
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
193
|
+
- **每实例独立代理**:每个 droid 实例运行自己的代理,自动分配端口
|
|
194
|
+
- **自动清理**:droid 退出时代理自动停止
|
|
195
|
+
- **转发目标**:使用 `--api-base` 配合 `--websearch` 可将非搜索请求转发到自定义后端
|
|
183
196
|
|
|
184
197
|
**使用方法**:
|
|
198
|
+
|
|
185
199
|
```bash
|
|
186
|
-
# 创建带 websearch
|
|
200
|
+
# 创建带 websearch 的别名(使用官方 Factory API)
|
|
187
201
|
npx droid-patch --websearch droid-search
|
|
188
202
|
|
|
203
|
+
# 创建带 websearch + 自定义后端的别名
|
|
204
|
+
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
205
|
+
|
|
189
206
|
# 直接运行 - 一切都是自动的!
|
|
190
207
|
droid-search
|
|
191
208
|
```
|
|
@@ -193,6 +210,7 @@ droid-search
|
|
|
193
210
|
### `--reasoning-effort`
|
|
194
211
|
|
|
195
212
|
通过修补二进制文件为自定义模型启用推理强度控制:
|
|
213
|
+
|
|
196
214
|
1. 将 `supportedReasoningEfforts` 从 `["none"]` 改为 `["high"]`
|
|
197
215
|
2. 将 `defaultReasoningEffort` 从 `"none"` 改为 `"high"`
|
|
198
216
|
3. 启用推理强度 UI 选择器(通常对自定义模型隐藏)
|
|
@@ -201,12 +219,14 @@ droid-search
|
|
|
201
219
|
**用途**:允许自定义模型使用通常仅对官方模型可用的推理强度功能。
|
|
202
220
|
|
|
203
221
|
**工作原理**:
|
|
222
|
+
|
|
204
223
|
- 当 `supportedReasoningEfforts.length > 1` 时,droid UI 会显示推理强度选择器
|
|
205
224
|
- 自定义模型硬编码为 `["none"]`,隐藏了选择器
|
|
206
225
|
- 此补丁将值改为 `["high"]` 并修改 UI 条件以显示选择器
|
|
207
226
|
- 推理强度设置将发送到您的自定义模型 API
|
|
208
227
|
|
|
209
228
|
**使用方法**:
|
|
229
|
+
|
|
210
230
|
```bash
|
|
211
231
|
# 为自定义模型启用推理强度
|
|
212
232
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
@@ -238,6 +258,52 @@ npx droid-patch --is-custom --reasoning-effort droid-full
|
|
|
238
258
|
|
|
239
259
|
**注意**:`xhigh` 值会绕过验证直接发送到 API。请确保您的自定义模型/代理支持此参数。
|
|
240
260
|
|
|
261
|
+
### `--standalone`
|
|
262
|
+
|
|
263
|
+
与 `--websearch` 配合使用时启用独立模式。在此模式下,非 LLM 的 Factory API 会在本地 mock,而不是转发到 Factory 服务器。
|
|
264
|
+
|
|
265
|
+
**用途**:减少不必要的网络请求,实现完全本地化运行(LLM API 调用除外)。
|
|
266
|
+
|
|
267
|
+
**工作原理**:
|
|
268
|
+
|
|
269
|
+
- **白名单方式**:只有 `/api/llm/a/*`(Anthropic)和 `/api/llm/o/*`(OpenAI)会转发到上游
|
|
270
|
+
- 其他所有 Factory API 都会被 mock:
|
|
271
|
+
- `/api/sessions/create` → 返回唯一的本地 session ID
|
|
272
|
+
- `/api/cli/whoami` → 返回 401(触发本地 token 回退)
|
|
273
|
+
- `/api/tools/get-url-contents` → 返回 404(触发本地 URL 获取)
|
|
274
|
+
- 其他 API → 返回空 `{}` 响应
|
|
275
|
+
|
|
276
|
+
**使用方法**:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# 独立模式 + websearch
|
|
280
|
+
npx droid-patch --websearch --standalone droid-local
|
|
281
|
+
|
|
282
|
+
# 与其他补丁组合实现完全本地化
|
|
283
|
+
npx droid-patch --is-custom --skip-login --websearch --standalone droid-full-local
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### `--disable-telemetry`
|
|
287
|
+
|
|
288
|
+
禁用遥测数据上传和 Sentry 错误报告。
|
|
289
|
+
|
|
290
|
+
**用途**:阻止 droid 向 Factory 服务器发送使用数据和错误报告。
|
|
291
|
+
|
|
292
|
+
**工作原理**:
|
|
293
|
+
|
|
294
|
+
- 破坏 Sentry 环境变量检查(`ENABLE_SENTRY`、`VITE_VERCEL_ENV`)
|
|
295
|
+
- 使 `flushToWeb()` 始终提前返回,阻止任何遥测 fetch 请求
|
|
296
|
+
|
|
297
|
+
**使用方法**:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# 仅禁用遥测
|
|
301
|
+
npx droid-patch --disable-telemetry droid-private
|
|
302
|
+
|
|
303
|
+
# 与其他补丁组合
|
|
304
|
+
npx droid-patch --is-custom --skip-login --disable-telemetry droid-private
|
|
305
|
+
```
|
|
306
|
+
|
|
241
307
|
---
|
|
242
308
|
|
|
243
309
|
## WebSearch 配置指南
|
|
@@ -248,14 +314,14 @@ npx droid-patch --is-custom --reasoning-effort droid-full
|
|
|
248
314
|
|
|
249
315
|
代理按以下顺序尝试提供商,使用第一个成功的:
|
|
250
316
|
|
|
251
|
-
| 优先级 | 提供商
|
|
252
|
-
|
|
253
|
-
| 1
|
|
254
|
-
| 2
|
|
255
|
-
| 3
|
|
256
|
-
| 4
|
|
257
|
-
| 5
|
|
258
|
-
| 6
|
|
317
|
+
| 优先级 | 提供商 | 质量 | 免费额度 | 设置难度 |
|
|
318
|
+
| ------ | ------------ | ---- | --------------------- | -------- |
|
|
319
|
+
| 1 | Smithery Exa | 优秀 | 免费(通过 Smithery) | 简单 |
|
|
320
|
+
| 2 | Google PSE | 很好 | 10,000 次/天 | 中等 |
|
|
321
|
+
| 3 | Serper | 很好 | 2,500 免费额度 | 简单 |
|
|
322
|
+
| 4 | Brave Search | 好 | 2,000 次/月 | 简单 |
|
|
323
|
+
| 5 | SearXNG | 好 | 无限(自托管) | 较难 |
|
|
324
|
+
| 6 | DuckDuckGo | 基本 | 无限 | 无需配置 |
|
|
259
325
|
|
|
260
326
|
---
|
|
261
327
|
|
|
@@ -417,6 +483,7 @@ export SEARXNG_URL="https://searx.be"
|
|
|
417
483
|
#### 选项 B:使用 Docker 自托管
|
|
418
484
|
|
|
419
485
|
1. **使用 Docker 运行 SearXNG**
|
|
486
|
+
|
|
420
487
|
```bash
|
|
421
488
|
docker run -d \
|
|
422
489
|
--name searxng \
|
|
@@ -504,31 +571,7 @@ export BRAVE_API_KEY="your_brave_key"
|
|
|
504
571
|
|
|
505
572
|
---
|
|
506
573
|
|
|
507
|
-
##
|
|
508
|
-
|
|
509
|
-
### 自动关闭
|
|
510
|
-
|
|
511
|
-
代理在空闲 5 分钟后自动关闭以节省资源。
|
|
512
|
-
|
|
513
|
-
```bash
|
|
514
|
-
# 自定义超时时间(秒)
|
|
515
|
-
export DROID_PROXY_IDLE_TIMEOUT=600 # 10 分钟
|
|
516
|
-
export DROID_PROXY_IDLE_TIMEOUT=0 # 禁用自动关闭
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
### 检查代理状态
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
npx droid-patch proxy-status
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
输出显示:
|
|
526
|
-
- 代理运行状态
|
|
527
|
-
- 进程 ID
|
|
528
|
-
- Droid 进程检测
|
|
529
|
-
- 空闲超时设置
|
|
530
|
-
|
|
531
|
-
### 调试模式
|
|
574
|
+
## 调试模式
|
|
532
575
|
|
|
533
576
|
启用详细日志以排查搜索问题:
|
|
534
577
|
|
|
@@ -547,15 +590,33 @@ npx droid-patch --websearch droid-search
|
|
|
547
590
|
droid-search # 直接使用!
|
|
548
591
|
|
|
549
592
|
# 全功能 droid
|
|
550
|
-
npx droid-patch --is-custom --skip-login --websearch droid-full
|
|
593
|
+
npx droid-patch --is-custom --skip-login --websearch --reasoning-effort droid-full
|
|
594
|
+
|
|
595
|
+
# 独立模式:websearch + mock 非 LLM API
|
|
596
|
+
npx droid-patch --websearch --standalone droid-local
|
|
597
|
+
|
|
598
|
+
# 隐私模式:禁用遥测
|
|
599
|
+
npx droid-patch --disable-telemetry droid-private
|
|
600
|
+
|
|
601
|
+
# 完全本地化:所有功能组合
|
|
602
|
+
npx droid-patch --is-custom --skip-login --websearch --standalone --disable-telemetry droid-full-local
|
|
603
|
+
|
|
604
|
+
# websearch + 自定义后端
|
|
605
|
+
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
551
606
|
|
|
552
607
|
# 在当前目录创建独立的修补后二进制文件
|
|
553
608
|
npx droid-patch --skip-login -o . my-droid
|
|
554
609
|
./my-droid --version
|
|
555
610
|
|
|
611
|
+
# 列出所有别名及版本信息
|
|
612
|
+
npx droid-patch list
|
|
613
|
+
|
|
556
614
|
# 清理
|
|
557
|
-
npx droid-patch remove droid-search
|
|
558
|
-
npx droid-patch remove
|
|
615
|
+
npx droid-patch remove droid-search # 删除单个别名
|
|
616
|
+
npx droid-patch remove --flag=websearch # 删除所有 websearch 别名
|
|
617
|
+
npx droid-patch remove --flag=standalone # 删除所有 standalone 别名
|
|
618
|
+
npx droid-patch remove --patch-version=0.4.0 # 按 droid-patch 版本删除
|
|
619
|
+
npx droid-patch clear # 删除所有
|
|
559
620
|
```
|
|
560
621
|
|
|
561
622
|
## 许可证
|