@h1r-ai/croche-react-native 0.0.0-stage → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +475 -2
  3. package/THIRD-PARTY-NOTICES +5824 -0
  4. package/android/build.gradle +47 -0
  5. package/android/src/main/AndroidManifest.xml +8 -0
  6. package/android/src/main/java/dev/croche/reactnative/AgentMemory.kt +25 -0
  7. package/android/src/main/java/dev/croche/reactnative/CrocheRuntimeModule.kt +836 -0
  8. package/android/src/main/java/dev/croche/reactnative/CrocheRuntimePackage.kt +22 -0
  9. package/android/src/main/java/dev/croche/reactnative/ProjectAttestation.kt +17 -0
  10. package/android/src/test/java/dev/croche/reactnative/AgentMemoryTest.kt +49 -0
  11. package/android/src/test/java/dev/croche/reactnative/ProjectAttestationTest.kt +42 -0
  12. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/AndroidPlatform.kt +133 -0
  13. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/BitmapImageCodec.kt +47 -0
  14. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/CrocheProjectRecordProvider.kt +25 -0
  15. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/WorkManagerScheduler.kt +146 -0
  16. package/android/vendor/CrocheRuntimeSDK/consumer-rules.pro +9 -0
  17. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/AppStreamBranch.kt +110 -0
  18. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Control.kt +178 -0
  19. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Core.kt +12 -0
  20. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheRuntime.kt +405 -0
  21. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Effects.kt +195 -0
  22. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Host.kt +368 -0
  23. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Images.kt +161 -0
  24. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/NativeCoreStreamPort.kt +173 -0
  25. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Platform.kt +105 -0
  26. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectRecords.kt +87 -0
  27. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SendEncoding.kt +27 -0
  28. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Storage.kt +181 -0
  29. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/StreamHub.kt +211 -0
  30. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SubscriptionTypes.kt +74 -0
  31. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ffi/croche_ffi.kt +8316 -0
  32. package/android/vendor/jniLibs/arm64-v8a/libcroche_ffi.so +0 -0
  33. package/android/vendor/jniLibs/armeabi-v7a/libcroche_ffi.so +0 -0
  34. package/android/vendor/jniLibs/x86_64/libcroche_ffi.so +0 -0
  35. package/croche-react-native.podspec +28 -0
  36. package/ios/CrocheRuntimeBridge.swift +986 -0
  37. package/ios/RNCrocheRuntime.mm +221 -0
  38. package/ios/vendor/CrocheRuntimeSDK/Background.swift +59 -0
  39. package/ios/vendor/CrocheRuntimeSDK/Control.swift +192 -0
  40. package/ios/vendor/CrocheRuntimeSDK/Effects.swift +194 -0
  41. package/ios/vendor/CrocheRuntimeSDK/FFIStreamPort.swift +212 -0
  42. package/ios/vendor/CrocheRuntimeSDK/Host.swift +561 -0
  43. package/ios/vendor/CrocheRuntimeSDK/Images.swift +178 -0
  44. package/ios/vendor/CrocheRuntimeSDK/JSON.swift +63 -0
  45. package/ios/vendor/CrocheRuntimeSDK/Platform.swift +275 -0
  46. package/ios/vendor/CrocheRuntimeSDK/Runtime.swift +511 -0
  47. package/ios/vendor/CrocheRuntimeSDK/Storage.swift +345 -0
  48. package/ios/vendor/CrocheRuntimeSDK/StreamHub.swift +359 -0
  49. package/ios/vendor/CrocheRuntimeSDK/SubscriptionRuntime.swift +38 -0
  50. package/ios/vendor/CrocheRuntimeSDK/SubscriptionTypes.swift +323 -0
  51. package/ios/vendor/CrocheRuntimeSDK/croche_ffi.swift +5666 -0
  52. package/ios/vendor/croche_ffiFFI.xcframework/Info.plist +48 -0
  53. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/Headers/croche_ffiFFI.h +2006 -0
  54. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/Headers/module.modulemap +4 -0
  55. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/libcroche_ffi.a +0 -0
  56. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/Headers/croche_ffiFFI.h +2006 -0
  57. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap +4 -0
  58. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/libcroche_ffi.a +0 -0
  59. package/package.json +40 -4
  60. package/scripts/vendor-native.sh +56 -0
  61. package/src/NativeCrocheRuntime.ts +162 -0
  62. package/src/index.ts +660 -0
  63. package/src/project-types.ts +35 -0
  64. package/src/project.ts +426 -0
  65. package/src/protocol.ts +28 -0
  66. package/src/types.ts +9 -0
@@ -0,0 +1,47 @@
1
+ // React Native library module. Compiles the bridge together with the Android SDK sources
2
+ // (sdk/kotlin, including its UniFFI bindings) and libcroche_ffi.so per ABI, which
3
+ // scripts/vendor-native.sh android copies and builds into vendor/ (cargo-ndk).
4
+ // First built 2026-10-04 in the harness app (harness/, RN 0.87.1) on the Android emulator.
5
+ buildscript {
6
+ repositories { google(); mavenCentral() }
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:8.9.2"
9
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.21"
10
+ }
11
+ }
12
+
13
+ apply plugin: "com.android.library"
14
+ apply plugin: "kotlin-android"
15
+ apply plugin: "com.facebook.react"
16
+
17
+ android {
18
+ namespace "dev.croche.reactnative"
19
+ compileSdk 35
20
+ defaultConfig { minSdk 26; consumerProguardFiles "vendor/CrocheRuntimeSDK/consumer-rules.pro" }
21
+ sourceSets {
22
+ main {
23
+ java.srcDirs += ["src/main/java", "vendor/CrocheRuntimeSDK/core", "vendor/CrocheRuntimeSDK/android"]
24
+ jniLibs.srcDirs += ["vendor/jniLibs"]
25
+ }
26
+ }
27
+ compileOptions { sourceCompatibility JavaVersion.VERSION_17; targetCompatibility JavaVersion.VERSION_17 }
28
+ kotlinOptions { jvmTarget = "17" }
29
+ }
30
+
31
+ repositories { google(); mavenCentral() }
32
+
33
+ dependencies {
34
+ implementation "com.facebook.react:react-android"
35
+ implementation "com.google.code.gson:gson:2.11.0"
36
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
37
+ implementation "net.java.dev.jna:jna:5.17.0@aar"
38
+ implementation "com.google.android.play:integrity:1.4.0"
39
+ implementation "androidx.work:work-runtime:2.10.1"
40
+ testImplementation "junit:junit:4.13.2"
41
+ }
42
+
43
+ react {
44
+ jsRootDir = file("../src")
45
+ libraryName = "CrocheRuntimeSpec"
46
+ codegenJavaPackageName = "dev.croche.reactnative"
47
+ }
@@ -0,0 +1,8 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.INTERNET" />
3
+ <application>
4
+ <provider android:name="dev.croche.android.CrocheProjectRecordProvider"
5
+ android:authorities="${applicationId}.croche.project-record"
6
+ android:exported="false" />
7
+ </application>
8
+ </manifest>
@@ -0,0 +1,25 @@
1
+ package dev.croche.reactnative
2
+
3
+ import com.google.gson.JsonObject
4
+ import dev.croche.CrocheException
5
+ import dev.croche.ffi.CoreRuntimeInterface
6
+ import dev.croche.ffi.EventListener
7
+ import dev.croche.keepAttached
8
+
9
+ /** Agent entries own an FFI CoreRuntime, rather than the legacy SDK Runtime wrapper. */
10
+ internal fun agentMemory(core: CoreRuntimeInterface, op: String, args: JsonObject, changed: (String) -> Unit): String = when (op) {
11
+ "list" -> core.memoryList()
12
+ "set" -> throw CrocheException("invalid_memory", "memory.set was removed: only the AI writes memories.")
13
+ "delete" -> core.memoryDelete(args.get("id")?.takeIf { it.isJsonPrimitive }?.asString ?: "")
14
+ "clear" -> core.memoryClear()
15
+ "enabled" -> core.memorySetEnabled(args.get("on")?.takeIf { it.isJsonPrimitive && it.asJsonPrimitive.isBoolean }?.asBoolean == true)
16
+ "export" -> core.memoryExport()
17
+ "observe" -> {
18
+ val on = args.get("on")?.takeIf { it.isJsonPrimitive && it.asJsonPrimitive.isBoolean }?.asBoolean == true
19
+ core.setMemoryObserver(if (on) object : EventListener {
20
+ override fun onEvent(event: String) { keepAttached(); changed(event) }
21
+ } else null)
22
+ "null"
23
+ }
24
+ else -> throw CrocheException("invalid_memory", "Unknown memory operation $op")
25
+ }