feat(core): add shared Zod config/WS schemas and SQLite WAL migrations
This commit is contained in:
parent
48676a1285
commit
2c60483a90
12 changed files with 1007 additions and 0 deletions
40
src/shared/schemas/settings.schema.ts
Normal file
40
src/shared/schemas/settings.schema.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { z } from 'zod';
|
||||
import { EntityIdSchema } from './common.js';
|
||||
|
||||
export const ThemeIdSchema = z.enum([
|
||||
'phosphor-green',
|
||||
'amber-term',
|
||||
'nord-dark',
|
||||
'gruvbox-dark',
|
||||
'paper-light',
|
||||
]);
|
||||
|
||||
export const SettingsSchema = z.object({
|
||||
version: z.literal(1).default(1),
|
||||
theme: ThemeIdSchema.default('phosphor-green'),
|
||||
defaultMobileSafeMode: z.boolean().default(true),
|
||||
rawRetentionHours: z.number().int().min(1).max(720).default(48),
|
||||
rollupRetentionDays: z.number().int().min(1).max(3650).default(30),
|
||||
configRevisionLimit: z.number().int().min(5).max(500).default(50),
|
||||
ptyScrollbackBytes: z.number().int().min(16384).max(4194304).default(524288),
|
||||
ptyIdleTtlSec: z.number().int().min(60).max(604800).default(43200),
|
||||
sshKeepaliveMs: z.number().int().min(5000).max(120000).default(15000),
|
||||
sshReadyTimeoutMs: z.number().int().min(3000).max(120000).default(15000),
|
||||
ai: z
|
||||
.object({
|
||||
enabled: z.boolean().default(false),
|
||||
baseUrl: z.string().url().default('http://127.0.0.1:11434'),
|
||||
model: z.string().min(1).default('qwen2.5-coder:7b'),
|
||||
secretRef: EntityIdSchema.optional(),
|
||||
maxContextChars: z.number().int().min(1000).max(128000).default(16000),
|
||||
})
|
||||
.default({
|
||||
enabled: false,
|
||||
baseUrl: 'http://127.0.0.1:11434',
|
||||
model: 'qwen2.5-coder:7b',
|
||||
maxContextChars: 16000,
|
||||
}),
|
||||
});
|
||||
|
||||
export type ThemeId = z.infer<typeof ThemeIdSchema>;
|
||||
export type SettingsConfig = z.infer<typeof SettingsSchema>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue