@quantiya/codevibe-antigravity-plugin 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/server.js +48 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -3654,10 +3654,56 @@ function generateLaunchSessionId(wrapperPid) {
3654
3654
  const nonce = crypto3.randomBytes(8).toString("hex");
3655
3655
  return `agy-${wrapperPid}-${nonce}`;
3656
3656
  }
3657
+ var cliLogResolvedPathCache = /* @__PURE__ */ new Map();
3658
+ var CLI_LOG_RESOLVE_TTL_MS = 5e3;
3657
3659
  function getActiveConversationFromCliLog(cliLogPath) {
3658
3660
  try {
3659
- if (!fs5.existsSync(cliLogPath)) return null;
3660
- const content = fs5.readFileSync(cliLogPath, "utf8");
3661
+ let initialStat;
3662
+ try {
3663
+ initialStat = fs5.lstatSync(cliLogPath);
3664
+ } catch {
3665
+ return null;
3666
+ }
3667
+ let resolvedPath = null;
3668
+ try {
3669
+ if (initialStat.isSymbolicLink()) {
3670
+ const now = Date.now();
3671
+ const cached = cliLogResolvedPathCache.get(cliLogPath);
3672
+ if (cached && now - cached.lastScanMs < CLI_LOG_RESOLVE_TTL_MS) {
3673
+ resolvedPath = cached.resolvedPath;
3674
+ } else {
3675
+ const logDir = path5.join(path5.dirname(cliLogPath), "log");
3676
+ let dirOk = false;
3677
+ try {
3678
+ dirOk = fs5.statSync(logDir).isDirectory();
3679
+ } catch {
3680
+ }
3681
+ if (dirOk) {
3682
+ const entries = [];
3683
+ for (const name of fs5.readdirSync(logDir)) {
3684
+ if (!/^cli-.*\.log$/.test(name)) continue;
3685
+ const full = path5.join(logDir, name);
3686
+ try {
3687
+ const s = fs5.statSync(full);
3688
+ if (s.isFile()) entries.push({ full, mtimeMs: s.mtimeMs });
3689
+ } catch {
3690
+ }
3691
+ }
3692
+ if (entries.length > 0) {
3693
+ entries.sort((a, b) => b.mtimeMs - a.mtimeMs || b.full.localeCompare(a.full));
3694
+ resolvedPath = entries[0].full;
3695
+ }
3696
+ }
3697
+ cliLogResolvedPathCache.set(cliLogPath, { resolvedPath, lastScanMs: now });
3698
+ }
3699
+ } else {
3700
+ resolvedPath = cliLogPath;
3701
+ }
3702
+ } catch {
3703
+ resolvedPath = initialStat.isSymbolicLink() ? null : cliLogPath;
3704
+ }
3705
+ if (resolvedPath === null) return null;
3706
+ const content = fs5.readFileSync(resolvedPath, "utf8");
3661
3707
  const regex = /(?:Created conversation|Streaming conversation|Starting conversation update stream for)\s+([0-9a-fA-F-]{36})/g;
3662
3708
  const matches = Array.from(content.matchAll(regex));
3663
3709
  if (matches.length === 0) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-antigravity-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Control Antigravity CLI from your iPhone and Android — real-time sync, approve file edits, send prompts by voice. Part of CodeVibe.",
5
5
  "main": "dist/server.js",
6
6
  "bin": {