diff --git a/bun.lock b/bun.lock index 5e37ce5cc..6b1c83465 100644 --- a/bun.lock +++ b/bun.lock @@ -117,7 +117,6 @@ "plist": "^3.1.0", "proper-lockfile": "^4.1.2", "qrcode": "^1.5.4", - "qrcode-terminal": "^0.12.0", "react": "^19.2.5", "react-compiler-runtime": "^1.0.0", "react-reconciler": "^0.33.0", @@ -2477,8 +2476,6 @@ "qrcode": ["qrcode@1.5.4", "https://registry.npmmirror.com/qrcode/-/qrcode-1.5.4.tgz", { "dependencies": { "dijkstrajs": "^1.0.1", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg=="], - "qrcode-terminal": ["qrcode-terminal@0.12.0", "", { "bin": { "qrcode-terminal": "./bin/qrcode-terminal.js" } }, "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ=="], - "qs": ["qs@6.15.1", "https://registry.npmmirror.com/qs/-/qs-6.15.1.tgz", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg=="], "queue-microtask": ["queue-microtask@1.2.3", "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], diff --git a/package.json b/package.json index ed0c5e676..262053031 100644 --- a/package.json +++ b/package.json @@ -67,11 +67,11 @@ }, "devDependencies": { "@alcalzone/ansi-tokenize": "^0.3.0", - "@ant/model-provider": "workspace:*", "@ant/claude-for-chrome-mcp": "workspace:*", "@ant/computer-use-input": "workspace:*", "@ant/computer-use-mcp": "workspace:*", "@ant/computer-use-swift": "workspace:*", + "@ant/model-provider": "workspace:*", "@anthropic-ai/bedrock-sdk": "^0.26.4", "@anthropic-ai/claude-agent-sdk": "^0.2.114", "@anthropic-ai/foundry-sdk": "^0.2.3", @@ -173,7 +173,6 @@ "plist": "^3.1.0", "proper-lockfile": "^4.1.2", "qrcode": "^1.5.4", - "qrcode-terminal": "^0.12.0", "react": "^19.2.5", "react-compiler-runtime": "^1.0.0", "react-reconciler": "^0.33.0", diff --git a/src/services/weixin/login.ts b/src/services/weixin/login.ts index 23789c4ce..fd5c68c4c 100644 --- a/src/services/weixin/login.ts +++ b/src/services/weixin/login.ts @@ -1,3 +1,5 @@ +import { toString as qrToString } from 'qrcode' + export interface QRCodeResult { qrcodeUrl?: string qrcodeId: string @@ -14,20 +16,12 @@ export interface LoginResult { } async function renderQrCodeToTerminal(qrcodeUrl: string): Promise { - const moduleName = 'qrcode-terminal' - const { default: qrcode } = (await import(moduleName)) as { - default: { - generate: ( - text: string, - options?: { small?: boolean }, - callback?: (output: string) => void, - ) => void - } - } - - qrcode.generate(qrcodeUrl, { small: true }, output => { - process.stderr.write(`${output}\n`) + const output = await qrToString(qrcodeUrl, { + type: 'terminal', + errorCorrectionLevel: 'L', + small: true, }) + process.stderr.write(`${output}\n`) } export async function startLogin(apiBaseUrl: string): Promise { diff --git a/src/types/qrcode-terminal.d.ts b/src/types/qrcode-terminal.d.ts deleted file mode 100644 index b1c2bdc71..000000000 --- a/src/types/qrcode-terminal.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare module 'qrcode-terminal' { - const qrcode: { - generate( - text: string, - options?: { small?: boolean }, - callback?: (output: string) => void, - ): void - } - - export default qrcode -}