feat: add CASL authorization and AI configuration
This commit is contained in:
43
apps/server/src/agent-tools/agent-tools.module.ts
Normal file
43
apps/server/src/agent-tools/agent-tools.module.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Module, OnModuleInit } from '@nestjs/common';
|
||||
import { StudentsModule } from '../students/students.module';
|
||||
import { AgentToolRegistry } from './agent-tool.registry';
|
||||
import { AgentToolExecutor } from './agent-tool.executor';
|
||||
import { SearchStudentsTool } from './tools/search-students.tool';
|
||||
import { GetStudentBasicTool } from './tools/get-student-basic.tool';
|
||||
|
||||
/**
|
||||
* Agent Tools feature module.
|
||||
*
|
||||
* Provides a provider-neutral tool executor for LLM agent frameworks.
|
||||
* SDK consumers interact ONLY with {@link AgentToolExecutor}.
|
||||
*
|
||||
* `AgentToolRegistry` is an internal provider — it is NOT exported from
|
||||
* this module. All tool listing and execution goes through the executor,
|
||||
* which enforces double-check authorization, audit logging, and context
|
||||
* trust validation.
|
||||
*
|
||||
* Imports `StudentsModule` for student data access and relies on the
|
||||
* globally available `AuthorizationModule` and `OperationLogsModule`.
|
||||
*/
|
||||
@Module({
|
||||
imports: [StudentsModule],
|
||||
providers: [
|
||||
AgentToolRegistry,
|
||||
AgentToolExecutor,
|
||||
SearchStudentsTool,
|
||||
GetStudentBasicTool,
|
||||
],
|
||||
exports: [AgentToolExecutor],
|
||||
})
|
||||
export class AgentToolsModule implements OnModuleInit {
|
||||
constructor(
|
||||
private readonly registry: AgentToolRegistry,
|
||||
private readonly searchTool: SearchStudentsTool,
|
||||
private readonly getTool: GetStudentBasicTool,
|
||||
) {}
|
||||
|
||||
onModuleInit(): void {
|
||||
this.registry.register(this.searchTool);
|
||||
this.registry.register(this.getTool);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user