@opengeni/core 0.20.3 → 0.20.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1391,6 +1391,7 @@ import {
1391
1391
  listConnectionsMetadata,
1392
1392
  listEnabledMcpCapabilityServers,
1393
1393
  listPackInstallations as listPackInstallations2,
1394
+ listSocialConnections,
1394
1395
  mcpServerIdForCapability,
1395
1396
  updatePackInstallationStatus,
1396
1397
  upsertCapabilityCatalogItem
@@ -1743,6 +1744,7 @@ async function buildCapabilityCatalog(input) {
1743
1744
  capabilityInstallations,
1744
1745
  packInstallations,
1745
1746
  workspacePacks,
1747
+ socialConnections,
1746
1748
  bundledSkills,
1747
1749
  curatedLibrarySkills
1748
1750
  ] = await Promise.all([
@@ -1750,6 +1752,7 @@ async function buildCapabilityCatalog(input) {
1750
1752
  listCapabilityInstallations(input.db, input.workspaceId),
1751
1753
  listPackInstallations2(input.db, input.workspaceId),
1752
1754
  listWorkspaceCapabilityPacks(input.db, input.workspaceId),
1755
+ listSocialConnections(input.db, input.workspaceId, 500),
1753
1756
  discoverBundledSkills(),
1754
1757
  discoverCuratedSkillLibraryItems()
1755
1758
  ]);
@@ -1765,7 +1768,7 @@ async function buildCapabilityCatalog(input) {
1765
1768
  (pack) => packCatalogItem(pack, builtInPackIds.has(pack.id) ? "built_in" : "manual")
1766
1769
  ),
1767
1770
  ...configuredMcpCatalogItems(input.settings),
1768
- ...platformApiCatalogItems(),
1771
+ ...platformApiCatalogItems(socialConnections),
1769
1772
  ...bundledSkills,
1770
1773
  ...curatedLibrarySkills
1771
1774
  ];
@@ -2430,8 +2433,47 @@ function configuredMcpCatalogItems(settings) {
2430
2433
  })
2431
2434
  );
2432
2435
  }
2433
- function platformApiCatalogItems() {
2434
- return [
2436
+ function platformApiCatalogItems(socialConnections) {
2437
+ const xConnection = preferredSocialConnection(socialConnections, "x");
2438
+ const xEnabled = xConnection?.status === "connected" || xConnection?.status === "needs_reauth";
2439
+ const x = CapabilityCatalogItem.parse({
2440
+ id: "api:x",
2441
+ kind: "api",
2442
+ source: "built_in",
2443
+ name: "X",
2444
+ description: "Connect an X account for live search, mentions, thread context, post sync, and permission-controlled replies.",
2445
+ category: "social-media",
2446
+ tags: ["api", "x", "twitter", "social", "marketing"],
2447
+ homepageUrl: "https://x.com",
2448
+ authModel: "oauth2_authorization_code_pkce",
2449
+ providerDomain: "x.com",
2450
+ surfaceType: "first_party_social",
2451
+ authKind: "oauth2",
2452
+ tools: [{ kind: "mcp", id: "opengeni" }],
2453
+ runtime: {
2454
+ available: true,
2455
+ mcpServerId: "opengeni",
2456
+ notes: "Account access is provided through OpenGeni's first-party social tools."
2457
+ },
2458
+ enabled: xEnabled,
2459
+ enabledReason: xEnabled ? xConnection.status === "connected" ? "workspace social account connected" : "workspace social account needs reconnection" : null,
2460
+ metadata: {
2461
+ connectorMode: "first_party_social",
2462
+ provider: "x",
2463
+ ownership: "workspace",
2464
+ firstPartyMcpTools: [
2465
+ "social_connections_list",
2466
+ "social_posts_recent",
2467
+ "social_daily_analysis_context",
2468
+ "social_search_live",
2469
+ "social_mentions_live",
2470
+ "social_thread_fetch",
2471
+ "social_posts_sync",
2472
+ "social_post_reply"
2473
+ ]
2474
+ }
2475
+ });
2476
+ const platformApis = [
2435
2477
  {
2436
2478
  id: "api:github-app",
2437
2479
  name: "GitHub App",
@@ -2482,6 +2524,13 @@ function platformApiCatalogItems() {
2482
2524
  }
2483
2525
  })
2484
2526
  );
2527
+ return [x, ...platformApis];
2528
+ }
2529
+ function preferredSocialConnection(connections, provider) {
2530
+ const statusRank = (status) => status === "connected" ? 0 : status === "needs_reauth" ? 1 : 2;
2531
+ return connections.filter((connection) => connection.provider === provider).sort(
2532
+ (left, right) => statusRank(left.status) - statusRank(right.status) || right.updatedAt.localeCompare(left.updatedAt) || left.id.localeCompare(right.id)
2533
+ )[0] ?? null;
2485
2534
  }
2486
2535
  async function discoverBundledSkills() {
2487
2536
  const skillsDir = new URL(
@@ -2577,6 +2626,9 @@ function applyCapabilityEnablement(item, installation, activePackIds) {
2577
2626
  enabledReason: enabled2 ? "enabled" : null
2578
2627
  };
2579
2628
  }
2629
+ if (item.surfaceType === "first_party_social") {
2630
+ return { ...item, connectionRef: null };
2631
+ }
2580
2632
  if (item.source === "built_in" || item.source === "configured") {
2581
2633
  return {
2582
2634
  ...item,