qianshou 3.1.3

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_EN.md ADDED
@@ -0,0 +1,396 @@
1
+ <h1 align="center">Qianshou</h1>
2
+
3
+ <p align="center">
4
+ <strong>AI Agent Application for Office Professionals.</strong><br>
5
+ Understand project documentation and codebases. Plan complex tasks. Execute autonomously.<br>
6
+ Your terminal AI teammate.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://zyinfo.pro/qianshou/">📖 Official Documentation</a> •
11
+ <a href="#installation">🚀 Quick Start</a> •
12
+ <a href="#configuration">⚙️ Configuration Guide</a>
13
+ </p>
14
+
15
+ ---
16
+
17
+ ## Table of Contents
18
+
19
+ - [What is Qianshou](#what-is-qianshou)
20
+ - [Core Features](#core-features)
21
+ - [Installation](#installation)
22
+ - [Configuration](#configuration)
23
+ - [Quick Start](#quick-start)
24
+ - [Usage](#usage)
25
+ - [Experimental Features](#experimental-features)
26
+
27
+ ---
28
+
29
+ ## What is Qianshou
30
+
31
+ Qianshou is an **agent-based coding tool** that runs in your terminal. Unlike traditional code completion tools, Qianshou can understand your entire codebase, plan complex multi-step tasks, and execute them autonomously.
32
+
33
+ Think of it as an AI teammate that can:
34
+ - Read and understand large-scale projects
35
+ - Break down complex requirements into executable steps
36
+ - Write, modify, and refactor code across multiple files
37
+ - Run terminal commands and manage Git workflows
38
+ - Explain code logic and generate documentation
39
+
40
+ **Learn more:** [https://zyinfo.pro/qianshou/](https://zyinfo.pro/qianshou/)
41
+
42
+ ---
43
+
44
+ ## Core Features
45
+
46
+ ### 🧠 Agent-Based Coding
47
+
48
+ Qianshou runs as an **autonomous agent**, not just a passive assistant. When you give it a high-level goal like "add OAuth user authentication," it will:
49
+
50
+ 1. **Understand Intent** - Analyze your natural language request
51
+ 2. **Scan Context** - Read relevant files and understand project structure
52
+ 3. **Create Plan** - Break down the task into clear, actionable steps
53
+ 4. **Execute** - Implement each step with your approval
54
+ 5. **Iterate** - Report progress and seek clarification when needed
55
+
56
+ ### 📚 Codebase-Level Understanding
57
+
58
+ With support for **200K+ token context windows**, Qianshou can analyze entire projects at once. It understands:
59
+ - Project structure and module dependencies
60
+ - Coding patterns and design conventions
61
+ - Cross-file relationships and architectural decisions
62
+
63
+ ### 🔧 Deep Code Analysis
64
+
65
+ - **Explain Complex Code** - Get detailed explanations of functions, algorithms, and logic flows
66
+ - **Trace Function Calls** - Follow execution paths through the codebase
67
+ - **Identify Issues** - Detect performance bottlenecks, security vulnerabilities, and potential bugs
68
+ - **Smart Refactoring** - Execute large-scale, cross-file code transformations
69
+
70
+ ### ⚡ Workflow Automation
71
+
72
+ Qianshou seamlessly integrates with your development workflow:
73
+
74
+ - **Run Terminal Commands** - Execute `npm install`, run tests, build Docker images
75
+ - **Git Integration** - Search commit history, resolve merge conflicts, generate commit messages
76
+ - **Test Generation** - Automatically create comprehensive unit and integration tests
77
+ - **Documentation Generation** - Generate API docs, code comments, and README files
78
+
79
+ ### 🔌 Extensible Architecture
80
+
81
+ - **MCP Protocol** - Connect external tools and APIs via Model Context Protocol
82
+ - **Custom Skills** - Write your own commands and workflows
83
+ - **Plugin System** - Extend functionality with community plugins
84
+ - **IDE Agnostic** - Works with any editor (VS Code, JetBrains, Vim, etc.)
85
+
86
+ ### 🌐 Browser Automation
87
+
88
+ Qianshou supports browser automation with deep Chrome integration:
89
+
90
+ - **Web Interaction** - Auto-click elements, fill forms, capture screenshots
91
+ - **Tab Management** - Read and control browser tabs
92
+ - **Console Logs** - Read browser console logs and network requests
93
+ - **OAuth Auth** - Support for sites requiring login state
94
+
95
+ **Enable with:**
96
+ ```bash
97
+ # Start with --chrome flag
98
+ qianshou --chrome
99
+
100
+ # Or set environment variable
101
+ export QS_ENABLE_CFC=1
102
+ qianshou
103
+ ```
104
+
105
+ **Prerequisites:**
106
+ - Requires [Qianshou Chrome Extension](https://clau.de/chrome)
107
+ - Supports Chrome, Brave, Edge, and other Chromium browsers
108
+
109
+ ---
110
+
111
+ ## Installation
112
+
113
+ > **Detailed Installation Guide:** [https://zyinfo.pro/qianshou/](https://zyinfo.pro/qianshou/)
114
+
115
+ ### Windows Installation
116
+
117
+ Open PowerShell terminal in Windows Terminal (right-click Windows button, click "Terminal"), then execute:
118
+
119
+ ```powershell
120
+ # Install Git (or visit https://git-scm.com/install/windows for alternative methods)
121
+ winget install --exact --source winget --id Git.Git
122
+
123
+ # Install Node.js (or visit https://nodejs.org/en/download for alternative methods)
124
+ winget install --exact --source winget --id OpenJS.NodeJS
125
+
126
+ # Set script execution policy
127
+ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
128
+
129
+ # Close terminal window, open a new terminal window, then install Qianshou
130
+ npm install -g qianshou --registry=https://registry.npmmirror.com
131
+
132
+ # Initialize configuration
133
+ node --eval "
134
+ const homeDir = os.homedir();
135
+ const filePath = path.join(homeDir, '.claude.json');
136
+ if (fs.existsSync(filePath)) {
137
+ const content = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
138
+ fs.writeFileSync(filePath, JSON.stringify({ ...content, hasCompletedOnboarding: true }, null, 2), 'utf-8');
139
+ } else {
140
+ fs.writeFileSync(filePath, JSON.stringify({ hasCompletedOnboarding: true }), 'utf-8');
141
+ }"
142
+ ```
143
+
144
+ ### macOS/Linux Installation
145
+
146
+ ```bash
147
+ npm install -g qianshou
148
+ ```
149
+
150
+ ### System Requirements
151
+
152
+ - **Runtime**: [Node.js](https://nodejs.org/) or [Bun](https://bun.sh) >= 1.3.11
153
+ - **Operating System**: macOS, Linux, or Windows (WSL recommended)
154
+ - **Authentication**: API keys for your chosen provider
155
+
156
+ ---
157
+
158
+ ## Configuration
159
+
160
+ > **More Configuration Examples:** [https://zyinfo.pro/qianshou/](https://zyinfo.pro/qianshou/)
161
+
162
+ Qianshou natively supports multiple AI providers. Simply set the appropriate environment variables to switch providers.
163
+
164
+ ### Zhipu GLM (Recommended)
165
+
166
+ ```bash
167
+ export QS_AUTH_TOKEN="your-zhipu-api-key"
168
+ export QS_BASE_URL=https://open.bigmodel.cn/api/anthropic
169
+ export API_TIMEOUT_MS="3000000"
170
+ export QS_DISABLE_NONESSENTIAL_TRAFFIC=1
171
+ export QS_SMALL_MODEL="glm-4.5-air"
172
+ export QS_MIDDLE_MODEL="glm-4.7"
173
+ export QS_BIG_MODEL="glm-5.1"
174
+ export QS_MODEL="glm-5.1"
175
+ export ENABLE_TOOL_SEARCH=false
176
+
177
+ # Enter your working directory
178
+ cd your-work-directory
179
+
180
+ # Start Qianshou (bypassPermissions mode auto-approves all actions)
181
+ qianshou --permission-mode bypassPermissions
182
+ ```
183
+
184
+ ### Alibaba Cloud Tongyi Qianwen
185
+
186
+ ```bash
187
+ export QS_AUTH_TOKEN="your-aliyun-api-key"
188
+ export QS_BASE_URL="https://coding.dashscope.aliyuncs.com/apps/anthropic"
189
+ export API_TIMEOUT_MS=600000
190
+ export QS_MODEL="qwen-max"
191
+ export QS_BIG_MODEL="qwen-max"
192
+ export QS_MIDDLE_MODEL="qwen-plus"
193
+ export QS_SMALL_MODEL="qwen-turbo"
194
+
195
+ qianshou --permission-mode bypassPermissions
196
+ ```
197
+
198
+ ### DeepSeek
199
+
200
+ ```bash
201
+ export QS_BASE_URL=https://api.deepseek.com/anthropic
202
+ export QS_AUTH_TOKEN=sk-your-deepseek-key
203
+ export API_TIMEOUT_MS=600000
204
+ export QS_MODEL=deepseek-chat
205
+ export QS_SMALL_FAST_MODEL=deepseek-chat
206
+ export QS_DISABLE_NONESSENTIAL_TRAFFIC=1
207
+
208
+ qianshou --permission-mode bypassPermissions
209
+ ```
210
+
211
+ ### Desktop Office Edition
212
+
213
+ To handle Word, Excel, PDF and other office documents, add the following configuration:
214
+
215
+ ```bash
216
+ export QS_OFFICE=1
217
+ qianshou --permission-mode bypassPermissions
218
+ ```
219
+
220
+ ### Create Startup Script
221
+
222
+ It's recommended to save as a startup script (Linux/macOS: `.sh`, Windows: `.bat`) for convenience:
223
+
224
+ **Linux/macOS (qianshou.sh):**
225
+ ```bash
226
+ #!/bin/bash
227
+ export QS_AUTH_TOKEN="your-api-key"
228
+ export QS_BASE_URL="https://open.bigmodel.cn/api/anthropic"
229
+ export QS_MODEL="glm-5.1"
230
+ export QS_BIG_MODEL="glm-5.1"
231
+ export QS_MIDDLE_MODEL="glm-4.7"
232
+ export QS_SMALL_MODEL="glm-4.7"
233
+ cd "$1"
234
+ qianshou --permission-mode bypassPermissions
235
+ ```
236
+
237
+ **Windows (qianshou.bat):**
238
+ ```batch
239
+ @echo off
240
+ set QS_AUTH_TOKEN=your-api-key
241
+ set QS_BASE_URL=https://open.bigmodel.cn/api/anthropic
242
+ set QS_MODEL=glm-5.1
243
+ set QS_BIG_MODEL=glm-5.1
244
+ set QS_MIDDLE_MODEL=glm-4.7
245
+ set QS_SMALL_MODEL=glm-4.7
246
+ cd /d %1
247
+ qianshou --permission-mode bypassPermissions
248
+ ```
249
+
250
+ ### AGENTS.md Configuration
251
+
252
+ You can create an `AGENTS.md` file in your project root to help AI better understand your project.
253
+
254
+ ---
255
+
256
+ ## Quick Start
257
+
258
+ ### Three Steps to Get Started
259
+
260
+ **Step 1: Install Qianshou** (see [Installation](#installation) section above)
261
+
262
+ **Step 2: Configure Authentication** (see [Configuration](#configuration) section above)
263
+
264
+ **Step 3: Start Using**
265
+
266
+ ```bash
267
+ # Enter your working directory
268
+ cd your-work-directory
269
+
270
+ # Start Qianshou
271
+ qianshou --permission-mode bypassPermissions
272
+
273
+ # Or use auto-confirmation mode
274
+ qianshou --permission-mode bypassPermissions
275
+ ```
276
+
277
+ ### Common Startup Parameters
278
+
279
+ | Parameter | Description |
280
+ |-----------|-------------|
281
+ | `--permission-mode bypassPermissions` | Auto-approve all actions (suitable for daily use) |
282
+ | `--auto-run` | Auto-run mode, no confirmation needed for each command |
283
+ | `--chrome` | Enable browser automation mode |
284
+ | `-p "prompt"` | One-shot execution mode, run command directly |
285
+
286
+ ### Usage Tips
287
+
288
+ **Paste multi-line content:**
289
+ - Press `Ctrl+G` to open text box, paste content and save/close
290
+ - Or write content to a file and reference with `@filename`
291
+
292
+ **Reference:** [https://zyinfo.pro/qianshou/](https://zyinfo.pro/qianshou/)
293
+
294
+ ---
295
+
296
+ ## Usage
297
+
298
+ ### Interactive REPL
299
+
300
+ ```bash
301
+ qianshou --permission-mode bypassPermissions
302
+ ```
303
+
304
+ ### Conversation Examples
305
+
306
+ **Implementing a new feature:**
307
+ ```
308
+ You: Add a REST API endpoint for user registration
309
+
310
+ Qianshou: I'll help you add a user registration endpoint. Let me first check your project structure...
311
+
312
+ [Reading files, analyzing codebase]
313
+
314
+ I'll create the following:
315
+ 1. POST /api/users/register endpoint
316
+ 2. User validation schema
317
+ 3. Database model for users
318
+ 4. Unit tests for the endpoint
319
+
320
+ Shall I proceed?
321
+ ```
322
+
323
+ **Debugging an issue:**
324
+ ```
325
+ You: I'm getting a 500 error when uploading files. Here's the stack trace...
326
+
327
+ Qianshou: Looking at the error and your code, the issue appears to be in the file upload handler.
328
+ The problem is on line 42, where the buffer size is not handled properly. Let me fix this...
329
+ ```
330
+
331
+ **Refactoring code:**
332
+ ```
333
+ You: Refactor the authentication module to use JWT tokens
334
+
335
+ Qianshou: I'll refactor your authentication module to use JWT. This will involve:
336
+ 1. Installing the jsonwebtoken package
337
+ 2. Creating JWT utility functions
338
+ 3. Updating login/logout handlers
339
+ 4. Adding token verification middleware
340
+
341
+ [Proceeding with refactor]
342
+ ```
343
+
344
+ ---
345
+
346
+ ## Experimental Features
347
+
348
+ The `build:dev:full` build enables 54 experimental feature flags. Highlights include:
349
+
350
+ ### Interaction & UI
351
+ - **ULTRAPLAN** - Remote multi-agent planning
352
+ - **ULTRATHINK** - Deep thinking mode for complex reasoning
353
+ - **VOICE_MODE** - Push-to-talk voice input
354
+ - **TOKEN_BUDGET** - Usage tracking and warnings
355
+ - **HISTORY_PICKER** - Interactive prompt history
356
+ - **QUICK_SEARCH** - Quick prompt search
357
+
358
+ ### Agents, Memory & Planning
359
+ - **BUILTIN_EXPLORE_PLAN_AGENTS** - Built-in agent presets
360
+ - **VERIFICATION_AGENT** - Task verification
361
+ - **AGENT_TRIGGERS** - Background automation
362
+ - **EXTRACT_MEMORIES** - Automatic memory extraction
363
+ - **TEAMMEM** - Team memory files
364
+
365
+ ### Tools & Infrastructure
366
+ - **BRIDGE_MODE** - IDE remote control bridge
367
+ - **BASH_CLASSIFIER** - Intelligent permission decisions
368
+ - **MCP_RICH_OUTPUT** - Enhanced MCP output
369
+
370
+ ### Browser Integration
371
+ - **Claude in Chrome** - Chrome browser automation
372
+ - Support for auto-clicking, form filling, screenshots, and more
373
+ - Read console logs and network requests
374
+ - Works with sites requiring login state
375
+ - Requires [Chrome extension](https://clau.de/chrome)
376
+
377
+ **Enable browser mode:**
378
+ ```bash
379
+ # Method 1: Use --chrome flag
380
+ qianshou --chrome
381
+
382
+ # Method 2: Set environment variable
383
+ export QS_ENABLE_CFC=1
384
+ qianshou
385
+ ```
386
+
387
+ ---
388
+
389
+ ## Related Links
390
+
391
+ - **Official Documentation:** [https://zyinfo.pro/qianshou/](https://zyinfo.pro/qianshou/)
392
+ - **GitHub Repository:** [https://github.com/yourusername/qianshou](https://github.com/yourusername/qianshou)
393
+
394
+ ---
395
+
396
+ **Built with ❤️ for developers who want more from their AI tools.**
package/package.json ADDED
@@ -0,0 +1,125 @@
1
+ {
2
+ "name": "qianshou",
3
+ "version": "3.1.3",
4
+ "description": "Qianshou - AI 助手 /Chinese",
5
+ "type": "module",
6
+ "packageManager": "bun@1.3.11",
7
+ "bin": {
8
+ "qianshou": "./qianshou.js"
9
+ },
10
+ "files": [
11
+ "qianshou.js",
12
+ "vendor",
13
+ "README.md",
14
+ "README_en.md",
15
+ "LICENSE"
16
+ ],
17
+ "engines": {
18
+ "bun": ">=1.3.11"
19
+ },
20
+ "scripts": {
21
+ "build": "bun run ./scripts/build.ts",
22
+ "build:dev": "bun run ./scripts/build.ts --dev",
23
+ "build:dev:full": "bun run ./scripts/build.ts --dev --feature-set=dev-full",
24
+ "compile": "bun run ./scripts/build.ts --compile",
25
+ "dev": "bun run ./src/entrypoints/cli.tsx"
26
+ },
27
+ "devDependencies": {
28
+ "@alcalzone/ansi-tokenize": "^0.3.0",
29
+ "@anthropic-ai/bedrock-sdk": "^0.26.4",
30
+ "@anthropic-ai/claude-agent-sdk": "^0.2.87",
31
+ "@anthropic-ai/foundry-sdk": "^0.2.3",
32
+ "@anthropic-ai/mcpb": "^2.1.2",
33
+ "@anthropic-ai/sandbox-runtime": "^0.0.44",
34
+ "@anthropic-ai/sdk": "^0.80.0",
35
+ "@anthropic-ai/vertex-sdk": "^0.14.4",
36
+ "@aws-sdk/client-bedrock": "^3.1020.0",
37
+ "@aws-sdk/client-bedrock-runtime": "^3.1020.0",
38
+ "@aws-sdk/client-sts": "^3.1020.0",
39
+ "@aws-sdk/credential-provider-node": "^3.972.28",
40
+ "@aws-sdk/credential-providers": "^3.1020.0",
41
+ "@azure/identity": "^4.13.1",
42
+ "@commander-js/extra-typings": "^14.0.0",
43
+ "@growthbook/growthbook": "^1.6.5",
44
+ "@modelcontextprotocol/sdk": "^1.29.0",
45
+ "@opentelemetry/api": "^1.9.1",
46
+ "@opentelemetry/api-logs": "^0.214.0",
47
+ "@opentelemetry/core": "^2.6.1",
48
+ "@opentelemetry/exporter-logs-otlp-grpc": "^0.214.0",
49
+ "@opentelemetry/exporter-logs-otlp-http": "^0.214.0",
50
+ "@opentelemetry/exporter-logs-otlp-proto": "^0.214.0",
51
+ "@opentelemetry/exporter-metrics-otlp-grpc": "^0.214.0",
52
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.214.0",
53
+ "@opentelemetry/exporter-metrics-otlp-proto": "^0.214.0",
54
+ "@opentelemetry/exporter-prometheus": "^0.214.0",
55
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.214.0",
56
+ "@opentelemetry/exporter-trace-otlp-http": "^0.214.0",
57
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.214.0",
58
+ "@opentelemetry/resources": "^2.6.1",
59
+ "@opentelemetry/sdk-logs": "^0.214.0",
60
+ "@opentelemetry/sdk-metrics": "^2.6.1",
61
+ "@opentelemetry/sdk-trace-base": "^2.6.1",
62
+ "@opentelemetry/semantic-conventions": "^1.40.0",
63
+ "@smithy/core": "^3.23.13",
64
+ "@smithy/node-http-handler": "^4.5.1",
65
+ "@types/bun": "^1.3.11",
66
+ "ajv": "^8.18.0",
67
+ "asciichart": "^1.5.25",
68
+ "auto-bind": "^5.0.1",
69
+ "axios": "^1.14.0",
70
+ "bidi-js": "^1.0.3",
71
+ "cacache": "^20.0.4",
72
+ "chalk": "^5.6.2",
73
+ "chokidar": "^5.0.0",
74
+ "cli-boxes": "^4.0.1",
75
+ "cli-highlight": "^2.1.11",
76
+ "code-excerpt": "^4.0.0",
77
+ "diff": "^8.0.4",
78
+ "emoji-regex": "^10.6.0",
79
+ "env-paths": "^4.0.0",
80
+ "execa": "^9.6.1",
81
+ "fflate": "^0.8.2",
82
+ "figures": "^6.1.0",
83
+ "fuse.js": "^7.1.0",
84
+ "get-east-asian-width": "^1.5.0",
85
+ "google-auth-library": "^10.6.2",
86
+ "highlight.js": "^11.11.1",
87
+ "https-proxy-agent": "^8.0.0",
88
+ "ignore": "^7.0.5",
89
+ "indent-string": "^5.0.0",
90
+ "ink": "^6.8.0",
91
+ "jsonc-parser": "^3.3.1",
92
+ "lodash-es": "^4.17.24",
93
+ "lru-cache": "^11.2.7",
94
+ "marked": "^17.0.5",
95
+ "p-map": "^7.0.4",
96
+ "picomatch": "^4.0.4",
97
+ "plist": "^3.1.0",
98
+ "proper-lockfile": "^4.1.2",
99
+ "qrcode": "^1.5.4",
100
+ "react": "^19.2.4",
101
+ "react-reconciler": "^0.33.0",
102
+ "semver": "^7.7.4",
103
+ "sharp": "^0.34.5",
104
+ "shell-quote": "^1.8.3",
105
+ "signal-exit": "^4.1.0",
106
+ "stack-utils": "^2.0.6",
107
+ "strip-ansi": "^7.2.0",
108
+ "supports-hyperlinks": "^4.4.0",
109
+ "tree-kill": "^1.2.2",
110
+ "turndown": "^7.2.2",
111
+ "type-fest": "^5.5.0",
112
+ "typescript": "^6.0.2",
113
+ "undici": "^7.24.6",
114
+ "usehooks-ts": "^3.1.1",
115
+ "vscode-jsonrpc": "^8.2.1",
116
+ "vscode-languageserver-protocol": "^3.17.5",
117
+ "vscode-languageserver-types": "^3.17.5",
118
+ "wrap-ansi": "^10.0.0",
119
+ "ws": "^8.20.0",
120
+ "xss": "^1.0.15",
121
+ "xxhash-wasm": "^1.1.0",
122
+ "yaml": "^2.8.3",
123
+ "zod": "^4.3.6"
124
+ }
125
+ }