Expand description
§ty_plugin_protocol
The stable serialized contract between ty-extended and semantic extensions.
This crate intentionally contains data types only. It does not depend on checker internals, Salsa, AST ids, the plugin host, or a WASM engine. Manifests, requests, responses, claims, patches, diagnostics, and type expressions can therefore be serialized independently of ty’s implementation.
Most extension authors should depend on
ty_plugin_sdk, which re-exports this crate as
ty_plugin_sdk::protocol and adds the Plugin trait, ManifestBuilder, typed patch helpers,
dispatch, and WASM exports.
Depend on ty_plugin_protocol directly when implementing a host, validating manifests, inspecting
wire messages, or building protocol tooling.
§Add the Dependency
[dependencies]
ty_plugin_protocol = "0.0.3"§Protocol Model
The main types are:
PluginManifest: identity, compatibility, runtime, capabilities, claims, configuration, and stub overlays;PluginRequest: the tagged request enum sent by a host;PluginResponse: the tagged response enum returned by an extension;- request summaries such as
AnalyzeClassRequest,CallRequest, andResolveMemberRequest; - declarative outputs such as
ClassPatch,MemberPatch,CallSignaturePatch, andProjectIndexResponse; TypeExpr: source-level type data with expression, annotation, or stub mode;ProtocolVersion: compatibility negotiation between a host and extension.
The wire format is JSON with kebab-case field and variant names. A request is self-contained and a response is data; neither side shares memory objects from the checker.
§Compatibility Negotiation
The protocol is pre-1.0. A host accepts the same protocol major and any extension minor version no newer than its own:
use ty_plugin_protocol::{ProtocolCompatibility, ProtocolVersion};
let host = ProtocolVersion { major: 0, minor: 3 };
let extension = ProtocolVersion { major: 0, minor: 2 };
assert_eq!(
host.negotiate(extension),
ProtocolCompatibility::Compatible,
);Unknown JSON fields remain parseable for forward transport, but successful deserialization is not permission to use unsupported behavior. Always negotiate the version before dispatching requests.
§Example Manifest Fragment
{
"id": "my-extension",
"name": "My extension",
"version": "0.1.0",
"protocol-version": { "major": 0, "minor": 3 },
"ty-compatibility": { "requirement": ">=0.59.0,<0.60.0" },
"runtime": {
"kind": "wasm",
"artifact": "my_extension.wasm"
},
"capabilities": {
"call-return": true
},
"claims": {
"functions": [
{ "qualified-name": "my_library.Field" }
]
}
}Use ty_plugin_sdk::ManifestBuilder instead of hand-writing production manifests; it keeps claims
and capability flags aligned.
See the extension authoring
guide to build a
complete WASM extension and the ty_plugin_sdk API documentation
for the author-facing interface.
Structs§
- Analyze
Class Request - Argument
Summary - Assignment
Summary - Attribute
Claim - Build
Project Index Request - Call
Request - Call
Return Patch - Call
Signature Patch - Call
Value Summary - Callable
Signature - Class
Claim - Class
Patch - Class
Summary - Constant
Summary - Contribution
- Dependency
Request - Diagnostic
Location - Field
Patch - Field
Summary - Import
Binding - Literal
Dict Entry - Member
Patch - Member
Summary - Method
Claim - Method
Summary - Module
Claim - Mutation
Request - A syntax-level write or delete operation offered to a semantic plugin for validation.
- Mutation
Response - Nested
Class Summary - Parameter
- Plugin
Capabilities - Plugin
Claims - Plugin
Dependency - Plugin
Diagnostic - Plugin
Error - Plugin
Manifest - Project
Context - Project
Index Response - Protocol
Version - Receiver
Summary - Resolve
Member Request - Semantic
Context - Setting
Value Summary - Settings
Claim - Settings
Module Summary - Stub
Overlay - Subprocess
Runtime Spec - Symbol
Claim - Symbol
Ref - Symbol
Source - Text
Position - Type
Expr - Type
Snapshot Expression - Type
Snapshot Field - Type
Snapshot Metadata - Value
Summary - Version
Req - Virtual
Type Definition - Virtual
Type Field - Wasm
Runtime Spec
Enums§
- Argument
Kind - Assigned
Value Summary - Attribute
Claim Kind - Attribute
Scope - Call
OrSymbol Summary - Class
Claim Kind - Contribution
Patch - Contribution
Target - Diagnostic
Severity - Literal
Value - Member
Access Patch - Member
Patch Mode - Method
Claim Kind - Mutation
Operation - Parameter
Kind - Plugin
Request - Plugin
Response - Protocol
Compatibility - The outcome of negotiating a plugin’s declared
ProtocolVersionagainst the host’s. - Runtime
Spec - Type
Expr Mode - Type
Snapshot - Structural type data that survives a complete host -> plugin -> host round trip.
- Virtual
Type Shape