mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-06 23:55:12 +00:00
feat(plugins): add SQLite plugin state store (#74190)
* feat(plugins): add experimental sqlite plugin state store
This commit is contained in:
@@ -394,12 +394,28 @@ Provider and channel execution paths must use the active runtime config snapshot
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="api.runtime.state">
|
||||
State directory resolution.
|
||||
State directory resolution and SQLite-backed keyed storage.
|
||||
|
||||
```typescript
|
||||
const stateDir = api.runtime.state.resolveStateDir();
|
||||
const stateDir = api.runtime.state.resolveStateDir(process.env);
|
||||
const store = api.runtime.state.openKeyedStore<MyRecord>({
|
||||
namespace: "my-feature",
|
||||
maxEntries: 200,
|
||||
defaultTtlMs: 15 * 60_000,
|
||||
});
|
||||
|
||||
await store.register("key-1", { value: "hello" });
|
||||
const value = await store.lookup("key-1");
|
||||
await store.consume("key-1");
|
||||
await store.clear();
|
||||
```
|
||||
|
||||
Keyed stores survive restarts and are isolated by the runtime-bound plugin id. Limits: `maxEntries` per namespace, 1,000 live rows per plugin, JSON values under 64KB, and optional TTL expiry.
|
||||
|
||||
<Warning>
|
||||
Bundled plugins only in this release.
|
||||
</Warning>
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="api.runtime.tools">
|
||||
Memory tool factories and CLI.
|
||||
|
||||
Reference in New Issue
Block a user