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

Struct Agent

pkg/agent/agent.go:35–87  ·  view source on GitHub ↗

Agent AI代理

Source from the content-addressed store, hash-verified

33
34// Agent AI代理
35type Agent struct {
36 // 基础配置
37 id string
38 template *types.AgentTemplateDefinition
39 config *types.AgentConfig
40 deps *Dependencies
41
42 // 核心组件
43 eventBus *events.EventBus
44 provider provider.Provider
45 sandbox sandbox.Sandbox
46 executor *tools.Executor
47 toolMap map[string]tools.Tool
48
49 // Middleware 支持 (Phase 6C)
50 middlewareStack *middleware.Stack
51
52 // Slash Commands & Skills 支持
53 commandExecutor *commands.Executor
54 skillInjector *skills.Injector
55
56 // RAG 和语义记忆支持
57 semanticMemory *memory.SemanticMemory
58
59 // 状态管理
60 mu sync.RWMutex
61 state types.AgentRuntimeState
62 breakpoint types.BreakpointState
63 messages []types.Message
64 toolRecords map[string]*types.ToolCallRecord
65 runningTools map[string]*runningToolHandle
66 stepCount int
67 iterationCount int // 当前会话的模型调用次数
68 maxIterations int // 最大迭代次数限制(默认50)
69 initialThinkingSent bool // 是否已发送初始思考事件(用于防止重复发送"任务规划")
70 lastSfpIndex int
71 lastBookmark *types.Bookmark
72 createdAt time.Time
73
74 // 权限管理
75 pendingPermissions map[string]chan string // callID -> decision channel
76 permissionInspector *permission.EnhancedInspector // Claude SDK 风格的权限检查器
77
78 // Plan 模式管理
79 planMode *PlanModeManager
80
81 // 执行计划管理
82 executionPlanMgr *ExecutionPlanManager
83
84 // 控制信号
85 stopCh chan struct{}
86 iterationContinueCh chan bool // 迭代限制确认 channel
87}
88
89// runningToolHandle 保存可中断工具的句柄
90type runningToolHandle struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected