Repository navigation
feat(agents): 原生会话报告可切换的模型、推理等级和模式,用户经 agents.setConfigOption 修改(API-45 0 内补充) - #220
Merged
Merged
Conversation
…45 0 内补充) - 会话事件新增 configOptions(对齐 ACP session config options):最多 16 个设置,每个 1–128 个值,ID 与值唯一,currentValue 必须在列表里;每次报告替换上一次,空列表撤回 - 宿主命令 agents.setConfigOption 只接受用户请求,回合中也可调用,拒绝码 agents.unknownConfigOption、agents.unknownConfigValue、agents.backendUnavailable - 通知 lithe/host/agents/didSetConfigOption 交给插件后端,四种官方 SDK 新增会话处理器方法 - Go SDK 的宿主通知统一走 Agent 通知分发,去掉重复的方法列表 - 契约 README、fixture、API 总表、更新记录、Agent 功能页同步;#219 移到时间线
xiaoyumuxi
marked this pull request as ready for review
November 28, 2026 10:54
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 3 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
This was referenced Nov 28, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 28, 2026
…#223) * feat(agents): agentSessions.calls 按时间倒序分页列出调用,带费用、缓存命中率和速度 * feat(agents): Agent 资源库统一管理指令、技能、MCP 服务器和 Hooks,按用户操作写进各 Agent(API-45 0 内补充) - 清单 agents[] 新增可选 configuration {instructions?, skills?, files?, read?, edit?},新增权限 agents.configuration; 安装审查新增 agentConfiguration 程序,Agent 目录条目带 configuration 和 mayConfigure - 新增 agent-runtime library 模块:资源库存放在平台应用数据目录,read 带修订号,save 只在修订号未变时替换, apply 把用户选中的一项改动写进一个 Agent(指令文件整份重写、技能用符号链接、MCP 与 Hooks 交给插件 edit 改暂存副本, Core 校验后原子替换,期间文件被改动就拒绝);importSkill、removeSkill 管理技能目录 - 新增宿主命令 agentLibrary.configure/read/save/apply/importSkill/removeSkill,写操作只接受用户发起的请求 - 新增 agentLibrary.* 错误码(一码一义)与日志事件 agent.library.*,日志只带分类码和计数 - 契约 README、schema、fixture(agents 插件补配置声明,invalid-manifests 新增 10 个拒绝用例)、 agents 领域参考、能力版本页、API 总表、四种官方 SDK 说明同步补充 - 协议更新记录:新增本 PR 待合入条目,回填 #220 的合入日期(其余 19 条过期记录见 #222) * docs(plugins): 更新记录里本 PR 的编号改为 #223 * fix(agents): hookEvents 上限改为 64(Claude Code 2.1 有 34 个事件),SDK 说明写准 read 可以读 CLI 自己装的内容
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述 / Summary
API-45(Agent)的
agents0 内补充,给桌面端 1lck/Lithe-IDEA#2492 的 Agent 对话用:用户要能在对话里切换模型、拖动推理等级、选择模式。Codex(model/list+turn/start的model、effort)和 Claude Code(set_model、apply_flag_settings、get_settings)都支持这些操作,但现在的会话协议没有办法把“可选的值”交给宿主,也没有办法把用户的选择交回插件后端。协议形状照 ACP 的 session config options(
session/set_config_option),这样以后 Core 的通用 ACP 客户端可以直接映射:configOptions:后端报告用户可改的设置,最多 16 个{id, name, description?, category?, currentValue, options}:category是model、thoughtLevel、mode之一;ACP 的thought_level写作thoughtLevel;options有 1–128 个{value, name, description?};currentValue必须是其中一个值;thoughtLevel的值从低到高排列,宿主据此画成滑块;agents.setConfigOption {session, option, value}→{}:agents.userActionRequired),插件不能替用户改设置;agents.unknownConfigOption、agents.unknownConfigValue;后端没有接收时为agents.backendUnavailable。lithe/host/agents/didSetConfigOption {session, option, value}:交给拥有会话的后端(授权agents.native)。后端在 CLI 能接受时应用,并重新报告configOptions;CLI 拒绝时报告没变的设置和一条notice。没有新增能力版本、协议版本、权限或宿主方法。旧 Core 把
configOptions当成未知事件拒绝(-32602),插件在旧宿主上忽略这次拒绝即可。宿主方法与通知 / Host methods and notifications
lithe/host/agents/didSetConfigOption(通知)lithe/host/agents/report(已有方法,事件新增configOptions)另有平台宿主命令(不是插件宿主方法):
agents.setConfigOption主要改动 / Changes
rust/crates/agent-runtime/src/events.rsConfigCategory、ConfigValue、ConfigOption、ConfigOptions(都deny_unknown_fields),SessionEvent::ConfigOptions。check_config_options检查个数、标签长度、ID 和值唯一、currentValue在列表里。TurnState.config记下最近一次报告的设置和值;check_config给agents.setConfigOption用。rust/crates/agent-runtime/src/live.rs:set_config_option先检查用户来源,再检查设置和值,然后发didSetConfigOption。rust/crates/agent-runtime/src/lib.rs、rust/crates/core/src/protocol/command.rs:登记命令agents.setConfigOption。rust/crates/plugin-rpc/src/host_notifications.rs:新增AGENTS_DID_SET_CONFIG_OPTION,授权agents.native、参数按 Agent 通知校验。set_config_option(option, value);SetConfigOption(option, value),AgentSessionBase默认什么都不做;setConfigOption(option, value);default void setConfigOption(String option, String value),Notice多一个value字段;hostNotification原来自己维护一份 Agent 通知列表,加新通知时会漏掉;改为先判断isAgentNotification,统一走 Agent 通知分发。agent-runtime新增session_settings_are_checked_and_reach_the_backend,覆盖:type字段),并且不影响已有设置;agents.backendUnavailable。agents.setConfigOption。agents/native-session.json加上这条通知和一个configOptions报告,四种 SDK 的 Agent 测试都按它检查。rust-core-api.md、API 总表中英两张方法表、domains/agents.md中英文同步;验证 / Verification
cargo test -p lithe-agent-runtime:19 个通过;cargo test -p lithe-plugin-rpc:43 个通过;cargo test -p lithe-core:全部通过(库 948 个)。cargo clippy -p lithe-agent-runtime -p lithe-plugin-rpc -p lithe-core --all-targets -- -D warnings、cargo fmt --check:通过。cargo test --test agents、Gogo test ./lithe/、Nodenode --test test/agents.test.mjs、JavaAgentsTest:通过。node shared/plugins/scripts/verify-docs.mjs、node shared/plugins/scripts/sdk-e2e.mjs:通过。跟进 / Follow-up
PINNED_CORE_REVISION换到 main 上的合入提交。