@@ -22,10 +22,31 @@ describe('readFeishuConfig', () => {
2222 expect ( config . feishuAppId ) . toBe ( 'cli_test_app_id' ) ;
2323 expect ( config . feishuAppSecret ) . toBe ( 'test-secret' ) ;
2424 expect ( config . feishuBaseUrl ) . toBe ( 'https://example.invalid' ) ;
25+ expect ( config . feishuModelSelectionTimeoutMs ) . toBe ( 10_000 ) ;
2526 expect ( 'feishuPort' in config ) . toBe ( false ) ;
2627 expect ( config . agentTimeoutMs ) . toBeGreaterThan ( 0 ) ;
2728 } ) ;
2829
30+ it ( 'allows overriding the model auto-selection timeout' , ( ) => {
31+ const config = readFeishuConfig ( {
32+ ...process . env ,
33+ FEISHU_APP_ID : 'cli_test_app_id' ,
34+ FEISHU_APP_SECRET : 'test-secret' ,
35+ FEISHU_MODEL_SELECTION_TIMEOUT_MS : '2500' ,
36+ } ) ;
37+
38+ expect ( config . feishuModelSelectionTimeoutMs ) . toBe ( 2_500 ) ;
39+ } ) ;
40+
41+ it ( 'rejects dirty model auto-selection timeout input' , ( ) => {
42+ expect ( ( ) => readFeishuConfig ( {
43+ ...process . env ,
44+ FEISHU_APP_ID : 'cli_test_app_id' ,
45+ FEISHU_APP_SECRET : 'test-secret' ,
46+ FEISHU_MODEL_SELECTION_TIMEOUT_MS : '10s' ,
47+ } ) ) . toThrow ( 'Invalid numeric environment variable: FEISHU_MODEL_SELECTION_TIMEOUT_MS' ) ;
48+ } ) ;
49+
2950 it ( 'throws when required Feishu environment variables are missing' , ( ) => {
3051 expect ( ( ) => readFeishuConfig ( {
3152 ...process . env ,
@@ -47,6 +68,8 @@ describe('readFeishuConfig', () => {
4768 artifactMaxSizeBytes : 123_456 ,
4869 claudeBin : '/tmp/bin/claude' ,
4970 codexBin : '/tmp/bin/codex' ,
71+ opencodeBin : '/tmp/bin/opencode' ,
72+ feishuModelSelectionTimeoutMs : 2_345 ,
5073 feishuAppId : 'test-app-id' ,
5174 feishuAppSecret : 'test-secret' ,
5275 feishuBaseUrl : 'https://open.feishu.cn' ,
@@ -62,6 +85,8 @@ describe('readFeishuConfig', () => {
6285 expect ( process . env [ 'CLAUDE_CWD' ] ) . toBe ( '/tmp/feishu-workspace' ) ;
6386 expect ( process . env [ 'CLAUDE_BIN' ] ) . toBe ( '/tmp/bin/claude' ) ;
6487 expect ( process . env [ 'CODEX_BIN' ] ) . toBe ( '/tmp/bin/codex' ) ;
88+ expect ( process . env [ 'OPENCODE_BIN' ] ) . toBe ( '/tmp/bin/opencode' ) ;
89+ expect ( process . env [ 'FEISHU_MODEL_SELECTION_TIMEOUT_MS' ] ) . toBe ( '2345' ) ;
6590 } ) ;
6691} ) ;
6792
@@ -76,6 +101,8 @@ describe('startup entry', () => {
76101 artifactMaxSizeBytes : 8 * 1024 * 1024 ,
77102 claudeBin : '/opt/homebrew/bin/claude' ,
78103 codexBin : '/opt/homebrew/bin/codex' ,
104+ opencodeBin : '/opt/homebrew/bin/opencode' ,
105+ feishuModelSelectionTimeoutMs : 10_000 ,
79106 feishuAppId : 'test-app-id' ,
80107 feishuAppSecret : 'test-secret' ,
81108 feishuBaseUrl : 'https://open.feishu.cn' ,
@@ -104,6 +131,8 @@ describe('startup entry', () => {
104131 artifactMaxSizeBytes : 8 * 1024 * 1024 ,
105132 claudeBin : '/opt/homebrew/bin/claude' ,
106133 codexBin : '/opt/homebrew/bin/codex' ,
134+ opencodeBin : '/opt/homebrew/bin/opencode' ,
135+ feishuModelSelectionTimeoutMs : 10_000 ,
107136 feishuAppId : 'test-app-id' ,
108137 feishuAppSecret : 'test-secret' ,
109138 feishuBaseUrl : 'https://open.feishu.cn' ,
0 commit comments