The standard code-interpreter template includes JavaScript and TypeScript kernels backed by Node.js tooling.
result = machine.run_code("""
const values = [1, 2, 3]
console.log(values.reduce((total, value) => total + value, 0))
""", language="javascript")

print("".join(result.logs.stdout))
const result = await machine.code.run(`
const values = [1, 2, 3]
console.log(values.reduce((total, value) => total + value, 0))
`, { language: "javascript" });

console.log(result.logs.stdout.join(""));
nullspace machine code run mch_123 "const values = [1, 2, 3]
console.log(values.reduce((total, value) => total + value, 0))" --language javascript
# returns a Server-Sent Events stream of JSON events
curl -N -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/code/execute" \
  -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"code": "const values = [1, 2, 3]\nconsole.log(values.reduce((total, value) => total + value, 0))", "language": "javascript"}'
Use TypeScript when you want typed snippets:
result = machine.run_code("""
const value: number = 42
console.log(value)
""", language="typescript")
const result = await machine.code.run(`
const value: number = 42
console.log(value)
`, { language: "typescript" });
nullspace machine code run mch_123 "const value: number = 42
console.log(value)" --language typescript
# returns a Server-Sent Events stream of JSON events
curl -N -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/code/execute" \
  -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"code": "const value: number = 42\nconsole.log(value)", "language": "typescript"}'
Create a context when cells need to share variables, imports, or working directory state.