(ctx: AdapterContext)
| 102 | adapter: string, |
| 103 | channelId: string, |
| 104 | text: string, |
| 105 | ) => Promise<void> = async () => {}; |
| 106 | private jobs = new Map<string, ManagedJob>(); |
| 107 | |
| 108 | async start(ctx: AdapterContext): Promise<void> { |
| 109 | this.agent = ctx.agent; |
| 110 | this.rootDir = ctx.rootDir; |
| 111 | this.ipcBroadcaster = ctx.ipcBroadcaster ?? null; |
| 112 | this.notifyFn = ctx.notify || (async () => {}); |
| 113 | console.log( |
| 114 | `[Scheduler] IPC broadcaster ${this.ipcBroadcaster ? "attached" : "not available"} for agent events`, |
| 115 | ); |
| 116 | |
| 117 | const jobConfigs = loadJobFile(this.rootDir).jobs; |
| 118 | |
| 119 | let scheduledCount = 0; |
| 120 | let disabledCount = 0; |
| 121 | let oneTimeCount = 0; |
| 122 | for (const jc of jobConfigs) { |
| 123 | const result = this.registerJob(jc); |
| 124 | if (result.registered) { |
| 125 | if (!isRecurringJob(jc)) { |
| 126 | oneTimeCount++; |
| 127 | } else if (jc.enabled === false) { |
| 128 | disabledCount++; |
| 129 | } else { |
| 130 | scheduledCount++; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | const parts: string[] = []; |
| 136 | if (scheduledCount > 0) parts.push(`${scheduledCount} active`); |
| 137 | if (disabledCount > 0) parts.push(`${disabledCount} disabled`); |
| 138 | if (oneTimeCount > 0) parts.push(`${oneTimeCount} one-time`); |
| 139 | if (parts.length > 0) { |
| 140 | console.log(`[SchedulerAdapter] Started with ${parts.join(", ")} job(s)`); |
| 141 | } else { |
| 142 | console.log("[SchedulerAdapter] Started (no jobs configured)"); |
| 143 | } |
nothing calls this directly
no test coverage detected