(input: Record<string, unknown>)
| 340 | } |
| 341 | |
| 342 | function buildCronUpdatePatch(input: Record<string, unknown>): Record<string, unknown> { |
| 343 | const patch = { ...input }; |
| 344 | if ('schedule' in patch && patch.schedule !== undefined) patch.schedule = normalizeScheduleInput(patch.schedule); |
| 345 | if (typeof patch.message === 'string') { |
| 346 | patch.payload = { kind: 'agentTurn', message: patch.message }; |
| 347 | delete patch.message; |
| 348 | } |
| 349 | if ('delivery' in patch) patch.delivery = normalizeCronDeliveryPatch(patch.delivery); |
| 350 | if ('agentId' in patch) { |
| 351 | patch.agentId = typeof patch.agentId === 'string' && patch.agentId.trim() ? patch.agentId.trim() : 'main'; |
| 352 | } |
| 353 | return patch; |
| 354 | } |
| 355 | |
| 356 | function transformCronJob(job: GatewayCronJob): CronJob { |
| 357 | const message = job.payload?.message || job.payload?.text || ''; |
no test coverage detected