How are DSL workflows deterministic?

I was reading this sample code for typescript SDK’s DSL interpreter workflow: samples-typescript/dsl-interpreter at main · temporalio/samples-typescript · GitHub . How is the workflow definition considered deterministic if the activities are invoked ad hoc based on arguments passed into the workflow?

I saw a similar thread here: Why is the workflow definition in the DSL sample project deterministic? , but I am unable to understand how this solves the problem of non-deterministic steps like different activity order each time the same workflow is run.

Can someone explain what’s going on here? Thanks!

A workflow is deterministic if they always produce the same results for the same inputs by executing tasks in a fixed, reproducible order—isolated from external variability like timing, randomness, or system restarts.
If the workflow fails or is restarted you would expect the same result if the activities are true functions. Eg. an activity that always produces the same output for the same input, with no side effects or hidden dependencies

Workflows can be dynamic, executing different code paths depending on workflow inputs and activity results. As @Tate_Jones pointed out the activity results are recorded in the workflow history and the workflow takes the same path given the same activity results from the recorded history.