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

-42
View File
@@ -719,48 +719,6 @@ export const auditLogs = mysqlTable(
],
);
export const sessionRecordings = mysqlTable(
"session_recordings",
{
id: int("id").autoincrement().primaryKey(),
hostId: int("host_id")
.notNull()
.references(() => hosts.id, { onDelete: "cascade" }),
// Nullable on purpose: a recording is evidence about the host as much as the
// person, so it outlives the account. username keeps it attributable.
userId: varchar("user_id", { length: 255 }).references(() => users.id, { onDelete: "set null" }),
username: text("username"),
accessId: int("access_id").references(() => hostAccess.id, {
onDelete: "set null",
}),
startedAt: varchar("started_at", { length: 255 })
.notNull()
.default(sql`(CURRENT_TIMESTAMP)`),
endedAt: text("ended_at"),
duration: int("duration"),
commands: text("commands"),
dangerousActions: text("dangerous_actions"),
recordingPath: text("recording_path"),
protocol: varchar("protocol", { length: 255 }).notNull().default("ssh"),
format: text("format").notNull().default("text"),
terminatedByOwner: boolean("terminated_by_owner").default(false),
terminationReason: text("termination_reason"),
},
// Listed newest-first per user, and audited per host.
(table) => [
index("idx_session_recordings_user_started").on(
table.userId,
table.startedAt,
),
index("idx_session_recordings_host").on(table.hostId),
],
);
export const opksshTokens = mysqlTable(
"opkssh_tokens",
{