@ondeinference / onde / commits / 19f2ddc

Add SDK branding rules, copyright headers, and update example README

- Add `.agents/skills/sdk-branding/SKILL.md` with comprehensive SDK branding rules - Add copyright header to all hand-written Dart, Swift, and C++ source files - Update `sdk/dart/example/README.md` to match branding structure: logo, tagline, badges, feature table, project structure, and footer - Update `.gitignore` to exclude local Android/Flutter SDK paths - Remove committed `android/local.properties` from example app - Update copyright year in Windows plugin to 2026

keypair34 committed Apr 5, 2026 at 17:27 UTC 19f2ddc4f36a01926ea065b03e508db49735bec7
10 files changed +427 -17
.agents/skills/sdk-branding/SKILL.md new
+286
@@ -0,0 +1,286 @@
1 +---
2 +name: sdk-branding
3 +description: Onde Inference SDK branding rules. Covers copyright headers for every language, brand identity (logo, colors, badges), README structure, and file classification (generated vs hand-written). Apply when creating or editing any SDK source file, README, or documentation.
4 +allowed-tools: Read, Write, Edit, Glob, Grep
5 +user-invocable: false
6 +---
7 +
8 +# SDK Branding
9 +
10 +Branding rules for the Onde Inference SDK. These apply across all languages and all SDK surfaces: source files, READMEs, package metadata, and CI output.
11 +
12 +---
13 +
14 +## Copyright Header
15 +
16 +Every hand-written source file starts with this three-line block. No blank line before it. One blank line after it (before the first import or code).
17 +
18 +### Format
19 +
20 +```
21 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
22 +// Use of this source code is governed by the MIT license.
23 +//
24 +```
25 +
26 +Use `//` comment syntax for all languages that support it: Dart, Swift, Kotlin, Rust, C, C++.
27 +
28 +### Language reference
29 +
30 +**Dart**
31 +```dart
32 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
33 +// Use of this source code is governed by the MIT license.
34 +//
35 +import 'dart:async';
36 +```
37 +
38 +**Swift**
39 +```swift
40 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
41 +// Use of this source code is governed by the MIT license.
42 +//
43 +import Foundation
44 +```
45 +
46 +**Kotlin**
47 +```kotlin
48 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
49 +// Use of this source code is governed by the MIT license.
50 +//
51 +package com.ondeinference
52 +```
53 +
54 +**Rust**
55 +```rust
56 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
57 +// Use of this source code is governed by the MIT license.
58 +//
59 +use std::sync::Arc;
60 +```
61 +
62 +**C / C++**
63 +```cpp
64 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
65 +// Use of this source code is governed by the MIT license.
66 +//
67 +#include <flutter/plugin_registrar.h>
68 +```
69 +
70 +### Existing file-level comments
71 +
72 +If the file already has a descriptive comment block below the copyright position (e.g. `// OndeInferencePlugin.swift\n// Native iOS plugin...`), prepend the copyright header above it — do not replace it.
73 +
74 +```swift
75 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
76 +// Use of this source code is governed by the MIT license.
77 +//
78 +// OndeInferencePlugin.swift
79 +//
80 +// Native iOS plugin for onde_inference.
81 +//
82 +```
83 +
84 +---
85 +
86 +## File Classification
87 +
88 +Apply the header only to hand-written files. Never add it to generated files.
89 +
90 +### Always add the header
91 +
92 +| File | Notes |
93 +|---|---|
94 +| `lib/src/engine.dart` | Core SDK logic |
95 +| `lib/src/types.dart` | SDK types |
96 +| `lib/onde_inference.dart` | Public barrel file |
97 +| `test/dart_test.dart` | Hand-written unit tests |
98 +| `example/lib/main.dart` | Example app entry point |
99 +| `ios/Classes/OndeInferencePlugin.swift` | iOS plugin |
100 +| `macos/Classes/OndeInferencePlugin.swift` | macOS plugin |
101 +| `android/src/main/kotlin/**/*.kt` | Android plugin |
102 +| `windows/**/*.cpp` | Windows plugin |
103 +| `linux/**/*.cc` / `linux/**/*.h` | Linux plugin |
104 +| `src/**/*.rs` | Rust crate source |
105 +
106 +### Never add the header — generated files
107 +
108 +These files are written by a tool on every codegen run. Adding a header would be overwritten or cause diffs noise.
109 +
110 +| File / Pattern | Generator |
111 +|---|---|
112 +| `lib/src/frb_generated.dart/**` | `flutter_rust_bridge_codegen` |
113 +| `**/*.freezed.dart` | `build_runner` + `freezed` |
114 +| `**/*.g.dart` | `build_runner` |
115 +| `example/*/Flutter/GeneratedPluginRegistrant.*` | `flutter pub get` |
116 +| `generated/**` (repo root) | `uniffi-bindgen` |
117 +| `onde.swift` in `onde-swift` | `uniffi-bindgen` |
118 +
119 +### Never add the header — platform scaffold
120 +
121 +These files are produced by `flutter create` or Xcode project templates. They are committed to git but were not hand-written by the team.
122 +
123 +| Pattern | Tool |
124 +|---|---|
125 +| `example/ios/Runner/AppDelegate.swift` | `flutter create` |
126 +| `example/ios/Runner/SceneDelegate.swift` | `flutter create` |
127 +| `example/ios/RunnerTests/RunnerTests.swift` | `flutter create` |
128 +| `example/macos/Runner/AppDelegate.swift` | `flutter create` |
129 +| `example/macos/Runner/MainFlutterWindow.swift` | `flutter create` |
130 +| `example/macos/RunnerTests/RunnerTests.swift` | `flutter create` |
131 +| `example/test/widget_test.dart` | `flutter create` |
132 +
133 +**Rule of thumb:** if the first meaningful line of a file is a Flutter or Xcode framework import with no project-specific logic, it is scaffold — skip it.
134 +
135 +---
136 +
137 +## Brand Identity
138 +
139 +### Logo
140 +
141 +Always reference the logo via the raw GitHub URL so it renders on pub.dev, crates.io, and any mirror.
142 +
143 +```
144 +https://raw.githubusercontent.com/ondeinference/onde/main/assets/onde-inference-logo.svg
145 +```
146 +
147 +Width: `96` for top-level READMEs. Use `72` for secondary pages (example apps, sub-package docs).
148 +
149 +### Colors
150 +
151 +| Role | Hex |
152 +|---|---|
153 +| Brand green (foreground, badge color) | `#235843` |
154 +| Dark background (badge `labelColor`) | `#17211D` |
155 +
156 +### Badge row
157 +
158 +Use this exact pattern in every top-level README. Adjust the registry badge to match the file's context (pub.dev for Dart, crates.io for Rust):
159 +
160 +**Dart / Flutter SDK:**
161 +```html
162 +<a href="https://pub.dev/packages/onde_inference"><img src="https://img.shields.io/pub/v/onde_inference?style=flat-square&color=235843&labelColor=17211D&label=pub.dev" alt="pub.dev"></a>
163 +<a href="https://ondeinference.com"><img src="https://img.shields.io/badge/ondeinference.com-235843?style=flat-square&labelColor=17211D" alt="Website"></a>
164 +<a href="https://apps.apple.com/se/developer/splitfire-ab/id1831430993"><img src="https://img.shields.io/badge/App%20Store-live-235843?style=flat-square&labelColor=17211D" alt="App Store"></a>
165 +```
166 +
167 +**Rust SDK:**
168 +```html
169 +<a href="https://crates.io/crates/onde"><img src="https://img.shields.io/crates/v/onde?style=flat-square&color=235843&labelColor=17211D&label=crates.io" alt="crates.io"></a>
170 +<a href="https://ondeinference.com"><img src="https://img.shields.io/badge/ondeinference.com-235843?style=flat-square&labelColor=17211D" alt="Website"></a>
171 +<a href="https://apps.apple.com/se/developer/splitfire-ab/id1831430993"><img src="https://img.shields.io/badge/App%20Store-live-235843?style=flat-square&labelColor=17211D" alt="App Store"></a>
172 +```
173 +
174 +### Footer
175 +
176 +Every README ends with this line, inside a centered `<p>`:
177 +
178 +```html
179 +<p align="center">
180 + <sub>© 2026 <a href="https://ondeinference.com">Onde Inference</a> — MIT License</sub>
181 +</p>
182 +```
183 +
184 +Use `— MIT License` on sub-pages (example apps, package-level docs). Omit it on the top-level repo README (it has its own license section).
185 +
186 +---
187 +
188 +## README Structure
189 +
190 +### Top-level SDK README (e.g. `sdk/dart/README.md`)
191 +
192 +1. Centered logo block
193 +2. Centered `<h1>` with SDK name
194 +3. Centered tagline (`<p><strong>...</strong></p>`)
195 +4. Centered badge row
196 +5. Centered cross-SDK nav links (`Rust SDK · Swift SDK · Website`)
197 +6. `---` divider
198 +7. `## Features` — bullet list with emoji prefix per feature
199 +8. `## Platform support` — table: Platform | GPU backend | Default model | Notes
200 +9. `## Quick start` — `### Add the dependency`, `### Initialize`, then usage sections
201 +10. `## Model selection` — table + code examples
202 +11. `## Sampling` — presets table + code
203 +12. `## Error handling`
204 +13. `## Contributing`
205 +14. `## License`
206 +15. Footer
207 +
208 +### Example app README
209 +
210 +1. Centered logo block (width `96`)
211 +2. Centered `<h1>` with `— Example App` suffix
212 +3. Centered one-line description (bold) + second line: `No server. No API key. No data leaving the device.`
213 +4. Centered badge row (identical to SDK README)
214 +5. `---` divider
215 +6. `## What this example demonstrates` — feature table mapping feature → file/function
216 +7. `## Running the example` — Prerequisites, Steps, Platform notes table
217 +8. `## SDK quick reference` — minimal happy-path snippet (load → stream → unload)
218 +9. `## Project structure` — directory tree
219 +10. `## Learn more` — links to pub.dev, ondeinference.com, GitHub
220 +11. Footer
221 +
222 +### Taglines
223 +
224 +Use these verbatim. Do not paraphrase.
225 +
226 +| Context | Tagline |
227 +|---|---|
228 +| Rust crate | `On-device LLM inference — optimized for Apple silicon.` |
229 +| Flutter SDK | `On-device LLM inference for Flutter & Dart — optimized for Apple silicon.` |
230 +| Example app | `A complete Flutter chat app running fully on-device LLM inference.` |
231 +
232 +---
233 +
234 +## Package Metadata Branding
235 +
236 +### `pubspec.yaml`
237 +
238 +```yaml
239 +description: >-
240 + On-device LLM inference SDK for Flutter & Dart. Runs Qwen 2.5 models locally
241 + with Metal (Apple silicon) and CPU acceleration — no cloud, no data leaving
242 + the device. Powered by the Onde Rust engine and mistral.rs.
243 +repository: https://github.com/ondeinference/onde/
244 +homepage: https://ondeinference.com
245 +issue_tracker: https://github.com/ondeinference/onde/issues
246 +```
247 +
248 +### `Cargo.toml`
249 +
250 +```toml
251 +description = "On-device inference engine for Apple silicon."
252 +license = "MIT"
253 +repository = "https://github.com/ondeinference/onde"
254 +homepage = "https://ondeinference.com"
255 +documentation = "https://docs.rs/onde"
256 +keywords = ["inference", "on-device", "chat", "llm", "mistral"]
257 +categories = ["science::ml", "api-bindings"]
258 +```
259 +
260 +---
261 +
262 +## Version Synchronisation
263 +
264 +The version in `Cargo.toml` and `sdk/dart/pubspec.yaml` must always be identical. When bumping a version, update both files in the same commit. The CI workflows for Swift and Dart both validate that the git tag equals the version in their respective metadata file — a mismatch fails fast.
265 +
266 +```
267 +Cargo.toml version = "X.Y.Z"
268 +sdk/dart/pubspec.yaml version: X.Y.Z
269 +git tag X.Y.Z
270 +```
271 +
272 +---
273 +
274 +## Applying the Copyright Header to an Existing Codebase
275 +
276 +When asked to add copyright headers to a set of files:
277 +
278 +1. Run `find` or `Glob` to list all `.dart`, `.swift`, `.kt`, `.rs`, `.cpp`, `.cc`, `.h` files under the SDK path.
279 +2. For each file, read its first line.
280 +3. Skip if the first line already starts with `// Copyright`.
281 +4. Skip if the first line contains `Generated` or `Do not edit`.
282 +5. Skip if the file path matches any generated or scaffold pattern above.
283 +6. Prepend the three-line header followed by a blank line.
284 +7. If the file begins with an existing file-description comment block, insert the header above that block.
285 +
286 +Do all qualifying files in one pass. Do not ask for confirmation per file.
\ No newline at end of file
sdk/dart/example/.gitignore
+3
@@ -43,3 +43,6 @@ app.*.map.json
43 /android/app/debug
44 /android/app/profile
45 /android/app/release
46 +
47 +# Local machine-specific Android/Flutter SDK paths — never commit
48 +**/android/local.properties
sdk/dart/example/README.md
+119 -11
@@ -1,17 +1,125 @@
1 -# onde_inference_example
1 +<p align="center">
2 + <img src="https://raw.githubusercontent.com/ondeinference/onde/main/assets/onde-inference-logo.svg" alt="Onde Inference" width="96">
3 +</p>
4
3 -A new Flutter project.
5 +<h1 align="center">onde_inference — Example App</h1>
6
5 -## Getting Started
7 +<p align="center">
8 + <strong>A complete Flutter chat app running fully on-device LLM inference.</strong><br>
9 + No server. No API key. No data leaving the device.
10 +</p>
11
7 -This project is a starting point for a Flutter application.
12 +<p align="center">
13 + <a href="https://pub.dev/packages/onde_inference"><img src="https://img.shields.io/pub/v/onde_inference?style=flat-square&color=235843&labelColor=17211D&label=pub.dev" alt="pub.dev"></a>
14 + <a href="https://ondeinference.com"><img src="https://img.shields.io/badge/ondeinference.com-235843?style=flat-square&labelColor=17211D" alt="Website"></a>
15 + <a href="https://apps.apple.com/se/developer/splitfire-ab/id1831430993"><img src="https://img.shields.io/badge/App%20Store-live-235843?style=flat-square&labelColor=17211D" alt="App Store"></a>
16 +</p>
17
9 -A few resources to get you started if this is your first Flutter project:
18 +---
19
11 -- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter)
12 -- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
13 -- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
20 +## What this example demonstrates
21
15 -For help getting started with Flutter development, view the
16 -[online documentation](https://docs.flutter.dev/), which offers tutorials,
17 -samples, guidance on mobile development, and a full API reference.
22 +This is a production-quality Material 3 chat app built on the `onde_inference` Flutter SDK. It covers every major SDK feature in a single, self-contained file ([`lib/main.dart`](lib/main.dart)):
23 +
24 +| Feature | Where |
25 +|---|---|
26 +| `OndeInference.init()` + sandbox cache setup | `main()` |
27 +| Synchronous `OndeChatEngine()` factory (no `await`, no nulls) | `_ChatScreenState` |
28 +| Platform-aware default model loading (`loadDefaultModel`) | `_loadModel()` |
29 +| Multi-turn streaming chat via `streamMessage()` | `_sendMessage()` |
30 +| Live `EngineInfo` status bar (model name, memory, history length) | `_EngineStatusBar` |
31 +| `OndeError` sealed-class error handling | `_loadModel()`, `_sendMessage()` |
32 +| Sampling preset switcher (creative / precise / fast) | `_SamplingPreset` |
33 +| Unload and reload model at runtime | `_unloadModel()`, `_loadModel()` |
34 +| Blinking cursor animation during streaming | `_BlinkingCursor` |
35 +
36 +---
37 +
38 +## Running the example
39 +
40 +### Prerequisites
41 +
42 +- [Flutter SDK](https://docs.flutter.dev/get-started/install) ≥ 3.10
43 +- [Rust toolchain](https://rustup.rs) (stable) — required to compile the native inference engine
44 +- A physical device or simulator/emulator for your target platform
45 +
46 +> **First build takes 5–10 minutes** to compile the full Rust dependency tree (mistral.rs + candle). Subsequent builds are incremental and fast.
47 +
48 +### Steps
49 +
50 +```sh
51 +# From the repo root
52 +cd onde/sdk/dart/example
53 +
54 +# Install Dart dependencies
55 +flutter pub get
56 +
57 +# Run on your connected device or simulator
58 +flutter run
59 +```
60 +
61 +On **iOS / macOS** the Rust engine is compiled via the CocoaPods podspec and linked automatically by Xcode. On **Android** it is compiled via CMake/Gradle. On **Linux / Windows** it is linked as a shared library.
62 +
63 +### Platform notes
64 +
65 +| Platform | GPU backend | Default model loaded |
66 +|---|---|---|
67 +| iOS (device) | Metal | Qwen 2.5 1.5B (~941 MB) |
68 +| macOS | Metal | Qwen 2.5 3B (~1.93 GB) |
69 +| Android (arm64) | CPU | Qwen 2.5 1.5B (~941 MB) |
70 +| Linux / Windows | CPU | Qwen 2.5 3B (~1.93 GB) |
71 +
72 +> The model is downloaded from HuggingFace Hub on first launch and cached locally — an internet connection is required once.
73 +
74 +---
75 +
76 +## SDK quick reference
77 +
78 +```dart
79 +import 'package:onde_inference/onde_inference.dart';
80 +
81 +// 1. Initialise once at startup
82 +await OndeInference.init();
83 +
84 +// 2. Create the engine and load the platform-appropriate model
85 +final engine = OndeChatEngine();
86 +await engine.loadDefaultModel(systemPrompt: 'You are a helpful assistant.');
87 +
88 +// 3. Stream a reply token-by-token
89 +await for (final chunk in engine.streamMessage('Hello!')) {
90 + stdout.write(chunk.delta);
91 + if (chunk.done) break;
92 +}
93 +
94 +// 4. Release memory when done
95 +await engine.unloadModel();
96 +```
97 +
98 +---
99 +
100 +## Project structure
101 +
102 +```
103 +example/
104 +├── lib/
105 +│ └── main.dart # Complete chat UI + SDK integration
106 +├── android/ # Android Gradle + CMake build
107 +├── ios/ # iOS Xcode project + CocoaPods
108 +├── macos/ # macOS Xcode project + CocoaPods
109 +├── linux/ # Linux CMake build
110 +└── windows/ # Windows CMake build
111 +```
112 +
113 +---
114 +
115 +## Learn more
116 +
117 +- **[onde_inference on pub.dev](https://pub.dev/packages/onde_inference)** — full API reference
118 +- **[Onde Inference docs](https://ondeinference.com)** — guides, model catalogue, platform setup
119 +- **[onde on GitHub](https://github.com/ondeinference/onde)** — Rust engine source, Swift SDK, issue tracker
120 +
121 +---
122 +
123 +<p align="center">
124 + <sub>© 2026 <a href="https://ondeinference.com">Onde Inference</a> — MIT License</sub>
125 +</p>
\ No newline at end of file
sdk/dart/example/android/local.properties deleted
-2
@@ -1,2 +0,0 @@
1 -sdk.dir=/Users/setoelkahfi/Library/Android/sdk
2 -flutter.sdk=/Users/setoelkahfi/Develop/flutter
\ No newline at end of file
sdk/dart/ios/Classes/OndeInferencePlugin.swift
+4 -1
@@ -1,3 +1,6 @@
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 +// Use of this source code is governed by the MIT license.
3 +//
4 // OndeInferencePlugin.swift
5 //
6 // Native iOS plugin for onde_inference.
@@ -46,4 +49,4 @@ public class OndeInferencePlugin: NSObject, FlutterPlugin {
49 result(FlutterMethodNotImplemented)
50 }
51 }
49 -}
\ No newline at end of file
52 +}
sdk/dart/lib/src/engine.dart
+3
@@ -1,3 +1,6 @@
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 +// Use of this source code is governed by the MIT license.
3 +//
4 // ignore_for_file: prefer_const_constructors
5
6 import 'dart:async';
sdk/dart/lib/src/types.dart
+3
@@ -1,3 +1,6 @@
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 +// Use of this source code is governed by the MIT license.
3 +//
4 /// Generated and convenience types for the Onde Inference SDK.
5 ///
6 /// All core data types ([ChatRole], [ChatMessage], [SamplingConfig],
sdk/dart/macos/Classes/OndeInferencePlugin.swift
+4 -1
@@ -1,3 +1,6 @@
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 +// Use of this source code is governed by the MIT license.
3 +//
4 // OndeInferencePlugin.swift
5 //
6 // Native macOS plugin for onde_inference.
@@ -46,4 +49,4 @@ public class OndeInferencePlugin: NSObject, FlutterPlugin {
49 result(FlutterMethodNotImplemented)
50 }
51 }
49 -}
\ No newline at end of file
52 +}
sdk/dart/test/dart_test.dart
+3
@@ -1,3 +1,6 @@
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 +// Use of this source code is governed by the MIT license.
3 +//
4 import 'package:flutter_test/flutter_test.dart';
5 import 'package:onde_inference/onde_inference.dart';
6
sdk/dart/windows/onde_inference_plugin.cpp
+2 -2
@@ -1,4 +1,4 @@
1 -// Copyright 2024 Onde Inference (Splitfire AB). All rights reserved.
1 +// Copyright 2026 Onde Inference (Splitfire AB). All rights reserved.
2 // Use of this source code is governed by the MIT license.
3 //
4 // onde_inference_plugin.cpp
@@ -33,4 +33,4 @@ OndeInferencePlugin::OndeInferencePlugin() {}
33
34 OndeInferencePlugin::~OndeInferencePlugin() {}
35
36 -} // namespace onde_inference
\ No newline at end of file
36 +} // namespace onde_inference