MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / execute

Method execute

ai/ai.ts:2365–2385  ·  view source on GitHub ↗
(
    input: T,
    finalHandler: (input: T, token?: AbortToken) => Promise<any>,
    token?: AbortToken,
  )

Source from the content-addressed store, hash-verified

2363
2364 async execute<T>(
2365 input: T,
2366 finalHandler: (input: T, token?: AbortToken) => Promise<any>,
2367 token?: AbortToken,
2368 ): Promise<any> {
2369 const exec = async (
2370 idx: number,
2371 curInput: T,
2372 curToken?: AbortToken,
2373 ): Promise<any> => {
2374 if (idx >= this.middlewares.length)
2375 return await finalHandler(curInput, curToken);
2376 const mw = this.middlewares[idx];
2377 return await mw.process(
2378 curInput,
2379 (nextInput, nextToken) => exec(idx + 1, nextInput, nextToken),
2380 curToken,
2381 );
2382 };
2383 return await exec(0, input, token);
2384 }
2385}
2386
2387class TimeoutMiddleware implements Middleware {
2388 private configManagerPromise: Promise<ConfigManager>;

Callers

nothing calls this directly

Calls 1

execFunction · 0.85

Tested by

no test coverage detected