( blockId: string, tag: string, userId?: string, workspaceId?: string )
| 489 | } |
| 490 | |
| 491 | async 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 | |
| 519 | async function processWorkflowBlockFromDb( |
| 520 | workflowId: string, |
no test coverage detected