@qafka/react-native 2.4.0 → 2.4.1

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.4.1] — 2026-06-21
11
+
12
+ ### Fixed
13
+
14
+ - Development experience: when a development (test) API key has been rotated and the app is still running the old key, chat no longer fails silently. In development builds the SDK now logs an actionable warning and shows an in-chat message telling the developer to run `qafka refresh` and restart Metro with `--clear`. This guidance is stripped from release builds (`__DEV__`-gated) and only triggers for development keys, so it can never appear in production.
15
+
10
16
  ## [2.4.0] — 2026-06-21
11
17
 
12
18
  ### Added
@@ -311,6 +311,20 @@ exports.Qafka = (0, react_1.forwardRef)(function Qafka({ style, apiUrl: apiUrlPr
311
311
  setIsInitialMessageLoading(false);
312
312
  if (__DEV__) {
313
313
  console.warn('[Qafka] Initial message error:', err.message);
314
+ // Dev-only: a stale rotated test key would otherwise fail silently.
315
+ // Surface the actionable hint in the transcript so it is visible.
316
+ const devErr = err;
317
+ if (devErr.code === 'DEV_KEY_INVALID') {
318
+ const devErrMsg = {
319
+ id: `dev-key-error-${Date.now()}`,
320
+ role: 'assistant',
321
+ text: err.message,
322
+ content: err.message,
323
+ timestamp: new Date(),
324
+ metadata: { isInitialMessage: true },
325
+ };
326
+ setMessages((prev) => [...prev, devErrMsg]);
327
+ }
314
328
  }
315
329
  }, currentContext, contextDescription, undefined, // onToolSuggestions
316
330
  true);
@@ -601,12 +601,27 @@ class BackendService {
601
601
  });
602
602
  }
603
603
  else {
604
+ let serverMessage;
604
605
  try {
605
- const errorData = JSON.parse(xhr.responseText);
606
- onError(new Error(errorData.message || `HTTP Error: ${xhr.status}`));
606
+ serverMessage = JSON.parse(xhr.responseText)?.message;
607
607
  }
608
608
  catch {
609
- onError(new Error(`HTTP Error: ${xhr.status}`));
609
+ // non-JSON error body; fall through to a status-based message
610
+ }
611
+ // In dev, a 401 with a test key almost always means the rotated dev
612
+ // key is stale. Surface an actionable hint instead of a bare HTTP error.
613
+ if (__DEV__ && xhr.status === 401 && this.apiKey?.startsWith('qafka_test_')) {
614
+ const hint = 'Qafka dev key is invalid or was rotated. Run `qafka refresh`, then restart Metro with --clear.';
615
+ console.warn(`[Qafka] ${hint}`);
616
+ const devErr = new Error(hint);
617
+ devErr.code = 'DEV_KEY_INVALID';
618
+ devErr.status = xhr.status;
619
+ onError(devErr);
620
+ }
621
+ else {
622
+ const httpErr = new Error(serverMessage || `HTTP Error: ${xhr.status}`);
623
+ httpErr.status = xhr.status;
624
+ onError(httpErr);
610
625
  }
611
626
  }
612
627
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qafka/react-native",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Drop-in AI assistant for React Native: chat, voice, and tool execution with screen-aware navigation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",