@@ -137,26 +137,26 @@ func (s *Session) spawnSubAgentRequest(ctx context.Context, req agentcontracts.S
137137 return res , nil
138138}
139139
140- func mapContractsType (t agentcontracts.SubagentType ) SubAgentMode {
140+ func mapContractsType (t agentcontracts.SubagentType ) engagent. SubAgentMode {
141141 switch t {
142142 case agentcontracts .TypePlan :
143- return SubAgentPlan
143+ return engagent . SubAgentPlan
144144 case agentcontracts .TypeGeneralPurpose :
145- return SubAgentGeneral
145+ return engagent . SubAgentGeneral
146146 default :
147- return SubAgentExplore
147+ return engagent . SubAgentExplore
148148 }
149149}
150150
151151// spawnSubAgent creates a sub-agent with the given mode and depth tracking.
152152// Returns (output, worktreePath, error).
153- func (s * Session ) spawnSubAgent (ctx context.Context , norm agentcontracts.Normalized , mode SubAgentMode , depth int ) (string , string , error ) {
154- if depth >= MaxAgentDepth {
155- return "" , "" , fmt .Errorf ("max agent depth %d exceeded" , MaxAgentDepth )
153+ func (s * Session ) spawnSubAgent (ctx context.Context , norm agentcontracts.Normalized , mode engagent. SubAgentMode , depth int ) (string , string , error ) {
154+ if depth >= engagent . MaxAgentDepth {
155+ return "" , "" , fmt .Errorf ("max agent depth %d exceeded" , engagent . MaxAgentDepth )
156156 }
157157
158- maxTurns := DefaultTurnsForMode (mode )
159- if mode == SubAgentExplore && norm .Thoroughness != "" {
158+ maxTurns := engagent . DefaultTurnsForMode (mode )
159+ if mode == engagent . SubAgentExplore && norm .Thoroughness != "" {
160160 maxTurns = engagent .ThoroughnessTurns (engagent .ExploreThoroughness (norm .Thoroughness ))
161161 }
162162
@@ -174,7 +174,7 @@ func (s *Session) spawnSubAgent(ctx context.Context, norm agentcontracts.Normali
174174
175175 // Capability mode can further restrict tools beyond profile defaults.
176176 if norm .CapabilityMode == agentcontracts .CapReadOnly {
177- registry = registry .Filter (ExploreTools )
177+ registry = registry .Filter (engagent . ExploreTools )
178178 }
179179
180180 subPromptCtx := prompts.PromptContext {
@@ -185,14 +185,14 @@ func (s *Session) spawnSubAgent(ctx context.Context, norm agentcontracts.Normali
185185 if err != nil {
186186 subSystemPrompt = s .Persistence ().System ()
187187 }
188- if mode == SubAgentPlan {
188+ if mode == engagent . SubAgentPlan {
189189 subSystemPrompt = planSystemPrefix + "\n \n " + subSystemPrompt
190190 }
191191
192192 sub := s .SubSession (model , subSystemPrompt , registry )
193193 sub .PermSvc ().SetPermissionFn (s .PermSvc ().PermissionFn ())
194194 // Explore/plan: hard read-only bash allowlist (in addition to tool filter).
195- if IsReadOnlyMode (mode ) || norm .CapabilityMode == agentcontracts .CapReadOnly {
195+ if engagent . IsReadOnlyMode (mode ) || norm .CapabilityMode == agentcontracts .CapReadOnly {
196196 sub .Tools ().SetReadOnlyBash (true )
197197 }
198198 // A child receives an independent snapshot of the parent's policy. This
@@ -281,30 +281,30 @@ func (s *Session) spawnSubAgent(ctx context.Context, norm agentcontracts.Normali
281281const planSystemPrefix = "You are a planning sub-agent. Produce an ordered, actionable plan. " +
282282 "Do not modify files. Prefer research tools (Read, Grep, Glob, LS) and only use Bash for read-only inspection."
283283
284- func (s * Session ) resolveSubAgentModel (mode SubAgentMode ) string {
284+ func (s * Session ) resolveSubAgentModel (mode engagent. SubAgentMode ) string {
285285 current := s .ChatLLM ().Model ()
286286 if s .LifecycleSvc ().Cascade () == nil {
287287 return current
288288 }
289289 switch mode {
290- case SubAgentExplore :
290+ case engagent . SubAgentExplore :
291291 return s .LifecycleSvc ().Cascade ().SelectModel ("summarize" , current , s .LifecycleSvc ().Cascade ().Roles .Explorer )
292- case SubAgentPlan :
292+ case engagent . SubAgentPlan :
293293 return s .LifecycleSvc ().Cascade ().SelectModel ("planning" , current , s .LifecycleSvc ().Cascade ().Roles .Planner )
294- case SubAgentGeneral :
294+ case engagent . SubAgentGeneral :
295295 return s .LifecycleSvc ().Cascade ().SelectModel ("implement" , current , "" )
296296 default :
297297 return current
298298 }
299299}
300300
301- func (s * Session ) resolveSubAgentTools (mode SubAgentMode ) * tool.Registry {
301+ func (s * Session ) resolveSubAgentTools (mode engagent. SubAgentMode ) * tool.Registry {
302302 registry := s .Tools ().Registry ()
303303 switch mode {
304- case SubAgentExplore :
305- return registry .Filter (ExploreTools )
306- case SubAgentPlan :
307- return registry .Filter (PlanTools )
304+ case engagent . SubAgentExplore :
305+ return registry .Filter (engagent . ExploreTools )
306+ case engagent . SubAgentPlan :
307+ return registry .Filter (engagent . PlanTools )
308308 default :
309309 return registry
310310 }
0 commit comments