()
| 1822 | ); |
| 1823 | |
| 1824 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 1825 | Effect.gen(function* () { |
| 1826 | const rows = yield* core.findMany("integration", {}); |
| 1827 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 1828 | const dbIntegrations = rows.map((row) => |
| 1829 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 1830 | ); |
| 1831 | // A scoped toolkit must not advertise providers it grants no tools from |
| 1832 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 1833 | // user providers, so they stay; DB-backed integrations are filtered to |
| 1834 | // those that contribute at least one visible tool under the active policy. |
| 1835 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 1836 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 1837 | const visibleIntegrationSlugs = new Set( |
| 1838 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 1839 | ); |
| 1840 | return [ |
| 1841 | ...staticIntegrationList, |
| 1842 | ...dbIntegrations.filter((integration) => |
| 1843 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 1844 | ), |
| 1845 | ]; |
| 1846 | }); |
| 1847 | |
| 1848 | const integrationsGet = ( |
| 1849 | slug: IntegrationSlug, |
no test coverage detected