chore: rename @qwen-code/sdk-typescript to @qwen-code/sdk

This commit is contained in:
mingholy.lmh
2025-12-05 21:47:26 +08:00
parent 0e9255b122
commit 96d458fa8c
20 changed files with 31 additions and 37 deletions

View File

@@ -202,7 +202,7 @@ jobs:
registry-url: 'https://registry.npmjs.org'
scope: '@qwen-code'
- name: 'Publish @qwen-code/sdk-typescript'
- name: 'Publish @qwen-code/sdk'
working-directory: 'packages/sdk-typescript'
run: |-
npm publish --access public --tag=${{ steps.version.outputs.NPM_TAG }} ${{ steps.vars.outputs.is_dry_run == 'true' && '--dry-run' || '' }}

View File

@@ -13,7 +13,7 @@ import {
isSDKAssistantMessage,
type TextBlock,
type ContentBlock,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import { SDKTestHelper, createSharedTestOptions } from './test-helper.js';
const SHARED_TEST_OPTIONS = createSharedTestOptions();

View File

@@ -17,7 +17,7 @@ import {
isSDKAssistantMessage,
isSDKSystemMessage,
type SDKMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
extractText,

View File

@@ -19,7 +19,7 @@ import {
type SDKMessage,
type ToolUseBlock,
type SDKSystemMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
createMCPServer,

View File

@@ -21,7 +21,7 @@ import {
type SDKMessage,
type ControlMessage,
type ToolUseBlock,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import { SDKTestHelper, createSharedTestOptions } from './test-helper.js';
const SHARED_TEST_OPTIONS = createSharedTestOptions();

View File

@@ -22,7 +22,7 @@ import {
type SDKUserMessage,
type ToolUseBlock,
type ContentBlock,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
createSharedTestOptions,

View File

@@ -22,7 +22,7 @@ import {
isSDKSystemMessage,
type SDKMessage,
type SDKSystemMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
extractText,

View File

@@ -13,7 +13,7 @@ import {
type SDKMessage,
type SDKSystemMessage,
type SDKAssistantMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
extractText,

View File

@@ -17,7 +17,7 @@ import {
type SubagentConfig,
type ContentBlock,
type ToolUseBlock,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
SDKTestHelper,
extractText,

View File

@@ -9,7 +9,7 @@ import {
isSDKAssistantMessage,
isSDKSystemMessage,
type SDKUserMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import { SDKTestHelper, createSharedTestOptions } from './test-helper.js';
const SHARED_TEST_OPTIONS = createSharedTestOptions();

View File

@@ -21,12 +21,12 @@ import type {
ContentBlock,
TextBlock,
ToolUseBlock,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
import {
isSDKAssistantMessage,
isSDKSystemMessage,
isSDKResultMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
// ============================================================================
// Core Test Helper Class

View File

@@ -12,11 +12,7 @@
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import {
query,
isSDKAssistantMessage,
type SDKMessage,
} from '@qwen-code/sdk-typescript';
import { query, isSDKAssistantMessage, type SDKMessage } from '@qwen-code/sdk';
import {
SDKTestHelper,
extractText,

View File

@@ -5,9 +5,7 @@
"allowJs": true,
"baseUrl": ".",
"paths": {
"@qwen-code/sdk-typescript": [
"../packages/sdk-typescript/dist/index.d.ts"
]
"@qwen-code/sdk": ["../packages/sdk-typescript/dist/index.d.ts"]
}
},
"include": ["**/*.ts"],

View File

@@ -31,7 +31,7 @@ export default defineConfig({
resolve: {
alias: {
// Use built SDK bundle for e2e tests
'@qwen-code/sdk-typescript': resolve(
'@qwen-code/sdk': resolve(
__dirname,
'../packages/sdk-typescript/dist/index.mjs',
),

4
package-lock.json generated
View File

@@ -2793,7 +2793,7 @@
"resolved": "packages/test-utils",
"link": true
},
"node_modules/@qwen-code/sdk-typescript": {
"node_modules/@qwen-code/sdk": {
"resolved": "packages/sdk-typescript",
"link": true
},
@@ -16676,7 +16676,7 @@
}
},
"packages/sdk-typescript": {
"name": "@qwen-code/sdk-typescript",
"name": "@qwen-code/sdk",
"version": "0.1.0",
"license": "Apache-2.0",
"dependencies": {

View File

@@ -1,4 +1,4 @@
# @qwen-code/sdk-typescript
# @qwen-code/sdk
A minimum experimental TypeScript SDK for programmatic access to Qwen Code.
@@ -7,7 +7,7 @@ Feel free to submit a feature request/issue/PR.
## Installation
```bash
npm install @qwen-code/sdk-typescript
npm install @qwen-code/sdk
```
## Requirements
@@ -20,7 +20,7 @@ npm install @qwen-code/sdk-typescript
## Quick Start
```typescript
import { query } from '@qwen-code/sdk-typescript';
import { query } from '@qwen-code/sdk';
// Single-turn query
const result = query({
@@ -107,7 +107,7 @@ import {
isSDKSystemMessage,
isSDKResultMessage,
isSDKPartialAssistantMessage,
} from '@qwen-code/sdk-typescript';
} from '@qwen-code/sdk';
for await (const message of result) {
if (isSDKAssistantMessage(message)) {
@@ -167,7 +167,7 @@ The SDK supports different permission modes for controlling tool execution:
### Multi-turn Conversation
```typescript
import { query, type SDKUserMessage } from '@qwen-code/sdk-typescript';
import { query, type SDKUserMessage } from '@qwen-code/sdk';
async function* generateMessages(): AsyncIterable<SDKUserMessage> {
yield {
@@ -201,7 +201,7 @@ for await (const message of result) {
### Custom Permission Handler
```typescript
import { query, type CanUseTool } from '@qwen-code/sdk-typescript';
import { query, type CanUseTool } from '@qwen-code/sdk';
const canUseTool: CanUseTool = async (toolName, input, { signal }) => {
// Allow all read operations
@@ -230,7 +230,7 @@ const result = query({
### With External MCP Servers
```typescript
import { query } from '@qwen-code/sdk-typescript';
import { query } from '@qwen-code/sdk';
const result = query({
prompt: 'Use the custom tool from my MCP server',
@@ -290,7 +290,7 @@ Returns a `McpSdkServerConfigWithInstance` object that can be passed directly to
```typescript
import { z } from 'zod';
import { query, tool, createSdkMcpServer } from '@qwen-code/sdk-typescript';
import { query, tool, createSdkMcpServer } from '@qwen-code/sdk';
// Define a tool with Zod schema
const calculatorTool = tool(
@@ -327,7 +327,7 @@ for await (const message of result) {
### Abort a Query
```typescript
import { query, isAbortError } from '@qwen-code/sdk-typescript';
import { query, isAbortError } from '@qwen-code/sdk';
const abortController = new AbortController();
@@ -359,7 +359,7 @@ try {
The SDK provides an `AbortError` class for handling aborted queries:
```typescript
import { AbortError, isAbortError } from '@qwen-code/sdk-typescript';
import { AbortError, isAbortError } from '@qwen-code/sdk';
try {
// ... query operations

View File

@@ -1,5 +1,5 @@
{
"name": "@qwen-code/sdk-typescript",
"name": "@qwen-code/sdk",
"version": "0.1.0",
"description": "TypeScript SDK for programmatic access to qwen-code CLI",
"main": "./dist/index.cjs",

View File

@@ -14,7 +14,7 @@ import { dirname, join } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const PACKAGE_NAME = '@qwen-code/sdk-typescript';
const PACKAGE_NAME = '@qwen-code/sdk';
const TAG_PREFIX = 'sdk-typescript-v';
function readJson(filePath) {

View File

@@ -37,7 +37,7 @@ export type McpSdkServerConfigWithInstance = {
* @example
* ```typescript
* import { z } from 'zod';
* import { tool, createSdkMcpServer } from '@qwen-code/sdk-typescript';
* import { tool, createSdkMcpServer } from '@qwen-code/sdk';
*
* const calculatorTool = tool(
* 'calculate_sum',

View File

@@ -32,7 +32,7 @@ export type SdkMcpToolDefinition<Schema extends ZodRawShape = ZodRawShape> = {
* @example
* ```typescript
* import { z } from 'zod';
* import { tool } from '@qwen-code/sdk-typescript';
* import { tool } from '@qwen-code/sdk';
*
* const calculatorTool = tool(
* 'calculate_sum',