Many real apps need persistence beyond a flat blob, because the logic is relational: entities reference each other, queries aggregate, and writes touch several tables at once. A whole-model file with writeFile/readFile can carry that, but then the app owns a serialization format and every query as a hand-written scan. I've been mapping what the TS core path actually offers, and I want to check the intended direction.
What I found so far:
Cmd.persist() compiles but no host implements it yet (NS1028); the ts-core skill points at Cmd.writeFile/Cmd.readFile as the persistence pattern.
Cmd.request/Cmd.host with a custom name comes back rejected in the default wiring, because the generated TS wiring binds no host services. I confirmed in ts_core_main.zig and effects.zig that unbound host calls get an err: "rejected" result.
- That leaves, as I see it: a whole-model file KV with a hand-rolled format, spawning a system
sqlite3 CLI per query, or ejecting to bind a Zig host service with SQLite linked in-process. npm-based bindings (libsql etc.) are ruled out by the subset.
Questions:
- Is in-process storage for TS cores on the roadmap (a builtin KV or SQL host service), or is the file KV pattern the intended answer for now?
- If the file KV pattern is it: any guidance on the 1 MiB per-file ceiling? And is
NATIVE_SDK_APP_DATA_DIR supposed to be set by the runner? The voice-memo example reads it through envMsgs, but I couldn't find anywhere in the CLI that injects it, so I'm deriving the data dir from HOME/XDG myself.
- I'd rather not spawn a subprocess per query, partly for latency and partly because it pins the app to whatever sqlite version the user has. Is that pattern something you'd discourage?
I think relational data is common enough that the answer shouldn't be "eject and write Zig." Curious what you'd recommend.
Many real apps need persistence beyond a flat blob, because the logic is relational: entities reference each other, queries aggregate, and writes touch several tables at once. A whole-model file with
writeFile/readFilecan carry that, but then the app owns a serialization format and every query as a hand-written scan. I've been mapping what the TS core path actually offers, and I want to check the intended direction.What I found so far:
Cmd.persist()compiles but no host implements it yet (NS1028); the ts-core skill points atCmd.writeFile/Cmd.readFileas the persistence pattern.Cmd.request/Cmd.hostwith a custom name comes backrejectedin the default wiring, because the generated TS wiring binds no host services. I confirmed ints_core_main.zigandeffects.zigthat unbound host calls get anerr: "rejected"result.sqlite3CLI per query, or ejecting to bind a Zig host service with SQLite linked in-process. npm-based bindings (libsql etc.) are ruled out by the subset.Questions:
NATIVE_SDK_APP_DATA_DIRsupposed to be set by the runner? The voice-memo example reads it throughenvMsgs, but I couldn't find anywhere in the CLI that injects it, so I'm deriving the data dir from HOME/XDG myself.I think relational data is common enough that the answer shouldn't be "eject and write Zig." Curious what you'd recommend.