Scope
Ourin implements SAORI/1.0 host-side support under Ourin/SaoriHost/ and bridges it to YAYA runtime calls.
Main files:
SaoriLoader.swiftSaoriProtocol.swiftSaoriRegistry.swiftSaoriManager.swiftYayaAdapter.swift(bridge)yaya_core/src/VM.cpp,yaya_core/src/YayaCore.cpp(plugin operations)
Module loading (SaoriLoader)
SaoriLoader handles dynamic loading with dlopen/dlsym/dlclose:
- Resolves symbol variants:
request/saori_requestload/saori_loadunload/saori_unload- Calls
load(directory)when available - Sends binary request payload to
request(...) - Decodes response with configured charset (UTF-8 fallback)
Error cases are surfaced via SaoriLoaderError.
Protocol handling (SaoriProtocol)
SaoriProtocol provides:
- SAORI request parser
- SAORI response parser/builder
- Charset conversion helpers
Supported encodings:
- UTF-8
- Shift-JIS family aliases (
sjis,cp932,windows-31j, ...) - EUC-JP
- ISO-2022-JP
Discovery and cache (SaoriRegistry)
SaoriRegistry manages:
- Search paths
.saoridiscovery under ghost roots- Module name normalization (
foo,foo.dylib,libfoo.dylib, ...) - Loader cache and unload lifecycle
Default search locations include app resources and user Application Support.
Unified API (SaoriManager)
SaoriManager provides a single entrypoint:
- Discover/load/unload modules
- Send request text with charset
- Process plugin operations:
saori_loadsaori_unloadsaori_request
YAYA bridge path
Runtime chain:
- YAYA script calls
LOADLIB/UNLOADLIB/REQUESTLIB VM.cppforwards topluginOperation(...)YayaCore.cppemits host operation JSON (host_op)YayaAdapter.swiftreceiveshost_op=pluginYayaAdapter.handlePluginOperation(...)delegates toSaoriManager- Result JSON is returned back to
yaya_core
YayaAdapter also exposes helper handleSaoriRequest(...).
Tests and samples
Tests:
OurinTests/SaoriProtocolTests.swiftOurinTests/SaoriRegistryTests.swift
Samples:
Samples/SimpleSaori/CppSimpleSaoriSamples/SimpleSaori/SwiftSimpleSaori
Both sample modules implement load/unload/request.
Current Status
Status: Integration Complete (Core Path) / 2026-03-15
Core SAORI components are now integrated with the YAYA runtime through VM → YayaCore → YayaAdapter → SaoriManager.
Implemented Components
- ✅ SaoriLoader.swift - macOS native .dylib loading with dlopen/dlsym
- ✅ SaoriProtocol.swift - SAORI/1.0 request/response parsing
- ✅ SaoriRegistry.swift - Module discovery and caching
- ✅ SaoriManager.swift - Unified API for SAORI operations
- ✅ Test files - SaoriProtocolTests.swift, SaoriRegistryTests.swift
Integration Status
- ✅ VM.cpp - LOADLIB/UNLOADLIB/REQUESTLIB call pluginOperation bridge
- ✅ YayaCore.cpp - pluginOperation routed via handlePluginOperation with validation
- ✅ YayaAdapter.swift - handlePluginOperation / handleSaoriRequest delegate to SaoriManager
- ✅ Operational path - YAYA scripts can load/request/unload SAORI modules
Blocking Issues
- ✅ ID-001: Resolved
- ✅ ID-002: Resolved
Integration Record
Phase 1 integration work is complete and tracked in code/tests:
- ✅ VM.cpp bridge path (Task 1.1 complete)
- ✅ YayaCore plugin operation routing (Task 1.2 complete)
- ✅ YayaAdapter SAORI bridge wiring (Task 1.3 complete)
- ✅ Sample + smoke coverage (Tasks 1.4-1.5 complete)
Success Criteria
- [x] LOADLIB successfully loads .dylib module
- [x] REQUESTLIB sends request and receives response
- [x] UNLOADLIB unloads module
- [x] Integration smoke tests pass
- [x] No SAORI blockers remain (ID-001, ID-002 resolved)
Current limitations
- SAORI module ABI variance is handled by common symbol aliases only.
- Response memory ownership depends on module behavior; modules should follow SAORI conventions.
- Extended SAORI security policies are not fully formalized yet (future hardening item).
- End-to-end ghost behavior validation is still ongoing for broader real-ghost coverage.
出典と編集について
Ourin / Furin Lab・contributors。文書はCC BY-SA 4.0(第三者の個別表記を除く)。Web版は見出し・リンクの整備とローカルパスの一般化を行っています。更新基準日: 2026-10-30。
元資料: docs/SAORI_IMPLEMENTATION_en-us.md
ソース SHA-256: 4abbd8636198f4af43ff33555bb4326d4b738126674bee4d3f460421f8d30b2b