capacitor-native-agent 0.9.1 → 0.9.2
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/README.md +26 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,21 +73,26 @@ NativeAgent.addListener('nativeAgentEvent', (event) => {
|
|
|
73
73
|
}
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
-
// Initialize
|
|
76
|
+
// Initialize — `defaultProvider` and `defaultModel` are the agent's
|
|
77
|
+
// configured LLM identity. Every code path (sendMessage, cron jobs,
|
|
78
|
+
// skills, follow-up) inherits these unless the caller explicitly
|
|
79
|
+
// overrides per-call. See "Configuring the LLM provider" below.
|
|
77
80
|
await NativeAgent.initialize({
|
|
78
81
|
dbPath: 'files://agent.db',
|
|
79
82
|
workspacePath: '/path/to/workspace',
|
|
80
83
|
authProfilesPath: '/path/to/auth-profiles.json',
|
|
84
|
+
defaultProvider: 'openai',
|
|
85
|
+
defaultModel: 'gpt-4o',
|
|
81
86
|
})
|
|
82
87
|
|
|
83
88
|
// Set auth
|
|
84
89
|
await NativeAgent.setAuthKey({
|
|
85
|
-
key: 'sk
|
|
86
|
-
provider: '
|
|
90
|
+
key: 'sk-...',
|
|
91
|
+
provider: 'openai',
|
|
87
92
|
authType: 'api_key',
|
|
88
93
|
})
|
|
89
94
|
|
|
90
|
-
// Send a message
|
|
95
|
+
// Send a message — uses the configured default provider/model.
|
|
91
96
|
const { runId } = await NativeAgent.sendMessage({
|
|
92
97
|
prompt: 'Hello!',
|
|
93
98
|
sessionKey: 'session-1',
|
|
@@ -95,6 +100,18 @@ const { runId } = await NativeAgent.sendMessage({
|
|
|
95
100
|
})
|
|
96
101
|
```
|
|
97
102
|
|
|
103
|
+
## Configuring the LLM provider
|
|
104
|
+
|
|
105
|
+
The agent's `provider` and `model` are resolved at every turn (interactive `sendMessage`, cron jobs fired from background, skill kickoffs, follow-up turns) using this precedence chain:
|
|
106
|
+
|
|
107
|
+
1. **Per-call override** — `SendMessageParams.provider` / `model` if explicitly set on a single call.
|
|
108
|
+
2. **Configured default** — `InitConfig.defaultProvider` / `defaultModel` set once at `initialize()`.
|
|
109
|
+
3. **Hardcoded last-resort** — `anthropic` + that provider's default model. The native side emits a loud `eprintln!` whenever this branch fires; a properly-configured install never reaches it.
|
|
110
|
+
|
|
111
|
+
This means a cron job created with no explicit provider will run on whatever the agent was set up with at `initialize()`-time — not silently fall back to Anthropic. Cron skills can additionally pin a per-skill `provider` / `model` override (see `CronSkillInput`) when one specific skill needs a different model than the agent default.
|
|
112
|
+
|
|
113
|
+
Note: when a caller overrides `provider` but not `model`, the configured `defaultModel` is **not** applied (model strings are tied to providers). The resolver falls through to the per-provider default model instead.
|
|
114
|
+
|
|
98
115
|
## API
|
|
99
116
|
|
|
100
117
|
See [definitions.ts](src/definitions.ts) for the full TypeScript interface.
|
|
@@ -176,30 +193,16 @@ The `provider` argument is a free string. The Rust agent loop currently accepts:
|
|
|
176
193
|
| `openrouter` | `anthropic/claude-sonnet-4.5` | OpenRouter |
|
|
177
194
|
| `kimi` (aliases `kimi-coding`, `kimi-code`) | `kimi-for-coding` | Kimi Coding (Anthropic-messages-compatible, https://api.kimi.com/coding) |
|
|
178
195
|
|
|
179
|
-
|
|
196
|
+
The "Default model" column is what the resolver picks when a provider is selected but no model is supplied. To use a different model with a given provider, pass it explicitly via `defaultModel` at `initialize()` or per-call on `sendMessage`.
|
|
180
197
|
|
|
181
198
|
## Platform Support
|
|
182
199
|
|
|
183
|
-
| Platform | Status
|
|
184
|
-
|
|
185
|
-
| Android | Supported.
|
|
186
|
-
| iOS |
|
|
200
|
+
| Platform | Status |
|
|
201
|
+
|----------|--------|
|
|
202
|
+
| Android | Supported. `arm64-v8a` `.so` shipped under `android/src/main/jniLibs/`. |
|
|
203
|
+
| iOS | Supported. Universal `xcframework` ships device (`ios-arm64`) + Apple Silicon simulator (`ios-arm64-simulator`) slices. |
|
|
187
204
|
| Web | N/A (throws unavailable error). |
|
|
188
205
|
|
|
189
|
-
## Known limitations
|
|
190
|
-
|
|
191
|
-
### 0.9.0 — iOS xcframework not rebuilt
|
|
192
|
-
|
|
193
|
-
The Mac build host was unreachable when `0.9.0` was cut, so `ios/Frameworks/NativeAgentFFI.xcframework/` was **not** rebuilt against `native-agent-ffi@9946e0f`. iOS users on `0.9.0` are missing the following upstream changes (Android users have them):
|
|
194
|
-
|
|
195
|
-
- `ba8c97e` `feat(llm): add kimi (Kimi Code) provider` — `provider: 'kimi'` will fail on iOS until `0.9.1`.
|
|
196
|
-
- `2cb34be` `fix(llm): tolerate "data:" SSE without space` — Anthropic-compatible streaming endpoints that omit the space after `data:` will return empty messages on iOS.
|
|
197
|
-
- `9735f4d` `ffi: keep session context across send_message` — after a cold-boot resume, the next `sendMessage` may start without prior history on iOS.
|
|
198
|
-
- `02b1955` `feat(store): extract AgentStore trait` — internal refactor only; mobile `SqliteStore` default behavior unchanged, so no user-visible iOS impact.
|
|
199
|
-
- `9946e0f` `ffi: detach inner runtime on drop` — server-side concern only (handle dropped from inside another tokio runtime); does not affect Capacitor.
|
|
200
|
-
|
|
201
|
-
Action plan: rebuild `xcframework` on the Mac under `~/choreruiz/` via `scripts/build-ios.sh`, rsync `ios/Frameworks/` and `ios/Sources/NativeAgentPlugin/Generated/` back, bump to `0.9.1`, republish.
|
|
202
|
-
|
|
203
206
|
## License
|
|
204
207
|
|
|
205
208
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-native-agent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Native AI agent loop for Capacitor — runs LLM completions, tool execution, and cron jobs in native Rust, enabling background execution.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|