@independo/capacitor-inderun 1.1.0-dev.1 → 1.1.0-dev.3
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.
- package/Package.swift +1 -1
- package/README.md +28 -14
- package/package.json +16 -4
package/Package.swift
CHANGED
package/README.md
CHANGED
|
@@ -14,10 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
<p align="center">Built and maintained by <a href="https://www.independo.app/">Independo</a>.</p>
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**On-device AI with cloud fallback, for Capacitor apps.**
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Runs a prompt on the device when the device can — Apple Foundation Models on iOS, ML Kit GenAI
|
|
20
|
+
(Gemini Nano) on Android — and falls back to an OpenAI-compatible cloud endpoint when it cannot.
|
|
21
|
+
One API across iOS, Android and the web, with streaming and cancellation. MIT.
|
|
22
|
+
|
|
23
|
+
It is a thin bridge, not a second engine. The package delegates to the released
|
|
24
|
+
[IndeRun](https://github.com/independo-gmbh/inderun) platform SDKs instead of re-implementing
|
|
25
|
+
routing, provider logic, or normalized error handling:
|
|
21
26
|
|
|
22
27
|
- web: [`@independo/inderun-web`](https://www.npmjs.com/package/@independo/inderun-web) (npm)
|
|
23
28
|
- iOS: `IndeRun` Swift package (`github.com/independo-gmbh/inderun`, SwiftPM)
|
|
@@ -38,10 +43,15 @@ Then sync native projects with your normal Capacitor workflow.
|
|
|
38
43
|
|
|
39
44
|
| Platform | Minimum version |
|
|
40
45
|
|----------|------------------------|
|
|
41
|
-
| iOS |
|
|
46
|
+
| iOS | 16.0 |
|
|
42
47
|
| Android | API 26 (Android 8.0) |
|
|
43
48
|
| Web | Any modern browser |
|
|
44
49
|
|
|
50
|
+
The iOS floor comes from the IndeRun Swift package this bridge depends on, not from the bridge
|
|
51
|
+
itself. On-device execution needs more than the floor: Apple Foundation Models requires an Apple
|
|
52
|
+
Intelligence–capable device on iOS 26+, and ML Kit GenAI requires AICore / Gemini Nano support.
|
|
53
|
+
Availability is checked at runtime and the cloud provider serves the request when it is missing.
|
|
54
|
+
|
|
45
55
|
## Usage
|
|
46
56
|
|
|
47
57
|
```ts
|
|
@@ -96,16 +106,16 @@ for await (const event of run.events) {
|
|
|
96
106
|
run.cancel("user navigated away"); // idempotent; a no-op after the terminal
|
|
97
107
|
```
|
|
98
108
|
|
|
99
|
-
|
|
109
|
+
Event semantics, ordering, the terminal guarantees, cancellation and fallback are the engines'
|
|
110
|
+
contract, identical on every platform, and documented once in
|
|
111
|
+
[Streaming (Mode 2)](https://github.com/independo-gmbh/inderun/blob/dev/docs/streaming.md). Two
|
|
112
|
+
things are specific to reaching them through a bridge:
|
|
100
113
|
|
|
101
|
-
- **
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- **A failed run is not a rejected promise
|
|
105
|
-
|
|
106
|
-
the cumulative text rather than appending to it, and an empty one is how a provider
|
|
107
|
-
retracts content it already delivered — for example when an on-device safety check
|
|
108
|
-
rejects a half-generated response.
|
|
114
|
+
- **The bridge hop is not order-preserving.** That is why `sequence` rather than arrival is the
|
|
115
|
+
contract's ordering authority. `events` already yields strictly by it; if you attach your own
|
|
116
|
+
listener to `STREAM_EVENT_NAME` instead, ordering is yours to enforce.
|
|
117
|
+
- **A failed run is not a rejected promise**, and a bridge transport fault is a third thing again.
|
|
118
|
+
See [Error Handling](#error-handling).
|
|
109
119
|
|
|
110
120
|
## API
|
|
111
121
|
|
|
@@ -131,7 +141,11 @@ also carries the bridge-local correlation id. `stream()` hides this.
|
|
|
131
141
|
- Web requires `openAI` registration because the current web SDK only has the OpenAI-compatible provider.
|
|
132
142
|
- iOS always registers the Apple on-device provider and optionally registers OpenAI when configured.
|
|
133
143
|
- Android always registers the ML Kit on-device provider and optionally registers OpenAI when configured.
|
|
134
|
-
- Keep credentials behind `authContextRef`.
|
|
144
|
+
- Keep credentials behind `authContextRef`. That keeps a secret out of the request payload and out
|
|
145
|
+
of source; it does not make a key safe to ship, since anything an installed app or a browser can
|
|
146
|
+
read, someone with that app or browser can read. For a key you own, put it behind a backend you
|
|
147
|
+
control and point `endpointUrl` at that — for browser apps, a same-origin proxy with
|
|
148
|
+
`auth: "none"`.
|
|
135
149
|
|
|
136
150
|
## Current Limitations
|
|
137
151
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@independo/capacitor-inderun",
|
|
3
|
-
"version": "1.1.0-dev.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.0-dev.3",
|
|
4
|
+
"description": "On-device AI with cloud fallback for Capacitor apps. Apple Foundation Models on iOS, ML Kit GenAI (Gemini Nano) on Android, an OpenAI-compatible endpoint as fallback — one API, with streaming and cancellation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/independo-gmbh/capacitor-inderun#readme",
|
|
7
7
|
"repository": {
|
|
@@ -13,9 +13,21 @@
|
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"capacitor",
|
|
16
|
-
"plugin",
|
|
16
|
+
"capacitor-plugin",
|
|
17
|
+
"ionic",
|
|
17
18
|
"inderun",
|
|
18
|
-
"ai"
|
|
19
|
+
"ai",
|
|
20
|
+
"llm",
|
|
21
|
+
"on-device",
|
|
22
|
+
"on-device-ai",
|
|
23
|
+
"local-llm",
|
|
24
|
+
"offline",
|
|
25
|
+
"cloud-fallback",
|
|
26
|
+
"streaming",
|
|
27
|
+
"openai",
|
|
28
|
+
"gemini-nano",
|
|
29
|
+
"ml-kit",
|
|
30
|
+
"foundation-models"
|
|
19
31
|
],
|
|
20
32
|
"engines": {
|
|
21
33
|
"node": ">=24"
|