forked from wangziqi/gongxue-base
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { SyncService } from '../../sync/sync.service';
|
|
import type { AgentToolContext, ToolDef, ToolInputResult } from '../agent-tool.types';
|
|
import { rejectUnknownKeys } from './tool-input';
|
|
|
|
@Injectable()
|
|
export class GetSyncStatusTool implements ToolDef<Record<string, never>> {
|
|
readonly name = 'get_sync_status';
|
|
readonly skillKey = 'sync';
|
|
readonly description = '查询钉钉学生/考勤、企业微信等平台最近一次同步状态,以及排课映射进度。';
|
|
readonly requiredPermission = 'sync:read';
|
|
readonly inputSchema = { type: 'object', properties: {}, additionalProperties: false };
|
|
constructor(private readonly service: SyncService) {}
|
|
|
|
validate(raw: Record<string, unknown>): ToolInputResult<Record<string, never>> {
|
|
const invalid = rejectUnknownKeys(raw, []);
|
|
if (invalid) return invalid;
|
|
return { ok: true, value: {} };
|
|
}
|
|
|
|
execute(_input: Record<string, never>, _context: AgentToolContext) {
|
|
return this.service.agentGetSyncStatus();
|
|
}
|
|
}
|