import { sqliteTable, text } from "drizzle-orm/sqlite-core"; import { createInsertSchema, createSelectSchema } from "@alkdev/drizzlebox"; import { type Static, Type } from "@alkdev/typebox"; import { ACTOR_TYPE, commonCols } from "./common.ts"; export const actors = sqliteTable("actors", { ...commonCols, name: text("name").notNull(), type: text("type", { enum: ["human", "llm", "agent"] }).notNull(), }); export const SelectActor = createSelectSchema(actors, { metadata: Type.Object({}, { additionalProperties: true }), createdAt: Type.Date(), updatedAt: Type.Date(), }); export type SelectActor = Static; export const InsertActor = createInsertSchema(actors, { name: Type.String({ minLength: 1, maxLength: 255 }), type: Type.Union([ Type.Literal(ACTOR_TYPE.Human), Type.Literal(ACTOR_TYPE.Llm), Type.Literal(ACTOR_TYPE.Agent), ]), metadata: Type.Optional(Type.Object({}, { additionalProperties: true })), }); export type InsertActor = Static;