@@ -214,7 +214,11 @@ describe("config agent writers", () => {
214214 } ) ;
215215
216216 test ( "qwen-code anthropic 端点走 anthropic 协议" , ( ) => {
217- qwenCode . write ( { baseUrl : ANTHROPIC_URL , apiKey : "sk-q" , model : "qwen3-max" } ) ;
217+ qwenCode . write ( {
218+ baseUrl : ANTHROPIC_URL ,
219+ apiKey : "sk-q" ,
220+ model : "qwen3-max" ,
221+ } ) ;
218222 const settings = readJsonAt ( ".qwen" , "settings.json" ) ;
219223 expect ( ( settings . security as { auth : { selectedType : string } } ) . auth . selectedType ) . toBe (
220224 "anthropic" ,
@@ -225,8 +229,16 @@ describe("config agent writers", () => {
225229 } ) ;
226230
227231 test ( "qwen-code 对自有 provider 项按 id upsert 而非追加" , ( ) => {
228- qwenCode . write ( { baseUrl : OAI_URL , apiKey : "sk-1" , model : "qwen3-coder-plus" } ) ;
229- qwenCode . write ( { baseUrl : OAI_URL , apiKey : "sk-2" , model : "qwen3-coder-plus" } ) ;
232+ qwenCode . write ( {
233+ baseUrl : OAI_URL ,
234+ apiKey : "sk-1" ,
235+ model : "qwen3-coder-plus" ,
236+ } ) ;
237+ qwenCode . write ( {
238+ baseUrl : OAI_URL ,
239+ apiKey : "sk-2" ,
240+ model : "qwen3-coder-plus" ,
241+ } ) ;
230242 const settings = readJsonAt ( ".qwen" , "settings.json" ) ;
231243 const openaiEntries = ( settings . modelProviders as Record < string , unknown [ ] > ) . openai ;
232244 expect ( openaiEntries ) . toHaveLength ( 1 ) ;
@@ -327,7 +339,11 @@ describe("config agent writers", () => {
327339 JSON . stringify ( { provider : { other : { name : "Other" } } } ) ,
328340 ) ;
329341
330- opencode . write ( { baseUrl : ANTHROPIC_URL , apiKey : "sk-o" , model : "qwen3-max" } ) ;
342+ opencode . write ( {
343+ baseUrl : ANTHROPIC_URL ,
344+ apiKey : "sk-o" ,
345+ model : "qwen3-max" ,
346+ } ) ;
331347 const config = readJsonAt ( ".config" , "opencode" , "opencode.json" ) ;
332348 const provider = config . provider as Record < string , Record < string , unknown > > ;
333349 expect ( provider . other ) . toBeDefined ( ) ;
@@ -351,7 +367,11 @@ describe("config agent writers", () => {
351367 } ) ;
352368
353369 test ( "openclaw 写入 provider、api、primary,并登记 defaults.models" , ( ) => {
354- openclaw . write ( { baseUrl : OAI_URL , apiKey : "sk-c" , model : "qwen3-coder-plus" } ) ;
370+ openclaw . write ( {
371+ baseUrl : OAI_URL ,
372+ apiKey : "sk-c" ,
373+ model : "qwen3-coder-plus" ,
374+ } ) ;
355375 const config = readJsonAt ( ".openclaw" , "openclaw.json" ) ;
356376 const models = config . models as Record < string , unknown > ;
357377 expect ( models . mode ) . toBe ( "merge" ) ;
@@ -496,19 +516,21 @@ describe("config agent writers", () => {
496516 // 预置 auth.json 无关键,验证合并保留
497517 writeFileSync ( join ( home , ".codex" , "auth.json" ) , JSON . stringify ( { EXISTING : "keep" } ) ) ;
498518
499- codex . write ( {
519+ const summary = codex . write ( {
500520 baseUrl : OAI_URL ,
501521 apiKey : "sk-x" ,
502522 model : "qwen3-coder-plus" ,
503523 } ) ;
524+ // 默认路径无警告
525+ expect ( summary . warnings ) . toBeUndefined ( ) ;
504526 const toml = readFileSync ( join ( home , ".codex" , "config.toml" ) , "utf8" ) ;
505527 expect ( toml ) . toContain ( 'model_provider = "bailian-cli"' ) ;
506528 expect ( toml ) . toContain ( 'model = "qwen3-coder-plus"' ) ;
507529 expect ( toml ) . toContain ( "[model_providers.bailian-cli]" ) ;
508530 expect ( toml ) . toContain ( `base_url = "${ OAI_URL } "` ) ;
509531 expect ( toml ) . toContain ( 'env_key = "OPENAI_API_KEY"' ) ;
510- // 未传 --wire-api 时默认 chat(所有模型可用 )
511- expect ( toml ) . toContain ( 'wire_api = "chat "' ) ;
532+ // 未传 --wire-api 时默认 responses(新版 Codex 已不支持 chat )
533+ expect ( toml ) . toContain ( 'wire_api = "responses "' ) ;
512534 expect ( toml ) . toContain ( "requires_openai_auth = true" ) ;
513535 // 合并:保留用户已有的无关配置
514536 expect ( toml ) . toContain ( 'approval_policy = "on-request"' ) ;
@@ -518,16 +540,17 @@ describe("config agent writers", () => {
518540 expect ( auth . OPENAI_API_KEY ) . toBe ( "sk-x" ) ;
519541 expect ( auth . EXISTING ) . toBe ( "keep" ) ;
520542
521- // --wire-api responses:支持 Responses API 的模型
522- codex . write ( {
543+ // --wire-api chat:仅旧版 Codex <= 0.80.0 可用,附带警告
544+ const summary2 = codex . write ( {
523545 baseUrl : OAI_URL ,
524546 apiKey : "sk-x" ,
525- model : "qwen3.7-plus " ,
526- wireApi : "responses " ,
547+ model : "glm-5 " ,
548+ wireApi : "chat " ,
527549 } ) ;
550+ expect ( summary2 . warnings ?. some ( ( warning ) => warning . includes ( "0.80.0" ) ) ) . toBe ( true ) ;
528551 const toml2 = readFileSync ( join ( home , ".codex" , "config.toml" ) , "utf8" ) ;
529- expect ( toml2 ) . toContain ( 'wire_api = "responses "' ) ;
530- expect ( toml2 ) . toContain ( 'model = "qwen3.7-plus "' ) ;
552+ expect ( toml2 ) . toContain ( 'wire_api = "chat "' ) ;
553+ expect ( toml2 ) . toContain ( 'model = "glm-5 "' ) ;
531554 } ) ;
532555
533556 test ( "已存在的配置文件会被备份为 .bak.<epoch>" , ( ) => {
0 commit comments