@runanywhere/llamacpp 0.17.1 → 0.17.2

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 (65) hide show
  1. package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
  2. package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
  3. package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
  4. package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
  5. package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
  6. package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
  7. package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
  8. package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
  9. package/android/src/main/include/rac/core/rac_component_types.h +160 -0
  10. package/android/src/main/include/rac/core/rac_core.h +331 -0
  11. package/android/src/main/include/rac/core/rac_error.h +469 -0
  12. package/android/src/main/include/rac/core/rac_events.h +334 -0
  13. package/android/src/main/include/rac/core/rac_logger.h +416 -0
  14. package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
  15. package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
  16. package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
  17. package/android/src/main/include/rac/core/rac_types.h +264 -0
  18. package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
  19. package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
  20. package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
  21. package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
  22. package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
  23. package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
  24. package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
  25. package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
  26. package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
  27. package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
  28. package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
  29. package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
  30. package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
  31. package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
  32. package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
  33. package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
  34. package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
  35. package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
  36. package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
  37. package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
  38. package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
  39. package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
  40. package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
  41. package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
  42. package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
  43. package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
  44. package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
  45. package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
  46. package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
  47. package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
  48. package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
  49. package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
  50. package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
  51. package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
  52. package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
  53. package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
  54. package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
  55. package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
  56. package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
  57. package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
  58. package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
  59. package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
  60. package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
  61. package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
  62. package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
  63. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
  64. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
  65. package/package.json +1 -1
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @file rac_telemetry_types.h
3
+ * @brief Telemetry data structures - canonical source of truth
4
+ *
5
+ * All telemetry payloads are defined here. Platform SDKs (Swift, Kotlin, Flutter)
6
+ * use these types directly or create thin wrappers.
7
+ *
8
+ * Mirrors Swift's TelemetryEventPayload.swift structure.
9
+ */
10
+
11
+ #ifndef RAC_TELEMETRY_TYPES_H
12
+ #define RAC_TELEMETRY_TYPES_H
13
+
14
+ #include "rac/core/rac_types.h"
15
+ #include "rac/infrastructure/network/rac_environment.h"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // =============================================================================
22
+ // TELEMETRY EVENT PAYLOAD
23
+ // =============================================================================
24
+
25
+ /**
26
+ * @brief Complete telemetry event payload
27
+ *
28
+ * Maps to backend SDKTelemetryEvent schema with all fields for:
29
+ * - LLM events (tokens, generation times, etc.)
30
+ * - STT events (audio duration, word count, etc.)
31
+ * - TTS events (character count, audio size, etc.)
32
+ * - VAD events (speech duration)
33
+ * - Model lifecycle events (size, archive type)
34
+ * - SDK lifecycle events (count)
35
+ * - Storage events (freed bytes)
36
+ * - Network events (online status)
37
+ */
38
+ typedef struct rac_telemetry_payload {
39
+ // Required fields
40
+ const char* id; // Unique event ID (UUID)
41
+ const char* event_type; // Event type string
42
+ int64_t timestamp_ms; // Unix timestamp in milliseconds
43
+ int64_t created_at_ms; // When payload was created
44
+
45
+ // Event classification
46
+ const char* modality; // "llm", "stt", "tts", "model", "system"
47
+
48
+ // Device identification
49
+ const char* device_id; // Persistent device UUID
50
+ const char* session_id; // Optional session ID
51
+
52
+ // Model info
53
+ const char* model_id;
54
+ const char* model_name;
55
+ const char* framework; // "llamacpp", "onnx", "mlx", etc.
56
+
57
+ // Device info
58
+ const char* device; // Device model (e.g., "iPhone15,2")
59
+ const char* os_version; // OS version (e.g., "17.0")
60
+ const char* platform; // "ios", "android", "flutter"
61
+ const char* sdk_version; // SDK version string
62
+
63
+ // Common performance metrics
64
+ double processing_time_ms;
65
+ rac_bool_t success;
66
+ rac_bool_t has_success; // Whether success field is set
67
+ const char* error_message;
68
+ const char* error_code;
69
+
70
+ // LLM-specific fields
71
+ int32_t input_tokens;
72
+ int32_t output_tokens;
73
+ int32_t total_tokens;
74
+ double tokens_per_second;
75
+ double time_to_first_token_ms;
76
+ double prompt_eval_time_ms;
77
+ double generation_time_ms;
78
+ int32_t context_length;
79
+ double temperature;
80
+ int32_t max_tokens;
81
+
82
+ // STT-specific fields
83
+ double audio_duration_ms;
84
+ double real_time_factor;
85
+ int32_t word_count;
86
+ double confidence;
87
+ const char* language;
88
+ rac_bool_t is_streaming;
89
+ rac_bool_t has_is_streaming;
90
+ int32_t segment_index;
91
+
92
+ // TTS-specific fields
93
+ int32_t character_count;
94
+ double characters_per_second;
95
+ int32_t audio_size_bytes;
96
+ int32_t sample_rate;
97
+ const char* voice;
98
+ double output_duration_ms;
99
+
100
+ // Model lifecycle fields
101
+ int64_t model_size_bytes;
102
+ const char* archive_type;
103
+
104
+ // VAD fields
105
+ double speech_duration_ms;
106
+
107
+ // SDK lifecycle fields
108
+ int32_t count;
109
+
110
+ // Storage fields
111
+ int64_t freed_bytes;
112
+
113
+ // Network fields
114
+ rac_bool_t is_online;
115
+ rac_bool_t has_is_online;
116
+ } rac_telemetry_payload_t;
117
+
118
+ /**
119
+ * @brief Default/empty telemetry payload
120
+ */
121
+ RAC_API rac_telemetry_payload_t rac_telemetry_payload_default(void);
122
+
123
+ /**
124
+ * @brief Free any allocated strings in a telemetry payload
125
+ */
126
+ RAC_API void rac_telemetry_payload_free(rac_telemetry_payload_t* payload);
127
+
128
+ // =============================================================================
129
+ // TELEMETRY BATCH REQUEST
130
+ // =============================================================================
131
+
132
+ /**
133
+ * @brief Batch telemetry request for API
134
+ *
135
+ * Supports both V1 and V2 storage paths:
136
+ * - V1 (legacy): modality = NULL → stores in sdk_telemetry_events table
137
+ * - V2 (normalized): modality = "llm"/"stt"/"tts"/"model" → normalized tables
138
+ */
139
+ typedef struct rac_telemetry_batch_request {
140
+ rac_telemetry_payload_t* events;
141
+ size_t events_count;
142
+ const char* device_id;
143
+ int64_t timestamp_ms;
144
+ const char* modality; // NULL for V1, "llm"/"stt"/"tts"/"model" for V2
145
+ } rac_telemetry_batch_request_t;
146
+
147
+ /**
148
+ * @brief Batch telemetry response from API
149
+ */
150
+ typedef struct rac_telemetry_batch_response {
151
+ rac_bool_t success;
152
+ int32_t events_received;
153
+ int32_t events_stored;
154
+ int32_t events_skipped; // Duplicates skipped
155
+ const char** errors; // Array of error messages
156
+ size_t errors_count;
157
+ const char* storage_version; // "V1" or "V2"
158
+ } rac_telemetry_batch_response_t;
159
+
160
+ /**
161
+ * @brief Free batch response
162
+ */
163
+ RAC_API void rac_telemetry_batch_response_free(rac_telemetry_batch_response_t* response);
164
+
165
+ // =============================================================================
166
+ // DEVICE REGISTRATION TYPES
167
+ // =============================================================================
168
+
169
+ /**
170
+ * @brief Device information for registration (telemetry-specific)
171
+ *
172
+ * Platform-specific values are passed in from Swift/Kotlin.
173
+ * Matches backend schemas/device.py DeviceInfo schema.
174
+ * Note: Named differently from rac_device_info_t to avoid conflict.
175
+ */
176
+ typedef struct rac_device_registration_info {
177
+ // Required fields (backend schema)
178
+ const char* device_id; // Persistent UUID from Keychain/secure storage
179
+ const char* device_model; // "iPhone 16 Pro Max", "Pixel 7", etc.
180
+ const char* device_name; // User-assigned device name
181
+ const char* platform; // "ios", "android"
182
+ const char* os_version; // "17.0", "14"
183
+ const char* form_factor; // "phone", "tablet", "laptop", etc.
184
+ const char* architecture; // "arm64", "x86_64", etc.
185
+ const char* chip_name; // "A18 Pro", "Snapdragon 888", etc.
186
+ int64_t total_memory; // Total RAM in bytes
187
+ int64_t available_memory; // Available RAM in bytes
188
+ rac_bool_t has_neural_engine; // true if device has Neural Engine / NPU
189
+ int32_t neural_engine_cores; // Number of Neural Engine cores (0 if none)
190
+ const char* gpu_family; // "apple", "adreno", etc.
191
+ double battery_level; // 0.0-1.0, negative if unavailable
192
+ const char* battery_state; // "charging", "full", "unplugged", NULL if unavailable
193
+ rac_bool_t is_low_power_mode; // Low power mode enabled
194
+ int32_t core_count; // Total CPU cores
195
+ int32_t performance_cores; // Performance (P) cores
196
+ int32_t efficiency_cores; // Efficiency (E) cores
197
+ const char* device_fingerprint; // Unique device fingerprint (may be same as device_id)
198
+
199
+ // Legacy fields (for backward compatibility)
200
+ const char* device_type; // "smartphone", "tablet", etc. (deprecated - use form_factor)
201
+ const char* os_name; // "iOS", "Android" (deprecated - use platform)
202
+ int64_t total_disk_bytes;
203
+ int64_t available_disk_bytes;
204
+ const char* processor_info;
205
+ int32_t processor_count; // Deprecated - use core_count
206
+ rac_bool_t is_simulator;
207
+ const char* locale;
208
+ const char* timezone;
209
+ } rac_device_registration_info_t;
210
+
211
+ /**
212
+ * @brief Device registration request
213
+ */
214
+ typedef struct rac_device_registration_request {
215
+ rac_device_registration_info_t device_info;
216
+ const char* sdk_version;
217
+ const char* build_token; // For development mode
218
+ int64_t last_seen_at_ms;
219
+ } rac_device_registration_request_t;
220
+
221
+ /**
222
+ * @brief Device registration response
223
+ */
224
+ typedef struct rac_device_registration_response {
225
+ const char* device_id;
226
+ const char* status; // "registered" or "updated"
227
+ const char* sync_status; // "synced" or "pending"
228
+ } rac_device_registration_response_t;
229
+
230
+ #ifdef __cplusplus
231
+ }
232
+ #endif
233
+
234
+ #endif // RAC_TELEMETRY_TYPES_H
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runanywhere/llamacpp",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "LlamaCpp backend for RunAnywhere React Native SDK - GGUF model support for on-device LLM",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",