11import { createLogger } from '@sim/logger'
2- import { isMothershipBetaFeaturesEnabled } from '@/lib/core/config/env -flags'
2+ import { isFeatureEnabled } from '@/lib/core/config/feature -flags'
33import { executeInE2B , executeShellInE2B , type SandboxFile } from '@/lib/execution/e2b'
44import { CodeLanguage } from '@/lib/execution/languages'
55import {
@@ -53,7 +53,7 @@ export interface E2BDocFormat {
5353 * pptx/docx → node, pdf/xlsx → python. Only meaningful when the E2B doc sandbox
5454 * is enabled; callers gate on isE2BDocEnabled before using this.
5555 */
56- export function getE2BDocFormat ( fileName : string ) : E2BDocFormat | null {
56+ export async function getE2BDocFormat ( fileName : string ) : Promise < E2BDocFormat | null > {
5757 const l = fileName . toLowerCase ( )
5858 if ( l . endsWith ( '.pptx' ) )
5959 return {
@@ -79,10 +79,10 @@ export function getE2BDocFormat(fileName: string): E2BDocFormat | null {
7979 contentType : PDF_MIME ,
8080 sourceMime : PYTHON_PDF_SOURCE_MIME ,
8181 }
82- // xlsx is gated behind the mothership beta flag (like plans/changelog): the
82+ // xlsx is gated behind the mothership- beta feature flag (like plans/changelog): the
8383 // skill + prompt are gated on the Go side, and this is the single Sim chokepoint
8484 // that keeps the compile/serve/check/recalc paths off for xlsx when beta is off.
85- if ( l . endsWith ( '.xlsx' ) && isMothershipBetaFeaturesEnabled )
85+ if ( l . endsWith ( '.xlsx' ) && ( await isFeatureEnabled ( 'mothership-beta' ) ) )
8686 return {
8787 ext : 'xlsx' ,
8888 engine : 'python' ,
@@ -385,7 +385,7 @@ export async function compileDoc(
385385 args : CompileArgs
386386) : Promise < { buffer : Buffer ; contentType : string } > {
387387 const { source, fileName, workspaceId } = args
388- const fmt = getE2BDocFormat ( fileName )
388+ const fmt = await getE2BDocFormat ( fileName )
389389 if ( ! fmt ) throw new Error ( `Unsupported document format: ${ fileName } ` )
390390
391391 const existing = await loadCompiledDoc ( workspaceId , source , fmt . ext )
@@ -409,7 +409,7 @@ export async function loadCompiledDocByExt(
409409 source : string ,
410410 ext : string
411411) : Promise < { buffer : Buffer ; contentType : string } | null > {
412- const fmt = getE2BDocFormat ( `x.${ ext } ` )
412+ const fmt = await getE2BDocFormat ( `x.${ ext } ` )
413413 if ( ! fmt ) return null
414414 const buffer = await loadCompiledDoc ( workspaceId , source , fmt . ext )
415415 return buffer ? { buffer, contentType : fmt . contentType } : null
0 commit comments