()
| 2816 | ); |
| 2817 | |
| 2818 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 2819 | Effect.gen(function* () { |
| 2820 | const rows = yield* core.findMany("integration", {}); |
| 2821 | const staticIntegrationList = staticIntegrations().map(staticDeclToIntegration); |
| 2822 | const dbIntegrations = rows.map((row) => |
| 2823 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayForRow(row)), |
| 2824 | ); |
| 2825 | // A scoped toolkit must not advertise providers it grants no tools from |
| 2826 | // (mirrors `connectionsList`). Static integrations are system namespaces, not |
| 2827 | // user providers, so they stay; DB-backed integrations are filtered to |
| 2828 | // those that contribute at least one visible tool under the active policy. |
| 2829 | if (!activeToolPolicyProvider) return [...staticIntegrationList, ...dbIntegrations]; |
| 2830 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 2831 | const visibleIntegrationSlugs = new Set( |
| 2832 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 2833 | ); |
| 2834 | return [ |
| 2835 | ...staticIntegrationList, |
| 2836 | ...dbIntegrations.filter((integration) => |
| 2837 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 2838 | ), |
| 2839 | ]; |
| 2840 | }); |
| 2841 | |
| 2842 | const integrationsGet = ( |
| 2843 | slug: IntegrationSlug, |
no test coverage detected