Skip to content

Use protobuf definition to generate language independent types#9

Merged
dhuebner merged 2 commits intomainfrom
dhuebner/protocol-definition
Dec 17, 2025
Merged

Use protobuf definition to generate language independent types#9
dhuebner merged 2 commits intomainfrom
dhuebner/protocol-definition

Conversation

@dhuebner
Copy link
Contributor

This pull request introduces significant improvements to the langium-ai-tools package and related example projects, focusing on adding Protocol Buffers (protobuf) support for evaluator results, standardizing naming conventions, and updating dependencies for compatibility and new features. The most important changes are grouped below.

Protocol Buffers Integration & Metadata Structure:

  • Added a new interface.proto file defining protobuf messages for evaluator results, diagnostics, syntax statistics, and metadata, enabling structured, cross-language data exchange.
  • Updated the build and watch scripts in langium-ai-tools/package.json to generate TypeScript code from the protobuf definitions and copy them to the distribution folder. Also added @protobuf-ts/runtime and @protobuf-ts/plugin as dependencies for protobuf support. [1] [2]
  • Exported generated protobuf types from langium-ai-tools/src/index.ts for external use.
  • Added a .gitignore in src/gen/ to exclude generated TypeScript files from version control.

Evaluator Result and API Standardization:

  • Refactored LangiumDocumentAnalyzer.evaluateDocument to return a protocol-compatible EvaluatorResultMsg object, including syntax statistics in the new metadata structure and ensuring diagnostic codes are always strings. [1] [2]
  • Updated the extraction of syntax statistics from evaluator results to handle the new metadata wrapping and protobuf structure.
  • Removed the old SyntaxStatistic TypeScript type in favor of the protobuf-based definition.

Naming Consistency and Data Structure Updates:

  • Standardized naming: replaced all instances of response_length with responseLength and _runtime with runtime across the codebase and type definitions for consistency and protobuf compatibility. [1] [2] [3] [4] [5]

Dependency and Example Updates:

  • Updated langium-ai-tools and langium dependencies to version ~4.1.x in both langium-ai-mcp and the example evaluator, ensuring compatibility with new features and protobuf integration. [1] [2]
  • Added langium as a direct dependency in langium-ai-mcp for explicit compatibility.
  • Removed the unused prepare script from langium-ai-mcp/package.json.

These changes collectively modernize the evaluator infrastructure, improve interoperability, and lay the groundwork for future protocol-based integrations.

# Conflicts:
#	package-lock.json
#	packages/langium-ai-tools/package.json
@montymxb montymxb self-requested a review December 17, 2025 08:02
Copy link
Contributor

@montymxb montymxb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@dhuebner dhuebner merged commit dd5cc92 into main Dec 17, 2025
2 checks passed
@dhuebner dhuebner deleted the dhuebner/protocol-definition branch December 17, 2025 13:47
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

Successfully merging this pull request may close these issues.

2 participants