@quantiya/codevibe-claude-plugin 2.0.70 → 2.0.72

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.
@@ -9052,7 +9052,7 @@ var count3 = import_zod9.z.string().regex(/^(0|[1-9][0-9]{0,18})$/).refine((s) =
9052
9052
  return ready.catch(() => {
9053
9053
  }), this.starting = Promise.resolve().then(async () => {
9054
9054
  try {
9055
- this.fence(), this.credential = await this.deps.reader.credential(this.abort.signal, !0), this.fence();
9055
+ this.fence(), this.credential = await this.deps.reader.credential(this.abort.signal, this.deps.revalidateRegistration !== !1), this.fence(), this.deps.revalidateRegistration !== !1 && this.deps.onRegistrationRevalidated?.();
9056
9056
  let auth = await this.deps.wire.socketProof("CONNECT", this.credential, void 0, this.abort.signal);
9057
9057
  this.fence();
9058
9058
  let open15 = this.deps.openSocket ?? ((url, options) => new import_ws.default(url, options)), ws = this.ws = open15(this.endpoint, {
@@ -9062,7 +9062,13 @@ var count3 = import_zod9.z.string().regex(/^(0|[1-9][0-9]{0,18})$/).refine((s) =
9062
9062
  followRedirects: !1,
9063
9063
  handshakeTimeout: DEADLINE
9064
9064
  });
9065
- ws.on("error", () => this.fail(failure())), ws.on("close", () => this.fail(failure())), ws.on("message", (data, binary) => this.message(data, binary)), ws.on("pong", (data) => {
9065
+ ws.on("error", () => this.fail(failure())), ws.on("unexpected-response", (_request, response) => {
9066
+ try {
9067
+ this.fence(), (response.statusCode === 401 || response.statusCode === 403) && this.deps.onUpgradeRejected?.();
9068
+ } catch {
9069
+ }
9070
+ response.resume(), this.fail(failure());
9071
+ }), ws.on("close", () => this.fail(failure())), ws.on("message", (data, binary) => this.message(data, binary)), ws.on("pong", (data) => {
9066
9072
  this.pingNonce && data.equals(this.pingNonce) && (clearTimeout(this.pongTimer), this.pongTimer = void 0, this.pingNonce = void 0);
9067
9073
  }), ws.on("open", () => {
9068
9074
  this.sendControl("hello").catch((error) => this.fail(error));
@@ -11572,6 +11578,8 @@ var AppSyncClient = class _AppSyncClient {
11572
11578
  throw [
11573
11579
  mutations.createEvent,
11574
11580
  mutations.updateEventStatus,
11581
+ mutations.createEventV2,
11582
+ mutations.updateEventV2,
11575
11583
  mutations.recordWorkspaceOutcomeV2,
11576
11584
  mutations.reportSecurityPostureV2,
11577
11585
  queries.listEvents,
@@ -11724,7 +11732,7 @@ var AppSyncClient = class _AppSyncClient {
11724
11732
  return !this.authenticated || this.currentUserId !== userId || this.tokens?.userId !== userId || value?.userId !== userId || value.state.environment !== this.environment || !Number.isSafeInteger(now) || value.state.observedAtEpochMs > now + SYNC_STATE_CLOCK_SKEW_MS || now >= value.state.validUntilEpochMs ? null : value.state;
11725
11733
  }
11726
11734
  /** Existing socket maintenance recovers idle status after its cloud cache
11727
- * expires. This is display-only; admissions never use the cached result. */
11735
+ * expires. Cached observations never grant cloud mutation authority. */
11728
11736
  async refreshCompanionSyncDisplayOnMaintenance(userId, signal) {
11729
11737
  this.assertSyncAccount(userId), _AppSyncClient.throwIfAborted(signal), !this.companionSyncStatusSnapshot(userId) && (await this.getCompanionSyncState(signal), this.assertSyncAccount(userId), _AppSyncClient.throwIfAborted(signal));
11730
11738
  }
@@ -11850,6 +11858,9 @@ var AppSyncClient = class _AppSyncClient {
11850
11858
  endpoint: config.aws.syncWebSocketUrl,
11851
11859
  environment: this.environment,
11852
11860
  scope,
11861
+ revalidateRegistration: options.revalidateRegistration,
11862
+ onRegistrationRevalidated: options.onRegistrationRevalidated,
11863
+ onUpgradeRejected: options.onUpgradeRejected,
11853
11864
  wire: client,
11854
11865
  reader,
11855
11866
  inbound: writer.inbound(),
@@ -11918,7 +11929,8 @@ var AppSyncClient = class _AppSyncClient {
11918
11929
  send: (action, input, signal) => (this.assertSyncAccount(userId), this.mutateDesktopSyncEvent(action, input, signal)),
11919
11930
  isQuotaDenial: (error) => error instanceof AppSyncGraphQLError && error.errorType === "SYNC_QUOTA_EXHAUSTED",
11920
11931
  omitNewPayload: async (signal) => {
11921
- let state = await this.getCompanionSyncState(signal);
11932
+ this.assertSyncAccount(userId), _AppSyncClient.throwIfAborted(signal);
11933
+ let observed = this.companionSyncStatusSnapshot(userId), state = observed?.mode === "SHADOW" ? observed : await this.getCompanionSyncState(signal);
11922
11934
  if (this.assertSyncAccount(userId), _AppSyncClient.throwIfAborted(signal), state.protocol !== "SYNC_V2") throw new SyncEventClientError("SYNC_PRODUCER_FROZEN");
11923
11935
  return state.usage?.syncState === "PAUSED";
11924
11936
  }
@@ -14365,8 +14377,18 @@ var AppSyncClient = class _AppSyncClient {
14365
14377
  let session2 = await this.getSession(state.sessionId);
14366
14378
  if (!current()) return;
14367
14379
  if (this.assertSyncAccount(userId), !session2?.sessionGenerationId || session2.userId !== userId || !["ACTIVE" /* ACTIVE */, "PAUSED" /* PAUSED */].includes(session2.status)) throw new SyncEventClientError("SYNC_SESSION_UNAVAILABLE");
14368
- let connection = await this.desktopSyncLiveSession(
14369
- { sessionId: state.sessionId, sessionGenerationId: session2.sessionGenerationId },
14380
+ let generation = session2.sessionGenerationId, connection = await this.desktopSyncLiveSession(
14381
+ {
14382
+ sessionId: state.sessionId,
14383
+ sessionGenerationId: generation,
14384
+ revalidateRegistration: state.syncRegistrationRevalidationGeneration === generation,
14385
+ onRegistrationRevalidated: () => {
14386
+ current() && (state.syncRegistrationRevalidatedGeneration = generation, delete state.syncRegistrationRevalidationGeneration);
14387
+ },
14388
+ onUpgradeRejected: () => {
14389
+ current() && state.syncRegistrationRevalidatedGeneration !== generation && (state.syncRegistrationRevalidationGeneration = generation);
14390
+ }
14391
+ },
14370
14392
  (event) => {
14371
14393
  if (current() && shouldDeliverSubscribedEvent(event, !!state.receiveDesktopEvents)) return state.onEvent(event);
14372
14394
  },
@@ -14379,7 +14401,7 @@ var AppSyncClient = class _AppSyncClient {
14379
14401
  await connection.close();
14380
14402
  return;
14381
14403
  }
14382
- state.syncConnection = connection, state.syncSessionGenerationId = session2.sessionGenerationId, this.rememberSyncRegistration({ sessionId: state.sessionId, sessionGenerationId: session2.sessionGenerationId }), await connection.start(), current() && this.handleSubscriptionStartAck(state);
14404
+ state.syncConnection = connection, state.syncSessionGenerationId = session2.sessionGenerationId, this.rememberSyncRegistration({ sessionId: state.sessionId, sessionGenerationId: session2.sessionGenerationId }), await connection.start(), current() && (state.syncRegistrationRevalidationGeneration === generation && delete state.syncRegistrationRevalidationGeneration, state.syncRegistrationRevalidatedGeneration === generation && delete state.syncRegistrationRevalidatedGeneration, this.handleSubscriptionStartAck(state));
14383
14405
  })().catch((error) => {
14384
14406
  current() && this.handleSubscriptionError(state, error instanceof Error ? error : new Error("Sync connection failed"));
14385
14407
  });
@@ -14521,11 +14543,12 @@ var AppSyncClient = class _AppSyncClient {
14521
14543
  isUrgentPhase ? delay = Math.min(
14522
14544
  RECONNECT_CONFIG.baseDelayMs * Math.pow(RECONNECT_CONFIG.backoffMultiplier, state.reconnectAttempts - 1),
14523
14545
  RECONNECT_CONFIG.maxDelayMs
14524
- ) : (delay = RECONNECT_CONFIG.persistentDelayMs, state.reconnectAttempts === RECONNECT_CONFIG.urgentMaxAttempts + 1 && logger.info("[AppSyncClient] Switching to persistent reconnect (every 5min)", { sessionId })), logger.info("[AppSyncClient] Scheduling reconnect", {
14546
+ ) : (delay = RECONNECT_CONFIG.persistentDelayMs, state.reconnectAttempts === RECONNECT_CONFIG.urgentMaxAttempts + 1 && logger.info("[AppSyncClient] Switching to persistent reconnect (every 5min)", { sessionId })), error instanceof SyncReadClientError && Number.isSafeInteger(error.retryAfterMs) && error.retryAfterMs >= 0 && (delay = Math.max(delay, Math.min(error.retryAfterMs, 2147483647))), logger.info("[AppSyncClient] Scheduling reconnect", {
14525
14547
  sessionId,
14526
14548
  attempt: state.reconnectAttempts,
14527
14549
  phase: isUrgentPhase ? "urgent" : "persistent",
14528
- delayMs: delay
14550
+ delayMs: delay,
14551
+ ...error instanceof SyncReadClientError && { backendCode: error.backendCode, retryAfterMs: error.retryAfterMs }
14529
14552
  }), state.ws && (disposeWatcherSocket(state.ws), state.ws = null), state.keepAliveTimer && clearTimeout(state.keepAliveTimer), state.reconnectTimer = setTimeout(async () => {
14530
14553
  if (state.isReconnecting = !1, state.destroyed || this.activeSubscriptions.get(sessionId) !== state) {
14531
14554
  logger.info("[AppSyncClient] Reconnect skipped \u2014 state is no longer canonical", { sessionId });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.65",
3
+ "version": "2.0.67",
4
4
  "description": "Core library for CodeVibe plugins - shared keychain, crypto, AppSync, and auth functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-claude-plugin",
3
- "version": "2.0.70",
3
+ "version": "2.0.72",
4
4
  "description": "Control Claude Code 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
  "codevibe": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=22.0.0"
49
49
  },
50
50
  "dependencies": {
51
- "@quantiya/codevibe-core": "^2.0.65",
51
+ "@quantiya/codevibe-core": "^2.0.67",
52
52
  "@quantiya/quorum-core": "^1.0.1",
53
53
  "dotenv": "^16.6.1",
54
54
  "express": "^5.1.0",