- buildMessages 组装时对「距尾 ≥N 个 assistant 轮」的重负载行换单行占位: write_file 参数正文(≥1 轮)、fetch/read_file 回执(≥2 轮);DB/UI 不动, 占位保留 path/url 作恢复指针(文件在盘上可重读,页面可重抓) - 阈值可配 agent.trim_write_rounds / trim_result_rounds(0=关,重启生效) - 压缩回合显式关裁剪:摘要需要原料原文 - 短正文(<600 字)不裁;errAck/图片回执等既有专属路径不碰 - test/trim-smoke.js:纯函数冒烟(占位格式/新鲜保留/压缩豁免/开关/缺参不炸)
91 lines
6.8 KiB
YAML
91 lines
6.8 KiB
YAML
# config.example.yml —— agent-core 专属配置模板:与 server/config.js 的 DEFAULTS 一一对应。
|
||
# ⚠️ 本文件(及其生成物 config.yml)只给 core 进程读:内含平台 api_key / 登录 secret,
|
||
# executor、wxbot 等其他组件一律不挂、不读(bind mount 只挂给 agent-core),它们的接线全部由根 compose 经 .env 注入 env。
|
||
# 部署推荐用 scripts/init.sh 生成 config.yml(只写 platforms/auth/mcp_servers/public_link,其余走默认值);
|
||
# 手动部署才整份复制本文件。platforms 为空则无模型可用,可在前端设置页添加后重启。
|
||
|
||
# 模型平台池:每平台 {name, url, type?, models:[{id, ...}], keys:[{api_key, concurrency?}]}。
|
||
platforms: []
|
||
|
||
# 全局工具黑名单:profile 未配 tools_deny 时继承它;allow 先、deny 后叠加(deny 赢,与 mcp_servers 同构)。
|
||
# 写数组即整体覆盖默认值,写 [] 即清空。默认屏蔽元工具 lab 与阶段出口 handoff(后者仅 advising 显式清空后可见)。
|
||
tools_deny: [lab, handoff]
|
||
|
||
# 模型 profile:prompt + tools 名单组合,模型用 profile: <名> 引用(不配 = 全量)。
|
||
# 内置 advising 不靠引用:会话处于 advising 阶段(顾问澄清需求/规划)时强制命中,见 server/engine.js resolveProfileName。
|
||
model_profiles:
|
||
advising: # 顾问阶段:只聊和读不写(profile 画像元信息除外),唯一出口 handoff,配专属提示词
|
||
tools_allow: [read_file, fetch, handoff, profile]
|
||
tools_deny: [] # 必须显式清空全局黑名单,否则 handoff 自己也被 deny(同 lab 的教训)
|
||
system_prompt_file: advising-system.txt
|
||
lab: # 统一入口自测:tools 只有 lab,其余能力经 lab(help) 现场发现
|
||
tools_allow: [lab]
|
||
tools_deny: [] # 必须显式清空全局黑名单,否则 lab 自己也被 deny → 零工具
|
||
system_prompt_file: lab-system.txt # 相对 server/templates/(也接受绝对路径)
|
||
zero: # 纯文本对话:一个工具都不发
|
||
tools_allow: []
|
||
system_prompt_file: zero-system.txt
|
||
|
||
port: 8090 # 服务监听端口
|
||
workspace_root: "/workspace/tasks" # 任务工作区根目录,AI 文件操作限制在此
|
||
data_root: "/workspace/data" # 数据根目录:SQLite 与 prompt dump
|
||
db_path: "" # 留空取 data_root/.agent.db
|
||
log_level: "info" # debug < info < warn < error < none(仅 core 自身;executor/wxbot 的日志等级另走 EXECUTOR_LOG_LEVEL / WXBOT_LOG_LEVEL env,compose 注)
|
||
|
||
# executor(命令执行)与 wxbot(微信接入)均**不是本文件的配置项**,接线全走根 compose 注入的 env(见 .env.example):
|
||
# EXECUTOR_URL / EXECUTOR_TOKEN;WXBOT_URL(默认 http://wxbot:8093,置空=微信入口静默关闭)/ WXBOT_TOKEN(init.sh 生成,两侧同值)。
|
||
# 详见 docs/ARCHITECTURE.md §5.13。
|
||
|
||
terminal:
|
||
default_timeout_ms: 30000 # 命令默认超时(ms)
|
||
max_output_chars: 10000 # 回传模型的最大输出字符数
|
||
|
||
fetch:
|
||
timeout_ms: 30000 # 抓取总超时(ms),覆盖响应头到 body 读完
|
||
max_bytes: 1048576 # 单次响应最多抓多少字节,超限即断开(下载不占上下文,可宽松)
|
||
max_chars: 12000 # 返回给模型的默认字符上限(与下载上限解耦;超窗尾部提示 offset 续读)
|
||
max_chars_hard: 64000 # 模型显式传 max_chars 时的硬帽
|
||
allow_private: false # SSRF 防护:false=拒抓解析到内网/回环地址的目标;确需抓内网服务才开 true
|
||
|
||
agent:
|
||
temperature: 1.0 # 采样温度
|
||
max_tool_iterations: 100 # 单轮最大迭代数(含工具调用)
|
||
max_retries: 2 # 上游失败重试次数
|
||
language: "Simplified Chinese" # 强制回复语言;留空不限
|
||
auto_compress_tokens: 60000 # In token 超此值弹「自动压缩」提议;0=关
|
||
trim_write_rounds: 1 # 历史重放裁剪:write_file 参数正文距尾 ≥N 个 assistant 轮换单行占位(0=关;DB/UI 不动,盘上可重读)
|
||
trim_result_rounds: 2 # fetch/read_file 回执正文距尾 ≥N 个 assistant 轮换单行占位(0=关;占位留 url/path 作恢复指针)
|
||
auto_complete_ms: 1800000 # 保持中(held)超此时长自动收口为已完成;0=关(纯状态动作,历史/模型绑定不动)
|
||
|
||
# 长期记忆(日记,memory.js):收口时一条几十字第一人称碎片入当日条目;存储默认永久,旧记忆靠回忆下钻
|
||
memory:
|
||
inject_max: 3 # 新会话开场注入最近几条碎片;0=只记录不注入
|
||
retain_days: 0 # 存储裁剪窗;0=永不删,正数=超窗硬删
|
||
wrap_idle_ms: 14400000 # 空闲超此时长自动收口(碎片+归档+微信解绑);0=关
|
||
|
||
upload:
|
||
image_compress_threshold_kb: 1536 # 大图压缩提示阈值(KB)
|
||
image_max_dim: 2000 # 压缩后长边上限(px)
|
||
image_quality: 0.85 # JPEG 质量
|
||
confirm_size_mb: 10 # 任意文件二次确认阈值(MB)
|
||
|
||
skills:
|
||
skills_root: "" # 留空取 workspace_root 同级 skills 目录
|
||
timeout_ms: 120000 # 单个技能执行超时(ms)
|
||
|
||
# 旧版 model_hold(模型保持租约)已废弃删除:key 不再独占也不排队,回合结束后的 held 不再自动到期。
|
||
|
||
auth: # users 留空 = 不启用登录认证
|
||
secret: "" # 登录态签名密钥;留空则每次重启随机(需重新登录)
|
||
ttl_ms: 2592000000 # 登录态有效期(ms,默认 30 天)
|
||
users:
|
||
- user: admin # 默认账号
|
||
password: "admin" # 默认密码,请务必修改
|
||
|
||
# 外部 MCP 服务列表:每项 {name?, url, headers?, enable?(默认 true), timeout_ms?, tools_allow?, tools_deny?}。
|
||
mcp_servers: []
|
||
|
||
public_link:
|
||
base_url: "" # 留空关闭 mint_public_link;填本服务对外地址
|
||
ttl_ms: 1800000 # 链接有效期(ms)
|