Skip to content

Self-improving AI Employees for everyone

Fix executor TypeScript compilation and regression check

trohitg4abca224be62
diff --git a/server/nodejs/package.json b/server/nodejs/package.json
index 2b7b1d23..b7d0e131 100644
--- a/server/nodejs/package.json
+++ b/server/nodejs/package.json
@@ -6,6 +6,7 @@
"main": "dist/index.js",
"scripts": {
"build": "bun build src/index.ts --target=bun --outfile=dist/index.js",
+ "typecheck": "tsc --noEmit -p tsconfig.json",
"start": "bun dist/index.js",
"dev": "bun --watch src/index.ts"
},
diff --git a/server/nodejs/src/index.ts b/server/nodejs/src/index.ts
index 452e0d68..cc57e1be 100644
--- a/server/nodejs/src/index.ts
+++ b/server/nodejs/src/index.ts
@@ -28,7 +28,15 @@ const USER_PACKAGES_DIR = process.env.NODEJS_USER_PACKAGES_DIR ?? path.join(__di
// user-packages tree: `process.execPath` is bun, and `bun add` installs
// from the npm registry with no node or npm on the machine.
const BUN = process.execPath;
-const bunVersion = (globalThis as { Bun?: { version: string } }).Bun?.version ?? null;
+const bunRuntime = (globalThis as {
+ Bun?: {
+ version: string;
+ Transpiler: new (options: { loader: 'ts'; target: 'node' }) => {
+ transformSync(code: string): string;
+ };
+ };
+}).Bun;
+const bunVersion = bunRuntime?.version ?? null;
const app = express();
app.use(express.json({ limit: BODY_LIMIT }));
@@ -67,7 +75,7 @@ app.get('/health', (_req: Request, res: Response) => {
// vm context (which evaluates JavaScript only). Type annotations, interfaces
// and enums therefore work in typescriptExecutor; a syntax error surfaces as
// the same {success: false, error} envelope as a runtime error.
-const tsTranspiler = typeof Bun !== 'undefined' ? new Bun.Transpiler({ loader: 'ts', target: 'node' }) : null;
+const tsTranspiler = bunRuntime ? new bunRuntime.Transpiler({ loader: 'ts', target: 'node' }) : null;
function prepareSource(code: string, language: ExecuteRequest['language']): string {
if (language !== 'typescript') return code;
diff --git a/server/tests/nodes/test_tool_call_dispatch.py b/server/tests/nodes/test_tool_call_dispatch.py
index c1b4b048..0c9677c2 100644
--- a/server/tests/nodes/test_tool_call_dispatch.py
+++ b/server/tests/nodes/test_tool_call_dispatch.py
@@ -164,7 +164,9 @@ def test_agent_workflow_payload_carries_unmerged_tool_args():
from services.temporal.agent_workflow import AgentWorkflow
- source = inspect.getsource(AgentWorkflow.run)
+ # The entry point owns lifecycle cleanup; activity payloads are built by
+ # the execution core it delegates to.
+ source = inspect.getsource(AgentWorkflow._run_impl)
assert '"tool_args": call_args' in source, (
"the per-type tool activity payload must carry the model's unmerged "
"arguments or split-schema ToolNodes silently drop them"