Refactor runtime executor integration and introduce eino package

- Replaced the existing runtime executor with a new eino package for better modularity.
- Updated Service struct to use the new RuntimeExecutor from eino.
- Adjusted Run and Resume methods to accommodate changes in input types and execution logic.
- Introduced new types in the eino package to align with the previous executor's functionality.
- Refactored tooling preparation logic to streamline tool definitions and improve clarity.
- Added new context builders and event consumers to enhance runtime event handling.
- Removed legacy executor code and ensured all references are updated to the new eino package.
This commit is contained in:
mlogclub
2026-04-14 09:33:49 +08:00
parent f5bbb0aaf2
commit 164121836d
15 changed files with 335 additions and 297 deletions
+5 -5
View File
@@ -3,11 +3,11 @@ package runtime
import (
"context"
runtimeexecutor "cs-agent/internal/ai/runtime/executor"
runtimeeino "cs-agent/internal/ai/infra/eino"
)
type Service struct {
runtime *runtimeexecutor.Service
runtime *runtimeeino.RuntimeExecutor
catalog *toolCatalog
prepare *prepareService
}
@@ -15,7 +15,7 @@ type Service struct {
func NewService() *Service {
catalog := newToolCatalog()
return &Service{
runtime: runtimeexecutor.NewService(),
runtime: runtimeeino.NewRuntimeExecutor(),
catalog: catalog,
prepare: newPrepareService(catalog),
}
@@ -35,7 +35,7 @@ func (s *Service) Run(ctx context.Context, req Request) (*Summary, error) {
if err := s.prepare.prepareToolsForRun(&req); err != nil {
return nil, err
}
summary, err := s.runtime.ExecuteRun(ctx, runtimeexecutor.RunInput{
summary, err := s.runtime.ExecuteRun(ctx, runtimeeino.RunInput{
Conversation: req.Conversation,
UserMessage: req.UserMessage,
AIAgent: req.AIAgent,
@@ -67,7 +67,7 @@ func (s *Service) Resume(ctx context.Context, req ResumeRequest) (*Summary, erro
if err := s.prepare.prepareToolsForResume(&req); err != nil {
return nil, err
}
summary, err := s.runtime.ExecuteResume(ctx, runtimeexecutor.ResumeInput{
summary, err := s.runtime.ExecuteResume(ctx, runtimeeino.ResumeInput{
Conversation: req.Conversation,
AIAgent: req.AIAgent,
AIConfig: req.AIConfig,
@@ -3,10 +3,10 @@ package runtime
import (
"strings"
runtimeexecutor "cs-agent/internal/ai/runtime/executor"
runtimeeino "cs-agent/internal/ai/infra/eino"
)
func toSummary(summary *runtimeexecutor.RunResult) *Summary {
func toSummary(summary *runtimeeino.RunResult) *Summary {
if summary == nil {
return nil
}