feat: update codex live automation and plan flows

This commit is contained in:
2026-04-24 08:06:36 +09:00
parent 916107dbe5
commit f2d6310efa
47 changed files with 2767 additions and 507 deletions

View File

@@ -1,5 +1,6 @@
import { z } from 'zod';
import { db } from '../db/client.js';
import { resolveAutomationType, resolveStoredAutomationTypeId } from './automation-type-config-service.js';
import {
createCompletedPlanExecutionLogItem,
createPlanActionHistory,
@@ -186,7 +187,7 @@ export function mapPlanScheduledTaskRow(row: Record<string, unknown>) {
id: row.id,
workId: row.work_id,
note: row.note,
automationType: normalizePlanAutomationType(row.automation_type),
automationType: resolveStoredAutomationTypeId(row),
releaseTarget: row.release_target,
jangsingProcessingRequired: Boolean(row.jangsing_processing_required ?? true),
autoDeployToMain: Boolean(row.auto_deploy_to_main ?? true),
@@ -229,6 +230,7 @@ export async function ensurePlanScheduledTaskTable() {
table.string('work_id', 120).notNullable().defaultTo('반복작업');
table.text('note').notNullable().defaultTo('');
table.string('automation_type', 40).notNullable().defaultTo('none');
table.string('automation_type_id', 120).nullable();
table.string('release_target', 120).notNullable().defaultTo('release');
table.boolean('jangsing_processing_required').notNullable().defaultTo(true);
table.boolean('auto_deploy_to_main').notNullable().defaultTo(true);
@@ -252,6 +254,9 @@ export async function ensurePlanScheduledTaskTable() {
await ensurePlanScheduledTaskColumn('automation_type', (table) => {
table.string('automation_type', 40).notNullable().defaultTo('none');
});
await ensurePlanScheduledTaskColumn('automation_type_id', (table) => {
table.string('automation_type_id', 120).nullable();
});
await ensurePlanScheduledTaskColumn('jangsing_processing_required', (table) => {
table.boolean('jangsing_processing_required').notNullable().defaultTo(true);
});
@@ -295,6 +300,11 @@ export async function ensurePlanScheduledTaskTable() {
await db(PLAN_SCHEDULED_TASK_TABLE)
.where({ automation_type: 'general_development' })
.update({ automation_type: 'auto_worker' });
await db(PLAN_SCHEDULED_TASK_TABLE)
.whereNull('automation_type_id')
.update({
automation_type_id: db.raw('automation_type'),
});
await db(PLAN_SCHEDULED_TASK_TABLE)
.where({ repeat_interval_unit: 'minute' })
@@ -320,12 +330,14 @@ export async function createPlanScheduledTask(payload: z.infer<typeof createPlan
const scheduleMode = normalizeScheduleMode(payload.scheduleMode);
const repeatIntervalValue = normalizeRepeatIntervalValue(payload.repeatIntervalValue);
const repeatIntervalUnit = normalizeRepeatIntervalUnit(payload.repeatIntervalUnit);
const automationType = await resolveAutomationType(payload.automationType);
const rows = await db(PLAN_SCHEDULED_TASK_TABLE)
.insert({
work_id: normalizeScheduledWorkId(payload.workId),
note: payload.note,
automation_type: normalizePlanAutomationType(payload.automationType),
automation_type: automationType.behaviorType,
automation_type_id: automationType.id,
release_target: payload.releaseTarget,
jangsing_processing_required: payload.jangsingProcessingRequired,
auto_deploy_to_main: payload.autoDeployToMain,
@@ -358,13 +370,17 @@ export async function updatePlanScheduledTask(id: number, payload: z.infer<typeo
payload.repeatIntervalValue ?? currentRow.repeat_interval_value ?? currentRow.repeat_interval_minutes ?? 60,
);
const repeatIntervalUnit = normalizeRepeatIntervalUnit(payload.repeatIntervalUnit ?? currentRow.repeat_interval_unit);
const automationType = await resolveAutomationType(
payload.automationType ?? currentRow.automation_type_id ?? currentRow.automation_type,
);
const rows = await db(PLAN_SCHEDULED_TASK_TABLE)
.where({ id })
.update({
work_id: payload.workId === undefined ? currentRow.work_id : normalizeScheduledWorkId(payload.workId),
note: payload.note ?? currentRow.note,
automation_type: normalizePlanAutomationType(payload.automationType ?? currentRow.automation_type),
automation_type: automationType.behaviorType,
automation_type_id: automationType.id,
release_target: payload.releaseTarget ?? currentRow.release_target ?? 'release',
jangsing_processing_required:
payload.jangsingProcessingRequired ?? currentRow.jangsing_processing_required ?? true,
@@ -458,7 +474,7 @@ async function registerPlanScheduledTaskRow(row: Record<string, unknown>, now: D
const executionLog = await createCompletedPlanExecutionLogItem({
workId: formatScheduleWorkId(String(row.work_id ?? '반복작업'), now),
note: executionLogNoteLines.join('\n'),
automationType: 'plan',
automationType: String(row.automation_type_id ?? row.automation_type ?? 'plan'),
releaseTarget: String(row.release_target ?? 'release'),
jangsingProcessingRequired: Boolean(row.jangsing_processing_required ?? true),
autoDeployToMain: Boolean(row.auto_deploy_to_main ?? true),
@@ -500,7 +516,7 @@ async function registerPlanScheduledTaskRow(row: Record<string, unknown>, now: D
const createdPlan = await createPlanItem({
workId: formatScheduleWorkId(String(row.work_id ?? '반복작업'), now),
note: String(row.note ?? ''),
automationType: normalizePlanAutomationType(row.automation_type),
automationType: String(row.automation_type_id ?? row.automation_type ?? 'none'),
releaseTarget: String(row.release_target ?? 'release'),
jangsingProcessingRequired: Boolean(row.jangsing_processing_required ?? true),
autoDeployToMain: Boolean(row.auto_deploy_to_main ?? true),