feat(智能体): 不设硬性预算上限,花费改为可见
- 去掉每天次数、每天花费、单次花费、单次 token 四个上限的拦截;设置项登记为弃用,旧值兼容读取、不生效 - 保留单次工具调用次数与时长两个防跑飞限制,缺省调宽(120 次 / 1800 秒,后台调查 20 次) - 新增 GET /agent/usage:今天与最近 7 天按会话类型(对话 / 巡检 / 后台调查 / 整理识别 / 子会话)的次数、token 与费用 - 设置 agent.autoIdentifyOrganize(整理识别不到时叫智能体识别,缺省开)一并加在智能体设置里 - runner 里加整理识别会话的能力白名单与调查会话去重键解析(investigationDecisionId) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
7b7fadbfb6
commit
414ea7c890
10 files changed
+259
-48
No files matched your search
@@ -359,6 +359,23 @@ export type AgentRunChoiceInput = z.infer<typeof AgentRunChoiceInput>;
|
||||
export const AgentRunAbortInput = z.object({ reason: z.string().max(500).optional() });
|
||||
export type AgentRunAbortInput = z.infer<typeof AgentRunAbortInput>;
|
||||
|
||||
/**
|
||||
* 智能体用量(2026-10-06 起不设硬性预算上限,花费改为可见):按会话类型统计次数、token 与费用。
|
||||
* chat = 用户对话;patrol = 智能体巡检;investigate = 待处理事项的后台调查 / 授权内恢复;
|
||||
* organize_identify = 整理没识别出作品时的智能体识别;subagent = 子会话
|
||||
*/
|
||||
export const AgentSpendKind = z.enum(["chat", "patrol", "investigate", "organize_identify", "subagent"]);
|
||||
export type AgentSpendKind = z.infer<typeof AgentSpendKind>;
|
||||
export const AgentSpendBucket = z.object({
|
||||
runs: NonNegInt,
|
||||
tokens: NonNegInt,
|
||||
costUsd: z.number().min(0),
|
||||
byKind: z.array(z.object({ kind: AgentSpendKind, runs: NonNegInt, tokens: NonNegInt, costUsd: z.number().min(0) })),
|
||||
});
|
||||
export type AgentSpendBucket = z.infer<typeof AgentSpendBucket>;
|
||||
export const AgentSpend = z.object({ today: AgentSpendBucket, last7d: AgentSpendBucket });
|
||||
export type AgentSpend = z.infer<typeof AgentSpend>;
|
||||
|
||||
export const AgentRunListQuery = z.object({
|
||||
cursor: z.string().min(1).optional(),
|
||||
limit: z.coerce.number().int().min(1).max(200).default(50),
|
||||
|
||||
Reference in new issue
Block a user