1 // Copyright 2026 Splitfire AB (Onde Inference). All rights reserved.
2 // SPDX-License-Identifier: MIT OR Apache-2.0
3
4 import { requireNativeModule } from "expo-modules-core";
5
6 /**
7 * Raw native module interface. All JSON serialization/deserialization
8 * happens in the TypeScript wrapper layer (index.ts), not here.
9 *
10 * Methods that return complex types return JSON strings from the native side.
11 * The TypeScript API layer parses these into typed objects.
12 */
13 export interface OndeInferenceNativeModule {
14 // Sync
15 isLoaded(): boolean;
16 setSystemPrompt(prompt: string): void;
17 clearSystemPrompt(): void;
18 setSampling(samplingJson: string): void;
19 clearHistory(): number;
20 pushHistory(messageJson: string): void;
21
22 // Async (returns JSON strings)
23 loadDefaultModel(
24 systemPrompt: string | null,
25 samplingJson: string | null,
26 ): Promise<string>;
27 loadAssignedModel(
28 appId: string,
29 appSecret: string,
30 systemPrompt: string | null,
31 samplingJson: string | null,
32 ): Promise<string>;
33 loadModel(
34 configJson: string,
35 systemPrompt: string | null,
36 samplingJson: string | null,
37 ): Promise<string>;
38 unloadModel(): Promise<string>;
39 info(): Promise<string>;
40 history(): Promise<string>;
41 sendMessage(message: string): Promise<string>;
42 generate(messagesJson: string, samplingJson: string | null): Promise<string>;
43
44 // Config functions (sync, return JSON strings)
45 defaultModelConfig(): string;
46 qwen251_5bConfig(): string;
47 qwen253bConfig(): string;
48 qwen3_0_6bConfig(): string;
49 qwen3_1_7bConfig(): string;
50 qwen3_4bConfig(): string;
51 qwen3_8bConfig(): string;
52 qwen3_14bConfig(): string;
53 qwen3_32bConfig(): string;
54 qwen3_4bInstruct2507Config(): string;
55 qwen3_4bThinking2507Config(): string;
56 qwen3_30bA3bInstruct2507Config(): string;
57 defaultSamplingConfig(): string;
58 deterministicSamplingConfig(): string;
59 mobileSamplingConfig(): string;
60 }
61
62 export default requireNativeModule<OndeInferenceNativeModule>("OndeInference");