@pikecode/api-key-manager 2.0.9 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikecode/api-key-manager",
3
- "version": "2.0.9",
3
+ "version": "2.1.1",
4
4
  "description": "A CLI tool for managing and switching multiple API provider configurations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -192,7 +192,31 @@ class EnvSwitcher extends BaseCommand {
192
192
 
193
193
  } catch (error) {
194
194
  UIHelper.clearLoadingAnimation(loadingInterval);
195
- throw error;
195
+
196
+ // 如果是 Claude Code 的"没有可恢复的会话"错误,自动移除 --continue 参数并重试
197
+ if (!isCodex &&
198
+ error.message.includes('没有可恢复的会话') &&
199
+ selectedLaunchArgs.includes('--continue')) {
200
+ Logger.info('会话不可用,自动移除 --continue 参数重新启动...');
201
+ console.log();
202
+
203
+ const retryArgs = selectedLaunchArgs.filter(arg => arg !== '--continue');
204
+ const retryLoadingInterval = UIHelper.createLoadingAnimation('正在重新启动(无历史恢复)...');
205
+
206
+ try {
207
+ await markProviderAsCurrent(this.configManager, provider, retryArgs);
208
+ UIHelper.clearLoadingAnimation(retryLoadingInterval);
209
+
210
+ console.log(UIHelper.createCard('准备就绪', `环境配置完成,正在启动 🚀 ${ideDisplayName}(新会话)...`, UIHelper.icons.success));
211
+ console.log();
212
+ await launchProviderProcess(provider, retryArgs);
213
+ } catch (retryError) {
214
+ UIHelper.clearLoadingAnimation(retryLoadingInterval);
215
+ throw retryError;
216
+ }
217
+ } else {
218
+ throw error;
219
+ }
196
220
  }
197
221
 
198
222
  } catch (error) {