feat: turn session recording into a plugin (B13)

This commit is contained in:
LukeGus committed 2026-09-24 00:09:48 -05:00
1 parent a276f6898c
commit 0af2c94983
147 files changed
+25915 -2074

No files matched your search

+18
View File
@@ -250,6 +250,20 @@ export function createPluginContext(
{ action: "kv_list" },
);
const filesDataDir = guarded(
manifest,
"files:own",
async () => {
const fs = await import("node:fs/promises");
const path = await import("node:path");
const base = process.env.DATA_DIR ?? "./db/data";
const dir = path.join(base, "plugins", pluginId);
await fs.mkdir(dir, { recursive: true });
return dir;
},
{ action: "files_data_dir" },
);
const dbDefine = guarded(
manifest,
"db:own",
@@ -422,6 +436,10 @@ export function createPluginContext(
list: () => kvList(),
},
files: {
dataDir: () => filesDataDir(),
},
registry: {
provide: (key, value) => {
registry.provide(key, value);
+7
View File
@@ -47,6 +47,13 @@ export const TOPICS = {
* the row is not gone, only unrecoverable, and should go with it.
*/
userDataWiped: "user.data_wiped",
/**
* A user account was deleted. For a plugin whose rows should outlive the
* account (evidence, audit trail) rather than cascade with a refUser()
* column: it keeps a plain userId column and anonymizes its own rows here,
* the way core's own session recordings did before this event existed.
*/
userDeleted: "user.deleted",
} as const;
export type EventListener = (payload: unknown) => void;