a38986acdb
Implements the Sense observation engine runtime per RFC-001:
- IPC types: discriminated union for parent↔worker messages
- sense-runtime: openSenseDb (WAL), openPeerDb (readonly), runMigrations,
loadComputeFn, executeCompute with Result<T> error handling
- sense-worker: CLI bootstrap, reads nerve.yaml, inits per-sense DB,
builds peer map, enters IPC event loop
- examples/cpu-usage: sample sense with Drizzle schema + migration
- 15 unit tests covering migrations, DB ops, compute, peer isolation
小橘 🍊(NEKO Team)
12 lines
376 B
TypeScript
12 lines
376 B
TypeScript
import { integer, real, sqliteTable } from "drizzle-orm/sqlite-core";
|
|
|
|
/**
|
|
* Each row records one CPU load sample.
|
|
* `ts` is the Unix timestamp in milliseconds (primary key, append-only).
|
|
* `value` is the 1-minute load average from os.loadavg()[0].
|
|
*/
|
|
export const samples = sqliteTable("samples", {
|
|
ts: integer("ts").primaryKey(),
|
|
value: real("value").notNull(),
|
|
});
|