refactor: centralize task runtime contracts (#199)

This commit is contained in:
Eyejoker
2026-05-30 01:56:41 +09:00
committed by GitHub
parent 1531482363
commit 37b57b20bb
14 changed files with 152 additions and 77 deletions

View File

@@ -1,4 +1,5 @@
import { CronExpressionParser } from 'cron-parser';
import { normalizeTaskContextMode } from 'ejclaw-runners-shared';
import { createTask, findDuplicateCiWatcher } from '../db.js';
import { normalizeStoredAgentType } from '../db/room-registration.js';
@@ -49,10 +50,7 @@ export function handleScheduleTask(
const taskId =
data.taskId ||
`task-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
const contextMode =
data.context_mode === 'group' || data.context_mode === 'isolated'
? data.context_mode
: 'isolated';
const contextMode = normalizeTaskContextMode(data.context_mode);
const scheduledAgentType =
normalizeStoredAgentType(data.agent_type) ??
target.room.agentType ??