droid-patch 0.9.0 → 0.11.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 +91 -129
- package/README.zh-CN.md +80 -127
- package/dist/{alias-DkFWCjWn.mjs → alias-CX4QSelz.mjs} +10 -7
- package/dist/alias-CX4QSelz.mjs.map +1 -0
- package/dist/cli.mjs +542 -3241
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/alias-DkFWCjWn.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -32,15 +32,6 @@ npx droid-patch --websearch --standalone droid-local
|
|
|
32
32
|
# Patch with --reasoning-effort to enable reasoning for custom models
|
|
33
33
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
34
34
|
|
|
35
|
-
# Patch with --statusline for a Claude-style terminal statusline
|
|
36
|
-
npx droid-patch --statusline droid-status
|
|
37
|
-
|
|
38
|
-
# Combine --websearch and --statusline
|
|
39
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
40
|
-
|
|
41
|
-
# Enable sessions browser (interactive session selector)
|
|
42
|
-
npx droid-patch --statusline --sessions droid-full
|
|
43
|
-
|
|
44
35
|
# Combine multiple patches
|
|
45
36
|
npx droid-patch --is-custom --skip-login --websearch --reasoning-effort droid-full
|
|
46
37
|
|
|
@@ -71,10 +62,9 @@ npx droid-patch --skip-login -o /path/to/dir my-droid
|
|
|
71
62
|
| `--is-custom` | Patch `isCustom:!0` to `isCustom:!1` (enables context compression for custom models) |
|
|
72
63
|
| `--skip-login` | Bypass login by injecting a fake `FACTORY_API_KEY` into the binary |
|
|
73
64
|
| `--api-base <url>` | Replace API URL (standalone: binary patch, max 22 chars; with `--websearch`: proxy forward target, no limit) |
|
|
74
|
-
| `--websearch` |
|
|
75
|
-
| `--
|
|
76
|
-
| `--
|
|
77
|
-
| `--standalone` | Standalone mode: mock non-LLM Factory APIs (use with `--websearch`) |
|
|
65
|
+
| `--websearch` | External providers mode: Smithery, Google PSE, Serper, Brave, SearXNG, DuckDuckGo |
|
|
66
|
+
| `--websearch-proxy` | Native provider mode: use model's built-in web_search (requires proxy plugin) |
|
|
67
|
+
| `--standalone` | Standalone mode: mock non-LLM Factory APIs (use with `--websearch` or `--websearch-proxy`) |
|
|
78
68
|
| `--reasoning-effort` | Enable reasoning effort UI selector for custom models (set to high) |
|
|
79
69
|
| `--disable-telemetry` | Disable telemetry and Sentry error reporting |
|
|
80
70
|
| `--dry-run` | Verify patches without actually modifying the binary |
|
|
@@ -206,15 +196,24 @@ npx droid-patch --websearch --api-base "http://127.0.0.1:20002" droid-custom
|
|
|
206
196
|
npx droid-patch --websearch --api-base "http://my-proxy.example.com:3000" droid-custom
|
|
207
197
|
```
|
|
208
198
|
|
|
199
|
+
### `--websearch` vs `--websearch-proxy`
|
|
200
|
+
|
|
201
|
+
**Important**: `--websearch` and `--websearch-proxy` are **mutually exclusive** - you can only use one at a time.
|
|
202
|
+
|
|
203
|
+
| Mode | Description | Requires |
|
|
204
|
+
| ------------------- | ------------------------------------ | --------------------------- |
|
|
205
|
+
| `--websearch` | External search providers | Environment variables |
|
|
206
|
+
| `--websearch-proxy` | Model's native web_search capability | Proxy plugin + custom model |
|
|
207
|
+
|
|
209
208
|
### `--websearch`
|
|
210
209
|
|
|
211
|
-
Enables WebSearch
|
|
210
|
+
Enables WebSearch via **external search providers** through a local proxy server.
|
|
212
211
|
|
|
213
|
-
**Purpose**: Enable WebSearch
|
|
212
|
+
**Purpose**: Enable WebSearch using third-party search APIs.
|
|
214
213
|
|
|
215
214
|
**Features**:
|
|
216
215
|
|
|
217
|
-
- **Multiple search providers** with automatic fallback
|
|
216
|
+
- **Multiple search providers** with automatic fallback (Smithery > Google PSE > Serper > Brave > SearXNG > DuckDuckGo)
|
|
218
217
|
- **Per-instance proxy**: Each droid instance runs its own proxy on an auto-assigned port
|
|
219
218
|
- **Auto-cleanup**: Proxy automatically stops when droid exits
|
|
220
219
|
- **Forward target**: Use `--api-base` with `--websearch` to forward non-search requests to a custom backend
|
|
@@ -233,6 +232,71 @@ npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
|
233
232
|
droid-search
|
|
234
233
|
```
|
|
235
234
|
|
|
235
|
+
### `--websearch-proxy`
|
|
236
|
+
|
|
237
|
+
Enables WebSearch via **model's native web_search capability** (e.g., Claude's `web_search_20250305` tool).
|
|
238
|
+
|
|
239
|
+
**Purpose**: Use the LLM provider's built-in web search instead of external providers.
|
|
240
|
+
|
|
241
|
+
**Requirements**:
|
|
242
|
+
|
|
243
|
+
1. **Custom model** configured in `~/.factory/settings.json` with a supported provider (`anthropic` or `openai`)
|
|
244
|
+
2. **Proxy plugin** ([jixoai/proxy](https://github.com/jixoai/proxy)) to handle Claude Code format conversion
|
|
245
|
+
|
|
246
|
+
**Features**:
|
|
247
|
+
|
|
248
|
+
- Reads model configuration from `~/.factory/settings.json`
|
|
249
|
+
- Supports Anthropic (`web_search_20250305`) and OpenAI (`web_search`) native tools
|
|
250
|
+
- Automatically detects current model's provider
|
|
251
|
+
- No external API keys needed (uses your LLM provider's search)
|
|
252
|
+
|
|
253
|
+
**Usage**:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Create alias with native websearch (requires proxy plugin)
|
|
257
|
+
npx droid-patch --is-custom --skip-login --websearch-proxy droid-native
|
|
258
|
+
|
|
259
|
+
# Combine with reasoning effort
|
|
260
|
+
npx droid-patch --is-custom --skip-login --reasoning-effort --websearch-proxy droid-full
|
|
261
|
+
|
|
262
|
+
# Debug mode
|
|
263
|
+
DROID_SEARCH_DEBUG=1 droid-native
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Proxy Plugin Setup**:
|
|
267
|
+
|
|
268
|
+
The `--websearch-proxy` mode requires the [jixoai/proxy](https://github.com/jixoai/proxy) plugin to convert between Claude Code format and standard Anthropic API format.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Clone and setup the proxy
|
|
272
|
+
git clone https://github.com/jixoai/proxy.git
|
|
273
|
+
cd proxy
|
|
274
|
+
|
|
275
|
+
# Install and run (see proxy README for details)
|
|
276
|
+
pnpm install
|
|
277
|
+
pnpm dev
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Configure your custom model in `~/.factory/settings.json`:
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"customModels": [
|
|
285
|
+
{
|
|
286
|
+
"model": "claude-sonnet-4-20250514",
|
|
287
|
+
"id": "custom:Claude-Proxy-0",
|
|
288
|
+
"baseUrl": "http://127.0.0.1:20002/droid",
|
|
289
|
+
"apiKey": "your-api-key",
|
|
290
|
+
"displayName": "Claude [proxy]",
|
|
291
|
+
"provider": "anthropic"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
"sessionDefaultSettings": {
|
|
295
|
+
"model": "custom:Claude-Proxy-0"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
236
300
|
### `--reasoning-effort`
|
|
237
301
|
|
|
238
302
|
Enables reasoning effort control for custom models by patching the binary to:
|
|
@@ -330,102 +394,6 @@ npx droid-patch --disable-telemetry droid-private
|
|
|
330
394
|
npx droid-patch --is-custom --skip-login --disable-telemetry droid-private
|
|
331
395
|
```
|
|
332
396
|
|
|
333
|
-
### `--statusline`
|
|
334
|
-
|
|
335
|
-
Enables a Claude-style statusline at the bottom of the terminal, displaying real-time session information.
|
|
336
|
-
|
|
337
|
-
**Purpose**: Provide at-a-glance visibility into model, context usage, git status, and token usage without interrupting the main UI.
|
|
338
|
-
|
|
339
|
-
**Features**:
|
|
340
|
-
|
|
341
|
-
- **Real-time context tracking**: Shows current token usage (cache read + new input)
|
|
342
|
-
- **Model info**: Displays the active model and provider
|
|
343
|
-
- **Token usage summary**: Shows session totals (In/Out/Cre/Read/Think) plus `LastOut` for the most recent reply
|
|
344
|
-
- **Git integration**: Shows current branch and diff summary (+insertions, -deletions)
|
|
345
|
-
- **Compaction indicator**: Shows when context compaction is in progress
|
|
346
|
-
- **PTY proxy architecture**: Reserves bottom row(s) for statusline without flickering
|
|
347
|
-
- **Non-interactive passthrough**: `--version`/`version`, `--help`/`help`, `completion(s)`, `exec` (or non-TTY) bypass the statusline wrapper
|
|
348
|
-
|
|
349
|
-
**How it works**:
|
|
350
|
-
|
|
351
|
-
1. A Bun PTY wrapper intercepts terminal I/O and reserves bottom row(s)
|
|
352
|
-
2. A Node.js monitor script tails the Factory log file (`~/.factory/logs/droid-log-single.log`)
|
|
353
|
-
3. The monitor parses streaming token usage and emits statusline frames
|
|
354
|
-
4. The wrapper renders the latest frame on the reserved rows
|
|
355
|
-
|
|
356
|
-
**Usage**:
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
# Enable statusline only
|
|
360
|
-
npx droid-patch --statusline droid-status
|
|
361
|
-
|
|
362
|
-
# Combine with websearch
|
|
363
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
364
|
-
|
|
365
|
-
# Combine with all features
|
|
366
|
-
npx droid-patch --is-custom --skip-login --websearch --statusline droid-ultimate
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**Example statusline display**:
|
|
370
|
-
|
|
371
|
-
```
|
|
372
|
-
Model: claude-sonnet-4-20250514 Prov: anthropic Ctx: 12345 (c8000+n4345) In:33 Out:1273 Cre:33.9k Read:25.9k Think:212 LastOut:130 ⎇ main (+10,-5) cwd: my-project
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
**Note**: The statusline uses a Bun-based PTY wrapper and requires Bun >= 1.3.5. It works best in modern terminal emulators (iTerm2, Alacritty, Kitty, etc.). Apple Terminal is supported but uses a longer render interval to reduce flicker.
|
|
376
|
-
|
|
377
|
-
### `--sessions`
|
|
378
|
-
|
|
379
|
-
Enables an interactive sessions browser that allows you to browse, search, and resume past sessions in the current directory.
|
|
380
|
-
|
|
381
|
-
**Purpose**: Quickly find and resume previous conversations without remembering session IDs.
|
|
382
|
-
|
|
383
|
-
**Features**:
|
|
384
|
-
|
|
385
|
-
- **Interactive selector**: Use arrow keys (↑/↓) or vim keys (j/k) to navigate
|
|
386
|
-
- **Session details**: Shows session ID, title, model, message count, timestamps
|
|
387
|
-
- **First/last input display**: Preview what you discussed in each session
|
|
388
|
-
- **Auto-resume**: Press Enter to resume the selected session with all patch features preserved
|
|
389
|
-
- **Filtered results**: Only shows sessions with actual user interactions (no empty sessions)
|
|
390
|
-
- **Sorted by recency**: Most recently used sessions appear first
|
|
391
|
-
|
|
392
|
-
**Usage**:
|
|
393
|
-
|
|
394
|
-
```bash
|
|
395
|
-
# Enable sessions browser (requires --statusline)
|
|
396
|
-
npx droid-patch --statusline --sessions droid-full
|
|
397
|
-
|
|
398
|
-
# Browse sessions
|
|
399
|
-
droid-full --sessions
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
**Interactive controls**:
|
|
403
|
-
|
|
404
|
-
- `↑`/`↓` or `j`/`k` - Navigate up/down
|
|
405
|
-
- `Page Up`/`Page Down` - Jump pages
|
|
406
|
-
- `Enter` - Resume selected session
|
|
407
|
-
- `q` or `Ctrl+C` - Quit
|
|
408
|
-
|
|
409
|
-
**Example display**:
|
|
410
|
-
|
|
411
|
-
```
|
|
412
|
-
Sessions: /Users/you/project
|
|
413
|
-
[↑/↓] Select [Enter] Resume [q] Quit
|
|
414
|
-
|
|
415
|
-
▶ Fix statusline flickering issue
|
|
416
|
-
ID: abc123def456...
|
|
417
|
-
Last: 12-18 14:30 | Model: claude-sonnet-4 | 42 msgs
|
|
418
|
-
First input: The statusline is flickering when...
|
|
419
|
-
Last input: Can you also add error handling?
|
|
420
|
-
|
|
421
|
-
Add websearch feature (12-17 09:15)
|
|
422
|
-
Refactor CLI options (12-16 18:22)
|
|
423
|
-
|
|
424
|
-
Page 1/3 (25 sessions)
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
**Note**: The `--sessions` flag requires `--statusline` to be enabled. Sessions are stored in `~/.factory/sessions/` and filtered by the current working directory.
|
|
428
|
-
|
|
429
397
|
---
|
|
430
398
|
|
|
431
399
|
## WebSearch Configuration Guide
|
|
@@ -707,34 +675,30 @@ droid-search
|
|
|
707
675
|
## Examples
|
|
708
676
|
|
|
709
677
|
```bash
|
|
710
|
-
# Quick start: create droid with websearch
|
|
678
|
+
# Quick start: create droid with websearch (external providers)
|
|
711
679
|
npx droid-patch --websearch droid-search
|
|
712
680
|
droid-search # Just works!
|
|
713
681
|
|
|
714
|
-
# Full-featured droid
|
|
682
|
+
# Full-featured droid with external websearch
|
|
715
683
|
npx droid-patch --is-custom --skip-login --websearch --reasoning-effort droid-full
|
|
716
684
|
|
|
685
|
+
# Native websearch via proxy plugin (requires jixoai/proxy)
|
|
686
|
+
npx droid-patch --is-custom --skip-login --websearch-proxy droid-native
|
|
687
|
+
|
|
688
|
+
# Native websearch + reasoning effort
|
|
689
|
+
npx droid-patch --is-custom --skip-login --reasoning-effort --websearch-proxy droid-native-full
|
|
690
|
+
|
|
717
691
|
# Standalone mode: websearch + mock non-LLM APIs
|
|
718
692
|
npx droid-patch --websearch --standalone droid-local
|
|
719
693
|
|
|
720
694
|
# Privacy mode: disable telemetry
|
|
721
695
|
npx droid-patch --disable-telemetry droid-private
|
|
722
696
|
|
|
723
|
-
#
|
|
724
|
-
npx droid-patch --statusline droid-status
|
|
725
|
-
|
|
726
|
-
# Statusline + Sessions: browse and resume past sessions
|
|
727
|
-
npx droid-patch --statusline --sessions droid-full
|
|
728
|
-
droid-full --sessions # Interactive session browser
|
|
729
|
-
|
|
730
|
-
# Websearch + Statusline: full UI experience
|
|
731
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
732
|
-
|
|
733
|
-
# Full local setup: all features combined
|
|
697
|
+
# Full local setup: all features combined (external websearch)
|
|
734
698
|
npx droid-patch --is-custom --skip-login --websearch --standalone --disable-telemetry droid-full-local
|
|
735
699
|
|
|
736
|
-
#
|
|
737
|
-
npx droid-patch --is-custom --skip-login --websearch --standalone --
|
|
700
|
+
# Full local setup with native websearch
|
|
701
|
+
npx droid-patch --is-custom --skip-login --websearch-proxy --standalone --disable-telemetry droid-native-local
|
|
738
702
|
|
|
739
703
|
# Websearch with custom backend
|
|
740
704
|
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
@@ -749,8 +713,6 @@ npx droid-patch list
|
|
|
749
713
|
# Clean up
|
|
750
714
|
npx droid-patch remove droid-search # remove single alias
|
|
751
715
|
npx droid-patch remove --flag=websearch # remove all websearch aliases
|
|
752
|
-
npx droid-patch remove --flag=statusline # remove all statusline aliases
|
|
753
|
-
npx droid-patch remove --flag=sessions # remove all sessions-enabled aliases
|
|
754
716
|
npx droid-patch remove --flag=standalone # remove all standalone aliases
|
|
755
717
|
npx droid-patch remove --patch-version=0.4.0 # remove by droid-patch version
|
|
756
718
|
npx droid-patch clear # remove everything
|
package/README.zh-CN.md
CHANGED
|
@@ -32,15 +32,6 @@ npx droid-patch --websearch --standalone droid-local
|
|
|
32
32
|
# 使用 --reasoning-effort 为自定义模型启用推理功能
|
|
33
33
|
npx droid-patch --reasoning-effort droid-reasoning
|
|
34
34
|
|
|
35
|
-
# 使用 --statusline 启用 Claude 风格的终端状态栏
|
|
36
|
-
npx droid-patch --statusline droid-status
|
|
37
|
-
|
|
38
|
-
# 组合 --websearch 和 --statusline
|
|
39
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
40
|
-
|
|
41
|
-
# 启用会话浏览器(交互式会话选择器)
|
|
42
|
-
npx droid-patch --statusline --sessions droid-full
|
|
43
|
-
|
|
44
35
|
# 组合多个修补选项
|
|
45
36
|
npx droid-patch --is-custom --skip-login --websearch --reasoning-effort droid-full
|
|
46
37
|
|
|
@@ -71,10 +62,9 @@ npx droid-patch --skip-login -o /path/to/dir my-droid
|
|
|
71
62
|
| `--is-custom` | 将 `isCustom:!0` 修改为 `isCustom:!1`(为自定义模型启用上下文压缩) |
|
|
72
63
|
| `--skip-login` | 通过注入假的 `FACTORY_API_KEY` 跳过登录验证 |
|
|
73
64
|
| `--api-base <url>` | 替换 API URL(单独使用:二进制补丁,最多 22 字符;与 `--websearch` 配合:代理转发目标,无限制) |
|
|
74
|
-
| `--websearch` |
|
|
75
|
-
| `--
|
|
76
|
-
| `--
|
|
77
|
-
| `--standalone` | 独立模式:mock 非 LLM 的 Factory API(与 `--websearch` 配合使用) |
|
|
65
|
+
| `--websearch` | 外部搜索模式:使用 Smithery、Google PSE、Serper、Brave、SearXNG、DuckDuckGo |
|
|
66
|
+
| `--websearch-proxy` | 原生搜索模式:使用模型内置的 web_search 能力(需要 proxy 插件) |
|
|
67
|
+
| `--standalone` | 独立模式:mock 非 LLM 的 Factory API(与 `--websearch` 或 `--websearch-proxy` 配合使用) |
|
|
78
68
|
| `--reasoning-effort` | 为自定义模型启用推理强度 UI 选择器(设置为 high) |
|
|
79
69
|
| `--disable-telemetry` | 禁用遥测数据上传和 Sentry 错误报告 |
|
|
80
70
|
| `--dry-run` | 验证修补但不实际修改二进制文件 |
|
|
@@ -206,15 +196,24 @@ npx droid-patch --websearch --api-base "http://127.0.0.1:20002" droid-custom
|
|
|
206
196
|
npx droid-patch --websearch --api-base "http://my-proxy.example.com:3000" droid-custom
|
|
207
197
|
```
|
|
208
198
|
|
|
199
|
+
### `--websearch` vs `--websearch-proxy`
|
|
200
|
+
|
|
201
|
+
**重要**:`--websearch` 和 `--websearch-proxy` **互斥** - 只能选择其中一个。
|
|
202
|
+
|
|
203
|
+
| 模式 | 描述 | 需要 |
|
|
204
|
+
| ------------------- | ------------------------ | ----------------------- |
|
|
205
|
+
| `--websearch` | 外部搜索提供商 | 环境变量配置 |
|
|
206
|
+
| `--websearch-proxy` | 模型原生 web_search 能力 | proxy 插件 + 自定义模型 |
|
|
207
|
+
|
|
209
208
|
### `--websearch`
|
|
210
209
|
|
|
211
|
-
通过本地代理服务器启用
|
|
210
|
+
通过本地代理服务器启用 **外部搜索提供商** 的 WebSearch 功能。
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
**用途**:使用第三方搜索 API 实现 WebSearch。
|
|
214
213
|
|
|
215
214
|
**特性**:
|
|
216
215
|
|
|
217
|
-
-
|
|
216
|
+
- **多搜索提供商**:自动降级(Smithery > Google PSE > Serper > Brave > SearXNG > DuckDuckGo)
|
|
218
217
|
- **每实例独立代理**:每个 droid 实例运行自己的代理,自动分配端口
|
|
219
218
|
- **自动清理**:droid 退出时代理自动停止
|
|
220
219
|
- **转发目标**:使用 `--api-base` 配合 `--websearch` 可将非搜索请求转发到自定义后端
|
|
@@ -233,6 +232,71 @@ npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
|
233
232
|
droid-search
|
|
234
233
|
```
|
|
235
234
|
|
|
235
|
+
### `--websearch-proxy`
|
|
236
|
+
|
|
237
|
+
通过 **模型原生 web_search 能力**(如 Claude 的 `web_search_20250305` 工具)启用 WebSearch。
|
|
238
|
+
|
|
239
|
+
**用途**:使用 LLM 提供商内置的网页搜索,而非外部提供商。
|
|
240
|
+
|
|
241
|
+
**需求**:
|
|
242
|
+
|
|
243
|
+
1. 在 `~/.factory/settings.json` 中配置支持的 provider(`anthropic` 或 `openai`)的 **自定义模型**
|
|
244
|
+
2. **Proxy 插件**([jixoai/proxy](https://github.com/jixoai/proxy))处理 Claude Code 格式转换
|
|
245
|
+
|
|
246
|
+
**特性**:
|
|
247
|
+
|
|
248
|
+
- 从 `~/.factory/settings.json` 读取模型配置
|
|
249
|
+
- 支持 Anthropic(`web_search_20250305`)和 OpenAI(`web_search`)原生工具
|
|
250
|
+
- 自动检测当前模型的 provider
|
|
251
|
+
- 无需外部 API 密钥(使用 LLM 提供商的搜索)
|
|
252
|
+
|
|
253
|
+
**使用方法**:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# 创建带原生 websearch 的别名(需要 proxy 插件)
|
|
257
|
+
npx droid-patch --is-custom --skip-login --websearch-proxy droid-native
|
|
258
|
+
|
|
259
|
+
# 配合推理强度使用
|
|
260
|
+
npx droid-patch --is-custom --skip-login --reasoning-effort --websearch-proxy droid-full
|
|
261
|
+
|
|
262
|
+
# 调试模式
|
|
263
|
+
DROID_SEARCH_DEBUG=1 droid-native
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Proxy 插件设置**:
|
|
267
|
+
|
|
268
|
+
`--websearch-proxy` 模式需要 [jixoai/proxy](https://github.com/jixoai/proxy) 插件在 Claude Code 格式和标准 Anthropic API 格式之间转换。
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# 克隆并设置 proxy
|
|
272
|
+
git clone https://github.com/jixoai/proxy.git
|
|
273
|
+
cd proxy
|
|
274
|
+
|
|
275
|
+
# 安装并运行(详见 proxy README)
|
|
276
|
+
pnpm install
|
|
277
|
+
pnpm dev
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
在 `~/.factory/settings.json` 中配置自定义模型:
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"customModels": [
|
|
285
|
+
{
|
|
286
|
+
"model": "claude-sonnet-4-20250514",
|
|
287
|
+
"id": "custom:Claude-Proxy-0",
|
|
288
|
+
"baseUrl": "http://127.0.0.1:20002/droid",
|
|
289
|
+
"apiKey": "your-api-key",
|
|
290
|
+
"displayName": "Claude [proxy]",
|
|
291
|
+
"provider": "anthropic"
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
"sessionDefaultSettings": {
|
|
295
|
+
"model": "custom:Claude-Proxy-0"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
236
300
|
### `--reasoning-effort`
|
|
237
301
|
|
|
238
302
|
通过修补二进制文件为自定义模型启用推理强度控制:
|
|
@@ -330,102 +394,6 @@ npx droid-patch --disable-telemetry droid-private
|
|
|
330
394
|
npx droid-patch --is-custom --skip-login --disable-telemetry droid-private
|
|
331
395
|
```
|
|
332
396
|
|
|
333
|
-
### `--statusline`
|
|
334
|
-
|
|
335
|
-
在终端底部启用 Claude 风格的状态栏,实时显示会话信息。
|
|
336
|
-
|
|
337
|
-
**用途**:在不干扰主 UI 的情况下,一目了然地查看模型、上下文使用量、git 状态和 token 用量。
|
|
338
|
-
|
|
339
|
-
**特性**:
|
|
340
|
-
|
|
341
|
-
- **实时上下文追踪**:显示当前 token 使用量(缓存读取 + 新输入)
|
|
342
|
-
- **模型信息**:显示当前激活的模型和提供商
|
|
343
|
-
- **用量汇总**:显示会话累计(In/Out/Cre/Read/Think)并附带最近一次回复的 `LastOut`
|
|
344
|
-
- **Git 集成**:显示当前分支和差异摘要(+插入行数,-删除行数)
|
|
345
|
-
- **压缩指示器**:显示上下文压缩正在进行中
|
|
346
|
-
- **PTY 代理架构**:为状态栏预留底部行,避免闪烁
|
|
347
|
-
- **非交互直通**:运行 `--version`/`version`、`--help`/`help`、`completion(s)`、`exec` 或在非 TTY(管道/重定向)时自动绕过状态栏
|
|
348
|
-
|
|
349
|
-
**工作原理**:
|
|
350
|
-
|
|
351
|
-
1. Bun PTY 包装器拦截终端 I/O 并预留底部行
|
|
352
|
-
2. Node.js 监控脚本跟踪 Factory 日志文件(`~/.factory/logs/droid-log-single.log`)
|
|
353
|
-
3. 监控器解析流式 token 使用并输出状态栏帧
|
|
354
|
-
4. 包装器在预留行上渲染最新帧
|
|
355
|
-
|
|
356
|
-
**使用方法**:
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
# 仅启用状态栏
|
|
360
|
-
npx droid-patch --statusline droid-status
|
|
361
|
-
|
|
362
|
-
# 与 websearch 组合
|
|
363
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
364
|
-
|
|
365
|
-
# 与所有功能组合
|
|
366
|
-
npx droid-patch --is-custom --skip-login --websearch --statusline droid-ultimate
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**状态栏显示示例**:
|
|
370
|
-
|
|
371
|
-
```
|
|
372
|
-
Model: claude-sonnet-4-20250514 Prov: anthropic Ctx: 12345 (c8000+n4345) In:33 Out:1273 Cre:33.9k Read:25.9k Think:212 LastOut:130 ⎇ main (+10,-5) cwd: my-project
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
**注意**:状态栏使用 Bun 版本的 PTY 包装器,需要 Bun >= 1.3.5。在现代终端模拟器(iTerm2、Alacritty、Kitty 等)中效果最佳。支持 Apple Terminal,但使用较长的渲染间隔以减少闪烁。
|
|
376
|
-
|
|
377
|
-
### `--sessions`
|
|
378
|
-
|
|
379
|
-
启用交互式会话浏览器,可以浏览、搜索和恢复当前目录下的历史会话。
|
|
380
|
-
|
|
381
|
-
**用途**:快速查找和恢复之前的对话,无需记住会话 ID。
|
|
382
|
-
|
|
383
|
-
**功能特性**:
|
|
384
|
-
|
|
385
|
-
- **交互式选择器**:使用方向键(↑/↓)或 vim 键(j/k)导航
|
|
386
|
-
- **会话详情**:显示会话 ID、标题、模型、消息数量、时间戳
|
|
387
|
-
- **输入预览**:显示每个会话的第一条和最后一条用户输入
|
|
388
|
-
- **自动恢复**:按 Enter 恢复选中的会话,保留所有 patch 功能
|
|
389
|
-
- **过滤结果**:只显示有实际用户交互的会话(不显示空会话)
|
|
390
|
-
- **按时间排序**:最近使用的会话排在最前面
|
|
391
|
-
|
|
392
|
-
**使用方法**:
|
|
393
|
-
|
|
394
|
-
```bash
|
|
395
|
-
# 启用会话浏览器(需要 --statusline)
|
|
396
|
-
npx droid-patch --statusline --sessions droid-full
|
|
397
|
-
|
|
398
|
-
# 浏览会话
|
|
399
|
-
droid-full --sessions
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
**交互控制**:
|
|
403
|
-
|
|
404
|
-
- `↑`/`↓` 或 `j`/`k` - 上下导航
|
|
405
|
-
- `Page Up`/`Page Down` - 翻页
|
|
406
|
-
- `Enter` - 恢复选中的会话
|
|
407
|
-
- `q` 或 `Ctrl+C` - 退出
|
|
408
|
-
|
|
409
|
-
**显示示例**:
|
|
410
|
-
|
|
411
|
-
```
|
|
412
|
-
Sessions: /Users/you/project
|
|
413
|
-
[↑/↓] Select [Enter] Resume [q] Quit
|
|
414
|
-
|
|
415
|
-
▶ 修复 statusline 闪烁问题
|
|
416
|
-
ID: abc123def456...
|
|
417
|
-
Last: 12-18 14:30 | Model: claude-sonnet-4 | 42 msgs
|
|
418
|
-
First input: statusline 在窗口调整时闪烁...
|
|
419
|
-
Last input: 能否同时添加错误处理?
|
|
420
|
-
|
|
421
|
-
添加 websearch 功能 (12-17 09:15)
|
|
422
|
-
重构 CLI 选项 (12-16 18:22)
|
|
423
|
-
|
|
424
|
-
Page 1/3 (25 sessions)
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
**注意**:`--sessions` 标志需要启用 `--statusline`。会话存储在 `~/.factory/sessions/` 目录中,按当前工作目录过滤。
|
|
428
|
-
|
|
429
397
|
---
|
|
430
398
|
|
|
431
399
|
## WebSearch 配置指南
|
|
@@ -720,22 +688,9 @@ npx droid-patch --websearch --standalone droid-local
|
|
|
720
688
|
# 隐私模式:禁用遥测
|
|
721
689
|
npx droid-patch --disable-telemetry droid-private
|
|
722
690
|
|
|
723
|
-
# 状态栏模式:Claude 风格的终端状态栏
|
|
724
|
-
npx droid-patch --statusline droid-status
|
|
725
|
-
|
|
726
|
-
# 状态栏 + 会话浏览器:浏览和恢复历史会话
|
|
727
|
-
npx droid-patch --statusline --sessions droid-full
|
|
728
|
-
droid-full --sessions # 交互式会话浏览器
|
|
729
|
-
|
|
730
|
-
# Websearch + 状态栏:完整 UI 体验
|
|
731
|
-
npx droid-patch --websearch --statusline droid-full-ui
|
|
732
|
-
|
|
733
691
|
# 完全本地化:所有功能组合
|
|
734
692
|
npx droid-patch --is-custom --skip-login --websearch --standalone --disable-telemetry droid-full-local
|
|
735
693
|
|
|
736
|
-
# 终极设置:包含状态栏的所有功能
|
|
737
|
-
npx droid-patch --is-custom --skip-login --websearch --standalone --statusline --disable-telemetry droid-ultimate
|
|
738
|
-
|
|
739
694
|
# websearch + 自定义后端
|
|
740
695
|
npx droid-patch --websearch --api-base=http://127.0.0.1:20002 droid-custom
|
|
741
696
|
|
|
@@ -749,8 +704,6 @@ npx droid-patch list
|
|
|
749
704
|
# 清理
|
|
750
705
|
npx droid-patch remove droid-search # 删除单个别名
|
|
751
706
|
npx droid-patch remove --flag=websearch # 删除所有 websearch 别名
|
|
752
|
-
npx droid-patch remove --flag=statusline # 删除所有 statusline 别名
|
|
753
|
-
npx droid-patch remove --flag=sessions # 删除所有启用会话浏览器的别名
|
|
754
707
|
npx droid-patch remove --flag=standalone # 删除所有 standalone 别名
|
|
755
708
|
npx droid-patch remove --patch-version=0.4.0 # 按 droid-patch 版本删除
|
|
756
709
|
npx droid-patch clear # 删除所有
|
|
@@ -255,16 +255,16 @@ function formatPatches(patches) {
|
|
|
255
255
|
const applied = [];
|
|
256
256
|
if (patches.isCustom) applied.push("isCustom");
|
|
257
257
|
if (patches.skipLogin) applied.push("skipLogin");
|
|
258
|
-
if (patches.apiBase && !patches.websearch) applied.push(`apiBase(${patches.apiBase})`);
|
|
258
|
+
if (patches.apiBase && !patches.websearch && !patches.websearchProxy) applied.push(`apiBase(${patches.apiBase})`);
|
|
259
259
|
if (patches.websearch) {
|
|
260
260
|
const target = patches.apiBase || "api.factory.ai";
|
|
261
261
|
applied.push(`websearch(${target})`);
|
|
262
262
|
}
|
|
263
|
-
if (patches.
|
|
263
|
+
if (patches.websearchProxy) applied.push("websearchProxy(native)");
|
|
264
|
+
if (patches.proxy && !patches.websearch && !patches.websearchProxy) applied.push(`websearch(${patches.proxy})`);
|
|
264
265
|
if (patches.reasoningEffort) applied.push("reasoningEffort");
|
|
265
266
|
if (patches.noTelemetry) applied.push("noTelemetry");
|
|
266
267
|
if (patches.standalone) applied.push("standalone");
|
|
267
|
-
if (patches.statusline) applied.push("statusline");
|
|
268
268
|
if (patches.autoHigh) applied.push("autoHigh");
|
|
269
269
|
return applied.length > 0 ? applied.join(", ") : "(none)";
|
|
270
270
|
}
|
|
@@ -525,6 +525,7 @@ async function removeAlias(aliasName) {
|
|
|
525
525
|
const statuslineDir = join(DROID_PATCH_DIR, "statusline");
|
|
526
526
|
const statuslineWrapperPath = join(statuslineDir, aliasName);
|
|
527
527
|
const statuslineMonitorPath = join(statuslineDir, `${aliasName}-statusline.js`);
|
|
528
|
+
const statuslineSessionsPath = join(statuslineDir, `${aliasName}-sessions.js`);
|
|
528
529
|
if (existsSync(statuslineWrapperPath)) {
|
|
529
530
|
await unlink(statuslineWrapperPath);
|
|
530
531
|
console.log(styleText("green", ` Removed statusline wrapper: ${statuslineWrapperPath}`));
|
|
@@ -535,6 +536,11 @@ async function removeAlias(aliasName) {
|
|
|
535
536
|
console.log(styleText("green", ` Removed statusline monitor: ${statuslineMonitorPath}`));
|
|
536
537
|
removed = true;
|
|
537
538
|
}
|
|
539
|
+
if (existsSync(statuslineSessionsPath)) {
|
|
540
|
+
await unlink(statuslineSessionsPath);
|
|
541
|
+
console.log(styleText("green", ` Removed sessions browser: ${statuslineSessionsPath}`));
|
|
542
|
+
removed = true;
|
|
543
|
+
}
|
|
538
544
|
if (await removeAliasMetadata(aliasName)) {
|
|
539
545
|
console.log(styleText("green", ` Removed metadata`));
|
|
540
546
|
removed = true;
|
|
@@ -848,9 +854,6 @@ async function removeAliasesByFilter(filter) {
|
|
|
848
854
|
case "websearch":
|
|
849
855
|
if (!patches.websearch) matches = false;
|
|
850
856
|
break;
|
|
851
|
-
case "statusline":
|
|
852
|
-
if (!patches.statusline) matches = false;
|
|
853
|
-
break;
|
|
854
857
|
case "reasoning-effort":
|
|
855
858
|
if (!patches.reasoningEffort) matches = false;
|
|
856
859
|
break;
|
|
@@ -978,4 +981,4 @@ async function clearAllAliases() {
|
|
|
978
981
|
|
|
979
982
|
//#endregion
|
|
980
983
|
export { removeAlias as a, restoreOriginal as c, listAllMetadata as d, loadAliasMetadata as f, listAliases as i, createMetadata as l, patchDroid as m, createAlias as n, removeAliasesByFilter as o, saveAliasMetadata as p, createAliasForWrapper as r, replaceOriginal as s, clearAllAliases as t, formatPatches as u };
|
|
981
|
-
//# sourceMappingURL=alias-
|
|
984
|
+
//# sourceMappingURL=alias-CX4QSelz.mjs.map
|