()
| 1838 | ); |
| 1839 | |
| 1840 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 1841 | Effect.gen(function* () { |
| 1842 | const rows = yield* core.findMany("integration", {}); |
| 1843 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 1844 | const dbIntegrations = rows.map((row) => |
| 1845 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 1846 | ); |
| 1847 | // A scoped toolkit must not advertise providers it grants no tools from |
| 1848 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 1849 | // user providers, so they stay; DB-backed integrations are filtered to |
| 1850 | // those that contribute at least one visible tool under the active policy. |
| 1851 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 1852 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 1853 | const visibleIntegrationSlugs = new Set( |
| 1854 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 1855 | ); |
| 1856 | return [ |
| 1857 | ...staticIntegrationList, |
| 1858 | ...dbIntegrations.filter((integration) => |
| 1859 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 1860 | ), |
| 1861 | ]; |
| 1862 | }); |
| 1863 | |
| 1864 | const integrationsGet = ( |
| 1865 | slug: IntegrationSlug, |
no test coverage detected