just-ai/jaicf-kotlin

Absolute state paths in scenario are not reliable with append mechanics

Denire opened this issue · 0 comments

After #139 was merged JAICF obtained ability to merge sub-scenarios inside parent scenario.

Scenario example:

val HelperScenario = Scenario {
    state("ask4name") {
        activators {
            catchAll()
            intent("name")
        }
    ...
}

val HelloWorldScenario = Scenario {
    append(context = "helper", HelperScenario)
}

Here we can see that parent scenario provides context for subscenario. Thus means subscenario can never know absolute state path and should rely only on relative state paths (e.g. do reactions.go("../../someState") instead of reactions.go("/someState")).
This opens a major issue for many StateNotFound runtime exceptions in bot.

What can be done:
Create new symbol in statepath resolution - ~, which will hold a root path of current scenario object. This will allow to use absolute paths from scenario root (from ~) and will give more flexibility for appended sub-scenarios.
So the transition will look like reactions.go(~/someState)