agentlang
Version:
The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans
42 lines • 1.89 kB
JavaScript
import { inject } from 'langium';
import { createDefaultModule, createDefaultSharedModule, } from 'langium/lsp';
import { AgentlangGeneratedModule, AgentlangGeneratedSharedModule } from './generated/module.js';
import { AgentlangValidator, registerValidationChecks } from './agentlang-validator.js';
/**
* Dependency injection module that overrides Langium default services and contributes the
* declared custom services. The Langium defaults can be partially specified to override only
* selected services, while the custom services must be fully specified.
*/
export const AgentlangModule = {
validation: {
AgentlangValidator: () => new AgentlangValidator(),
},
};
/**
* Create the full set of services required by Langium.
*
* First inject the shared services by merging two modules:
* - Langium default shared services
* - Services generated by langium-cli
*
* Then inject the language-specific services by merging three modules:
* - Langium default language-specific services
* - Services generated by langium-cli
* - Services specified in this file
*
* @param context Optional module context with the LSP connection
* @returns An object wrapping the shared services and the language-specific services
*/
export function createAgentlangServices(context) {
const shared = inject(createDefaultSharedModule(context), AgentlangGeneratedSharedModule);
const Agentlang = inject(createDefaultModule({ shared }), AgentlangGeneratedModule, AgentlangModule);
shared.ServiceRegistry.register(Agentlang);
registerValidationChecks(Agentlang);
if (!context.connection) {
// We don't run inside a language server
// Therefore, initialize the configuration provider instantly
shared.workspace.ConfigurationProvider.initialized({});
}
return { shared, Agentlang };
}
//# sourceMappingURL=agentlang-module.js.map