MCPcopy Create free account
hub / github.com/electric-sql/electric / pickAgentUiFile

Function pickAgentUiFile

packages/agents-server/src/utils/server-utils.ts:54–72  ·  view source on GitHub ↗
(
  agentUiDistDir: string,
  filePath: string,
  fallbackToIndex: boolean
)

Source from the content-addressed store, hash-verified

52}
53
54export async function pickAgentUiFile(
55 agentUiDistDir: string,
56 filePath: string,
57 fallbackToIndex: boolean
58): Promise<string | null> {
59 if (isAgentUiPath(agentUiDistDir, filePath) && (await fileExists(filePath))) {
60 return filePath
61 }
62
63 if (!fallbackToIndex) {
64 return null
65 }
66
67 const indexPath = path.join(agentUiDistDir, `index.html`)
68 if (!(await fileExists(indexPath))) {
69 return null
70 }
71 return indexPath
72}
73
74export function isAgentUiPath(
75 agentUiDistDir: string,

Callers 1

serveAgentUiFunction · 0.85

Calls 3

isAgentUiPathFunction · 0.85
fileExistsFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected