@opengeni/core 0.4.4 → 0.4.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.d.ts +3 -2
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/domain/capabilities.ts +30 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Settings } from '@opengeni/config';
|
|
2
|
-
import { ScheduledTask, Document, Permission, AccessContext, AccessGrant, LimitAction, LimitDecision,
|
|
2
|
+
import { ScheduledTask, Document, Permission, AccessContext, AccessGrant, LimitAction, LimitDecision, CapabilityCatalogItem, CapabilityInstallation, CapabilityCatalogResponse, CreateCapabilityCatalogItemRequest, EnableCapabilityRequest, WorkspaceEnvironment, CapabilityPack, SocialConnection, ScheduledTaskAgentConfig, ToolRef, ResourceRef, CreateScheduledTaskRequest, UpdateScheduledTaskRequest, ReasoningEffort, SessionMcpCredentialUpdateInput, SessionEvent, SessionTurn, GoalSpec, SessionMcpServerMetadata, Session, WorkspaceMember } from '@opengeni/contracts';
|
|
3
3
|
export { mergeToolRefs, stableJson } from '@opengeni/contracts';
|
|
4
4
|
import { Database, SandboxRecord, EnabledMcpCapabilityServer, UpdateScheduledTaskInput, CreateSessionMcpServerInput, UpdateSessionMcpServerCredentialsInput } from '@opengeni/db';
|
|
5
5
|
import { DocumentServices } from '@opengeni/documents';
|
|
@@ -404,6 +404,7 @@ declare function discoverMcpRegistryCapabilities(input: {
|
|
|
404
404
|
}): Promise<CapabilityCatalogItem[]>;
|
|
405
405
|
|
|
406
406
|
type McpRegistryFetch = (input: URL, init?: RequestInit) => Promise<Response>;
|
|
407
|
+
declare function applyCapabilityEnablement(item: CapabilityCatalogItem, installation: CapabilityInstallation | undefined, activePackIds: Set<string>): CapabilityCatalogItem;
|
|
407
408
|
|
|
408
409
|
declare const MAX_ENVIRONMENTS_PER_WORKSPACE = 25;
|
|
409
410
|
declare const MAX_VARIABLES_PER_ENVIRONMENT = 100;
|
|
@@ -748,4 +749,4 @@ declare function assertWorkspaceDeletable(input: {
|
|
|
748
749
|
activeSessionCount: number;
|
|
749
750
|
}): void;
|
|
750
751
|
|
|
751
|
-
export { type AccessDeps, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type LimitCheckInput, MARKETING_SOCIAL_PACK_ID, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResumeBoxByIdInput, type ResumedSandboxSession, type RunOnOp, type RunOnResult, type SessionWorkflowClient, acceptSessionUserMessage, assertAllowedEnvironmentVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, createAndStartSession, createCatalogItem, createSessionForRequest, createValidatedScheduledTask, disableCapability, discoverMcpRegistryCapabilities, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, provisionSandbox, reasoningEffortForSession, recordEnvironmentAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireEnvironmentForApi, requireLimit, requirePermission, requireQueuedTurnForApi, requireScheduledTaskForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, routingEnabled, runOnSandbox, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateSessionTitle, validateEnvironmentAttachment, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };
|
|
752
|
+
export { type AccessDeps, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type LimitCheckInput, MARKETING_SOCIAL_PACK_ID, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResumeBoxByIdInput, type ResumedSandboxSession, type RunOnOp, type RunOnResult, type SessionWorkflowClient, acceptSessionUserMessage, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, createAndStartSession, createCatalogItem, createSessionForRequest, createValidatedScheduledTask, disableCapability, discoverMcpRegistryCapabilities, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, provisionSandbox, reasoningEffortForSession, recordEnvironmentAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireEnvironmentForApi, requireLimit, requirePermission, requireQueuedTurnForApi, requireScheduledTaskForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, routingEnabled, runOnSandbox, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateSessionTitle, validateEnvironmentAttachment, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };
|
package/dist/index.js
CHANGED
|
@@ -1238,7 +1238,7 @@ async function validateMcpCapabilityConnection(item, probe = probeStreamableHttp
|
|
|
1238
1238
|
};
|
|
1239
1239
|
} catch (error) {
|
|
1240
1240
|
throw new HTTPException6(422, {
|
|
1241
|
-
message: `MCP capability "${item.name}" could not be enabled because
|
|
1241
|
+
message: `MCP capability "${item.name}" could not be enabled because ${mcpProbeErrorMessage(error, item.endpointUrl)}`
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
@@ -1261,9 +1261,13 @@ async function probeStreamableHttpMcpServer(input) {
|
|
|
1261
1261
|
await client.close().catch(() => void 0);
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
function mcpProbeErrorMessage(error) {
|
|
1264
|
+
function mcpProbeErrorMessage(error, endpointUrl) {
|
|
1265
1265
|
const message = error instanceof Error ? error.message : String(error);
|
|
1266
|
-
|
|
1266
|
+
const normalized = message.replace(/\s+/g, " ").trim();
|
|
1267
|
+
if (/404|405|not found|unexpected token|not valid json|invalid json|failed to parse|streamable http error|unable to connect|fetch failed|econnrefused|enotfound|timeout|aborted/i.test(normalized)) {
|
|
1268
|
+
return `OpenGeni could not reach a valid Streamable HTTP MCP server at ${endpointUrl}. Check the endpoint URL or choose a different catalog entry.`;
|
|
1269
|
+
}
|
|
1270
|
+
return `OpenGeni could not initialize ${endpointUrl}: ${normalized.slice(0, 500) || "unknown error"}`;
|
|
1267
1271
|
}
|
|
1268
1272
|
async function disableCapability(input) {
|
|
1269
1273
|
const item = await requireCatalogItem(input.db, input.workspaceId, input.settings, input.capabilityId);
|
|
@@ -1557,9 +1561,21 @@ function applyCapabilityEnablement(item, installation, activePackIds) {
|
|
|
1557
1561
|
return {
|
|
1558
1562
|
...item,
|
|
1559
1563
|
enabled,
|
|
1560
|
-
enabledReason: enabled ? "enabled" : null
|
|
1564
|
+
enabledReason: enabled ? "enabled" : null,
|
|
1565
|
+
connectionRef: enabled && installation ? installationConnectionRef(installation.config) : null
|
|
1561
1566
|
};
|
|
1562
1567
|
}
|
|
1568
|
+
function installationConnectionRef(config) {
|
|
1569
|
+
const ref = config.connectionRef;
|
|
1570
|
+
if (!ref || typeof ref !== "object") {
|
|
1571
|
+
return null;
|
|
1572
|
+
}
|
|
1573
|
+
const { connectionId, providerDomain, kind } = ref;
|
|
1574
|
+
if (typeof connectionId !== "string" || typeof providerDomain !== "string" || typeof kind !== "string") {
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
return { connectionId, providerDomain, kind };
|
|
1578
|
+
}
|
|
1563
1579
|
function dedupeCatalogItems(items) {
|
|
1564
1580
|
const byId = /* @__PURE__ */ new Map();
|
|
1565
1581
|
for (const item of items) {
|
|
@@ -2781,6 +2797,7 @@ export {
|
|
|
2781
2797
|
MAX_ENVIRONMENTS_PER_WORKSPACE,
|
|
2782
2798
|
MAX_VARIABLES_PER_ENVIRONMENT,
|
|
2783
2799
|
acceptSessionUserMessage,
|
|
2800
|
+
applyCapabilityEnablement,
|
|
2784
2801
|
assertAllowedEnvironmentVariableName,
|
|
2785
2802
|
assertConfiguredModel,
|
|
2786
2803
|
assertPackSandboxImageCompatible,
|