codexuse-cli 3.1.3 → 3.1.4

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 CHANGED
@@ -3799,6 +3799,7 @@ async function handleLicense(args, version) {
3799
3799
  }
3800
3800
 
3801
3801
  // ../../packages/runtime-profiles/src/profiles/profile-manager.ts
3802
+ var import_node_crypto4 = require("crypto");
3802
3803
  var import_fs = require("fs");
3803
3804
  var import_path = __toESM(require("path"), 1);
3804
3805
  var import_path2 = require("path");
@@ -4424,6 +4425,73 @@ var ProfileManager = class {
4424
4425
  return null;
4425
4426
  }
4426
4427
  }
4428
+ async captureActiveAuthSnapshot() {
4429
+ await this.initialize();
4430
+ let raw;
4431
+ try {
4432
+ raw = await import_fs.promises.readFile(this.activeAuth, "utf8");
4433
+ } catch (error) {
4434
+ if (this.isNotFoundError(error)) {
4435
+ return {
4436
+ fingerprint: null,
4437
+ email: null,
4438
+ accountId: null,
4439
+ userId: null,
4440
+ chatgptUserId: null,
4441
+ workspaceId: null
4442
+ };
4443
+ }
4444
+ const message = error instanceof Error ? error.message : "unknown error";
4445
+ const signature = typeof message === "string" ? `${message}:${this.activeAuth}` : this.activeAuth;
4446
+ if (this.lastActiveAuthErrorSignature !== signature) {
4447
+ logWarn("Failed to snapshot active auth file:", error);
4448
+ this.lastActiveAuthErrorSignature = signature;
4449
+ }
4450
+ return {
4451
+ fingerprint: null,
4452
+ email: null,
4453
+ accountId: null,
4454
+ userId: null,
4455
+ chatgptUserId: null,
4456
+ workspaceId: null
4457
+ };
4458
+ }
4459
+ const trimmed = raw.trim();
4460
+ if (!trimmed) {
4461
+ return {
4462
+ fingerprint: null,
4463
+ email: null,
4464
+ accountId: null,
4465
+ userId: null,
4466
+ chatgptUserId: null,
4467
+ workspaceId: null
4468
+ };
4469
+ }
4470
+ const fingerprint = (0, import_node_crypto4.createHash)("sha256").update(trimmed).digest("hex");
4471
+ try {
4472
+ const parsed = JSON.parse(trimmed);
4473
+ const normalized = this.normalizeProfileData(parsed);
4474
+ const metadata = this.extractProfileMetadata(normalized);
4475
+ const workspace = this.resolveWorkspaceIdentity(normalized, metadata);
4476
+ return {
4477
+ fingerprint,
4478
+ email: this.resolveProfileEmail(normalized, metadata) ?? null,
4479
+ accountId: this.getAccountIdFromData(normalized) ?? null,
4480
+ userId: metadata?.userId ?? null,
4481
+ chatgptUserId: metadata?.chatgptUserId ?? null,
4482
+ workspaceId: workspace.id ?? null
4483
+ };
4484
+ } catch {
4485
+ return {
4486
+ fingerprint,
4487
+ email: null,
4488
+ accountId: null,
4489
+ userId: null,
4490
+ chatgptUserId: null,
4491
+ workspaceId: null
4492
+ };
4493
+ }
4494
+ }
4427
4495
  /**
4428
4496
  * Decode a JWT payload into an object without validating the signature.
4429
4497
  */
@@ -8650,7 +8718,7 @@ async function ensureCliStorageReady() {
8650
8718
  }
8651
8719
 
8652
8720
  // src/app/main.ts
8653
- var VERSION = true ? "3.1.3" : "0.0.0";
8721
+ var VERSION = true ? "3.1.4" : "0.0.0";
8654
8722
  async function runCli() {
8655
8723
  const args = process.argv.slice(2);
8656
8724
  if (args.length === 0) {