No way to add `temp:variable` during `Runner.runAsync`
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 205
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 92
Description
**Is your feature request related to a problem? Please describe.**
There's no way to inject a temporary variable into the session state at the start of an invocation. The `temp:` prefixed variables are filtered out.
The workarounds I've thought through (like leveraging plugins) seem over the top.
**Describe the solution you'd like**
Add a way for the caller access the invocation context or the session during/after the call to `Runner.runAsync`.
For instance:
```js
runner.runAsync({
// existing params
beforeRunCallback: ({ invocationContext }) => {
invocationContext.session.state.set('temp:var', 'value')
},
})
```
**Describe alternatives you've considered**
This is roughly how plugins work, but plugins don't have a way to access the local scope in which `runner.runAsync` was called (unless a new runner is created which doesn't seem to be recommended for long running processes like API servers).
Contributor guide
Assessment
This issue has not been assessed yet.