@qwen-code/sdk 0.1.5-preview.2 → 0.1.6-preview.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 +31 -0
- package/dist/cli/cli.js +243331 -226153
- package/dist/cli/locales/de.js +1658 -0
- package/dist/cli/locales/en.js +1709 -0
- package/dist/cli/locales/ja.js +1162 -0
- package/dist/cli/locales/pt.js +1653 -0
- package/dist/cli/locales/ru.js +1665 -0
- package/dist/cli/locales/zh.js +1529 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +15 -0
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ Creates a new query session with the Qwen Code.
|
|
|
60
60
|
| `permissionMode` | `'default' \| 'plan' \| 'auto-edit' \| 'yolo'` | `'default'` | Permission mode controlling tool execution approval. See [Permission Modes](#permission-modes) for details. |
|
|
61
61
|
| `canUseTool` | `CanUseTool` | - | Custom permission handler for tool execution approval. Invoked when a tool requires confirmation. Must respond within 60 seconds or the request will be auto-denied. See [Custom Permission Handler](#custom-permission-handler). |
|
|
62
62
|
| `env` | `Record<string, string>` | - | Environment variables to pass to the Qwen Code process. Merged with the current process environment. |
|
|
63
|
+
| `systemPrompt` | `string \| QuerySystemPromptPreset` | - | System prompt configuration for the main session. Use a string to fully override the built-in Qwen Code system prompt, or a preset object to keep the built-in prompt and append extra instructions. |
|
|
63
64
|
| `mcpServers` | `Record<string, McpServerConfig>` | - | MCP (Model Context Protocol) servers to connect. Supports external servers (stdio/SSE/HTTP) and SDK-embedded servers. External servers are configured with transport options like `command`, `args`, `url`, `httpUrl`, etc. SDK servers use `{ type: 'sdk', name: string, instance: Server }`. |
|
|
64
65
|
| `abortController` | `AbortController` | - | Controller to cancel the query session. Call `abortController.abort()` to terminate the session and cleanup resources. |
|
|
65
66
|
| `debug` | `boolean` | `false` | Enable debug mode for verbose logging from the CLI process. |
|
|
@@ -247,6 +248,36 @@ const result = query({
|
|
|
247
248
|
});
|
|
248
249
|
```
|
|
249
250
|
|
|
251
|
+
### Override the System Prompt
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { query } from '@qwen-code/sdk';
|
|
255
|
+
|
|
256
|
+
const result = query({
|
|
257
|
+
prompt: 'Say hello in one sentence.',
|
|
258
|
+
options: {
|
|
259
|
+
systemPrompt: 'You are a terse assistant. Answer in exactly one sentence.',
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Append to the Built-in System Prompt
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { query } from '@qwen-code/sdk';
|
|
268
|
+
|
|
269
|
+
const result = query({
|
|
270
|
+
prompt: 'Review the current directory.',
|
|
271
|
+
options: {
|
|
272
|
+
systemPrompt: {
|
|
273
|
+
type: 'preset',
|
|
274
|
+
preset: 'qwen_code',
|
|
275
|
+
append: 'Be terse and focus on concrete findings.',
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
```
|
|
280
|
+
|
|
250
281
|
### With SDK-Embedded MCP Servers
|
|
251
282
|
|
|
252
283
|
The SDK provides `tool` and `createSdkMcpServer` to create MCP servers that run in the same process as your SDK application. This is useful when you want to expose custom tools to the AI without running a separate server process.
|