codexuse-cli 6.0.1 → 6.0.2
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/dist/index.js +80 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5175,7 +5175,19 @@ var LicenseService = class {
|
|
|
5175
5175
|
this.verificationPromise = null;
|
|
5176
5176
|
}
|
|
5177
5177
|
async getCachedStatus() {
|
|
5178
|
-
|
|
5178
|
+
try {
|
|
5179
|
+
return await this.getStatus({ allowStale: true, refreshInBackground: true });
|
|
5180
|
+
} catch (error) {
|
|
5181
|
+
const message = error instanceof Error ? error.message : "License status could not be loaded.";
|
|
5182
|
+
console.warn("Cached license status unavailable:", error);
|
|
5183
|
+
return toLicenseStatus(null, {
|
|
5184
|
+
state: "error",
|
|
5185
|
+
profileLimit: null,
|
|
5186
|
+
profilesRemaining: null,
|
|
5187
|
+
message: "License status is temporarily unavailable.",
|
|
5188
|
+
error: message
|
|
5189
|
+
});
|
|
5190
|
+
}
|
|
5179
5191
|
}
|
|
5180
5192
|
async getStatus(options = {}) {
|
|
5181
5193
|
const forceRefresh = Boolean(options.forceRefresh);
|
|
@@ -36339,8 +36351,14 @@ var ProfileManager = class {
|
|
|
36339
36351
|
const homeIdsByProfileName = /* @__PURE__ */ new Map();
|
|
36340
36352
|
const profileNamesByHomeId = /* @__PURE__ */ new Map();
|
|
36341
36353
|
for (const [profileName, raw] of Object.entries(source)) {
|
|
36342
|
-
|
|
36343
|
-
|
|
36354
|
+
let record2;
|
|
36355
|
+
try {
|
|
36356
|
+
record2 = this.fromStateRecord(profileName, raw);
|
|
36357
|
+
} catch {
|
|
36358
|
+
continue;
|
|
36359
|
+
}
|
|
36360
|
+
const homeId = record2 ? normalizeProfileHomeId(raw.homeId) : null;
|
|
36361
|
+
if (!record2 || !homeId) {
|
|
36344
36362
|
continue;
|
|
36345
36363
|
}
|
|
36346
36364
|
const collisionKey = homeId.toLowerCase();
|
|
@@ -36479,17 +36497,17 @@ var ProfileManager = class {
|
|
|
36479
36497
|
}
|
|
36480
36498
|
async reconcileProfileHomeLocationConflicts(source) {
|
|
36481
36499
|
for (const [profileName, raw] of Object.entries(source)) {
|
|
36482
|
-
const record2 = this.fromStateRecord(profileName, raw);
|
|
36483
|
-
if (!record2) {
|
|
36484
|
-
continue;
|
|
36485
|
-
}
|
|
36486
|
-
const conflict = findProfileCodexHomeLocationConflict(record2.homeId);
|
|
36487
|
-
if (!conflict) {
|
|
36488
|
-
continue;
|
|
36489
|
-
}
|
|
36490
|
-
const currentAuthPath = (0, import_path2.join)(conflict.current, "auth.json");
|
|
36491
|
-
const legacyAuthPath = (0, import_path2.join)(conflict.legacy, "auth.json");
|
|
36492
36500
|
try {
|
|
36501
|
+
const record2 = this.fromStateRecord(profileName, raw);
|
|
36502
|
+
if (!record2) {
|
|
36503
|
+
continue;
|
|
36504
|
+
}
|
|
36505
|
+
const conflict = findProfileCodexHomeLocationConflict(record2.homeId);
|
|
36506
|
+
if (!conflict) {
|
|
36507
|
+
continue;
|
|
36508
|
+
}
|
|
36509
|
+
const currentAuthPath = (0, import_path2.join)(conflict.current, "auth.json");
|
|
36510
|
+
const legacyAuthPath = (0, import_path2.join)(conflict.legacy, "auth.json");
|
|
36493
36511
|
await this.withProfileAuthFileLock(currentAuthPath, async (currentRaw) => {
|
|
36494
36512
|
await this.withProfileAuthFileLock(legacyAuthPath, async (legacyRaw) => {
|
|
36495
36513
|
if (!legacyRaw?.trim()) {
|
|
@@ -37151,22 +37169,43 @@ var ProfileManager = class {
|
|
|
37151
37169
|
const byIdentityWorkspace = /* @__PURE__ */ new Map();
|
|
37152
37170
|
let cacheable = true;
|
|
37153
37171
|
for (const [profileName, raw] of Object.entries(source)) {
|
|
37154
|
-
|
|
37172
|
+
let storedRecord;
|
|
37173
|
+
try {
|
|
37174
|
+
storedRecord = this.fromStateRecord(profileName, raw);
|
|
37175
|
+
} catch (error) {
|
|
37176
|
+
logWarn(`Failed to read saved profile '${profileName}':`, error);
|
|
37177
|
+
cacheable = false;
|
|
37178
|
+
continue;
|
|
37179
|
+
}
|
|
37155
37180
|
if (!storedRecord) {
|
|
37156
37181
|
continue;
|
|
37157
37182
|
}
|
|
37158
|
-
|
|
37183
|
+
let hydration;
|
|
37184
|
+
try {
|
|
37185
|
+
hydration = await this.hydrateProfileRecordWithStatus(storedRecord);
|
|
37186
|
+
} catch (error) {
|
|
37187
|
+
logWarn(
|
|
37188
|
+
`Failed to hydrate profile '${profileName}'; using its saved metadata:`,
|
|
37189
|
+
error
|
|
37190
|
+
);
|
|
37191
|
+
hydration = { record: storedRecord, cacheable: false };
|
|
37192
|
+
}
|
|
37159
37193
|
const record2 = hydration.record;
|
|
37160
37194
|
cacheable = cacheable && hydration.cacheable;
|
|
37161
37195
|
records.push(record2);
|
|
37162
|
-
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
|
|
37166
|
-
|
|
37167
|
-
bucket
|
|
37168
|
-
|
|
37169
|
-
|
|
37196
|
+
try {
|
|
37197
|
+
const identityKey = this.resolveProfileIdentityFromRecord(record2);
|
|
37198
|
+
const workspaceId = record2.workspaceId ?? record2.data.workspace_id ?? DEFAULT_WORKSPACE_ID;
|
|
37199
|
+
const key = this.identityWorkspaceIndexKey(identityKey, workspaceId);
|
|
37200
|
+
const bucket = byIdentityWorkspace.get(key);
|
|
37201
|
+
if (bucket) {
|
|
37202
|
+
bucket.push(record2);
|
|
37203
|
+
} else {
|
|
37204
|
+
byIdentityWorkspace.set(key, [record2]);
|
|
37205
|
+
}
|
|
37206
|
+
} catch (error) {
|
|
37207
|
+
logWarn(`Failed to index saved profile '${profileName}':`, error);
|
|
37208
|
+
cacheable = false;
|
|
37170
37209
|
}
|
|
37171
37210
|
}
|
|
37172
37211
|
const index2 = { sourceFingerprint, records, byIdentityWorkspace };
|
|
@@ -38772,7 +38811,18 @@ var ProfileManager = class {
|
|
|
38772
38811
|
await this.initialize();
|
|
38773
38812
|
try {
|
|
38774
38813
|
const records = await this.listProfileRecords();
|
|
38775
|
-
|
|
38814
|
+
const profiles = [];
|
|
38815
|
+
for (const record2 of records) {
|
|
38816
|
+
try {
|
|
38817
|
+
const profile = this.buildProfileFromRow(record2);
|
|
38818
|
+
if (!profile.authMethod || profile.authMethod === "codex-cli") {
|
|
38819
|
+
profiles.push(profile);
|
|
38820
|
+
}
|
|
38821
|
+
} catch (error) {
|
|
38822
|
+
logWarn(`Failed to build saved profile '${record2.name}':`, error);
|
|
38823
|
+
}
|
|
38824
|
+
}
|
|
38825
|
+
return profiles.sort((a, b) => {
|
|
38776
38826
|
const aLabel = a.displayName ?? a.name;
|
|
38777
38827
|
const bLabel = b.displayName ?? b.name;
|
|
38778
38828
|
const base2 = aLabel.localeCompare(bLabel);
|
|
@@ -38780,7 +38830,7 @@ var ProfileManager = class {
|
|
|
38780
38830
|
});
|
|
38781
38831
|
} catch (error) {
|
|
38782
38832
|
logError("Error reading profiles from disk:", error);
|
|
38783
|
-
|
|
38833
|
+
throw error;
|
|
38784
38834
|
}
|
|
38785
38835
|
}
|
|
38786
38836
|
async runWithPreparedProfileHome(name, action, options = {}) {
|
|
@@ -40118,9 +40168,11 @@ async function listManagedProfiles(profileManager) {
|
|
|
40118
40168
|
return labelOrder !== 0 ? labelOrder : left.name.localeCompare(right.name);
|
|
40119
40169
|
});
|
|
40120
40170
|
}
|
|
40121
|
-
async function getCurrentManagedProfile(profileManager) {
|
|
40171
|
+
async function getCurrentManagedProfile(profileManager, activeCodexAuth) {
|
|
40122
40172
|
const [currentOpenAiProfile, state] = await Promise.all([
|
|
40123
|
-
|
|
40173
|
+
activeCodexAuth ? Promise.resolve(
|
|
40174
|
+
activeCodexAuth.state === "matched" && activeCodexAuth.profileName ? { name: activeCodexAuth.profileName, trusted: true } : { name: null, trusted: false }
|
|
40175
|
+
) : profileManager.getCurrentProfile(),
|
|
40124
40176
|
getAppState()
|
|
40125
40177
|
]);
|
|
40126
40178
|
const lastProfileName = state.app.lastProfileName?.trim() || null;
|
|
@@ -44720,7 +44772,7 @@ async function ensureCliStorageReady() {
|
|
|
44720
44772
|
}
|
|
44721
44773
|
|
|
44722
44774
|
// src/app/main.ts
|
|
44723
|
-
var VERSION = true ? "6.0.
|
|
44775
|
+
var VERSION = true ? "6.0.2" : "0.0.0";
|
|
44724
44776
|
async function runCli() {
|
|
44725
44777
|
const args2 = process.argv.slice(2);
|
|
44726
44778
|
if (args2.length === 0) {
|