H-86: Add minor hEngine compatibility with TypeScript for behaviors and initialization #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request has been brought over from hashintel/hash#2651. My (@rivertam) current thoughts are that this shouldn't be merged without also adding support for
import
in some capacity. However, I'm holding off on that at least for now as that's probably a bigger project. David told me you're going to come out with a blog post about the future of the engine, so I'm at least holding off until that.Original PR contents (more discussion can be found on the original PR)
Preamble
I'm really interested in this project, both as a user and as a potential contributor. I have a bespoke simulation framework that I've been toying with and would be interested in trying to merge some of the work I've done on it to Hash engine to see if it's useful. I'd love to take some conversations offline and I plan on messaging in the Discord, but just fyi I'm open to hopping on a video call to have higher throughput.
This PR isn't so much "I want to merge this" as it is "I wanted to get familiar enough with the internals to be able to do this", and I've spent the last couple of weeks reading through and trying to figure out how the project works from the inside. I've certainly made progress, but I'm sure guidance would help me speed up! In terms of this PR, I do need to do more thorough testing and add automated tests and I'm sure other things that are part of the process, but I wanted to submit for feedback first to avoid wasting my time. Think of this as a very involved Discussion rather than a PR, maybe.
I have a couple of ideas on things I want to work on after this PR (see next steps), but the long-and-short is that I'm interested in using
swc_bundler
to make it possible to split up complex logic (and maybe get rid of some temporary hacks on the worker).🌟 What is the purpose of this PR?
This uses the swc compiler to strip the TypeScript types from behavior files named
<something>.ts
and initialization files namedinit.ts
🔍 What does this change?
This adds a compilation step to the simulation executor for initialization and for behavior execution
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
I absolutely have not and am not sure how to do this! TBD
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🐾 Next steps
Great question
tsc
(is this out of scope? might be better to just leave this to editors/the web client)swc_bundler
to the manifest stage so we can split theinit
and behavior files into multiple files, which I think is currently unsupported (please correct me if I'm wrong!). While this wouldn't much help close out the "add TypeScript support" checkbox, it's what I want next as a user.🛡 What tests cover this?
❓ How to test this?
ageing-agents.ts.tar.gz
📹 Demo
I guess here ya go!
https://asciinema.org/a/ee9BQceUMV0t5OTAiWw7icy76