Remix.run Logo
mavdol04 7 hours ago

Thanks! Got it, I will add more examples for that. Currently you can do both: run dynamically untrusted code with eval, or run fully encapsulated logic (like in the existing examples).

I made a small example that might give you a better idea (it's not eval, but shows how to isolate a specific data processing task): https://github.com/mavdol/capsule/tree/main/examples/javascr...

And yes, you are spot on regarding LeetCode platforms. The resource limits are also designed for that kind of usage.

fix4fun 2 hours ago | parent | next [-]

yep, more examples with agents use will be helpful

zachrip 7 hours ago | parent | prev [-]

Would like to see the eval version - the dialogue version just seems like normal code with extra steps?

mavdol04 6 hours ago | parent [-]

yeah, the previous example was quite basic. I will write a complete example for that, but here is how you can run dynamic code:

   import { task } from "@capsule-run/sdk";

   export default task({
     name: "main",
     compute: "HIGH",
   }, async () => {
     const untrustedCode = "const x = 10; x * 2 + 5;";
     const result = eval(untrustedCode);
     return result;
   });
Hope that helps!