codex-slot 0.1.32 → 0.1.33

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.
@@ -12,6 +12,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
12
12
  const account_store_1 = require("../account-store");
13
13
  const config_1 = require("../config");
14
14
  const login_1 = require("../login");
15
+ const relay_store_1 = require("../relay-store");
15
16
  const state_1 = require("../state");
16
17
  const text_1 = require("../text");
17
18
  /**
@@ -49,7 +50,11 @@ async function loginAccount(slotName) {
49
50
  * @throws 无显式抛出。
50
51
  */
51
52
  function removeAccount(slotName) {
52
- return (0, account_store_1.removeManagedAccount)(slotName);
53
+ const removed = (0, account_store_1.removeManagedAccount)(slotName);
54
+ if (removed) {
55
+ (0, relay_store_1.removeRelaySlot)(slotName);
56
+ }
57
+ return removed;
53
58
  }
54
59
  /**
55
60
  * 列出当前所有受管账号配置。
@@ -74,6 +79,9 @@ function listAccounts() {
74
79
  * @throws 当旧槽位不存在、新槽位已存在或目录迁移失败时抛出异常。
75
80
  */
76
81
  function renameAccount(oldName, newName) {
82
+ if ((0, relay_store_1.findRelaySlot)(oldName) && (0, relay_store_1.findRelaySlot)(newName)) {
83
+ throw new Error((0, text_1.bi)(`中转槽位 ${newName} 已存在`, `Relay slot already exists: ${newName}`));
84
+ }
77
85
  const config = (0, config_1.loadConfig)();
78
86
  const index = config.accounts.findIndex((item) => item.id === oldName);
79
87
  if (index < 0) {
@@ -121,5 +129,8 @@ function renameAccount(oldName, newName) {
121
129
  delete state.scheduler_stats[oldName];
122
130
  }
123
131
  });
132
+ if ((0, relay_store_1.findRelaySlot)(oldName)) {
133
+ (0, relay_store_1.renameRelaySlot)(oldName, newName);
134
+ }
124
135
  return renamedAccount;
125
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-slot",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "本地 Codex 多账号切换与状态管理工具",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli.js",