(messages []map[string]any, state *AgentState)
| 1025 | } |
| 1026 | return query |
| 1027 | } |
| 1028 | |
| 1029 | func (e *CoreExecutionEngine) requestSkillShellPermission(ctx context.Context, executor *StreamingToolExecutor, req skills.SkillShellPermissionRequest) bool { |
| 1030 | if e != nil && e.Config.Yolo { |
| 1031 | return true |
| 1032 | } |
| 1033 | ch := make(chan bool, 1) |
| 1034 | e.mu.Lock() |
| 1035 | if e.skillPermissionCh != nil { |
| 1036 | e.mu.Unlock() |
| 1037 | return false |
| 1038 | } |
| 1039 | e.skillPermissionCh = ch |
| 1040 | e.skillPermissionQ = append(e.skillPermissionQ, NewStreamEvent("permission_needed", "", map[string]any{ |
| 1041 | "skill_shell_request": req, |
| 1042 | "dangerous": true, |
| 1043 | "risk": "high", |
| 1044 | })) |
| 1045 | e.mu.Unlock() |
| 1046 | if executor != nil { |
| 1047 | executor.signalActivity() |
| 1048 | } |
| 1049 | defer func() { |
| 1050 | e.mu.Lock() |
| 1051 | if e.skillPermissionCh == ch { |
| 1052 | e.skillPermissionCh = nil |
| 1053 | } |
| 1054 | e.mu.Unlock() |
| 1055 | }() |
| 1056 | select { |
| 1057 | case granted := <-ch: |
| 1058 | return granted |
| 1059 | case <-ctx.Done(): |
| 1060 | return false |
| 1061 | } |
| 1062 | } |
| 1063 | |
| 1064 | func (e *CoreExecutionEngine) drainSkillPermissionEvents() []StreamEvent { |
| 1065 | e.mu.Lock() |
| 1066 | defer e.mu.Unlock() |
| 1067 | if len(e.skillPermissionQ) == 0 { |
| 1068 | return nil |
| 1069 | } |
| 1070 | events := append([]StreamEvent(nil), e.skillPermissionQ...) |
| 1071 | e.skillPermissionQ = nil |
| 1072 | return events |
| 1073 | } |
| 1074 | |
| 1075 | func (e *CoreExecutionEngine) BuildClient(maxTokens int, model string, thinkingBudgetTokens *int) (api.LLMClient, error) { |
| 1076 | if model == "" { |
| 1077 | model = e.Config.APIModel |
| 1078 | } |
| 1079 | return CreateConfiguredLLMClient(e.Config, model, maxTokens, thinkingBudgetTokens, api.DefaultRetryConfigPtr()) |
| 1080 | } |
| 1081 | |
| 1082 | func (e *CoreExecutionEngine) PostToolUse(tc coretools.ToolCall, state *AgentState) { |
| 1083 | } |
| 1084 |
no test coverage detected