mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(durable): keep each conversation's context in memory; Durable Object SQLite adapter
runtime.context() keeps each conversation's last read range and derived view. A later read by any of the conversation's tasks with the same head marker scans and derives only the entries committed since, so a generation no longer rereads and re-derives the whole transcript for each model request. Busy conversations keep the range; idle ones for settings.contextRetentionMs (default ten minutes), checked on task changes and by one unreferenced timer where the runtime supports it. Kept entries are frozen; each read returns its own view arrays. Add openDurableObjectSqliteStorage(ctx.storage) in @earendil-works/pi-durable/storage/sqlite/cloudflare: SQLite storage on a SQLite-backed Cloudflare Durable Object, without per-row copies.
This commit is contained in:
parent
fe11328b0d
commit
da866ada17
12 changed files with 927 additions and 76 deletions
|
|
@ -54,6 +54,12 @@
|
|||
"import": "./dist/storage/sqlite/index.js",
|
||||
"default": "./dist/storage/sqlite/index.js"
|
||||
},
|
||||
"./storage/sqlite/cloudflare": {
|
||||
"source": "./src/storage/sqlite/cloudflare.ts",
|
||||
"types": "./dist/storage/sqlite/cloudflare.d.ts",
|
||||
"import": "./dist/storage/sqlite/cloudflare.js",
|
||||
"default": "./dist/storage/sqlite/cloudflare.js"
|
||||
},
|
||||
"./storage/sqlite/node": {
|
||||
"source": "./src/storage/sqlite/node.ts",
|
||||
"types": "./dist/storage/sqlite/node.d.ts",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue