@quantiya/codevibe-antigravity-plugin 1.0.2 → 1.0.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.
Files changed (2) hide show
  1. package/dist/server.js +62 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -2895,6 +2895,20 @@ var McpServer = class {
2895
2895
  }
2896
2896
  this.started = true;
2897
2897
  this.lifecycleGen++;
2898
+ await (0, import_codevibe_core4.registerDeviceEncryptionKey)(this.appSyncClient, logger);
2899
+ (0, import_codevibe_core4.startDeviceKeyWatcher)(this.appSyncClient, logger);
2900
+ try {
2901
+ const swept = await this.appSyncClient.sweepOrphanSessions({
2902
+ agentType: "ANTIGRAVITY"
2903
+ });
2904
+ if (swept > 0) {
2905
+ logger.info("Orphan sweep: marked stale Antigravity sessions INACTIVE", { swept });
2906
+ }
2907
+ } catch (error) {
2908
+ logger.warn("Orphan sweep failed, continuing startup", {
2909
+ error: error instanceof Error ? error.message : String(error)
2910
+ });
2911
+ }
2898
2912
  this.approvalDetector.start();
2899
2913
  this.addListener(this.approvalDetector, "pending-prompt", (state) => {
2900
2914
  void this.handlePendingPrompt(state).catch((err) => {
@@ -3654,10 +3668,56 @@ function generateLaunchSessionId(wrapperPid) {
3654
3668
  const nonce = crypto3.randomBytes(8).toString("hex");
3655
3669
  return `agy-${wrapperPid}-${nonce}`;
3656
3670
  }
3671
+ var cliLogResolvedPathCache = /* @__PURE__ */ new Map();
3672
+ var CLI_LOG_RESOLVE_TTL_MS = 5e3;
3657
3673
  function getActiveConversationFromCliLog(cliLogPath) {
3658
3674
  try {
3659
- if (!fs5.existsSync(cliLogPath)) return null;
3660
- const content = fs5.readFileSync(cliLogPath, "utf8");
3675
+ let initialStat;
3676
+ try {
3677
+ initialStat = fs5.lstatSync(cliLogPath);
3678
+ } catch {
3679
+ return null;
3680
+ }
3681
+ let resolvedPath = null;
3682
+ try {
3683
+ if (initialStat.isSymbolicLink()) {
3684
+ const now = Date.now();
3685
+ const cached = cliLogResolvedPathCache.get(cliLogPath);
3686
+ if (cached && now - cached.lastScanMs < CLI_LOG_RESOLVE_TTL_MS) {
3687
+ resolvedPath = cached.resolvedPath;
3688
+ } else {
3689
+ const logDir = path5.join(path5.dirname(cliLogPath), "log");
3690
+ let dirOk = false;
3691
+ try {
3692
+ dirOk = fs5.statSync(logDir).isDirectory();
3693
+ } catch {
3694
+ }
3695
+ if (dirOk) {
3696
+ const entries = [];
3697
+ for (const name of fs5.readdirSync(logDir)) {
3698
+ if (!/^cli-.*\.log$/.test(name)) continue;
3699
+ const full = path5.join(logDir, name);
3700
+ try {
3701
+ const s = fs5.statSync(full);
3702
+ if (s.isFile()) entries.push({ full, mtimeMs: s.mtimeMs });
3703
+ } catch {
3704
+ }
3705
+ }
3706
+ if (entries.length > 0) {
3707
+ entries.sort((a, b) => b.mtimeMs - a.mtimeMs || b.full.localeCompare(a.full));
3708
+ resolvedPath = entries[0].full;
3709
+ }
3710
+ }
3711
+ cliLogResolvedPathCache.set(cliLogPath, { resolvedPath, lastScanMs: now });
3712
+ }
3713
+ } else {
3714
+ resolvedPath = cliLogPath;
3715
+ }
3716
+ } catch {
3717
+ resolvedPath = initialStat.isSymbolicLink() ? null : cliLogPath;
3718
+ }
3719
+ if (resolvedPath === null) return null;
3720
+ const content = fs5.readFileSync(resolvedPath, "utf8");
3661
3721
  const regex = /(?:Created conversation|Streaming conversation|Starting conversation update stream for)\s+([0-9a-fA-F-]{36})/g;
3662
3722
  const matches = Array.from(content.matchAll(regex));
3663
3723
  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.4",
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": {