(ctx context.Context, skill SkillSpec, args, sessionID string, approveProjectShell func(SkillShellPermissionRequest) bool, baseRegistry *coretools.ToolRegistry, parentState any, extraContext coretools.ExecutionContext)
| 58 | } |
| 59 | |
| 60 | func (e *SkillExecutor) ExecuteFork(ctx context.Context, skill SkillSpec, args, sessionID string, approveProjectShell func(SkillShellPermissionRequest) bool, baseRegistry *coretools.ToolRegistry, parentState any, extraContext coretools.ExecutionContext) (SkillExecutionResult, error) { |
| 61 | loaded := e.Loader.LoadFullContent(skill) |
| 62 | if sessionID == "" { |
| 63 | sessionID = uuid.NewString()[:12] |
| 64 | } |
| 65 | prompt, err := e.PromptProcessor.Process(loaded, args, sessionID, approveProjectShell) |
| 66 | if err != nil { |
| 67 | return SkillExecutionResult{}, err |
| 68 | } |
| 69 | prompt = applyForkEffort(prompt, skill.Frontmatter.Effort) |
| 70 | subagentScope := "subagent:" + uuid.NewString()[:12] |
| 71 | if extraContext == nil { |
| 72 | extraContext = coretools.ExecutionContext{} |
| 73 | } |
| 74 | extraContext["_skill_agent_scope"] = subagentScope |
| 75 | if persistence, _ := extraContext["_skill_persistence"].(*SkillPersistence); persistence != nil { |
| 76 | defer persistence.ClearForScope(subagentScope) |
| 77 | } |
| 78 | filtered := buildForkRegistry(baseRegistry, skill.Frontmatter.AllowedTools) |
| 79 | if e.ForkRunner == nil { |
| 80 | return SkillExecutionResult{}, fmt.Errorf("fork skill execution is not configured") |
| 81 | } |
| 82 | thinkingBudgetTokens := resolveForkThinkingBudget(skill.Frontmatter.Effort) |
| 83 | resultText, inputTokens, outputTokens, err := e.ForkRunner(ctx, skill, prompt, subagentScope, thinkingBudgetTokens, filtered, parentState, extraContext) |
| 84 | if err != nil { |
| 85 | return SkillExecutionResult{}, err |
| 86 | } |
| 87 | return SkillExecutionResult{Mode: "fork", Prompt: &prompt, ResultText: &resultText, SubagentScope: &subagentScope, InputTokens: inputTokens, OutputTokens: outputTokens}, nil |
| 88 | } |
| 89 | |
| 90 | func (e *SkillExecutor) BuildInlineSkillMessage(skill SkillSpec, prompt string, disableSkillTool bool) map[string]any { |
| 91 | sourceLabel := "skill" |
no test coverage detected