Files
ai-agent/internal/ai/runtime/reply_service.go
T
t 2bbf42b741 refactor(auth): delegate access control to be-system
Remove Agent Desk users, roles, login sessions, tokens, and local permission persistence. Expose the backend as an embeddable ai-agent module with host-provided subject lookup and operation authorization callbacks, and complete the frontend/backend repository split.
2026-08-21 00:41:07 +08:00

41 lines
929 B
Go

package runtime
import (
"strings"
applicationruntime "code.tczkiot.com/wlw/ai-agent/internal/ai/application/runtime"
svc "code.tczkiot.com/wlw/ai-agent/internal/services"
)
var AIReplyService = newAIReplyService()
func init() {
svc.TriggerAIReplyAsyncHook = AIReplyService.TriggerReplyAsync
}
func newAIReplyService() *aiReplyService {
return &aiReplyService{
eligibility: newReplyEligibility(),
executor: newRuntimeReplyExecutor(),
interrupts: newReplyInterruptService(),
commit: newReplyCommitService(),
}
}
type aiReplyService struct {
eligibility *replyEligibility
executor *runtimeReplyExecutor
interrupts *replyInterruptService
commit *replyCommitService
}
func firstInvokedToolCode(summary *applicationruntime.RunResult) string {
if summary == nil {
return ""
}
if len(summary.InvokedToolCodes) > 0 {
return strings.TrimSpace(summary.InvokedToolCodes[0])
}
return ""
}