@opengeni/core 0.20.3 → 0.20.10
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/dependencies.d.ts +4 -0
- package/dist/index.js +55 -3
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/dependencies.ts +4 -0
- package/src/domain/capabilities.ts +76 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/core",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.10",
|
|
4
4
|
"description": "OpenGeni framework-agnostic core: the domain, access, and billing layers (neutral access, off-HTTP V2 surface). Behavior-preserving extraction from apps/api — keeps Hono's HTTPException for error throwing (typed-errors cleanup deferred).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
37
37
|
"@opengeni/codex": "^0.2.10",
|
|
38
|
-
"@opengeni/config": "^0.10.
|
|
39
|
-
"@opengeni/contracts": "^0.
|
|
40
|
-
"@opengeni/db": "^0.27.
|
|
41
|
-
"@opengeni/documents": "^0.
|
|
42
|
-
"@opengeni/events": "^0.3.
|
|
43
|
-
"@opengeni/observability": "^0.4.
|
|
44
|
-
"@opengeni/runtime": "^0.18.
|
|
45
|
-
"@opengeni/storage": "^0.2.
|
|
38
|
+
"@opengeni/config": "^0.10.11",
|
|
39
|
+
"@opengeni/contracts": "^0.38.1",
|
|
40
|
+
"@opengeni/db": "^0.27.7",
|
|
41
|
+
"@opengeni/documents": "^0.5.3",
|
|
42
|
+
"@opengeni/events": "^0.3.73",
|
|
43
|
+
"@opengeni/observability": "^0.4.14",
|
|
44
|
+
"@opengeni/runtime": "^0.18.10",
|
|
45
|
+
"@opengeni/storage": "^0.2.64",
|
|
46
46
|
"hono": "^4.12.18"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
package/src/dependencies.ts
CHANGED
|
@@ -117,6 +117,10 @@ export type AppDependencies = {
|
|
|
117
117
|
slackFetch?: typeof fetch;
|
|
118
118
|
/** Injectable Google OAuth/Drive transport for deterministic connector tests. */
|
|
119
119
|
googleDriveFetch?: typeof fetch;
|
|
120
|
+
/** Injectable MCP OAuth setup deadline for deterministic stalled-provider tests. */
|
|
121
|
+
oauthStartDeadlineMs?: number;
|
|
122
|
+
/** Injectable MCP OAuth callback deadline for deterministic stalled-provider tests. */
|
|
123
|
+
oauthCallbackDeadlineMs?: number;
|
|
120
124
|
/** Optional host-owned voice-input transcription service. */
|
|
121
125
|
transcription?: TranscriptionService | null;
|
|
122
126
|
// The API process's OWN agent-loop-free sandbox client (constructed from
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type CreateCapabilityCatalogItemRequest,
|
|
12
12
|
type EnableCapabilityRequest,
|
|
13
13
|
type McpServerConnectionRef,
|
|
14
|
+
type SocialConnection,
|
|
14
15
|
} from "@opengeni/contracts";
|
|
15
16
|
import {
|
|
16
17
|
CODEX_APPS_MCP_SERVER_ID,
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
listConnectionsMetadata,
|
|
37
38
|
listEnabledMcpCapabilityServers,
|
|
38
39
|
listPackInstallations,
|
|
40
|
+
listSocialConnections,
|
|
39
41
|
mcpServerIdForCapability,
|
|
40
42
|
updatePackInstallationStatus,
|
|
41
43
|
upsertCapabilityCatalogItem,
|
|
@@ -76,6 +78,7 @@ export async function buildCapabilityCatalog(input: {
|
|
|
76
78
|
capabilityInstallations,
|
|
77
79
|
packInstallations,
|
|
78
80
|
workspacePacks,
|
|
81
|
+
socialConnections,
|
|
79
82
|
bundledSkills,
|
|
80
83
|
curatedLibrarySkills,
|
|
81
84
|
] = await Promise.all([
|
|
@@ -83,6 +86,7 @@ export async function buildCapabilityCatalog(input: {
|
|
|
83
86
|
listCapabilityInstallations(input.db, input.workspaceId),
|
|
84
87
|
listPackInstallations(input.db, input.workspaceId),
|
|
85
88
|
listWorkspaceCapabilityPacks(input.db, input.workspaceId),
|
|
89
|
+
listSocialConnections(input.db, input.workspaceId, 500),
|
|
86
90
|
discoverBundledSkills(),
|
|
87
91
|
discoverCuratedSkillLibraryItems(),
|
|
88
92
|
]);
|
|
@@ -100,7 +104,7 @@ export async function buildCapabilityCatalog(input: {
|
|
|
100
104
|
packCatalogItem(pack, builtInPackIds.has(pack.id) ? "built_in" : "manual"),
|
|
101
105
|
),
|
|
102
106
|
...configuredMcpCatalogItems(input.settings),
|
|
103
|
-
...platformApiCatalogItems(),
|
|
107
|
+
...platformApiCatalogItems(socialConnections),
|
|
104
108
|
...bundledSkills,
|
|
105
109
|
...curatedLibrarySkills,
|
|
106
110
|
];
|
|
@@ -968,8 +972,52 @@ function configuredMcpCatalogItems(settings: Settings): CapabilityCatalogItem[]
|
|
|
968
972
|
);
|
|
969
973
|
}
|
|
970
974
|
|
|
971
|
-
function platformApiCatalogItems(): CapabilityCatalogItem[] {
|
|
972
|
-
|
|
975
|
+
function platformApiCatalogItems(socialConnections: SocialConnection[]): CapabilityCatalogItem[] {
|
|
976
|
+
const xConnection = preferredSocialConnection(socialConnections, "x");
|
|
977
|
+
const xEnabled = xConnection?.status === "connected" || xConnection?.status === "needs_reauth";
|
|
978
|
+
const x = CapabilityCatalogItem.parse({
|
|
979
|
+
id: "api:x",
|
|
980
|
+
kind: "api",
|
|
981
|
+
source: "built_in",
|
|
982
|
+
name: "X",
|
|
983
|
+
description:
|
|
984
|
+
"Connect an X account for live search, mentions, thread context, post sync, and permission-controlled replies.",
|
|
985
|
+
category: "social-media",
|
|
986
|
+
tags: ["api", "x", "twitter", "social", "marketing"],
|
|
987
|
+
homepageUrl: "https://x.com",
|
|
988
|
+
authModel: "oauth2_authorization_code_pkce",
|
|
989
|
+
providerDomain: "x.com",
|
|
990
|
+
surfaceType: "first_party_social",
|
|
991
|
+
authKind: "oauth2",
|
|
992
|
+
tools: [{ kind: "mcp", id: "opengeni" }],
|
|
993
|
+
runtime: {
|
|
994
|
+
available: true,
|
|
995
|
+
mcpServerId: "opengeni",
|
|
996
|
+
notes: "Account access is provided through OpenGeni's first-party social tools.",
|
|
997
|
+
},
|
|
998
|
+
enabled: xEnabled,
|
|
999
|
+
enabledReason: xEnabled
|
|
1000
|
+
? xConnection.status === "connected"
|
|
1001
|
+
? "workspace social account connected"
|
|
1002
|
+
: "workspace social account needs reconnection"
|
|
1003
|
+
: null,
|
|
1004
|
+
metadata: {
|
|
1005
|
+
connectorMode: "first_party_social",
|
|
1006
|
+
provider: "x",
|
|
1007
|
+
ownership: "workspace",
|
|
1008
|
+
firstPartyMcpTools: [
|
|
1009
|
+
"social_connections_list",
|
|
1010
|
+
"social_posts_recent",
|
|
1011
|
+
"social_daily_analysis_context",
|
|
1012
|
+
"social_search_live",
|
|
1013
|
+
"social_mentions_live",
|
|
1014
|
+
"social_thread_fetch",
|
|
1015
|
+
"social_posts_sync",
|
|
1016
|
+
"social_post_reply",
|
|
1017
|
+
],
|
|
1018
|
+
},
|
|
1019
|
+
});
|
|
1020
|
+
const platformApis = [
|
|
973
1021
|
{
|
|
974
1022
|
id: "api:github-app",
|
|
975
1023
|
name: "GitHub App",
|
|
@@ -1020,6 +1068,25 @@ function platformApiCatalogItems(): CapabilityCatalogItem[] {
|
|
|
1020
1068
|
},
|
|
1021
1069
|
}),
|
|
1022
1070
|
);
|
|
1071
|
+
return [x, ...platformApis];
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
function preferredSocialConnection(
|
|
1075
|
+
connections: SocialConnection[],
|
|
1076
|
+
provider: "x" | "reddit",
|
|
1077
|
+
): SocialConnection | null {
|
|
1078
|
+
const statusRank = (status: SocialConnection["status"]): number =>
|
|
1079
|
+
status === "connected" ? 0 : status === "needs_reauth" ? 1 : 2;
|
|
1080
|
+
return (
|
|
1081
|
+
connections
|
|
1082
|
+
.filter((connection) => connection.provider === provider)
|
|
1083
|
+
.sort(
|
|
1084
|
+
(left, right) =>
|
|
1085
|
+
statusRank(left.status) - statusRank(right.status) ||
|
|
1086
|
+
right.updatedAt.localeCompare(left.updatedAt) ||
|
|
1087
|
+
left.id.localeCompare(right.id),
|
|
1088
|
+
)[0] ?? null
|
|
1089
|
+
);
|
|
1023
1090
|
}
|
|
1024
1091
|
|
|
1025
1092
|
async function discoverBundledSkills(): Promise<CapabilityCatalogItem[]> {
|
|
@@ -1150,6 +1217,12 @@ export function applyCapabilityEnablement(
|
|
|
1150
1217
|
enabledReason: enabled ? "enabled" : null,
|
|
1151
1218
|
};
|
|
1152
1219
|
}
|
|
1220
|
+
if (item.surfaceType === "first_party_social") {
|
|
1221
|
+
// Social connector state is derived from the authoritative workspace
|
|
1222
|
+
// connection row while the catalog is built. Being built in means the
|
|
1223
|
+
// connector is browseable, not that an account is already connected.
|
|
1224
|
+
return { ...item, connectionRef: null };
|
|
1225
|
+
}
|
|
1153
1226
|
if (item.source === "built_in" || item.source === "configured") {
|
|
1154
1227
|
return {
|
|
1155
1228
|
...item,
|