liteFlow/liteflow-testcase-el
everywhere.z a37df41628 feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接
Task 5.1:用 v2 RC3 的 MiddlewareBase 重建 Task 0 删除的三个 1.0 Hook 能力。

新增 middleware 包(com.yomahub.liteflow.agent.middleware):
- LoggingMiddleware:onReasoning/onActing 打印 reason/act/error 日志(替代
  ReActLoggingHook,格式对齐 1.0),由 cmp.enableReActLogging() 控制。
- ChatUsageMiddleware:onModelCall 订阅 ModelCallEndEvent.getUsage() 累加(替代
  ChatUsageTrackingHook)。per-invocation ThreadLocal 累加器,process() 入口 bind、
  出口 unbind;snapshot() 静态读累计值。
- SkillTrackingMiddleware:onActing 跟踪 load_skill_through_path 工具调用(替代
  SkillTrackingHook)。构造期从注入的 AgentSkillRepository 建 skillId→name 映射,
  per-invocation ThreadLocal 集合,usedSkills() 静态读。

探针结论(findings R-skill-track,已追加):"技能被使用"的最干净可观测信号是
onActing 的 ActingInput.toolCalls()——load_skill_through_path 工具名固定、
input.skillId 即 AgentSkill.getSkillId()。未降级,usedSkills() 真实落地。

接入与恢复:
- ReActAgentComponent:process() 入口 ChatUsageMiddleware.bind() +
  SkillTrackingMiddleware.bind(),出口 finally unbind;新增 protected
  middlewares()(默认空);hooks() 标 @Deprecated(since=2.16.0, forRemoval=true),
  指引改用 middlewares();新增 protected final usedSkills()。
- ReActAgentContext:getChatUsage() 恢复为 ChatUsageMiddleware.snapshot();
  删除 stub setChatUsageTrackingHook;class javadoc 从"迁移期"改为"v2(RC3)"。
- ReactAgentFactory.build:组装 [LoggingMiddleware(if enabled), ChatUsageMiddleware,
  SkillTrackingMiddleware(repo), ...cmp.middlewares()] 逐个 builder.middleware(),
  再 builder.hooks(cmp.hooks()) 直接桥接旧 Hook(RC3 Hook 软弃用但 builder.hooks
  仍存在,无需 adapter)。
- SkillRepositoryResolver.configure 签名 void→AgentSkillRepository(返回注册的
  repo 供 SkillTrackingMiddleware 建映射)。

un-stub:SkillsAgentCmp.handleReply 的 USED_SKILLS_SNAPSHOT 从 List.of() stub
改回 usedSkills();ChatUsageAgentCmp/HookAgentCmp 无需改源(随核心恢复自动生效)。

校验:core compile + test-compile SUCCESS;
-Dtest=ChatUsageMiddlewareTest,ProcessIntegrationTest,ShellPermissionBehaviorTest,
SkillLoadingTest → 14 用例全绿;ReactAgentFactoryTest 2 用例无回归。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-20 11:07:45 +08:00
..
liteflow-testcase-el-apollo-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-builder feature #ICUMKV 全面支持jdk21,以及支持jdk21中的虚拟线程 2025-08-26 11:23:46 +08:00
liteflow-testcase-el-declare-multi-solon bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-declare-multi-springboot bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-declare-springboot bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-etcd-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-nacos-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-nospring bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-react-agent feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接 2026-06-20 11:07:45 +08:00
liteflow-testcase-el-redis-springboot feature #IAY66T 修复单测 2025-07-27 09:42:13 +08:00
liteflow-testcase-el-routechain 对大容量路由脚本增加测试用例 2026-01-22 10:54:04 +08:00
liteflow-testcase-el-script-aviator-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-graaljs-springboot enhancement #IBJO4X 建立统一元数据操作类,所有元数据的操作的入口 2025-02-05 17:06:07 +08:00
liteflow-testcase-el-script-groovy-springboot 优化groovy脚本的测试用例 2025-01-23 14:34:25 +08:00
liteflow-testcase-el-script-java-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-javascript-springboot enhancement #IBJO4X 建立统一元数据操作类,所有元数据的操作的入口 2025-02-05 17:06:07 +08:00
liteflow-testcase-el-script-javax-springboot 适配新的中央仓库发布方式,更改maven的整体结构 2025-08-30 23:32:05 +08:00
liteflow-testcase-el-script-javaxpro-springboot fix #IAY66T 修复JavaxPro插件相同脚本问题 2026-02-01 20:02:16 +08:00
liteflow-testcase-el-script-kotlin-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-lua-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-multi-language-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-python-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-script-qlexpress-springboot bug:#ID22LR 当 Chain 和 组件 同名时 栈溢出 2025-10-16 17:04:59 +08:00
liteflow-testcase-el-solon bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-springboot feat(core): 支持无 chain 配置启动 2026-04-30 14:27:49 +08:00
liteflow-testcase-el-springboot4 chore(agent): 补全 agent 配置 javadoc 与 spring 配置元数据,精简测试模块 pom 2026-05-06 23:25:07 +08:00
liteflow-testcase-el-springnative bug #ID7OTO bind对象为chain时,chain的定义顺序影响了bind数据的获取 2026-01-20 15:33:15 +08:00
liteflow-testcase-el-sql-solon feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
liteflow-testcase-el-sql-springboot 优化代码 2025-08-26 16:57:22 +08:00
liteflow-testcase-el-sql-springboot-dynamic feature #IAUS2R sql插件希望支持指定数据源 2025-02-21 11:56:48 +08:00
liteflow-testcase-el-sql-springboot-sharding-jdbc feature #IAUS2R sql插件希望支持指定数据源 2025-02-21 11:56:48 +08:00
liteflow-testcase-el-zk-springboot feature #IAJD9H 期望liteflow 有自己的生命周期扩展 2024-10-12 22:57:19 +08:00
.gitignore test(agent): reorganize react agent test coverage 2026-05-13 23:31:07 +08:00
pom.xml chore(agent): 补全 agent 配置 javadoc 与 spring 配置元数据,精简测试模块 pom 2026-05-06 23:25:07 +08:00