58 Commits

Author SHA1 Message Date
everywhere.z
49044d1b76 refactor(agent): drop fixed assistant identity line from default system prompt
移除 DEFAULT_SYSTEM_PROMPT 中固定的「你是 LiteFlow ReAct Agent 助手。」身份行,
并同步更新 react-agent guide 文档中的对应描述。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 21:33:27 +08:00
everywhere.z
115ffd652c refactor(agent): replace SkillToolManifest with SkillToolResolver and relocate test
- Switch SkillBoxFactory to SkillToolResolver, which resolves tool classes from
  the framework container (enabling DI) and falls back to no-arg reflection,
  resolving tools per AgentSkill instead of by name.
- Remove the obsolete SkillToolManifest.
- Move ReActAgentComponentTest from liteflow-react-agent-core to
  liteflow-testcase-el per the test-placement convention.
- Drop the temporary surefire skipTests=false override in react-agent-core.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 19:29:49 +08:00
everywhere.z
e8cb271d5a feat(agent): resolve skill tools from container to enable DI
SkillToolResolver 优先按类型从 ContextAware 容器取已注册的工具 bean,
使其依赖注入生效;容器未就绪/未注册时降级反射实例化。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 18:30:57 +08:00
everywhere.z
083bdfa0f2 feat(agent): track per-invocation chat usage across ReAct reasoning steps
Add ChatUsageTrackingHook that accumulates ChatUsage from every
PostReasoningEvent within a single process() call, expose it via
ReActAgentContext#getChatUsage(), and emit a per-step usage line in
ReActLoggingHook. The hook is cached on AgentSession and reset at the
start of each process() so the snapshot reflects the full invocation
(not just the last reasoning step).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 20:50:23 +08:00
everywhere.z
8ea01d2e88 feat: add default system prompt, shell safety checks, and deterministic test models
- Add DEFAULT_SYSTEM_PROMPT and effectiveSystemPrompt() to ReActAgentComponent
- Block unsupported shell syntax (pipes, redirections, chaining) in ManagedShellCommandTool
- Fix process I/O to prevent hangs when command waits for stdin
- Fix missing sessionId in ReActLoggingHook result log line
- Introduce FakeEchoModel for deterministic local testing
- Add unit tests for ReActAgentComponent, ReActLoggingHook, and shell syntax rejection
- Remove LiveTestSupport credential skip calls from feature tests

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:23:45 +08:00
everywhere.z
c5891515f9 feat: improve PostActingEvent log with multiline result display 2026-05-16 23:45:19 +08:00
everywhere.z
a9fe301d1b feat: display thinking content in PostReasoningEvent logs 2026-05-16 23:40:39 +08:00
everywhere.z
be439e1a3e feat: add extractThinking method to ReActLoggingHook
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:36:36 +08:00
everywhere.z
686e43be55 fix: update truncate calls with maxLen parameter
Update all calling sites of truncate() method to pass the max length
parameter as required by the updated method signature.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:32:35 +08:00
everywhere.z
fbeab8b880 refactor: make truncate method accept maxLen parameter
The truncate method now accepts a maxLen parameter instead of using
the hardcoded MAX_TEXT_LEN constant. This allows different types of
content to use different truncation lengths. Note: calling sites will
need to be updated to pass the maxLen parameter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:30:28 +08:00
everywhere.z
ab0efe6bd1 chore: add MAX_THINKING_LEN and MAX_RESULT_LEN constants 2026-05-16 23:26:06 +08:00
everywhere.z
6cf7faed41 chore: add ThinkingBlock import to ReActLoggingHook 2026-05-16 23:22:17 +08:00
everywhere.z
65cbb1ecd5 feat(agent): wire conversation workspace into skill code execution
Pass the ReAct agent context workspace directory through SkillBoxFactory
so SkillBox's code execution runs against the conversation workspace
instead of the process default.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 14:00:37 +08:00
everywhere.z
65a6213b72 feat(core): add generic flow event channel for streaming output
Introduce FlowEvent/FlowEventListener/FlowEventPublisher on the Slot so
callers can subscribe via ExecuteOption.eventListener and receive
incremental events while a chain is running. ReActAgentComponent wires
agentscope reasoning/tool_result/summary/result events into this channel
when a listener is registered, keeping the non-listener path as a plain
blocking call.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 16:24:10 +08:00
everywhere.z
dc5d328941 docs(agent): describe react agent skills 2026-05-10 22:23:13 +08:00
everywhere.z
d8fd7f6015 feat(agent): integrate skills with react agent component 2026-05-10 22:20:14 +08:00
everywhere.z
a3bf935c5c feat(agent): track loaded skills 2026-05-10 21:53:06 +08:00
everywhere.z
db4a099361 feat(agent): load skills into skill box 2026-05-10 21:34:13 +08:00
everywhere.z
3175af400d feat(agent): refactor session management to dual-key (conversationId + agentKey)
AgentSessionManager 从单一 sessionId 改为 (conversationId, agentKey) 双 key 架构:
同一 conversationId 下多个 agent 共享 workspace 目录但各自拥有独立的 AgentSession
和对话记忆。删除 NanoIdSessionIdGenerator(conversationId 生成职责上移到 core 层
的 ConversationIdGenerator)。新增 ReActAgentConversationContinuityTest 和
ReActAgentMultiAgentChainTest 覆盖对话连续性和多 agent 协作场景。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 15:01:39 +08:00
everywhere.z
67a9b9bed7 refactor(react-agent): make all hooks parameterless via slot-bound ctx
- ReActAgentComponent 所有 hook 改为无参签名,新增 protected final ctx() 访问器
- ctx 通过 Slot.setAttachment 按 _react_agent_ctx_<nodeId> 挂载,process() finally 解绑
- 按 nodeId 隔离 attachment key,支持 WHEN 并发场景多个 agent 节点共享 slot
- 7 个测试 cmp 子类全部迁移到新签名
- StubModel 改为持有组件引用,运行时动态调 comp.ctx() 取当次 ctx

破坏性变更:所有 ReActAgentComponent 子类必须更新签名。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 14:22:43 +08:00
everywhere.z
c31e279560 refactor(agent): rename WORKSPACE_FILE to LOCAL_FILE for memory storage mode
该模式的 .agent-session 目录实际位于 workspace.root 之下、与各 session
的 workspace 子目录平级而非嵌套,旧名 WORKSPACE_FILE 容易误导为"存储在
某个 workspace 内部"。LOCAL_FILE 与 REDIS、MYSQL 同层级地描述后端类型,
更准确地反映实际行为。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 00:11:21 +08:00
everywhere.z
d27eb7041d liteflow react agent pom adjust 2026-04-30 23:52:19 +08:00
everywhere.z
9612800b4b feat(react-agent): log ReAct reason/act events with sessionId and config toggle
Subscribe to agentscope Pre/PostReasoningEvent, Pre/PostActingEvent
and ErrorEvent through a new ReActLoggingHook, surfacing the agent's
internal think-act loop in standard logs. Each line carries the
LiteFlow agent sessionId so concurrent sessions stay distinguishable.

ReActAgentComponent attaches the hook automatically alongside any
user-provided hooks. Toggle via liteflow.agent.logging.react-enabled
(default true) or override enableReActLogging() per component.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 11:49:27 +08:00
everywhere.z
5bd1850d99 fix(react-agent-gemini): align agentscope and google-genai versions with parent BOM
The module had hardcoded agentscope:1.0.9 and google-genai:1.0.0,
which conflicted with parent pom's 1.0.11/1.38.0 properties and
caused NoSuchMethodError on Part.thoughtSignature() at runtime.
Use the property placeholders so versions stay centrally managed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 11:49:17 +08:00
everywhere.z
a630e85a88 chore(react-agent-core): add missing NanoIdSessionIdGenerator source
Supplements 61824d695 which referenced this generator without
checking it in.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 11:49:10 +08:00
everywhere.z
61824d6956 feat(react-agent): add session factory infrastructure, memory storage config, and integration tests
- Add MemoryStorageConfig/MemoryStorageMode and per-backend configs (Redis, MySQL, workspace file)
- Add AgentSessionFactoryRegistry with NONE, JVM, WORKSPACE_FILE, REDIS, MYSQL implementations
- Add integration test suite with EL-orchestrated Spring Boot tests
- Remove per-module READMEs in favor of unified guide
- Update POMs, CLAUDE.md, AGENTS.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 19:12:29 +08:00
everywhere.z
ca9608f793 refactor(react-agent-core): switch abstract from buildModel to model
ReActAgentComponent now requires subclasses to override model(ctx)
returning a ModelSpec. The legacy buildModel(ctx) becomes a
non-abstract escape hatch with a default implementation delegating
to model(ctx).resolve(agentConfig()).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:25:22 +08:00
everywhere.z
055e7399e1 feat(react-agent-dashscope): add DashScope entry and DashScopeSpec
DashScope.of(modelName) returns DashScopeSpec with a thinking
sub-builder using DashScope's native budget term.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:22:39 +08:00
everywhere.z
64d5404b2c feat(react-agent-gemini): add Gemini entry and GeminiSpec
Gemini.of(modelName) returns GeminiSpec exposing a thinking sub-builder
that supports both Gemini 2.5's level() and the legacy budget() form.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:22:33 +08:00
everywhere.z
994cbd2a25 feat(react-agent-anthropic): add Anthropic entry and AnthropicSpec
Anthropic.of(modelName) and AnthropicCompatible.custom(configKey,
modelName) return AnthropicSpec, with a thinking sub-builder using
Anthropic's native budget/enabled terms.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:22:27 +08:00
everywhere.z
679dc33ca2 feat(react-agent-openai): add OpenAI-compatible vendor entries
DeepSeek/Kimi/GLM/Minimax static entries with default baseUrls,
plus OpenAICompatible.custom() fallback for arbitrary vendors.
All read credentials from liteflow.agent.openai-compatible.<key>.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:15:36 +08:00
everywhere.z
5cc43acff2 feat(react-agent-openai): add OpenAI entry and OpenAISpec
OpenAI.of(modelName) returns an OpenAISpec exposing reasoningEffort,
frequencyPenalty, and presencePenalty in addition to the common
ModelSpec setters; resolve() reads liteflow.agent.openai credential.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:11:54 +08:00
everywhere.z
b40ec52632 feat(react-agent-core): add CredentialResolver helper
Centralizes credential lookup with consistent AgentConfigException
messages that point at the relevant liteflow.agent.* config path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:06:46 +08:00
everywhere.z
4abb4d1eb4 fix(react-agent-core): widen ModelSpec.resolve to public
resolve() is the framework SPI: ReActAgentComponent (in a different
package) needs to call spec.resolve(cfg), which protected access
does not permit. The test's TestSpec override is widened in lockstep
since Java forbids narrowing visibility on override.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 17:54:26 +08:00
everywhere.z
c417620f2c feat(react-agent-core): introduce ModelSpec base class
Vendor-neutral model descriptor with common fluent setters
(temperature/topP/topK/maxTokens/seed/stream/cacheControl) and an
abstract resolve(AgentConfig) SPI that provider modules implement.
2026-04-29 17:43:38 +08:00
everywhere.z
b63bc1a7f4 docs(react-agent): add design spec for ModelSpec API redesign
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 17:28:23 +08:00
everywhere.z
efe384890a docs(agent): add README for react-agent parent and sub-modules
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:08:14 +08:00
everywhere.z
4b2050446c fix(build): enable gemini module in parent pom
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:06:12 +08:00
everywhere.z
7a0720636f fix(agent-anthropic): add anthropic-java SDK dependency
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:04:55 +08:00
everywhere.z
e573416bf4 feat(agent-dashscope): add DashScope module to parent pom
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:01:38 +08:00
everywhere.z
6840f2fc2a feat(agent-dashscope): add DashScope (Qwen) model factory
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:00:42 +08:00
everywhere.z
ff9f6e22d0 fix(agent): comment out unimplemented modules
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:00:24 +08:00
everywhere.z
f85d09a2b6 feat(agent-anthropic): add Anthropic model factory
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 20:00:12 +08:00
everywhere.z
7bf6908793 feat(agent-gemini): enable gemini and dashscope modules
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:59:54 +08:00
everywhere.z
8dcfc56258 feat(agent-gemini): add Gemini model factory
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:59:45 +08:00
everywhere.z
d719f83162 feat(agent-openai): add OpenAI factory and compatible presets
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:58:55 +08:00
everywhere.z
404f55c94e test(agent-core): add ReActAgentComponent end-to-end test with FakeEchoModel
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:56:48 +08:00
everywhere.z
17d5deefc7 feat(agent-core): implement ReActAgentComponent with final process()
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:52:57 +08:00
everywhere.z
4f9a4cdca6 feat(agent-core): add ManagedShellCommandTool with whitelist/blacklist policy
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:41:56 +08:00
everywhere.z
3b4c283ae4 feat(agent-core): add WorkspaceFileTools with path traversal guard
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:41:48 +08:00