MCPcopy Create free account
hub / github.com/Roy3838/Observer / postProcess

Function postProcess

app/src/utils/post-processor.ts:12–33  ·  view source on GitHub ↗
(
    agentId: string,
    response: string,
    code: string,
    iterationId: string, // <-- New parameter
    getToken?: TokenProvider,
    preprocessResult?: PreProcessorResult
)

Source from the content-addressed store, hash-verified

10 * based on the presence of a '#python' marker
11 */
12export async function postProcess(
13 agentId: string,
14 response: string,
15 code: string,
16 iterationId: string, // <-- New parameter
17 getToken?: TokenProvider,
18 preprocessResult?: PreProcessorResult
19): Promise<boolean> {
20 Logger.debug(agentId, 'Starting response post-processing', { iterationId });
21
22 if (code.trim().startsWith('#python')) {
23 Logger.debug(agentId, 'Detected Python code, using Python handler', { iterationId });
24 // Lazy load Python handler - only loads when Python code is executed!
25 const { executePython } = await import('./handlers/python');
26 return await executePython(response, agentId, code);
27 } else {
28 Logger.debug(agentId, 'Using JavaScript handler', { iterationId });
29 // Pass iterationId, getToken, and preprocessResult to JavaScript handler
30 return await executeJavaScript(response, agentId, code, iterationId, getToken, preprocessResult);
31 }
32 // No catch - let errors bubble up naturally to main_loop
33}

Callers 2

handleRunCodeFunction · 0.90
executeAgentIterationFunction · 0.90

Calls 3

executeJavaScriptFunction · 0.90
executePythonFunction · 0.85
debugMethod · 0.45

Tested by

no test coverage detected