Architecture

One memory-safe Rust core,four decoupled stages.

Candidate generation, morphosyntactic filtering, causal prefix-tree LM reranking, and pair-separated personal learning never collapse into an opaque black box. Both macOS Swift IMKit and Ubuntu C11 IBus consume the identical 35-symbol C ABI v6 boundary.

Single Rust CoreC ABI v6 (35 Symbols)4 Decoupled Stages

35 Symbols
soh-core: #![forbid(unsafe_code)]Swift IMKit + C11 IBus (AVX2 / OpenBLAS)

Thin native hosts, zero parallel state machines

Dual-Host Convergence · Single Rust Core

Two native OS hosts converging into one 35-symbol C ABI boundary

Swift IMKit Host (Soh.app)

15.4–18.8 ms active E2E p50 · UTF-16 boundary · 0 network frameworks

C11 IBus Host (ibus-engine-soh)

19.12 ms p50 (6T OpenBLAS) · 19.75 ms zero-dep AVX2+FMA

C ABI v6 Boundary

35 symbols · UTF-8 / UTF-16 · panic-proof

libsoh_ffi.a · Single Rust Core

#![forbid(unsafe_code)] · .sohdict v2 · 39.2 MB Q8_0 LM · 0600 M4 learner

macOSApple SiliconInputMethodKitmacOS

Swift IMKit Host (Soh.app)

Thin Swift InputMethodKit server linking libsoh_ffi.a with Apple Accelerate (cblas_sgemm) and vDSP/vvexpf vector paths. Enforces P-core QoS (TASK_FOREGROUND_APPLICATION + QOS_CLASS_USER_INTERACTIVE) on activateServer(_:) with a 60 ms fallback ceiling.

15.4–18.8 ms active E2E p50UTF-16 boundary0 network frameworks
LinuxUbuntu 26.04 LTSIBusUbuntu

C11 IBus Host (ibus-engine-soh)

Pure C11 GObject IBusEngine linking the identical libsoh_ffi.a core for GNOME Wayland and X11. Loads the 39.2 MB LM asynchronously on a background GThread and persists M4 learning via a 1.5 s debounced background pthread.

19.12 ms p50 (6T OpenBLAS)19.75 ms zero-dep AVX2+FMA

C ABI v6 contract (include/soh_core.h)

Every session state transition crosses a deterministic, panic-proof C ABI (SOH_ABI_VERSION = 6). Text crosses as UTF-8 with explicit byte lengths; caret and segment spans cross strictly in UTF-16 code units.

include/soh_core.h
/* include/soh_core.h — Single shared boundary (SOH_ABI_VERSION 6) */
#define SOH_ABI_VERSION 6u

typedef struct SohEngine  SohEngine;   /* immutable dictionary + tables */
typedef struct SohSession SohSession;  /* one input context, never shared */
typedef struct SohLm      SohLm;       /* immutable 39.2 MB Q8_0 local LM */
typedef struct SohLearner SohLearner;  /* thread-safe 0600 personal store */

/* 5-layer secure-field isolation enforced on Password / PIN / Private */
soh_session_set_features(session, 0);
soh_session_clear_context(session);
soh_session_clear_adaptation(session);
soh_session_set_lm(session, NULL);
soh_session_set_learner(session, NULL);
SOH_ABI_VERSION = 635 symbols
#![forbid(unsafe_code)]

Single source of state

The Rust core owns reading, caret, preedit, segments, candidates, and input mode. Native hosts render SohResponse directly with no duplicate state machine.

Non-blocking typing path

Only dictionary, LM, and learner open/save/delete calls touch the filesystem — never on key events. No session function blocks on I/O, network, or logging.

Panic-proof boundary

Panics never unwind across FFI. Any caught panic returns SOH_STATUS_PANIC and poisons the session until soh_session_cancel resets it cleanly.

Type accurate Japanese, completely offline.

Free and open source under Apache-2.0.

v0.1.039.2 MB on-device0 Bytes network