Repository navigation
External functions, records, & minor improvements - #43
Merged
47 commits merged intoNov 3, 2026
Merged
47 commits merged into
47 commits merged into
Conversation
Adds sessions to plugin targets, external implementations of contributed functions, the script-functions protocol, and Kotlin modules for writing contribution plugin services.
Parameter and return types were added to the global table and then remapped again through the contribution's own types array, which lost them for any contribution whose array did not line up.
Builds once up front and rebuilds the JVM services on request, since parallel Gradle builds conflict.
One control flow analysis now answers whether a body returns, whether a variable is initialized and whether a val may be assigned. Contributed parameters, results and record fields follow one type rule; enums and default values work across the boundary, varargs contributions are refused. Default arguments use Kotlin's mask convention, so the parameter limit is gone, and records can be renamed on import. Composite keys, class identity and plugin targets are structured values instead of strings, and sessions are no longer part of the plugin API the frontend reads.
Language plugins were already refused for this, contributions still had their sessions dropped silently. The rule is now one function with a test of its own. Also corrects the close code KDoc: only the TypeScript session server closes with 4408, here Ktor's pong timeout does it with a code of its own.
…them too Requests move from /request/<languageId>/<key> to /request/<kind>/<targetId>/<key>, the shape sessions already use, and a contribution answers them through its own handlers. A language request still gets a Langium instance; a contribution, which has none, is served without one.
A refresh can no longer make a contribution id ambiguous, request and file data keys must be one URL segment, plain and inflated bodies are bounded, malformed session declarations are refused, upstream timeouts answer 504/503, unexpected exception text stays in the log, and file data requests fail after shutdown instead of spinning.
Results are conformed to their declared types at every level, an operation's own collections map to an id only within one result, calls never wait on a closed session, optimizer threads get their own sessions, and the client offers only the agreed protocol version.
Early session messages are held until the handler is ready, config executions get the resolved contribution set, one-shot requests check project and body, a failed Langium build fails its waiter, and large caller deadlines no longer fire at once.
Control flow analysis tolerates blocks not typed yet, class names that would make a type ambiguous are refused, and the formatter keeps arguments in source order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
External functions for script contributions
A contribution plugin can implement a script function in its own service instead of shipping a
typed-AST body. Arguments travel over a session, the implementation runs there, and its result
comes back as values the script can use.
New features - script
bodies. Arguments are in-only and readonly on the service, and so is the model.
withcopies, usable as parameters, returns andfields.
val, named arguments and default arguments. No parameter-count limit.New features - platform and plugins
lang:<id>orcontrib:<id>. The kind is spelled out because the two id spaces overlap —config-mdeois botha language and a contribution.
token, lifetime, liveness, encoding; the protocol inside is the plugin's.
channel a language plugin already did.
script-functions: the protocol language-script defines on top. CBOR, collections keep theiridentity and are sent again only when changed, results are checked whole before they are used.
recordandopaqueclasses, and external implementations persignature.
script-functions-protocol,plugin-service,script-plugin-service(scriptContribution { function { ... } }DSL). Consumed withincludeBuild. Keeps number types exactly, unlike the old TS helper.no more refreshing plugins by hand after a redeploy.
X-Mdeo-Timeout-Ms), forwarded to plugins, handlers get an AbortSignal.TimeoutConfigfor all backend service timeouts, defaults unchanged.develop/sessions.md,kotlin-plugin-service.md,script-functions-protocol.md.Breaking changes
Older services do not work against this backend, so deploy everything together.
{"error": {"code", "message"}}.ExecutionWsErrorCodesmerged intoErrorCodes.plugin:file-data:compute,plugin:request:send,plugin:execution:start,session:open,session:contributions:read,plugin:session:connect. Gone:execution:read./request/<languageId>/<key>to/request/<kind>/<targetId>/<key>,on the backend and on plugin services alike.
contribution_targets,plugin_sessions,plugin_manifest_fingerprints, created atstartup like the rest.
be stored and the rest dropped silently.
valandrecordare keywords now; scripts using either as a name need backticks.Bug fixes
contribution's own array, losing them whenever the arrays did not line up.
returninside a branch that always jumps was no longer type-checked (regression on thisbranch); two more bugs fell out of unifying the control flow analysis.
refused, like language plugins already were.
Performance
97.6 kB → 2.9 kB, config contributions 49 kB → 3.6 kB per request.
POST /file-data-batch, same-tick coalescing, in-flight dedupe; a script fetched with itsimports in one request.
file_data.dataserved as stored, noparse/serialize round trip.
Model.nameOfmemoized.