MCPcopy Index your code
hub / github.com/simstudioai/sim / processBlockMetadata

Function processBlockMetadata

apps/sim/lib/copilot/chat/process-contents.ts:491–517  ·  view source on GitHub ↗
(
  blockId: string,
  tag: string,
  userId?: string,
  workspaceId?: string
)

Source from the content-addressed store, hash-verified

489}
490
491async function processBlockMetadata(
492 blockId: string,
493 tag: string,
494 userId?: string,
495 workspaceId?: string
496): Promise<AgentContext | null> {
497 try {
498 const permissionConfig =
499 userId && workspaceId ? await getUserPermissionConfig(userId, workspaceId) : null
500 const allowedIntegrations =
501 permissionConfig?.allowedIntegrations ?? getAllowedIntegrationsFromEnv()
502 if (allowedIntegrations != null && !allowedIntegrations.includes(blockId.toLowerCase())) {
503 logger.debug('Block not allowed by integration allowlist', { blockId, userId })
504 return null
505 }
506
507 const { registry: blockRegistry } = await import('@/blocks/registry')
508 if (!(blockRegistry as any)[blockId]) {
509 return null
510 }
511
512 return { type: 'blocks', tag, content: '', path: canonicalBlockVfsPath(blockId) }
513 } catch (error) {
514 logger.error('Error processing block metadata', { blockId, error })
515 return null
516 }
517}
518
519async function processWorkflowBlockFromDb(
520 workflowId: string,

Callers 1

processContextsServerFunction · 0.85

Calls 5

getUserPermissionConfigFunction · 0.90
canonicalBlockVfsPathFunction · 0.90
debugMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected