MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / makeScheduler

Function makeScheduler

packages/agent-core/test/loop/tool-scheduler.test.ts:242–262  ·  view source on GitHub ↗
(drained: string[])

Source from the content-addressed store, hash-verified

240}
241
242function makeScheduler(drained: string[]): {
243 readonly add: (task: ToolCallTask<string>) => void;
244 readonly collectResults: () => Promise<void>;
245 readonly allSettled: () => Promise<void>;
246} {
247 const scheduler = new ToolScheduler<string>();
248 const results: Array<Promise<string>> = [];
249 return {
250 add: (task) => {
251 results.push(scheduler.add(task));
252 },
253 collectResults: async () => {
254 for (const task of results) {
255 drained.push(await task);
256 }
257 },
258 allSettled: async () => {
259 await Promise.allSettled(results);
260 },
261 };
262}
263
264function makeControlledTask(
265 name: string,

Callers 1

Calls 2

addMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected