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

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 (77) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +486 -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 +837 -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/main/java/dev/croche/reactnative/ProjectTimeZone.kt +14 -0
  11. package/android/src/test/java/dev/croche/reactnative/AgentMemoryTest.kt +49 -0
  12. package/android/src/test/java/dev/croche/reactnative/ProjectAttestationTest.kt +42 -0
  13. package/android/src/test/java/dev/croche/reactnative/ProjectTimeZoneTest.kt +24 -0
  14. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/AndroidPlatform.kt +133 -0
  15. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/BitmapImageCodec.kt +47 -0
  16. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/CrocheProjectRecordProvider.kt +32 -0
  17. package/android/vendor/CrocheRuntimeSDK/android/dev/croche/android/WorkManagerScheduler.kt +146 -0
  18. package/android/vendor/CrocheRuntimeSDK/consumer-rules.pro +9 -0
  19. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/AppStreamBranch.kt +110 -0
  20. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Control.kt +178 -0
  21. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Core.kt +12 -0
  22. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Croche.kt +120 -0
  23. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheAgent.kt +116 -0
  24. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/CrocheRuntime.kt +415 -0
  25. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Effects.kt +195 -0
  26. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Host.kt +379 -0
  27. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Images.kt +161 -0
  28. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/NativeCoreStreamPort.kt +173 -0
  29. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Platform.kt +105 -0
  30. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectBinding.kt +79 -0
  31. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectPalRouting.kt +25 -0
  32. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectPlatform.kt +46 -0
  33. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectRecords.kt +87 -0
  34. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ProjectTypes.kt +44 -0
  35. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SendEncoding.kt +27 -0
  36. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/Storage.kt +181 -0
  37. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/StreamHub.kt +227 -0
  38. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/SubscriptionTypes.kt +74 -0
  39. package/android/vendor/CrocheRuntimeSDK/core/dev/croche/ffi/croche_ffi.kt +8316 -0
  40. package/android/vendor/jniLibs/arm64-v8a/libcroche_ffi.so +0 -0
  41. package/android/vendor/jniLibs/armeabi-v7a/libcroche_ffi.so +0 -0
  42. package/android/vendor/jniLibs/x86_64/libcroche_ffi.so +0 -0
  43. package/croche-react-native.podspec +28 -0
  44. package/ios/CrocheRuntimeBridge.swift +1008 -0
  45. package/ios/RNCrocheRuntime.mm +221 -0
  46. package/ios/vendor/CrocheRuntimeSDK/Background.swift +59 -0
  47. package/ios/vendor/CrocheRuntimeSDK/Control.swift +192 -0
  48. package/ios/vendor/CrocheRuntimeSDK/Effects.swift +194 -0
  49. package/ios/vendor/CrocheRuntimeSDK/FFIStreamPort.swift +215 -0
  50. package/ios/vendor/CrocheRuntimeSDK/Host.swift +562 -0
  51. package/ios/vendor/CrocheRuntimeSDK/Images.swift +178 -0
  52. package/ios/vendor/CrocheRuntimeSDK/JSON.swift +63 -0
  53. package/ios/vendor/CrocheRuntimeSDK/OpenOptions.swift +172 -0
  54. package/ios/vendor/CrocheRuntimeSDK/Platform.swift +275 -0
  55. package/ios/vendor/CrocheRuntimeSDK/PortableSHA256.swift +42 -0
  56. package/ios/vendor/CrocheRuntimeSDK/Project.swift +271 -0
  57. package/ios/vendor/CrocheRuntimeSDK/Runtime.swift +558 -0
  58. package/ios/vendor/CrocheRuntimeSDK/Storage.swift +345 -0
  59. package/ios/vendor/CrocheRuntimeSDK/StreamHub.swift +453 -0
  60. package/ios/vendor/CrocheRuntimeSDK/SubscriptionRuntime.swift +38 -0
  61. package/ios/vendor/CrocheRuntimeSDK/SubscriptionTypes.swift +345 -0
  62. package/ios/vendor/CrocheRuntimeSDK/croche_ffi.swift +5666 -0
  63. package/ios/vendor/croche_ffiFFI.xcframework/Info.plist +48 -0
  64. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/Headers/croche_ffiFFI.h +2006 -0
  65. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/Headers/module.modulemap +4 -0
  66. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64/libcroche_ffi.a +0 -0
  67. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/Headers/croche_ffiFFI.h +2006 -0
  68. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap +4 -0
  69. package/ios/vendor/croche_ffiFFI.xcframework/ios-arm64_x86_64-simulator/libcroche_ffi.a +0 -0
  70. package/package.json +40 -4
  71. package/scripts/vendor-native.sh +56 -0
  72. package/src/NativeCrocheRuntime.ts +162 -0
  73. package/src/index.ts +660 -0
  74. package/src/project-types.ts +35 -0
  75. package/src/project.ts +434 -0
  76. package/src/protocol.ts +28 -0
  77. package/src/types.ts +9 -0
@@ -0,0 +1,4 @@
1
+ module croche_ffiFFI {
2
+ header "croche_ffiFFI.h"
3
+ export *
4
+ }
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@h1r-ai/croche-react-native",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "license": "SEE LICENSE IN LICENSE",
8
+ "description": "Croche Runtime for React Native: the shared Rust Core through the native iOS and Android SDKs, with app attestation and Keychain/Keystore credentials.",
9
+ "main": "src/index.ts",
10
+ "types": "src/index.ts",
11
+ "react-native": "src/index.ts",
12
+ "files": [
13
+ "src",
14
+ "ios",
15
+ "android",
16
+ "scripts",
17
+ "croche-react-native.podspec",
18
+ "README.md",
19
+ "LICENSE",
20
+ "THIRD-PARTY-NOTICES"
21
+ ],
22
+ "peerDependencies": {
23
+ "@h1r-ai/croche": "0.5.1",
24
+ "react-native": ">=0.76"
25
+ },
26
+ "devDependencies": {
27
+ "@h1r-ai/croche": "0.5.1"
28
+ },
29
+ "codegenConfig": {
30
+ "name": "CrocheRuntimeSpec",
31
+ "type": "modules",
32
+ "jsSrcsDir": "src",
33
+ "android": {
34
+ "javaPackageName": "dev.croche.reactnative"
35
+ }
36
+ },
37
+ "scripts": {
38
+ "typecheck": "tsc --noEmit -p tsconfig.json",
39
+ "vendor:native": "scripts/vendor-native.sh",
40
+ "test": "vitest run --root ../.. packages/react-native/tests"
41
+ }
42
+ }
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ # Builds the Rust Runtime (crates/croche-ffi) for iOS and/or Android and places it, with the iOS
3
+ # SDK sources and their generated bindings, INSIDE
4
+ # this package, where CocoaPods and Gradle expect a library's files (CocoaPods does not take
5
+ # source patterns outside the pod's directory). Run on the Mac before `pod install` or the
6
+ # first Android build, and again after any change under crates/ or sdk/.
7
+ # packages/react-native/scripts/vendor-native.sh [ios|android|all]
8
+ set -euo pipefail
9
+ package=$(cd "$(dirname "$0")/.." && pwd)
10
+ root=$(cd "$package/../.." && pwd)
11
+ what=${1:-all}
12
+
13
+ if [[ $what == ios || $what == all ]]; then
14
+ work=$(mktemp -d)
15
+ CROCHE_SWIFT_OUTPUT="$work/out" "$root/sdk/swift/build-xcframework.sh"
16
+ rm -rf "$package/ios/vendor"; mkdir -p "$package/ios/vendor"
17
+ cp -R "$work/out/CrocheRuntime/croche_ffiFFI.xcframework" "$package/ios/vendor/"
18
+ cp -R "$root/sdk/swift/Sources/CrocheRuntime" "$package/ios/vendor/CrocheRuntimeSDK"
19
+ cp "$root/sdk/swift/Sources/CrocheFFI/croche_ffi.swift" "$package/ios/vendor/CrocheRuntimeSDK/"
20
+ # The pod compiles the SDK and its bindings into one module: no CrocheFFI module to import.
21
+ sed -i.bak '/^import CrocheFFI$/d' "$package/ios/vendor/CrocheRuntimeSDK/"*.swift
22
+ rm -f "$package/ios/vendor/CrocheRuntimeSDK/"*.bak
23
+ if grep -q 'CrocheFFI\.' "$package/ios/vendor/CrocheRuntimeSDK/"*.swift; then
24
+ echo 'The SDK names the CrocheFFI module; the pod has none. Call the binding unqualified.' >&2; exit 1
25
+ fi
26
+ rm -rf "$work"
27
+ echo "iOS: ios/vendor/croche_ffiFFI.xcframework and ios/vendor/CrocheRuntimeSDK ready; run pod install."
28
+ fi
29
+
30
+ if [[ $what == android || $what == all ]]; then
31
+ : "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME to the selected Android NDK directory}"
32
+ command -v cargo-ndk >/dev/null || { echo 'Install cargo-ndk: cargo install cargo-ndk' >&2; exit 1; }
33
+ for target in aarch64-linux-android armv7-linux-androideabi x86_64-linux-android; do
34
+ rustup target list --installed | grep -Fxq "$target" || { echo "rustup target add $target" >&2; exit 1; }
35
+ done
36
+ rm -rf "$package/android/vendor"; mkdir -p "$package/android/vendor/CrocheRuntimeSDK"
37
+ # The Android SDK sources (sdk/kotlin, with its UniFFI bindings) are compiled into the bridge
38
+ # module; Gradle cannot reach sdk/ from node_modules, so they ship inside the package.
39
+ cp -R "$root/sdk/kotlin/src/main/kotlin" "$package/android/vendor/CrocheRuntimeSDK/core"
40
+ cp -R "$root/sdk/kotlin/android/src/main/kotlin" "$package/android/vendor/CrocheRuntimeSDK/android"
41
+ cp "$root/sdk/kotlin/consumer-rules.pro" "$package/android/vendor/CrocheRuntimeSDK/"
42
+ (cd "$root" && cargo ndk -t arm64-v8a -t armeabi-v7a -t x86_64 --platform 26 \
43
+ -o "$package/android/vendor/jniLibs" build --release -p croche-ffi)
44
+ # cargo-ndk also copies croche-core's own cdylib; libcroche_ffi.so links the Core statically.
45
+ rm -f "$package/android/vendor/jniLibs/"*/libcroche_core.so
46
+ # Not stripped: the release .so has no debug info, and its symbol table is what the app's Gradle
47
+ # extracts for crash symbolication before it strips the APK's copy (Atlas, #213). Keep it so.
48
+ nm=$(ls "$ANDROID_NDK_HOME"/toolchains/llvm/prebuilt/*/bin/llvm-nm | head -1)
49
+ for so in "$package/android/vendor/jniLibs/"*/libcroche_ffi.so; do
50
+ "$nm" "$so" | grep -c '11croche_core7runtimeNtB._4Core5admit' >/dev/null || { echo "$so lost its symbol table (Core::admit)" >&2; exit 1; }
51
+ done
52
+ for abi in arm64-v8a armeabi-v7a x86_64; do
53
+ [[ -f "$package/android/vendor/jniLibs/$abi/libcroche_ffi.so" ]] || { echo "Missing libcroche_ffi.so for $abi" >&2; exit 1; }
54
+ done
55
+ echo "Android: android/vendor/jniLibs/<abi>/libcroche_ffi.so (arm64-v8a, armeabi-v7a, x86_64) and android/vendor/CrocheRuntimeSDK ready."
56
+ fi
@@ -0,0 +1,162 @@
1
+ // TurboModule spec (React Native codegen reads this file). Every structured value crosses
2
+ // the bridge as a JSON string, so numbers, keys and nesting arrive exactly as the Rust Core
3
+ // produced them. The native side is a thin driver over the platform SDK: iOS CrocheRuntime
4
+ // (Swift) and Android dev.croche (Kotlin), which run the shared Rust Core.
5
+ import type { TurboModule } from 'react-native';
6
+ import { TurboModuleRegistry } from 'react-native';
7
+
8
+ export interface Spec extends TurboModule {
9
+ /**
10
+ * Opens (or reopens) one Runtime under `handle`. `configJson` is Core configuration, with
11
+ * tool metadata but no callbacks. `optionsJson` carries host choices: `storageKey`,
12
+ * `attestation` ("platform" | "off"), `backgroundSync` (boolean), `maintenanceIntervalMs`,
13
+ * `android.cloudProjectNumber` and `backgroundDelivery` ({iosTaskIdentifier} or absent).
14
+ * Resolves the Runtime's inspection JSON.
15
+ */
16
+ open(handle: string, configJson: string, optionsJson: string): Promise<string>;
17
+ /**
18
+ * Resolves the TurnResult JSON. Several sends may be in flight per handle. `responseFormatJson`:
19
+ * the structured-output format, or "null" for none. `callId` names this call, unique per handle:
20
+ * a retry of the same input id is another call, with its own cancellation.
21
+ */
22
+ send(handle: string, inputJson: string, responseFormatJson: string, callId: string): Promise<string>;
23
+ /**
24
+ * Stops the handle's running turn only; sends held behind it still run, together, as the next
25
+ * turn. The running send's promise still resolves with the outcome.
26
+ */
27
+ cancel(handle: string): void;
28
+ /**
29
+ * Cancels one send call: held, it is dropped; running, its turn stops (a turn several sends
30
+ * share stops for all of them). A call not yet registered natively is remembered and starts
31
+ * cancelled, so an abort right after `send` is never lost.
32
+ */
33
+ cancelSend(handle: string, callId: string): void;
34
+ /** Drops the sends held behind the running turn (each ends `cancelled`); resolves how many. */
35
+ clearQueued(handle: string): Promise<number>;
36
+ inspect(handle: string): Promise<string>;
37
+ /**
38
+ * One round of background upkeep (deliver call reports, then sync). The native SDK also
39
+ * runs it by itself after each turn and on a timer; call it when the app returns to the
40
+ * foreground. Resolves the MaintenanceResult JSON. Never delays a send.
41
+ */
42
+ maintain(handle: string, force: boolean): Promise<string>;
43
+ /**
44
+ * The platform SDK's `deliverDue()`: the agent's scheduled notes that are due, as one turn.
45
+ * Resolves `{ran: false}` (none due, or one being delivered: `inFlight`) or
46
+ * `{ran, ids, delivered, turn}` JSON.
47
+ */
48
+ deliverDue(handle: string): Promise<string>;
49
+ /** The platform SDK's `schedules()`: `{pending: [{id, at, note}], due}` JSON. */
50
+ schedules(handle: string): Promise<string>;
51
+ /**
52
+ * Asks Cloud to raise (`absolute` false) or set (`absolute` true) this user's allowance
53
+ * within the project's ceilings. `id` ("" for none) makes a retry safe: Cloud applies an
54
+ * id once. Resolves the BudgetAdjustment JSON.
55
+ */
56
+ adjustBudget(handle: string, amount: number, absolute: boolean, id: string): Promise<string>;
57
+ /**
58
+ * Replaces the tool list: `toolsJson` is tool metadata as in `open`'s config (no callbacks;
59
+ * JavaScript keeps the handlers). Rejects, changing nothing, when the Core refuses the list.
60
+ */
61
+ setTools(handle: string, toolsJson: string): Promise<void>;
62
+ /** Starts a new session: forgets history and memory, keeps money and identity. */
63
+ clearHistory(handle: string): Promise<void>;
64
+ /**
65
+ * One wiki operation on the platform SDK's `runtime.wiki`, as JSON both ways:
66
+ * `set` {docs} → digest; `put` {docs} → null; `remove` {path} → boolean; `list` {folder?}
67
+ * → entries; `read` {path, part} → page or null; `search` {query, limit} → hits;
68
+ * `putUser` {docs} → {documents, bytes}; `removeUser` {path} → boolean; `clearUser` {} →
69
+ * count; `bundled` {folder} → the documents shipped in the app (iOS bundle folder, Android
70
+ * assets), with `handle` unused. Docs are [{path, markdown, agents?}].
71
+ */
72
+ wiki(handle: string, op: string, argsJson: string): Promise<string>;
73
+ /**
74
+ * One operation on the platform SDK's `runtime.memory`, as JSON both ways: `list` {} → items;
75
+ * `delete` {id} → {deleted}; `clear` {} → {cleared};
76
+ * `enabled` {on} → null; `export` {} → {enabled, items}; `observe` {on} → null,
77
+ * attaching (or removing) the SDK's onChanged so each change arrives as a `memoryChanged`
78
+ * message.
79
+ */
80
+ memory(handle: string, op: string, argsJson: string): Promise<string>;
81
+ close(handle: string): Promise<void>;
82
+ /** Answers a `tool` event. When `ok`, `resultJson` is `{value, images?, imageResolution?}`:
83
+ * the images beside the value (H3). Otherwise `{code}`, set by this bridge alone:
84
+ * `tool_not_dispatched` (no handler ran), `invalid_tool_result` (it ran and returned something
85
+ * unreadable: that call fails alone) or `effect_failed` (the handler threw). */
86
+ resolveTool(callId: string, ok: boolean, resultJson: string): void;
87
+ // The project API (Keel #339 6093822222: RN mirrors TS `Croche` / `CrocheAgent`). A thin
88
+ // binding of the FFI's `CoreProject` (#377): `project` names one open project, and each
89
+ // agent it opens is an FFI `CoreRuntime` under its own `handle`, which every per-agent method
90
+ // below (and `clearHistory`, `close`, `resolveTool`) takes. The native side builds the
91
+ // `HostPalFactory` from its platform SDK's PAL pieces (storage, HTTP, tools, attestation).
92
+ // JavaScript runs the TypeScript SDK's StreamHub over the stream port, so subscriptions
93
+ // behave as in TypeScript. Every callback arrives as a `CrocheRuntimeEvent` NativeMessage
94
+ // (protocol.ts: {handle, type, json}) emitted from ONE serial queue per handle, in the order
95
+ // the Core called it: observe events, projection events and readOutcome's capture share that
96
+ // order (the hub relies on it). Tool calls use the existing `tool`/`toolCancel` messages and
97
+ // `resolveTool`, with the Core's tool context passed through unchanged.
98
+ /**
99
+ * `Croche.open`. `optionsJson`: `{host, user?, config, handlers, language?, streaming,
100
+ * backgroundSync, maintenanceIntervalMs}` as the FFI's `ProjectOpenOptions` (host and config
101
+ * as JSON values, not text), plus RN host choices `attestation` ("platform" | "off"),
102
+ * `android.cloudProjectNumber`. Usage arrives as `{handle: project, type: "usage", json}`.
103
+ * Resolves `projectInfo`'s JSON. Rejects with the Core's code; nothing stays open.
104
+ */
105
+ projectOpen(project: string, optionsJson: string): Promise<string>;
106
+ /** Synchronous (in-memory getters): `{user, installationId, crocheUserId, agentIds, applied}`. */
107
+ // Sync getters (projectInfo, agentState) either throw a coded error or return {"error":{"code","message"}}.
108
+ projectInfo(project: string): string;
109
+ /** `Croche.deleteStore` (R8): `optionsJson` is `{host, user?, config, agent?}`, as TypeScript's wire. */
110
+ projectDeleteStore(optionsJson: string): Promise<void>;
111
+ /**
112
+ * `croche.agent(id?, {instance?, fresh?, config?})` (#406): opens (or returns again) that agent
113
+ * as `handle`; `id` "" is the default agent, `optionsJson` `{instance?, fresh?, config?}`.
114
+ * Resolves `{id, name, mode, visibleTools, logId, instance, created}`. Rejects with the Core's
115
+ * code (override mismatch, closed).
116
+ */
117
+ projectAgent(project: string, handle: string, id: string, optionsJson: string): Promise<string>;
118
+ /** Closes every agent of the project, then the project. */
119
+ projectClose(project: string): Promise<void>;
120
+ /**
121
+ * One agent control, JSON both ways: `setTools` {visible: string[] | null} → null; `setMode`
122
+ * {mode: string | null} → null; `sync` {} → null.
123
+ */
124
+ agentControl(handle: string, op: string, argsJson: string): Promise<string>;
125
+ /** Synchronous (in-memory getters): `{id, name, mode, visibleTools, closed}`. */
126
+ agentState(handle: string): string;
127
+ /**
128
+ * Starts the agent's one observation: type `observe` (json: the Core event) per event, then one
129
+ * `observeEnd` (json: the Core error, or "null"). Rejects with the
130
+ * Core's code (for example `invalid_configuration` when observed already), observing nothing.
131
+ */
132
+ observe(handle: string): Promise<void>;
133
+ unobserve(handle: string): void;
134
+ /**
135
+ * Opens a projection, `selectionJson` `{"initialMessages": n}` or `{"after": {logId, seq}}`.
136
+ * Resolves its id; each event arrives as type `projection`, json `{"projection": id, "event": …}`.
137
+ */
138
+ select(handle: string, selectionJson: string): Promise<number>;
139
+ closeProjection(handle: string, projection: number): void;
140
+ /** Places one history page (`before` -1: from the loaded edge); the page arrives on the projection. */
141
+ history(handle: string, projection: number, before: number, limit: number): Promise<void>;
142
+ /**
143
+ * The retained ends of input `id` from `fromSeq`. The capture is emitted, in order, as type
144
+ * `captured`, json `{"readId": …, "state": …}`, before this resolves `{messages, gap?}` JSON;
145
+ * JavaScript waits for both.
146
+ */
147
+ readOutcome(handle: string, id: string, fromSeq: number, readId: string): Promise<string>;
148
+ /**
149
+ * The receipt send: resolves `{id, status, seq}` JSON once the input is accepted. `cancelSend`
150
+ * with this `callId` applies before acceptance only.
151
+ */
152
+ sendReceipt(handle: string, inputJson: string, responseFormatJson: string, callId: string): Promise<string>;
153
+ /** Core `cancel(id)`: resolves once durable; rejects `unknown_id` or `closed`. */
154
+ cancelInput(handle: string, id: string): Promise<void>;
155
+ /** Core `cancel_turn`: stops the running turn at the call (FFI #397 returns at once). */
156
+ cancelTurn(handle: string): Promise<void>;
157
+ /** Emitter bookkeeping for the `CrocheRuntimeEvent` stream. */
158
+ addListener(eventName: string): void;
159
+ removeListeners(count: number): void;
160
+ }
161
+
162
+ export default TurboModuleRegistry.getEnforcing<Spec>('CrocheRuntime');