MCPcopy Create free account
hub / github.com/astercloud/aster / ExecutePlan

Method ExecutePlan

pkg/agent/execution_plan.go:197–224  ·  view source on GitHub ↗

ExecutePlan 执行当前计划

(ctx context.Context)

Source from the content-addressed store, hash-verified

195
196// ExecutePlan 执行当前计划
197func (m *ExecutionPlanManager) ExecutePlan(ctx context.Context) error {
198 if m.currentPlan == nil {
199 return errors.New("no plan to execute")
200 }
201
202 // 创建工具上下文
203 toolCtx := &tools.ToolContext{
204 AgentID: m.agent.id,
205 Sandbox: m.agent.sandbox,
206 Signal: ctx,
207 }
208
209 // 执行计划
210 err := m.executor.Execute(ctx, m.currentPlan, toolCtx)
211
212 // 触发完成回调
213 if m.onPlanCompleted != nil {
214 m.onPlanCompleted(m.currentPlan)
215 }
216
217 agentLog.Info(ctx, "execution plan completed", map[string]any{
218 "plan_id": m.currentPlan.ID,
219 "status": m.currentPlan.Status,
220 "total_duration_ms": m.currentPlan.TotalDurationMs,
221 })
222
223 return err
224}
225
226// ExecutePlanDirect 直接执行指定计划(不设置为当前计划)
227func (m *ExecutionPlanManager) ExecutePlanDirect(ctx context.Context, plan *executionplan.ExecutionPlan) error {

Callers

nothing calls this directly

Calls 2

ExecuteMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected