* Get a specific agent context by ID
(id: string)
| 202 | * Get a specific agent context by ID |
| 203 | */ |
| 204 | async getById(id: string): Promise<AgentContext | null> { |
| 205 | const result = await query( |
| 206 | `SELECT |
| 207 | id, |
| 208 | organization_id, |
| 209 | agent_url, |
| 210 | agent_name, |
| 211 | agent_type, |
| 212 | protocol, |
| 213 | auth_token_encrypted IS NOT NULL as has_auth_token, |
| 214 | auth_token_hint, |
| 215 | auth_type, |
| 216 | oauth_access_token_encrypted IS NOT NULL as has_oauth_token, |
| 217 | oauth_refresh_token_encrypted IS NOT NULL as has_oauth_refresh_token, |
| 218 | oauth_token_expires_at, |
| 219 | oauth_client_id IS NOT NULL as has_oauth_client, |
| 220 | (oauth_cc_token_endpoint IS NOT NULL |
| 221 | AND oauth_cc_client_id IS NOT NULL |
| 222 | AND oauth_cc_client_secret_encrypted IS NOT NULL) as has_oauth_client_credentials, |
| 223 | tools_discovered, |
| 224 | last_discovered_at, |
| 225 | last_test_scenario, |
| 226 | last_test_passed, |
| 227 | last_test_summary, |
| 228 | last_tested_at, |
| 229 | total_tests_run, |
| 230 | created_at, |
| 231 | updated_at, |
| 232 | created_by |
| 233 | FROM agent_contexts |
| 234 | WHERE id = $1`, |
| 235 | [id] |
| 236 | ); |
| 237 | return result.rows[0] || null; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Get agent context by organization and URL |
no test coverage detected