Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for "static" invoke imports in modules #4012

Open
dglazkov opened this issue Dec 14, 2024 · 1 comment
Open

Implement support for "static" invoke imports in modules #4012

dglazkov opened this issue Dec 14, 2024 · 1 comment

Comments

@dglazkov
Copy link
Collaborator

Roughly, we want to be able to do this:

import gemini, { type GeminiInputs } from "@invoke/https://url/to/gemini.bgl.json";

Which will translate into:

  1. Reading imports (fairly straightforward, since we have the whole TS runtime)
  2. If there are imports starting with @invoke/, loading the https://url/to/gemini.bgl.json graph
  3. If it's an imperative graph, getting its TS source
  4. If that exists, supplying it to the TS VFS as if it's local so that GeminiInput resolves correctly. This would also ensure that gemini has the right shape.
  5. Storing the graph in the dependencies array on the module

This would allow us to supply type information with graphs, which will be a huge productivity boost for imperative graph makers.

At runtime:

  1. If there are any dependencies, load them
  2. Add them as modules before starting QuickJS runtime.
@dglazkov
Copy link
Collaborator Author

Ah, maybe dependencies is a top-level GraphDescriptor property that allows storing all BGL dependencies as a flat list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant