@quantiya/codevibe-claude-plugin 2.0.71 → 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));
@@ -11852,6 +11858,9 @@ var AppSyncClient = class _AppSyncClient {
11852
11858
  endpoint: config.aws.syncWebSocketUrl,
11853
11859
  environment: this.environment,
11854
11860
  scope,
11861
+ revalidateRegistration: options.revalidateRegistration,
11862
+ onRegistrationRevalidated: options.onRegistrationRevalidated,
11863
+ onUpgradeRejected: options.onUpgradeRejected,
11855
11864
  wire: client,
11856
11865
  reader,
11857
11866
  inbound: writer.inbound(),
@@ -14368,8 +14377,18 @@ var AppSyncClient = class _AppSyncClient {
14368
14377
  let session2 = await this.getSession(state.sessionId);
14369
14378
  if (!current()) return;
14370
14379
  if (this.assertSyncAccount(userId), !session2?.sessionGenerationId || session2.userId !== userId || !["ACTIVE" /* ACTIVE */, "PAUSED" /* PAUSED */].includes(session2.status)) throw new SyncEventClientError("SYNC_SESSION_UNAVAILABLE");
14371
- let connection = await this.desktopSyncLiveSession(
14372
- { 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
+ },
14373
14392
  (event) => {
14374
14393
  if (current() && shouldDeliverSubscribedEvent(event, !!state.receiveDesktopEvents)) return state.onEvent(event);
14375
14394
  },
@@ -14382,7 +14401,7 @@ var AppSyncClient = class _AppSyncClient {
14382
14401
  await connection.close();
14383
14402
  return;
14384
14403
  }
14385
- 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));
14386
14405
  })().catch((error) => {
14387
14406
  current() && this.handleSubscriptionError(state, error instanceof Error ? error : new Error("Sync connection failed"));
14388
14407
  });
@@ -14524,11 +14543,12 @@ var AppSyncClient = class _AppSyncClient {
14524
14543
  isUrgentPhase ? delay = Math.min(
14525
14544
  RECONNECT_CONFIG.baseDelayMs * Math.pow(RECONNECT_CONFIG.backoffMultiplier, state.reconnectAttempts - 1),
14526
14545
  RECONNECT_CONFIG.maxDelayMs
14527
- ) : (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", {
14528
14547
  sessionId,
14529
14548
  attempt: state.reconnectAttempts,
14530
14549
  phase: isUrgentPhase ? "urgent" : "persistent",
14531
- delayMs: delay
14550
+ delayMs: delay,
14551
+ ...error instanceof SyncReadClientError && { backendCode: error.backendCode, retryAfterMs: error.retryAfterMs }
14532
14552
  }), state.ws && (disposeWatcherSocket(state.ws), state.ws = null), state.keepAliveTimer && clearTimeout(state.keepAliveTimer), state.reconnectTimer = setTimeout(async () => {
14533
14553
  if (state.isReconnecting = !1, state.destroyed || this.activeSubscriptions.get(sessionId) !== state) {
14534
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.66",
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.71",
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.66",
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",