| 148 | * better tool selection than one giant flat registry. |
| 149 | */ |
| 150 | export function composeChatTools(context: ChatAgentContext) { |
| 151 | const page = context.pageContext?.page; |
| 152 | const ids = context.pageContext?.ids; |
| 153 | |
| 154 | switch (page) { |
| 155 | case 'profileDetail': |
| 156 | return ids?.profileId |
| 157 | ? [...BASE_TOOLS, ...PROFILE_TOOLS, ...UI_TOOLS] |
| 158 | : [...BASE_TOOLS, ...UI_TOOLS]; |
| 159 | case 'sessionDetail': |
| 160 | return ids?.sessionId ? [...BASE_TOOLS, ...SESSION_TOOLS] : BASE_TOOLS; |
| 161 | case 'reportEditor': |
| 162 | return context.pageContext?.reportDraft |
| 163 | ? [...BASE_TOOLS, ...REPORT_EDITOR_TOOLS] |
| 164 | : BASE_TOOLS; |
| 165 | case 'pages': |
| 166 | return [...BASE_TOOLS, ...PAGES_TOOLS, ...UI_TOOLS]; |
| 167 | case 'seo': |
| 168 | return [...BASE_TOOLS, ...SEO_TOOLS, ...UI_TOOLS]; |
| 169 | case 'events': |
| 170 | return [...BASE_TOOLS, ...EVENTS_TOOLS, ...UI_TOOLS]; |
| 171 | case 'insights': |
| 172 | return [...BASE_TOOLS, ...INSIGHTS_TOOLS, ...UI_TOOLS]; |
| 173 | case 'groupDetail': |
| 174 | return ids?.groupId ? [...BASE_TOOLS, ...GROUP_TOOLS] : BASE_TOOLS; |
| 175 | case 'dashboard': |
| 176 | return ids?.dashboardId |
| 177 | ? [...BASE_TOOLS, ...DASHBOARD_TOOLS, ...UI_TOOLS] |
| 178 | : [...BASE_TOOLS, ...UI_TOOLS]; |
| 179 | case 'overview': |
| 180 | return [...BASE_TOOLS, ...UI_TOOLS]; |
| 181 | default: |
| 182 | return BASE_TOOLS; |
| 183 | } |
| 184 | } |