()
| 1913 | ); |
| 1914 | |
| 1915 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 1916 | Effect.gen(function* () { |
| 1917 | const rows = yield* core.findMany("integration", {}); |
| 1918 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 1919 | const dbIntegrations = rows.map((row) => |
| 1920 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 1921 | ); |
| 1922 | // A scoped toolkit must not advertise providers it grants no tools from |
| 1923 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 1924 | // user providers, so they stay; DB-backed integrations are filtered to |
| 1925 | // those that contribute at least one visible tool under the active policy. |
| 1926 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 1927 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 1928 | const visibleIntegrationSlugs = new Set( |
| 1929 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 1930 | ); |
| 1931 | return [ |
| 1932 | ...staticIntegrationList, |
| 1933 | ...dbIntegrations.filter((integration) => |
| 1934 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 1935 | ), |
| 1936 | ]; |
| 1937 | }); |
| 1938 | |
| 1939 | const integrationsGet = ( |
| 1940 | slug: IntegrationSlug, |
no test coverage detected