@quantiya/codevibe-antigravity-plugin 1.0.3 → 1.0.5

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 +29 -12
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -2508,7 +2508,8 @@ function mapTranscriptEvent(emit, sessionId) {
2508
2508
  sessionId,
2509
2509
  source: import_codevibe_core3.EventSource.DESKTOP
2510
2510
  };
2511
- const nextTimestamp = () => bumpTimestampForConv(event.created_at, emit.conversationId);
2511
+ const orderingKey = `${sessionId}:${emit.conversationId}`;
2512
+ const nextTimestamp = () => (0, import_codevibe_core3.prepareEventTimestamp)({ orderingKey, agentClock: event.created_at });
2512
2513
  const baseMetadata = {
2513
2514
  step_index: event.step_index,
2514
2515
  agy_source: event.source,
@@ -2642,15 +2643,6 @@ function mapTranscriptEvent(emit, sessionId) {
2642
2643
  pendingCallRegistrations: []
2643
2644
  };
2644
2645
  }
2645
- var lastEmittedSecondPerConv = /* @__PURE__ */ new Map();
2646
- function bumpTimestampForConv(createdAt, conversationId) {
2647
- const parsed = new Date(createdAt);
2648
- const agySec = Math.floor(parsed.getTime() / 1e3);
2649
- const lastSec = lastEmittedSecondPerConv.get(conversationId) ?? 0;
2650
- const effectiveSec = Math.max(agySec, lastSec + 1);
2651
- lastEmittedSecondPerConv.set(conversationId, effectiveSec);
2652
- return new Date(effectiveSec * 1e3).toISOString();
2653
- }
2654
2646
  function stripUserRequestWrapper(content) {
2655
2647
  const match = content.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);
2656
2648
  if (match && match[1] !== void 0) {
@@ -2895,6 +2887,20 @@ var McpServer = class {
2895
2887
  }
2896
2888
  this.started = true;
2897
2889
  this.lifecycleGen++;
2890
+ await (0, import_codevibe_core4.registerDeviceEncryptionKey)(this.appSyncClient, logger);
2891
+ (0, import_codevibe_core4.startDeviceKeyWatcher)(this.appSyncClient, logger);
2892
+ try {
2893
+ const swept = await this.appSyncClient.sweepOrphanSessions({
2894
+ agentType: "ANTIGRAVITY"
2895
+ });
2896
+ if (swept > 0) {
2897
+ logger.info("Orphan sweep: marked stale Antigravity sessions INACTIVE", { swept });
2898
+ }
2899
+ } catch (error) {
2900
+ logger.warn("Orphan sweep failed, continuing startup", {
2901
+ error: error instanceof Error ? error.message : String(error)
2902
+ });
2903
+ }
2898
2904
  this.approvalDetector.start();
2899
2905
  this.addListener(this.approvalDetector, "pending-prompt", (state) => {
2900
2906
  void this.handlePendingPrompt(state).catch((err) => {
@@ -3334,7 +3340,14 @@ var McpServer = class {
3334
3340
  source: import_codevibe_core4.EventSource.DESKTOP,
3335
3341
  content,
3336
3342
  metadata: optionsForMobile,
3337
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
3343
+ // Per-conversation monotonic timestamp (event-timestamp-ordering fix
3344
+ // v5.4, 2026-05-24). orderingKey scopes the counter to this conv so
3345
+ // INTERACTIVE_PROMPT can't be forced to lastMs+1 by a newer event
3346
+ // from a sibling conversation under v9's multi-conv-per-session
3347
+ // model.
3348
+ timestamp: (0, import_codevibe_core4.prepareEventTimestamp)({
3349
+ orderingKey: `${session.sessionId}:${state.conversationId}`
3350
+ })
3338
3351
  };
3339
3352
  try {
3340
3353
  await this.appSyncClient.createEvent(this.encryptOutbound(session, input));
@@ -3582,7 +3595,11 @@ var McpServer = class {
3582
3595
  source: payload.source,
3583
3596
  content: payload.content,
3584
3597
  metadata,
3585
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
3598
+ // External HTTP push has no conversationId in payload, so the
3599
+ // orderingKey is session-scoped. Slightly coarser than the
3600
+ // per-conv key used by transcript emits, but acceptable because
3601
+ // hook-script pushes are off the hot transcript path.
3602
+ timestamp: (0, import_codevibe_core4.prepareEventTimestamp)({ orderingKey: payload.sessionId })
3586
3603
  };
3587
3604
  const finalInput = this.encryptOutbound(session, input);
3588
3605
  const created = await this.appSyncClient.createEvent(finalInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-antigravity-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=18.0.0"
49
49
  },
50
50
  "dependencies": {
51
- "@quantiya/codevibe-core": "^1.0.24",
51
+ "@quantiya/codevibe-core": "^1.0.25",
52
52
  "chokidar": "^5.0.0",
53
53
  "dotenv": "^16.6.1",
54
54
  "express": "^5.1.0",