()
| 1797 | ); |
| 1798 | |
| 1799 | const integrationsList = (): Effect.Effect<readonly Integration[], StorageFailure> => |
| 1800 | Effect.gen(function* () { |
| 1801 | const rows = yield* core.findMany("integration", {}); |
| 1802 | const staticIntegrations = staticSources().map(staticSourceToIntegration); |
| 1803 | const dbIntegrations = rows.map((row) => |
| 1804 | rowToIntegration(row, describeAuthMethodsForRow(row), describeDisplayUrlForRow(row)), |
| 1805 | ); |
| 1806 | // A scoped toolkit must not advertise providers it grants no tools from |
| 1807 | // (mirrors `connectionsList`). Static sources are system namespaces, not |
| 1808 | // user providers, so they stay; DB-backed integrations are filtered to |
| 1809 | // those that contribute at least one visible tool under the active policy. |
| 1810 | if (!activeToolPolicyProvider) return [...staticIntegrations, ...dbIntegrations]; |
| 1811 | const visibleTools = yield* toolsList({ includeAnnotations: false }); |
| 1812 | const visibleIntegrationSlugs = new Set( |
| 1813 | visibleTools.filter((tool) => !tool.static).map((tool) => String(tool.integration)), |
| 1814 | ); |
| 1815 | return [ |
| 1816 | ...staticIntegrations, |
| 1817 | ...dbIntegrations.filter((integration) => |
| 1818 | visibleIntegrationSlugs.has(String(integration.slug)), |
| 1819 | ), |
| 1820 | ]; |
| 1821 | }); |
| 1822 | |
| 1823 | const integrationsGet = ( |
| 1824 | slug: IntegrationSlug, |
no test coverage detected