MCPcopy Create free account
hub / github.com/modelscope/ms-agent / _generate_js_env_setup

Method _generate_js_env_setup

ms_agent/skill/container.py:1328–1341  ·  view source on GitHub ↗

Generate JavaScript code to setup environment.

(self, input_spec: ExecutionInput,
                               sandbox_files: Dict[str, str])

Source from the content-addressed store, hash-verified

1326 return output
1327
1328 def _generate_js_env_setup(self, input_spec: ExecutionInput,
1329 sandbox_files: Dict[str, str]) -> str:
1330 """Generate JavaScript code to setup environment."""
1331 lines = [
1332 '// Environment setup',
1333 f"process.env.SKILL_OUTPUT_DIR = '{self.SANDBOX_OUTPUT_DIR}';",
1334 ]
1335
1336 for key, value in input_spec.env_vars.items():
1337 safe_value = value.replace("'", "\\'")
1338 lines.append(f"process.env.{key} = '{safe_value}';")
1339
1340 lines.append('')
1341 return '\n'.join(lines)
1342
1343 async def execute(self,
1344 executor_type: ExecutorType,

Callers 1

execute_javascriptMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected