MCPcopy Create free account
hub / github.com/AI45Lab/Code / step

Function step

sdk/node/examples/basic/test_real_config_env_sdk.mjs:21–32  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

19const runChildAgentSmoke = process.env.A3S_CODE_SDK_REAL_CHILD_AGENT_SMOKE === '1';
20
21async function step(name, fn) {
22 process.stdout.write(`[node-sdk-real] ${name} ... `);
23 const started = Date.now();
24 try {
25 const value = await withTimeout(Promise.resolve().then(fn), name);
26 console.log(`ok (${Date.now() - started}ms)`);
27 return value;
28 } catch (error) {
29 console.log(`failed (${Date.now() - started}ms)`);
30 throw error;
31 }
32}
33
34function withTimeout(promise, name) {
35 let timer;

Callers 1

Calls 4

withTimeoutFunction · 0.85
writeMethod · 0.80
resolveMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected