feat(automation): add scheduled minio memory sync jobs
This commit is contained in:
@@ -864,6 +864,9 @@ describe('configSchema automation', () => {
|
||||
expect(result.automation.daily_briefing.schedule).toBe('0 8 * * *');
|
||||
expect(result.automation.daily_briefing.name).toBe('daily-briefing');
|
||||
expect(result.automation.daily_briefing.dedupe_per_local_day).toBe(true);
|
||||
expect(result.automation.minio_sync.enabled).toBe(false);
|
||||
expect(result.automation.minio_sync.interval).toBe('6h');
|
||||
expect(result.automation.minio_sync.tasks).toEqual([]);
|
||||
});
|
||||
|
||||
it('accepts isolated automation delivery mode', () => {
|
||||
@@ -978,6 +981,44 @@ describe('configSchema automation', () => {
|
||||
expect(result.automation.heartbeat.checks).toContain('backup');
|
||||
expect(result.automation.heartbeat.checks).toContain('provider_errors');
|
||||
});
|
||||
|
||||
it('accepts scheduled minio sync automation config', () => {
|
||||
const result = configSchema.parse({
|
||||
...baseConfig,
|
||||
automation: {
|
||||
minio_sync: {
|
||||
enabled: true,
|
||||
interval: '3h',
|
||||
run_on_start: true,
|
||||
notify_on_success: true,
|
||||
notify: { channel: 'telegram', peer: '123' },
|
||||
tasks: [{
|
||||
prefix: 'knowledge/',
|
||||
namespace_base: 'global/knowledge/minio',
|
||||
mode: 'replace',
|
||||
max_objects: 50,
|
||||
max_chars_per_object: 12000,
|
||||
force: true,
|
||||
}],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.automation.minio_sync.enabled).toBe(true);
|
||||
expect(result.automation.minio_sync.interval).toBe('3h');
|
||||
expect(result.automation.minio_sync.run_on_start).toBe(true);
|
||||
expect(result.automation.minio_sync.notify_on_success).toBe(true);
|
||||
expect(result.automation.minio_sync.notify).toEqual({ channel: 'telegram', peer: '123' });
|
||||
expect(result.automation.minio_sync.tasks).toHaveLength(1);
|
||||
expect(result.automation.minio_sync.tasks[0]).toMatchObject({
|
||||
prefix: 'knowledge/',
|
||||
namespace_base: 'global/knowledge/minio',
|
||||
mode: 'replace',
|
||||
max_objects: 50,
|
||||
max_chars_per_object: 12000,
|
||||
force: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — intents', () => {
|
||||
|
||||
@@ -377,6 +377,28 @@ const dailyBriefingSchema = z.object({
|
||||
model_tier: modelTierEnum.optional(),
|
||||
}).default({});
|
||||
|
||||
const minioSyncTaskSchema = z.object({
|
||||
prefix: z.string().min(1, 'MinIO sync prefix is required'),
|
||||
bucket: z.string().optional(),
|
||||
namespace_base: z.string().min(1).default('global/knowledge/minio'),
|
||||
mode: z.enum(['append', 'replace']).default('append'),
|
||||
max_objects: z.number().min(1).max(500).default(20),
|
||||
max_chars_per_object: z.number().min(1).max(1_000_000).default(8_000),
|
||||
force: z.boolean().default(false),
|
||||
});
|
||||
|
||||
const minioSyncAutomationSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
interval: z.string().default('6h'),
|
||||
run_on_start: z.boolean().default(false),
|
||||
tasks: z.array(minioSyncTaskSchema).default([]),
|
||||
notify: z.object({
|
||||
channel: z.string().min(1),
|
||||
peer: z.string().min(1),
|
||||
}).optional(),
|
||||
notify_on_success: z.boolean().default(false),
|
||||
}).default({});
|
||||
|
||||
const automationDeliveryModeSchema = z.enum(['shared_session', 'isolated_job']);
|
||||
|
||||
const automationSchema = z.object({
|
||||
@@ -390,6 +412,7 @@ const automationSchema = z.object({
|
||||
gdrive: gdriveSchema,
|
||||
gtasks: gtasksSchema,
|
||||
daily_briefing: dailyBriefingSchema,
|
||||
minio_sync: minioSyncAutomationSchema,
|
||||
heartbeat: heartbeatSchema,
|
||||
}).default({});
|
||||
|
||||
@@ -860,6 +883,8 @@ export type GdocsConfig = z.infer<typeof gdocsSchema>;
|
||||
export type GdriveConfig = z.infer<typeof gdriveSchema>;
|
||||
export type GtasksConfig = z.infer<typeof gtasksSchema>;
|
||||
export type DailyBriefingConfig = z.infer<typeof dailyBriefingSchema>;
|
||||
export type MinioSyncTaskConfig = z.infer<typeof minioSyncTaskSchema>;
|
||||
export type MinioSyncAutomationConfig = z.infer<typeof minioSyncAutomationSchema>;
|
||||
export type AutomationDeliveryMode = z.infer<typeof automationDeliveryModeSchema>;
|
||||
export type PairingCodeConfig = z.infer<typeof pairingSchema>;
|
||||
export type LogLevel = z.infer<typeof logLevelSchema>;
|
||||
|
||||
Reference in New Issue
Block a user