-
Notifications
You must be signed in to change notification settings - Fork 353
feat(v2): v2 architecture migration — single long-lived branch (GAP 01-04 done; 05-09 to come) #494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanchitmonga22
wants to merge
131
commits into
main
Choose a base branch
from
feat/v2-architecture
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
131 commits
Select commit
Hold shift + click to select a range
5ad4eba
feat(gap01-phase1): IDL + codegen infrastructure
sanchitmonga22 68265d4
feat(gap01-phase2): Swift rollout — consume generated enums
sanchitmonga22 6a34618
feat(gap01-phase3): Kotlin rollout — one AudioFormat, one SDKEnvironment
sanchitmonga22 db897b8
feat(gap01-phase4): Dart rollout — proto bridges on every enum
sanchitmonga22 7566810
feat(gap01-phase5): TS rollout — proto bridges on RN + Web enums
sanchitmonga22 f506d64
feat(gap01-phase6): VoiceEvent handoff to GAP 09
sanchitmonga22 5ce9048
docs(gap01-final-gate): Success Criteria verification report
sanchitmonga22 e3ad196
feat(gap02-phase7): unified engine plugin ABI + registry
sanchitmonga22 079315e
feat(gap02-phase8): llama.cpp plugin entry points
sanchitmonga22 6648db3
feat(gap02-phase9): ONNX + whispercpp + whisperkit_coreml + metalrt e…
sanchitmonga22 21c13f1
feat(gap02-phase10): plugin registry tests + authoring doc
sanchitmonga22 3187219
docs(gap02-final-gate): Success Criteria verification report
sanchitmonga22 c6aa710
feat(gap03-phase1-2-3): dynamic plugin loader + CMake mode split
sanchitmonga22 7e93d0f
feat(gap03-phase4-5-6): static-macro polish + llama.cpp dual-mode + t…
sanchitmonga22 d598960
docs(gap03-phase7): authoring guide + final gate report
sanchitmonga22 f2efc81
feat(gap04-phase8-9-10-11): engine router + ABI v2 metadata extension
sanchitmonga22 b5a14b3
feat(gap04-phase12): rac_plugin_route C ABI + router tests + final gate
sanchitmonga22 0a2dba6
docs(wave-b-c-d-e-outline): post-Wave-A roadmap
sanchitmonga22 8d1f851
docs(wave-roadmap): single long-lived branch workflow
sanchitmonga22 67463b0
feat(gap07-phase1-2-3-4-5-6): root CMake + presets + helpers + wrappe…
sanchitmonga22 b1d523b
feat(gap07-phase7): pr-build.yml slim + gap03 doc fix + final gate
sanchitmonga22 ece9e41
feat(gap06-phase8-9): git mv backends/ → engines/ + cmake redirects
sanchitmonga22 66cf140
feat(gap06-phase10-11): sherpa/genie/diffusion-coreml stubs + smoke +…
sanchitmonga22 ba3ecef
feat(gap09-phase12-13-14): streaming service IDL + grpc codegen + ts …
sanchitmonga22 99715cc
feat(gap09-phase15-20): proto-byte event ABI + 5 adapters + parity gate
sanchitmonga22 fe18d69
chore(gap08-phase21-28): wave D deprecation markers + audit + final gate
sanchitmonga22 8668769
feat(gap11-phase29-30-31): deprecate rac_service_*, audit, final v2 gate
sanchitmonga22 05fbe60
docs(v2-audit): post-Wave-F reality check + prioritized remaining work
sanchitmonga22 e81fae3
chore(v2-closeout-phase0): baseline LOC + root cmake comment fix
sanchitmonga22 74ab575
chore(v2-closeout-phase1): build sanity log + fix CMakePresets.json s…
sanchitmonga22 12ad321
feat(gap09-phase15-followup): wire dispatch_proto_event body + 9 unit…
sanchitmonga22 6cf8b72
feat(gap09-phase13-followup): generate + commit grpc client stubs
sanchitmonga22 c26452e
feat(gap09-phase20-followup): parity_test.cpp golden producer + 4-lan…
sanchitmonga22 1c9712c
feat(v2-closeout-phase5): rac_llm_thinking C ABI + Phase 5 strategy doc
sanchitmonga22 97e452d
feat(gap08-phase21-actual): delete Kotlin voice orchestration body
sanchitmonga22 5a4cc7a
feat(gap08-phase22-actual): shrink CppBridgeAuth + fix 5min vs 60s re…
sanchitmonga22 552a050
chore(gap08-phase23-actual): delete 3 zero-caller CppBridge files (-4…
sanchitmonga22 0aade37
feat(gap08-phase24a-actual): delete Swift ThinkingContentParser, use …
sanchitmonga22 8b3b289
feat(gap08-phase24b-actual): delete Swift voice session orchestration
sanchitmonga22 f1cbe8f
feat(gap08-phase24c-actual): swift download honest audit + minor cleanup
sanchitmonga22 7ddbe43
feat(gap08-phase25-actual): delete Dart voice_session_handle.dart orc…
sanchitmonga22 88bded5
feat(gap08-phase26-actual): shrink RN VoiceSessionHandle.ts (-466 LOC)
sanchitmonga22 d0ce329
feat(gap08-phase27-actual): web tokenQueue → AsyncQueue helper, Event…
sanchitmonga22 4afb42a
test(gap08-phase28-actual): parity tests pass + device verification doc
sanchitmonga22 c3e474c
docs(v2-closeout-phase16): final ship gate + LOC delta tables + statu…
sanchitmonga22 a8cc072
docs(v2-postaudit): 3-agent re-audit corrections + production risk re…
sanchitmonga22 6db999a
test(v2-postaudit-phaseA): add 2 missing union-arm tests, all 11 green
sanchitmonga22 916cde4
chore(v2-postaudit-phaseB): sample apps annotate deprecated API call …
sanchitmonga22 dd9155e
chore(v2-postaudit-phaseC): prune 72 orphan native fun declarations (…
sanchitmonga22 8a1ebfa
docs(v2-postaudit-phaseD): flip 3 of 6 audit demotions back to OK; ri…
sanchitmonga22 3d4b1f9
docs(v2-postaudit-drift-cleanup): fix 9 stale-doc inconsistencies; ad…
sanchitmonga22 0156ec7
docs(v2.1-item1): per-SDK LOC measurement closes GAP 08 #6/#7/#8
sanchitmonga22 3f7eadb
docs+chore(v2.1-item2): batch 6 P4 spec-drift fixes
sanchitmonga22 016ead1
feat(v2.1-item3): p50 latency bench harness for GAP 09 #8
sanchitmonga22 bd7da76
feat(v2.1-item4-jni): add 16 rac_auth_* JNI thunks (commit 4 of 7)
sanchitmonga22 13e79d3
feat(v2.1-item4-bridge): add 16 racAuth* declarations to RunAnywhereB…
sanchitmonga22 52e9e48
refactor(v2.1-item4-shrink): CppBridgeAuth.kt 182 → 152 LOC, state mo…
sanchitmonga22 ba145f2
docs(v2.1-item4-flip): GAP 08 #2 PARTIAL → OK; close v2.1-4 (commit 7…
sanchitmonga22 540deec
feat(v2.1-1-swift): deprecate VoiceSessionEvent + add RAVoiceEvent ma…
sanchitmonga22 52ae409
docs(v2.1-1): add VoiceSessionEvent migration guide
sanchitmonga22 47c3f36
feat(v2.1-1-kotlin): scaffold VoiceSessionEvent deprecation + mapper …
sanchitmonga22 6b4e3cb
feat(v2.1-1-dart): scaffold VoiceSessionEvent deprecation + mapper stub
sanchitmonga22 64661d0
feat(v2.1-1-rn-web): scaffold VoiceSessionEvent deprecation + audit Web
sanchitmonga22 a8ad337
docs(v2.1-1): GAP 09 #6 PARTIAL → OK across canonical docs
sanchitmonga22 c95608e
feat(v3-A1): add VoiceAgentStreamAdapter JNI thunks (Kotlin streaming…
sanchitmonga22 65e7fee
feat(v3-A2): Dart rac_native.dart + FFI binding for voice-agent proto…
sanchitmonga22 2ecf565
feat(v3-A3): RN Nitro VoiceAgent spec + generated TS + HybridVoiceAge…
sanchitmonga22 158e667
feat(v3-A4): Web WASM export + runtime module + voice_agent_service.ts
sanchitmonga22 2e25f2c
feat(v3-A5): Kotlin VoiceSessionEvent.from() real mapper body (no mor…
sanchitmonga22 6fe699d
feat(v3-A6): Dart VoiceSessionEvent.fromProto() real mapper body (no …
sanchitmonga22 ed36a6c
feat(v3-A7): RN voiceSessionEventFromProto() real body + bonus Kind m…
sanchitmonga22 eb55f8e
feat(v3-A8): Kotlin rac_llm_thinking bindings (cross-SDK parity with …
sanchitmonga22 37473f4
feat(v3-A9): Dart rac_llm_thinking FFI bindings (cross-SDK parity)
sanchitmonga22 e56cc6b
feat(v3-A10): RN Nitro rac_llm_thinking bindings (cross-SDK parity)
sanchitmonga22 8038c14
feat(v3-A11): Web WASM rac_llm_thinking exports + TS LlmThinking facade
sanchitmonga22 3dd0279
docs(v3-phaseA-exit): update v2_current_state.md with Phase A completion
sanchitmonga22 5def30b
docs(v3-phaseB-gate): design block discovered — ABI extension required
sanchitmonga22 c721a9c
feat(v3-B0): ABI extension — add create(...) op to 7 per-primitive op…
sanchitmonga22 40d032d
feat(v3-B1): llamacpp LLM register — migrate to plugin registry (dele…
sanchitmonga22 e1824aa
feat(v3-B2): llamacpp VLM register — migrate to plugin registry
sanchitmonga22 67b7539
feat(v3-B3): onnx register — migrate STT+TTS+VAD to plugin registry
sanchitmonga22 f75c2c8
feat(v3-B4): whispercpp STT register — migrate to plugin registry
sanchitmonga22 c5ceb7b
feat(v3-B5): whisperkit_coreml STT register — migrate to plugin registry
sanchitmonga22 ce70e20
feat(v3-B6): metalrt register — migrate LLM+STT+TTS+VLM to plugin reg…
sanchitmonga22 890d759
feat(v3-B7): commons-side registers — onnx_embeddings + platform
sanchitmonga22 f46c448
feat(v3-B8): Reroute 7 commons consumers — rac_service_create -> rac_…
sanchitmonga22 e33c6fa
feat(v3-B9): JNI list-providers migration — rac_service_list_provider…
sanchitmonga22 fd8c9e7
feat(v3-B10): Swift CppBridge+Services — migrate to plugin registry
sanchitmonga22 deb79be
docs(v3-B11): Phase B complete — verification summary + C1/C2/C3 backlog
sanchitmonga22 7dc2cbd
feat(v3-C1): DELETE legacy rac_service_* surface
sanchitmonga22 eee8fe7
feat(v3-C2): scope-narrow deprecated-SDK-surface deletion + buildRegi…
sanchitmonga22 b55d41f
feat(v3-C3): RAC_PLUGIN_API_VERSION 2u -> 3u + semver 3.0.0
sanchitmonga22 b99c82b
fix(v3-audit): fix Swift ABI mirror drift + doc drift surfaced by 3-a…
sanchitmonga22 3d2674c
feat(v3.1-P1): Phase 1 unblockers — Swift SPM + MetalRT CMake + JNI +…
sanchitmonga22 dcef1c6
feat(v3.1-P2): Phase 2 perf_bench scaffolds -> real implementations
sanchitmonga22 ee191f3
feat(v3.1-P3.1): iOS sample — migrate VoiceAgentViewModel to VoiceAge…
sanchitmonga22 57cccd3
feat(v3.1-P3.2): Android sample + voice-agent handle JNI bridge
sanchitmonga22 3108c64
feat(v3.1-P3.3): Flutter sample — migrate voice_assistant_view to Voi…
sanchitmonga22 b0ab7f7
feat(v3.1-P3.4): React Native sample + voice-agent handle Nitro bridge
sanchitmonga22 e7ca2c5
feat(v3.1-P4.1): Swift — delete deprecated VoiceSessionEvent/Handle/s…
sanchitmonga22 b97cef3
feat(v3.1-P4.2): Kotlin — delete VoiceSessionEvent + processVoice/sta…
sanchitmonga22 787a678
feat(v3.1-P4.3): Dart — delete voice_session.dart, voice_session_hand…
sanchitmonga22 d17a2fb
feat(v3.1-P4.4): React Native — delete VoiceSession* + misc deprecate…
sanchitmonga22 dda0fd5
feat(v3.1-P5): Phase 5 quality gates — cancel parity harness (GAP 09 #7)
sanchitmonga22 122b98c
docs(v3.1-P6): document rac_add_engine_plugin() adoption state (GAP 06)
sanchitmonga22 766fa2a
docs(v3.1-P7): document Dart language blocker for Flutter runanywhere…
sanchitmonga22 a571293
docs(v3.1-P8): Kotlin LOC audit — GAP 08 #1 closed, #2 minimized, #3 …
sanchitmonga22 8e1c3eb
feat(v3.1-P9): Phase 9 GAP 05 DAG primitives — CancelToken + RingBuff…
sanchitmonga22 f6e49fe
release(v3.1.0): Phase 10 — final verification + version bump + doc f…
sanchitmonga22 129c6ad
docs: consolidate 39 docs → 3 canonical + 4 reference + archive/
sanchitmonga22 8ea25ec
release(v3.1.1): doc refreshes + Swift release-tooling script
sanchitmonga22 5d2401f
release(v3.1.2): Sprint 2 — 4 engine CMakeLists migrated to rac_add_e…
sanchitmonga22 24ff3fa
release(v3.1.3): Sprint 3 — Kotlin download multi-file DRY refactor +…
sanchitmonga22 25c1c95
release(flutter-v4.0.0): Sprint 4 — instance-method API + deprecation…
sanchitmonga22 748cb85
chore(versions+docs): reset all package versions to main baseline; ad…
sanchitmonga22 2cd347a
docs: add COMPREHENSIVE_STATUS.md — 6-agent deep-dive synthesis
sanchitmonga22 bc4dcdb
chore(docs): drop internal status / audit / archive docs from PR
sanchitmonga22 3e5b299
chore(docs): drop stale v3.1 version refs from public SDK docs
sanchitmonga22 1fc0b98
v2 close-out: end-to-end refactor across all phases
sanchitmonga22 801cac4
v2 green-from-source: cross-compile fixes, RAC_API exports, adapter r…
sanchitmonga22 9684f14
v2 architectural second wave: full compile matrix green (13/13)
sanchitmonga22 4ecf76b
v2 architecture complete: GAP 03/05/06/08 DONE, L1 runtime, GraphSche…
sanchitmonga22 26eec73
v2 hardening: build hygiene, Flutter Android plugin polish, RN Nitro …
sanchitmonga22 5cd9233
v2 reality audit: stabilize tree before verification
sanchitmonga22 737bd78
v2 reality reconciliation: verify, correct overclaims, finish runtime…
sanchitmonga22 6c0c1ce
v2 surgical remediation: runtime truth, TS proto dedup, web wiring
sanchitmonga22 c7b7735
v2 pr cleanup: trim audit noise and normalize review artifacts
sanchitmonga22 b491b27
v2 pr cleanup: remove transient planning docs
sanchitmonga22 418c25c
v2 pr cleanup: harden transient artifact ignores
sanchitmonga22 1d8b3f1
v2 pr cleanup round 2: archive remaining engineer/migration/component…
sanchitmonga22 cc1d427
v2 pr cleanup round 2: drop stale doc references and vendor missing r…
sanchitmonga22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Mark every IDL-generated tree as generated so GitHub's diff viewer collapses | ||
| # it by default. Anyone auditing a PR sees only the hand-written changes + the | ||
| # set of files that rotated after regen. The CI drift check is the actual | ||
| # gatekeeper; this attribute is purely cosmetic. | ||
| # | ||
| # Paths match the output directories from idl/codegen/generate_*.sh. | ||
|
|
||
| # Swift | ||
| sdk/runanywhere-swift/Sources/RunAnywhere/Generated/** linguist-generated=true | ||
|
|
||
| # Kotlin | ||
| sdk/runanywhere-kotlin/src/commonMain/kotlin/com/runanywhere/sdk/generated/** linguist-generated=true | ||
|
|
||
| # Dart | ||
| sdk/runanywhere-flutter/packages/runanywhere/lib/generated/** linguist-generated=true | ||
|
|
||
| # TypeScript (RN + Web) | ||
| sdk/runanywhere-react-native/packages/core/src/generated/** linguist-generated=true | ||
| sdk/runanywhere-web/packages/core/src/generated/** linguist-generated=true | ||
|
|
||
| # Python (future SDK; directory exists once generate_python.sh runs) | ||
| sdk/runanywhere-python/src/runanywhere/generated/** linguist-generated=true | ||
|
|
||
| # C++ | ||
| sdk/runanywhere-commons/src/generated/proto/** linguist-generated=true | ||
|
|
||
| # Mirror Nitrogen's existing output tree for consistency. | ||
| sdk/runanywhere-react-native/packages/core/nitrogen/generated/** linguist-generated=true | ||
| sdk/runanywhere-react-native/packages/llamacpp/nitrogen/generated/** linguist-generated=true | ||
| sdk/runanywhere-react-native/packages/onnx/nitrogen/generated/** linguist-generated=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: IDL drift check | ||
|
|
||
| # Runs on every PR and every push to `main`. If any .proto under idl/ is edited | ||
| # without regenerating the committed language bindings, or if anyone hand-edits | ||
| # a generated file, this job fails with ::error::IDL-generated code is out of | ||
| # sync with .proto sources. Fixing the PR is a one-liner locally: | ||
| # | ||
| # ./idl/codegen/generate_all.sh && git add -A && git commit --amend --no-edit | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'idl/**' | ||
| - 'sdk/runanywhere-swift/Sources/RunAnywhere/Generated/**' | ||
| - 'sdk/runanywhere-kotlin/src/commonMain/kotlin/com/runanywhere/sdk/generated/**' | ||
| - 'sdk/runanywhere-flutter/packages/runanywhere/lib/generated/**' | ||
| - 'sdk/runanywhere-react-native/packages/core/src/generated/**' | ||
| - 'sdk/runanywhere-web/packages/core/src/generated/**' | ||
| - 'sdk/runanywhere-commons/src/generated/proto/**' | ||
| - 'scripts/setup-toolchain.sh' | ||
| - '.github/workflows/idl-drift-check.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'idl/**' | ||
| - 'sdk/runanywhere-swift/Sources/RunAnywhere/Generated/**' | ||
| - 'sdk/runanywhere-kotlin/src/commonMain/kotlin/com/runanywhere/sdk/generated/**' | ||
| - 'sdk/runanywhere-flutter/packages/runanywhere/lib/generated/**' | ||
| - 'sdk/runanywhere-react-native/packages/core/src/generated/**' | ||
| - 'sdk/runanywhere-web/packages/core/src/generated/**' | ||
| - 'sdk/runanywhere-commons/src/generated/proto/**' | ||
| - 'scripts/setup-toolchain.sh' | ||
| - '.github/workflows/idl-drift-check.yml' | ||
|
|
||
| jobs: | ||
| check: | ||
| name: Verify generated code matches IDL | ||
| runs-on: macos-14 | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Homebrew | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| /usr/local/Homebrew | ||
| /opt/homebrew | ||
| ~/Library/Caches/Homebrew | ||
| key: ${{ runner.os }}-brew-protoc-${{ hashFiles('scripts/setup-toolchain.sh') }} | ||
|
|
||
| - name: Install protoc + swift-protobuf (Homebrew) | ||
| run: | | ||
| brew install protobuf swift-protobuf | ||
|
|
||
| - name: Install wire-compiler (best-effort — Gradle Wire plugin is the fallback) | ||
| run: | | ||
| brew install wire || echo "wire bottle unavailable; Gradle Wire plugin will handle Kotlin codegen" | ||
|
|
||
| - name: Install Dart plugin (protoc-gen-dart) | ||
| run: | | ||
| if command -v dart >/dev/null 2>&1; then | ||
| dart pub global activate protoc_plugin 21.1.2 | ||
| echo "$HOME/.pub-cache/bin" >> "$GITHUB_PATH" | ||
| else | ||
| echo "::warning::dart not found on macos-14 runner; Dart codegen skipped" | ||
| fi | ||
|
|
||
| - name: Install ts-proto (npm) | ||
| run: | | ||
| npm install -g ts-proto@1.181.1 protobufjs | ||
|
|
||
| - name: Install Python protobuf | ||
| run: | | ||
| python3 -m pip install --upgrade "protobuf>=4.25,<5" grpcio-tools | ||
|
|
||
| - name: Dump toolchain versions (debug) | ||
| run: | | ||
| echo "protoc: $(protoc --version)" | ||
| echo "protoc-gen-swift: $(protoc-gen-swift --version 2>/dev/null || echo 'not present')" | ||
| echo "wire-compiler: $(wire-compiler --version 2>/dev/null || echo 'not present')" | ||
| echo "protoc-gen-dart: $(protoc-gen-dart --version 2>/dev/null || echo 'present or skipped')" | ||
| echo "node: $(node --version)" | ||
| echo "python3: $(python3 --version)" | ||
|
|
||
| - name: Regenerate all bindings | ||
| run: ./idl/codegen/generate_all.sh | ||
|
|
||
| - name: Fail on drift | ||
| run: | | ||
| if ! git diff --exit-code --stat; then | ||
| echo "::error::IDL-generated code is out of sync with .proto sources." | ||
| echo "" | ||
| echo "To fix locally:" | ||
| echo " ./scripts/setup-toolchain.sh" | ||
| echo " ./idl/codegen/generate_all.sh" | ||
| echo " git add -A && git commit -m 'chore(codegen): regenerate bindings'" | ||
| exit 1 | ||
| fi | ||
| echo "✓ No drift detected." | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
Comment on lines
+44
to
+124
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| # Engine Plugin Authoring Guide | ||
|
|
||
| _Closes GAP 02 Phase 10. The definitive "how do I add a new engine to RunAnywhere?" reference._ | ||
|
|
||
| Use this guide when you want RunAnywhere to route a new primitive (LLM, STT, TTS, VAD, embedding, reranker, VLM, diffusion) through your engine. After Phase 10 of | ||
| [`v2_gap_specs/GAP_02_UNIFIED_ENGINE_PLUGIN_ABI.md`](../v2_gap_specs/GAP_02_UNIFIED_ENGINE_PLUGIN_ABI.md) there are **two** registration paths. Most authors should pick the unified path; the legacy path only stays around for binary-compatibility with releases ≤ v0.19. | ||
|
|
||
| ## Which path should I pick? | ||
|
|
||
| ``` | ||
| Are you adding a brand-new engine? | ||
| │ | ||
| ├─ Yes ────────────────────────────────────── Unified path (this guide). | ||
| │ | ||
| └─ No (you're modifying an existing backend) | ||
| │ | ||
| ├─ Add a NEW primitive to an existing backend? | ||
| │ (e.g. add `embed` to ONNX) | ||
| │ ────────────────────────────────────── Edit the existing | ||
| │ rac_plugin_entry_<name>.cpp. | ||
| │ | ||
| ├─ Fix a bug in existing ops? | ||
| │ ────────────────────────────────────── Edit the existing | ||
| │ rac_backend_<name>_register.cpp. | ||
| │ Both registration paths share | ||
| │ the same ops-struct; fixing | ||
| │ there fixes both. | ||
| │ | ||
| └─ Deprecate an engine? | ||
| ─────────────────────────────────────── Add `on_unload` hook in the | ||
| rac_plugin_entry_<name>.cpp | ||
| for cleanup, then drop the | ||
| rac_plugin_register() call at | ||
| consumer sites. | ||
| ``` | ||
|
|
||
| ## Unified path — 4 steps | ||
|
|
||
| ### 1. Fill in a `rac_engine_vtable_t` | ||
|
|
||
| Reserve a short stable name (e.g. `mlx`). Put the vtable in a new | ||
| `src/backends/<name>/rac_plugin_entry_<name>.cpp`: | ||
|
|
||
| ```cpp | ||
| #include "rac/plugin/rac_engine_vtable.h" | ||
| #include "rac/plugin/rac_plugin_entry.h" | ||
| #include "rac/features/llm/rac_llm_service.h" | ||
|
|
||
| extern "C" { | ||
| extern const rac_llm_service_ops_t g_mlx_ops; // <- your ops struct | ||
|
|
||
| static const rac_engine_vtable_t g_mlx_engine_vtable = { | ||
| /* metadata */ { | ||
| .abi_version = RAC_PLUGIN_API_VERSION, | ||
| .name = "mlx", | ||
| .display_name = "Apple MLX", | ||
| .engine_version = "0.1.0", | ||
| .priority = 95, // higher wins for same primitive | ||
| .capability_flags = 0, | ||
| .reserved_0 = 0, | ||
| .reserved_1 = 0, | ||
| }, | ||
| /* capability_check */ [](){ | ||
| #if defined(__APPLE__) | ||
| return RAC_SUCCESS; | ||
| #else | ||
| return RAC_ERROR_CAPABILITY_UNSUPPORTED; // silent reject | ||
| #endif | ||
| }, | ||
| /* on_unload */ nullptr, | ||
|
|
||
| /* llm_ops */ &g_mlx_ops, | ||
| /* other slots */ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, | ||
|
|
||
| /* reserved_slot_0..9 */ | ||
| nullptr, nullptr, nullptr, nullptr, nullptr, | ||
| nullptr, nullptr, nullptr, nullptr, nullptr, | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| RAC_PLUGIN_ENTRY_DEF(mlx) { | ||
| return &g_mlx_engine_vtable; | ||
| } | ||
| } // extern "C" | ||
| ``` | ||
|
|
||
| Rules: | ||
| - `metadata.abi_version` MUST equal `RAC_PLUGIN_API_VERSION` (currently 1). | ||
| - `metadata.name` MUST be unique across all registered engines. | ||
| - Fill exactly the primitive slots you serve; leave everything else NULL. | ||
| - `capability_check` returning non-zero rejects the plugin silently (no error log). | ||
|
|
||
| ### 2. Declare the entry in a public header | ||
|
|
||
| `sdk/runanywhere-commons/include/rac/plugin/rac_plugin_entry_mlx.h`: | ||
|
|
||
| ```c | ||
| #ifndef RAC_PLUGIN_ENTRY_MLX_H | ||
| #define RAC_PLUGIN_ENTRY_MLX_H | ||
| #include "rac/plugin/rac_plugin_entry.h" | ||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
| RAC_PLUGIN_ENTRY_DECL(mlx); | ||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
| #endif | ||
| ``` | ||
|
|
||
| The install rule already picks it up via `install(DIRECTORY include/)`. | ||
|
|
||
| ### 3. Hook CMake | ||
|
|
||
| In `sdk/runanywhere-commons/src/backends/mlx/CMakeLists.txt`: | ||
|
|
||
| ```cmake | ||
| set(MLX_BACKEND_SOURCES | ||
| rac_llm_mlx.cpp | ||
| rac_backend_mlx_register.cpp # optional — legacy path | ||
| rac_plugin_entry_mlx.cpp # unified path | ||
| ) | ||
| ``` | ||
|
|
||
| ### 4. Register at startup | ||
|
|
||
| Pick the simplest of: | ||
|
|
||
| ```cpp | ||
| // C++ app or library: uses static-init. | ||
| #include "rac/plugin/rac_plugin_entry_mlx.h" | ||
| RAC_STATIC_PLUGIN_REGISTER(mlx); | ||
| ``` | ||
|
|
||
| ```c | ||
| // C app or explicit ordering: call manually. | ||
| #include "rac/plugin/rac_plugin_entry_mlx.h" | ||
| int main(void) { | ||
| rac_plugin_register(rac_plugin_entry_mlx()); | ||
| // ... your code ... | ||
| } | ||
| ``` | ||
|
|
||
| ```c | ||
| // Dynamic plugin (dlopen): load then call by symbol name. | ||
| void* h = dlopen("libmlx.so", RTLD_NOW); | ||
| rac_plugin_entry_fn entry = (rac_plugin_entry_fn)dlsym(h, "rac_plugin_entry_mlx"); | ||
| rac_plugin_register(entry()); | ||
| ``` | ||
|
|
||
| ## Testing your plugin | ||
|
|
||
| ```cpp | ||
| // test_plugin_entry_mlx.cpp | ||
| #include "rac/plugin/rac_plugin_entry_mlx.h" | ||
| int main() { | ||
| const rac_engine_vtable_t* vt = rac_plugin_entry_mlx(); | ||
| assert(vt->metadata.abi_version == RAC_PLUGIN_API_VERSION); | ||
| assert(vt->llm_ops != nullptr); | ||
| rac_plugin_register(vt); | ||
| assert(rac_plugin_find(RAC_PRIMITIVE_GENERATE_TEXT) == vt); | ||
| rac_plugin_unregister("mlx"); | ||
| } | ||
| ``` | ||
|
|
||
| Hook it into `sdk/runanywhere-commons/tests/CMakeLists.txt` following the | ||
| pattern established by `test_plugin_entry_llamacpp` and | ||
| `test_plugin_entry_onnx` in Phase 10. | ||
|
|
||
| ## Priority ladder (as of GAP 02 Phase 9) | ||
|
|
||
| | Priority | Name | Primitives served | Platforms | | ||
| |----------|-------------------|-----------------------------------|------------| | ||
| | 120 | metalrt | LLM + STT + TTS + VLM | Apple | | ||
| | 110 | whisperkit_coreml | STT | Apple | | ||
| | 100 | llamacpp | LLM (vlm via llamacpp_vlm) | All | | ||
| | 100 | llamacpp_vlm | VLM | All | | ||
| | 90 | whispercpp | STT | All | | ||
| | 80 | onnx | STT + TTS + VAD | All | | ||
| | 95 | mlx (example) | LLM | Apple only | | ||
|
|
||
| Pick your priority within the existing range. Reserve 0–40 for | ||
| experimental / CPU fallback engines, 40–80 for standard CPU | ||
| implementations, 80–110 for optimized / hardware-accelerated | ||
| implementations, 110+ for Apple-specific hardware paths. | ||
|
|
||
| ## Bumping the plugin API version | ||
|
|
||
| Bump `RAC_PLUGIN_API_VERSION` in | ||
| `sdk/runanywhere-commons/include/rac/plugin/rac_plugin_entry.h` when any of: | ||
|
|
||
| - `rac_engine_vtable_t` field layout changes (reserved slot promotion, new primitive). | ||
| - A new primitive lands in `rac_primitive.h`. | ||
| - Any per-domain ops struct (`rac_llm_service_ops_t`, …) grows or shrinks. | ||
|
|
||
| Old plugins loaded against a newer host will fail the ABI check and be | ||
| rejected with `RAC_ERROR_ABI_VERSION_MISMATCH` — a safe outcome. Do **not** | ||
| bump for additive metadata fields (new `capability_flags` bits). | ||
|
|
||
| ## Relationship to the legacy path | ||
|
|
||
| Every existing backend (`llamacpp`, `onnx`, `whispercpp`, `whisperkit_coreml`, | ||
| `metalrt`) now exposes BOTH: | ||
|
|
||
| - `rac_backend_<name>_register()` — registers via the legacy per-domain | ||
| `rac_service_register_provider()` path used by the C ABI + Swift / | ||
| Kotlin / Dart bridges pre-GAP-02. | ||
| - `rac_plugin_entry_<name>()` — returns a `const rac_engine_vtable_t*` for | ||
| the unified registry. | ||
|
|
||
| Both paths share the same ops-struct (e.g. `g_llamacpp_ops`); a bug fix in | ||
| that struct shows up in both registries automatically. The legacy path will | ||
| stay around for two release cycles; GAP 06 deprecates it and GAP 11 deletes | ||
| it once every SDK frontend has cut over. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drift check silently passes when Dart is unavailable.
macos-14runners do not ship withdartpreinstalled, so this step emits a warning andgenerate_dart.shis never invoked bygenerate_all.sh. Because the committed Dart bindings undersdk/runanywhere-flutter/packages/runanywhere/lib/generated/**are not regenerated,git diff --exit-codeon line 91 reports no drift even when a contributor editsidl/*.protowithout regenerating Dart (or hand-edits a generated Dart file). The gate advertised in the workflow header ("any .proto … without regenerating the committed language bindings … this job fails") does not hold for Dart.Either install Dart unconditionally (e.g.,
dart-lang/setup-dart@v1) or fail the job whendartis missing rather than warning — the drift guarantee is only as strong as its weakest language.🛡️ Suggested change
🤖 Prompt for AI Agents