@khirby/plugin-ai-compose 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Idempotent SQL for ai_compose_settings.
3
+ * Statements are split on `;` — do not use DO $$ blocks.
4
+ */
5
+ export const AI_COMPOSE_MIGRATIONS_SQL = `
6
+ CREATE TABLE IF NOT EXISTS ai_compose_settings (
7
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
8
+ api_key_enc TEXT,
9
+ base_url TEXT NOT NULL DEFAULT 'https://api.openai.com/v1',
10
+ default_model TEXT,
11
+ allowed_models TEXT[] NOT NULL DEFAULT '{}',
12
+ system_prompt TEXT,
13
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
14
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
15
+ )
16
+ `;
package/src/schema.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { pgTable, uuid, text, timestamp } from 'drizzle-orm/pg-core';
2
+
3
+ export const aiComposeSettings = pgTable('ai_compose_settings', {
4
+ id: uuid('id').defaultRandom().primaryKey(),
5
+ apiKeyEnc: text('api_key_enc'),
6
+ baseUrl: text('base_url').notNull().default('https://api.openai.com/v1'),
7
+ defaultModel: text('default_model'),
8
+ allowedModels: text('allowed_models').array().notNull().default([]),
9
+ systemPrompt: text('system_prompt'),
10
+ createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
11
+ updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
12
+ });
13
+
14
+ export type AiComposeSettings = typeof aiComposeSettings.$inferSelect;