/** * 当月 AI 代码生成占比统计(移植自 chatcode-cli 的同名服务)。 * * 调用 ChatCode 平台 POST {base}/caassist-api-lt/caassist/api/stats/gitCommitRecord, * 查询当月(1 号 00:00:00 ~ 月末 23:59:59,本地时区)的 git 提交统计明细, * 聚合 sum(AI采纳行数)/sum(新增行数) 得到百分比,供启动信息面板的 * 「AI代码生成占比」指示行使用。鉴权与 401/403 自动刷新由 dsh-adapter/chatcode-api.ts 调用宿主鉴权服务。 */ import { type ChatCodeAuthorizedPost } from './chatCodeApi.js'; /** 单条提交统计记录(已归一化) */ export interface GitCommitRecord { /** 提交邮箱 */ email: string; /** 新增行数 */ addedLines: number; /** 删除行数 */ deletedLines: number; /** 总行数 */ totalLines: number; /** AI 采纳行数 */ aiAdoptedLines: number; /** AI 占比(0-100 百分数) */ aiRatioPercent: number; } /** 当月时间范围,格式 YYYY-MM-DD HH:mm:ss(本地时区) */ export declare function getCurrentMonthRange(now?: Date): { beginTime: string; endTime: string; }; /** * 拉取当月提交统计明细。 * 未登录 / 刷新失败 / 请求失败 / 业务码异常时抛错,由调用方决定展示或静默。 */ export declare function fetchGitCommitRecords(post: ChatCodeAuthorizedPost, signal?: AbortSignal): Promise; /** * 计算当月整体 AI 代码生成占比(百分数): * sum(AI采纳行数) / sum(新增行数) × 100。 * 无记录或新增行数为 0 时返回 null(调用方显示暂无数据,不伪装成 0%)。 */ export declare function computeAiRatioPercent(records: GitCommitRecord[]): number | null; //# sourceMappingURL=gitCommitStats.d.ts.map