package provider import ( "amadan.net/oficina/equipo/internal/specialist" "slices" ) // ActionProfile is an executable capability, independent of a specialist's name. type ActionProfile struct { Action, Specialist, Submission string ReadOnly bool Render bool } func Profile(action string) (ActionProfile, error) { p := ActionProfile{Action: action} switch action { case "coordinate": p.Specialist, p.Submission, p.ReadOnly = "Coordinator", "post_message", true case "converse": // Thin v1 coordinator: a long-lived conversation with no workspace. // Its Equipo tools are ConverseTools; the instance authorises each // call, and the permission callback denies anything else. p.Specialist, p.ReadOnly = "Coordinator", true case "assist": // Base's Assistant: the same shape as converse (a long-lived // conversation whose desk is read-only), with AssistTools. p.Specialist, p.ReadOnly = "Coordinator", true case "reproduce": p.Specialist, p.Submission = "Engineering", "submit_reproduction" case "scope": p.Specialist, p.Submission, p.ReadOnly = "Scope", "submit_acceptance", true case "recommend", "investigate", "research": p.Specialist, p.Submission, p.ReadOnly = "Research", "submit_answer", true case "implement": p.Specialist, p.Submission, p.Render = "Engineering", "submit_candidate", true case "copy": p.Specialist, p.Submission, p.Render = "Copy", "submit_candidate", true case "design": p.Specialist, p.Submission, p.Render = "Design", "submit_candidate", true case "review": p.Specialist, p.Submission, p.ReadOnly = "Review", "submit_review", true case "inspect": // Thin v1 Review: reads a candidate's tree (read-only mount) with // Read, Glob and Grep only, and gives its verdict through // submit_review. No write tools and no shell. p.Specialist, p.Submission, p.ReadOnly = "Reviewer", "submit_review", true case ResearchStepAction: // The Research step (research-v1, spec ยง4): an empty scratch // workspace, no native tools at all, and exactly the profile's // two Equipo tools. Not the legacy "research" action above, // which reads a workspace with Read, Glob, Grep and Bash. p.Specialist, p.Submission = ResearchSpecialist, specialist.ToolSubmitFindings case DesignStepAction: // The Design step (design-v1, task 13): Engineering's step with // exactly design-v1's three Equipo tools (render_page, not the // old submit_render) and /render read-only. Not the plan // workflow's legacy "design" action above. p.Specialist, p.Submission = DesignSpecialist, specialist.ToolSubmitCandidate case GlanceAction: // The Assistant's instant first line: a small model writes one // short line from the person's newest message. No tool at all, // native or Equipo, and its workspace (an empty directory) is // read-only. p.Specialist, p.ReadOnly = GlanceSpecialist, true case "answer": // Thin v1 "ask the implementer": a step's own session resumed to // answer the person's question about its work. Read-only: the // candidate's tree mounted read-only, Read, Glob and Grep, and the // runner's read-only git tools (AnswerTools). No write tools, no // shell, nothing to submit. p.Specialist, p.ReadOnly = "Answerer", true default: return p, ErrPolicy } return p, nil } func (p ActionProfile) Tools() []string { if p.Action == "coordinate" { return CoordinatorTools() } if p.Action == "converse" { return ConverseTools() } if p.Action == "assist" { return AssistTools() } if p.Action == "answer" { return AnswerTools() } if p.Action == GlanceAction { return []string{} } if ResearchAction(p.Action) { return ResearchTools() } if DesignAction(p.Action) { return DesignTools() } tools := []string{p.Submission, "ask_person"} if p.Render { tools = append(tools, "submit_render") } return tools } func (p ActionProfile) MCPTools() []string { tools := p.Tools() for i := range tools { tools[i] = "mcp__equipo__" + tools[i] } return tools } // CoordinatorAction reports whether an action runs the coordinator, with no // workspace mounted. func CoordinatorAction(action string) bool { return action == "coordinate" || action == "converse" || action == "assist" } // GlanceAction is the launch action of the Assistant's instant first // line (a glance); GlanceSpecialist is its launch role. const ( GlanceAction = "glance" GlanceSpecialist = "Glance" ) // The small models a glance runs on, one per provider: Claude's fastest, // and the smallest the pinned Codex 0.165.0 offers a subscription (its // bundled catalog, `codex debug models --bundled`: gpt-6-luna, "Fast and // affordable model for easier tasks", which gpt-5.6-luna upgrades to). const ( ClaudeGlanceModel = "claude-haiku-5-5" CodexGlanceModel = "gpt-6-luna" ) // GlanceModel is a provider's glance model, "" when it has none. func GlanceModel(provider string) string { switch provider { case "claude": return ClaudeGlanceModel case "codex": return CodexGlanceModel } return "" } // LaunchModel is the model a launch runs: the connection's bound model, // except for a glance, which runs its provider's small model. Only the // glance action reaches the small model, and it is no input: a glance has // no tools, writes a few words and runs on the same account, so it does // not widen what the person allowed. Every other action runs bound. func LaunchModel(action, provider, bound string) string { if action == GlanceAction { if m := GlanceModel(provider); m != "" { return m } } return bound } // ResearchStepAction is the Research step's launch action (profile // research-v1). ResearchSpecialist is its launch role, distinct from the // legacy "Research" role, which has native tools. const ( ResearchStepAction = "research_step" ResearchSpecialist = "Researcher" ) // ResearchAction reports whether an action runs the Research step: no // native tools, a minimal /etc and an empty scratch workspace. func ResearchAction(action string) bool { return action == ResearchStepAction } // ResearchTools are the Research step's Equipo tools, exactly research-v1's. func ResearchTools() []string { p, ok := specialist.Lookup(specialist.ProfileResearch) if !ok { return nil } return p.Tools } // DesignStepAction is the Design step's launch action (profile // design-v1's Policy.Action). DesignSpecialist is its launch role, the // legacy design action's too: Engineering's native tools. const ( DesignStepAction = specialist.ActionDesignStep DesignSpecialist = "Design" ) // DesignAction reports whether an action runs the Design step. func DesignAction(action string) bool { return action == DesignStepAction } // DesignTools are the Design step's Equipo tools, exactly design-v1's. func DesignTools() []string { p, ok := specialist.Lookup(specialist.ProfileDesign) if !ok { return nil } return p.Tools } // DesignReadOnly are the paths the Design step's native file tools may // read and never write beyond Engineering's, exactly design-v1's // (/render). func DesignReadOnly() []string { p, ok := specialist.Lookup(specialist.ProfileDesign) if !ok { return nil } return p.Policy.ReadOnly } // DesignMCPTools are DesignTools as the CLI names them. func DesignMCPTools() []string { p, _ := Profile(DesignStepAction) return p.MCPTools() } // RenderReaderAction reports whether an action may see its step's // captures, read-only at /render: the Design step only. func RenderReaderAction(action string) bool { return DesignAction(action) } // ResearchReaderAction reports whether an action may see a task's kept // research images, read-only at /research: Engineering and Review only. func ResearchReaderAction(action string) bool { return action == "implement" || action == "inspect" } // ConverseTools is the thin coordinator's tool set (wire.ConverseTools // plus create_project, which the runner carries out itself). func ConverseTools() []string { return []string{"request_access", "status", "find", "search_code", "read_file", "add_project", "create_project", "set_project_home", "star_project", "ask_person", "write_note", "read_notes", "record_task", "add_finding", "start_task", "read_task", "cancel_task", "add_report", "hold_merge", "set_merge_policy", "propose_specialist", "research", "offer_retry", "retry_step", "places", "propose_place", "publish_site", "site_status"} } // AssistTools is the Assistant's tool set (wire.AssistTools). func AssistTools() []string { return []string{"look", "describe", "use", "ask_person", "write_note", "read_notes", "read_attachment"} } // AnswerTools are an answering session's Equipo tools: read-only git // on the step's commit, run by the runner outside the namespace. func AnswerTools() []string { return []string{"git_log", "git_diff", "git_show"} } func CoordinatorTools() []string { return []string{"equipo_status", "read_project", "read_task", "propose_project", "propose_plan", "ask_person", "route_to_task", "post_message", "suggest_preference", "suggest_specialist", "suggest_playbook"} } // Codex 0.165.0 registers these whenever MCP is configured. The coordinator's // only server exposes one static routing fixture; Claude has no native-tool exception. func CoordinatorNativeTools(family string) []string { if family == "codex" { return []string{"list_mcp_resources", "list_mcp_resource_templates", "read_mcp_resource"} } return nil } // WithoutAccess removes only the protocol-26 proposal tool for an older peer. func WithoutAccess(tools []string) []string { return slices.DeleteFunc(slices.Clone(tools), func(s string) bool { return s == "mcp__equipo__request_access" }) } func (p ActionProfile) AcceptsTools(tools []string) bool { want := p.MCPTools() return slices.Equal(tools, want) || p.Action == "converse" && slices.Equal(tools, WithoutAccess(want)) }