MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / buildAutomationCommand

Function buildAutomationCommand

scripts/dev-with-automation.mjs:284–328  ·  view source on GitHub ↗

* Build the uvx command for running automation backend. * * Environment variables (highest precedence first): * - OH_AUTOMATION_GIT_REF: Git commit SHA or branch name * - OH_AUTOMATION_VERSION: Specific PyPI version (e.g., "1.0.0a1") * * If none are set, defaults to the released version specif

(env = process.env)

Source from the content-addressed store, hash-verified

282 * git branch or commit instead.
283 */
284function buildAutomationCommand(env = process.env) {
285 const gitRef = env.OH_AUTOMATION_GIT_REF;
286 const version = env.OH_AUTOMATION_VERSION;
287 const repoUrl = env.OH_AUTOMATION_REPO || DEFAULT_AUTOMATION_REPO;
288
289 const uvxArgs = [];
290 let source = "";
291
292 if (gitRef) {
293 // Use git ref - refresh to ensure latest commit is fetched
294 const gitUrl = `git+${repoUrl}@${gitRef}`;
295 uvxArgs.push(
296 "--refresh",
297 "--from",
298 gitUrl,
299 "uvicorn",
300 "openhands.automation.app:app",
301 );
302 source = `git (${gitRef})`;
303 } else if (version) {
304 // Use specific PyPI version
305 uvxArgs.push(
306 "--from",
307 `${DEFAULT_AUTOMATION_PACKAGE}==${version}`,
308 "uvicorn",
309 "openhands.automation.app:app",
310 );
311 source = `PyPI (${version})`;
312 } else {
313 // Default to released PyPI version
314 uvxArgs.push(
315 "--from",
316 `${DEFAULT_AUTOMATION_PACKAGE}==${DEFAULT_AUTOMATION_VERSION}`,
317 "uvicorn",
318 "openhands.automation.app:app",
319 );
320 source = `PyPI (${DEFAULT_AUTOMATION_VERSION}, default)`;
321 }
322
323 return {
324 command: "uvx",
325 args: uvxArgs,
326 source,
327 };
328}
329
330async function buildConfig(args, env = process.env) {
331 // Apply args to env for buildAutomationCommand

Callers 3

startAutomationBackendFunction · 0.90
startAutomationBackendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected