Generate JavaScript code to setup environment.
(self, input_spec: ExecutionInput,
sandbox_files: Dict[str, str])
| 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, |