feat: agent state endpoint + search module

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 14:21:40 +05:30
parent 8ba326589c
commit 4963a698d9
4 changed files with 128 additions and 0 deletions

View File

@@ -53,6 +53,29 @@ export class OzonetelAgentController {
}
}
@Post('agent-state')
async agentState(
@Body() body: { state: 'Ready' | 'Pause'; pauseReason?: string },
) {
if (!body.state) {
throw new HttpException('state required', 400);
}
this.logger.log(`Agent state change: ${this.defaultAgentId}${body.state} (${body.pauseReason ?? ''})`);
try {
const result = await this.ozonetelAgent.changeAgentState({
agentId: this.defaultAgentId,
state: body.state,
pauseReason: body.pauseReason,
});
return result;
} catch (error: any) {
const message = error.response?.data?.message ?? error.message ?? 'State change failed';
return { status: 'error', message };
}
}
@Post('agent-ready')
async agentReady() {
this.logger.log(`Force ready: logging out and back in agent ${this.defaultAgentId}`);