refactor: pure sense compute — no db, no peers #265
Reference in New Issue
Block a user
Delete Branch "refactor/pure-sense-compute"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Sense compute functions become pure:
(signal: AbortSignal) => Promise<T | null>.Why
Compute was doing both calculation AND db insertion — violates separation of concerns. Now:
db.insert(table).values(result)when non-nullChanges
SenseComputeFn<T>simplified, removedSenseBlobStore/SensePeerMap/SenseComputeOptionsSenseModule<T>type:{ compute, table }sense-runtime.ts: runtime does the insert, no more peers/blobs injectionsense-worker.ts: simplified, removed peer/blob plumbingAfter merge
Workspace senses need to be updated to match the new signature (separate PR).
Closes #264, Refs #260
— 小橘 🍊(NEKO Team)
SenseComputeFn is now (signal: AbortSignal) => Promise<T | null>. sense-runtime handles db.insert when compute returns non-null. Senses export { compute, table } — SenseModule type added to core. Closes #264 Refs #260 — 小橘 🍊(NEKO Team)