@opengeni/core 4.6.1 → 4.6.2-canary.39853438886001
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/domain/capabilities.d.ts +1 -0
- package/dist/domain/personal-connection-delegations.d.ts +3 -8
- package/dist/domain/scheduled-tasks.d.ts +2 -1
- package/dist/goal-admission.d.ts +4 -0
- package/dist/index.js +76 -100
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/domain/capabilities.ts +49 -8
- package/src/domain/connector-tool-permissions.ts +4 -1
- package/src/domain/organization-integration-catalog.ts +1 -0
- package/src/domain/personal-connection-delegations.ts +24 -95
- package/src/domain/scheduled-tasks.ts +19 -20
- package/src/domain/session-connection-accounts.ts +1 -15
- package/src/domain/sessions.ts +0 -18
|
@@ -10,6 +10,7 @@ export declare function buildCapabilityCatalog(input: {
|
|
|
10
10
|
/** The workspace's organization, when the caller knows it (skips a lookup). */
|
|
11
11
|
accountId?: string;
|
|
12
12
|
}): Promise<CapabilityCatalogResponse>;
|
|
13
|
+
export declare function applyGoogleConnectorSetupAvailability(item: CapabilityCatalogItem, settings: Settings): CapabilityCatalogItem;
|
|
13
14
|
export declare function applyOperatorOAuthClientRequirement(item: CapabilityCatalogItem, configured: (issuer: string) => boolean): CapabilityCatalogItem;
|
|
14
15
|
export declare function createCatalogItem(input: {
|
|
15
16
|
db: Database;
|
|
@@ -57,13 +57,8 @@ export declare function personalConnectionDelegationsFromParent(input: {
|
|
|
57
57
|
personalGitHubResources?: ResourceRef[];
|
|
58
58
|
targetSessionId?: string;
|
|
59
59
|
}): McpPersonalConnectionDelegation[];
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
* is eligible. Multiple writable Google accounts are intentionally ambiguous:
|
|
63
|
-
* callers must narrow the connection before a later turn can advertise or use
|
|
64
|
-
* the private publication tool.
|
|
65
|
-
*/
|
|
66
|
-
export declare function googleDrivePublicationDelegationFromVisibleConnections(input: {
|
|
60
|
+
/** Historical native Drive credentials never become new publication authority. */
|
|
61
|
+
export declare function googleDrivePublicationDelegationFromVisibleConnections(_input: {
|
|
67
62
|
subjectId: string;
|
|
68
63
|
connections: ConnectionMetadata[];
|
|
69
64
|
authoritySelection?: McpConnectionAccountSelection;
|
|
@@ -160,7 +155,7 @@ export declare function freezePersonalConnectionDelegations(input: {
|
|
|
160
155
|
resources?: ResourceRef[];
|
|
161
156
|
source: PersonalConnectionDelegationSource;
|
|
162
157
|
authoritySelections?: McpConnectionAccountSelection[];
|
|
163
|
-
/**
|
|
158
|
+
/** @deprecated Native Drive publishing is retired; this flag grants no authority. */
|
|
164
159
|
googleDrivePublicationEnabled?: boolean;
|
|
165
160
|
/** Exact first-party Atlassian tool + permission gate. */
|
|
166
161
|
atlassianEnabled?: boolean;
|
|
@@ -8,7 +8,8 @@ import { type ScheduledTaskSlackChannelVerifier } from "./slack-bot.js";
|
|
|
8
8
|
export declare function scheduledTaskToolsProvided(rawPayload: unknown): boolean;
|
|
9
9
|
/** Resolve the target's current tool policy before choosing its owner's accounts. */
|
|
10
10
|
export declare function scheduledConnectionTools(db: Database, workspaceId: string, settings: Settings, target: Session | null, taskTools: ToolRef[], subjectId?: string): Promise<ToolRef[]>;
|
|
11
|
-
|
|
11
|
+
/** Native publication surfaces are retired; MCP uses the ordinary selected-tool policy. */
|
|
12
|
+
export declare function scheduledConnectionSurfaceEligibility(_settings: Settings, _target: (Pick<Session, "firstPartyMcpTools" | "firstPartyMcpPermissions"> & Partial<Pick<Session, "toolPolicy" | "agent">>) | null, _workspaceSettings?: unknown): {
|
|
12
13
|
googleDrivePublicationEnabled: boolean;
|
|
13
14
|
atlassianEnabled: boolean;
|
|
14
15
|
};
|
package/dist/goal-admission.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export declare function resolveGoalModelAdmission(db: Database, settings: Settin
|
|
|
61
61
|
turnWorkerEmergencyMemoryUsage: number;
|
|
62
62
|
turnWorkerMemoryGuardIntervalMs: number;
|
|
63
63
|
turnWorkerMemoryGuardSustainMs: number;
|
|
64
|
+
turnWorkerShutdownGraceMs: number;
|
|
65
|
+
turnWorkerShutdownForceMs: number;
|
|
64
66
|
observabilityStructuredLogs: boolean;
|
|
65
67
|
observabilityMetricsEnabled: boolean;
|
|
66
68
|
observabilityOtlpEndpoint?: string | undefined;
|
|
@@ -122,6 +124,8 @@ export declare function resolveGoalModelAdmission(db: Database, settings: Settin
|
|
|
122
124
|
onePasswordFakeTokens: boolean;
|
|
123
125
|
protonPassCliPath?: string | undefined;
|
|
124
126
|
integrationsEnabled: boolean;
|
|
127
|
+
googleConnectorSetupEnabled: boolean;
|
|
128
|
+
googleDriveMcpEnabled: boolean;
|
|
125
129
|
integrationsStateSecret?: string | undefined;
|
|
126
130
|
integrationsAllowPrivateNetworkTargets: boolean;
|
|
127
131
|
privacyOnlyMeAllowed: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1637,7 +1637,10 @@ async function buildCapabilityCatalog(input) {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
} : projected;
|
|
1639
1639
|
return applyCapabilityLifecycle(
|
|
1640
|
-
|
|
1640
|
+
applyGoogleConnectorSetupAvailability(
|
|
1641
|
+
applyOperatorOAuthClientRequirement(runtimeProjected, operatorOAuthClientConfigured),
|
|
1642
|
+
input.settings
|
|
1643
|
+
)
|
|
1641
1644
|
);
|
|
1642
1645
|
}).sort(compareCatalogItems);
|
|
1643
1646
|
return {
|
|
@@ -1651,7 +1654,22 @@ function operatorOAuthClientResolver(settings) {
|
|
|
1651
1654
|
configured = parseIntegrationsOauthClientsJson(settings.integrationsOauthClientsJson);
|
|
1652
1655
|
} catch {
|
|
1653
1656
|
}
|
|
1654
|
-
return (issuer) => findIntegrationsOauthClient(configured, [issuer]) !== null;
|
|
1657
|
+
return (issuer) => (issuer !== "https://accounts.google.com" || settings.googleConnectorSetupEnabled) && findIntegrationsOauthClient(configured, [issuer]) !== null;
|
|
1658
|
+
}
|
|
1659
|
+
function applyGoogleConnectorSetupAvailability(item, settings) {
|
|
1660
|
+
const url = item.mcpUrl ?? item.endpointUrl;
|
|
1661
|
+
const drive = url === "https://drivemcp.googleapis.com/mcp/v1";
|
|
1662
|
+
const gmail = url === "https://gmailmcp.googleapis.com/mcp/v1";
|
|
1663
|
+
if (item.kind !== "mcp" || !drive && !gmail || settings.googleConnectorSetupEnabled && (!drive || settings.googleDriveMcpEnabled))
|
|
1664
|
+
return item;
|
|
1665
|
+
return {
|
|
1666
|
+
...item,
|
|
1667
|
+
runtime: {
|
|
1668
|
+
...item.runtime,
|
|
1669
|
+
operatorOAuthClient: { configured: false },
|
|
1670
|
+
notes: "New connections are unavailable until Google data-access verification and provider setup are complete."
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1655
1673
|
}
|
|
1656
1674
|
function applyOperatorOAuthClientRequirement(item, configured) {
|
|
1657
1675
|
if (item.kind !== "mcp") return item;
|
|
@@ -1750,9 +1768,11 @@ async function prepareCapabilityEnable(input) {
|
|
|
1750
1768
|
delete installationConfig.headerNames;
|
|
1751
1769
|
delete installationConfig.connectionRef;
|
|
1752
1770
|
if (item.kind === "mcp") {
|
|
1753
|
-
if (
|
|
1771
|
+
if (["https://gmailmcp.googleapis.com/mcp/v1", "https://drivemcp.googleapis.com/mcp/v1"].includes(
|
|
1772
|
+
item.endpointUrl?.replace(/\/+$/u, "") ?? ""
|
|
1773
|
+
) && (input.payload.connectionRef?.subjectScope !== "subject" || Object.keys(input.payload.headers ?? {}).length > 0)) {
|
|
1754
1774
|
throw new HTTPException4(422, {
|
|
1755
|
-
message: "
|
|
1775
|
+
message: "Google connector requires a personal-owned connection reference"
|
|
1756
1776
|
});
|
|
1757
1777
|
}
|
|
1758
1778
|
const unchanged = await withOrganizationIntegrationPolicyFence(
|
|
@@ -2197,6 +2217,7 @@ async function settingsWithEnabledCapabilityMcpServers(db, workspaceId, settings
|
|
|
2197
2217
|
readCodexAppsDesignation()
|
|
2198
2218
|
]);
|
|
2199
2219
|
}
|
|
2220
|
+
apiIntegrations = apiIntegrations.filter(apiIntegrationIsExecutable);
|
|
2200
2221
|
options?.onResolvedApiIntegrations?.(apiIntegrations);
|
|
2201
2222
|
options?.onResolvedCapabilityServers?.(enabled);
|
|
2202
2223
|
return settingsWithCodexAppsMcpServer(
|
|
@@ -2214,9 +2235,7 @@ async function settingsWithEnabledCapabilityMcpServersForTargets(db, workspaceId
|
|
|
2214
2235
|
serverIds: [...serverIds]
|
|
2215
2236
|
})).filter((server) => serverIds.has(server.id));
|
|
2216
2237
|
options.signal?.throwIfAborted();
|
|
2217
|
-
const apiIntegrations = await listInstalledApiIntegrations(db, workspaceId, options.subjectId, [
|
|
2218
|
-
...serverIds
|
|
2219
|
-
]);
|
|
2238
|
+
const apiIntegrations = (await listInstalledApiIntegrations(db, workspaceId, options.subjectId, [...serverIds])).filter(apiIntegrationIsExecutable);
|
|
2220
2239
|
options.signal?.throwIfAborted();
|
|
2221
2240
|
const codexAppsDesignation = settings.codexConnectedAppsEnabled && serverIds.has(CODEX_APPS_MCP_SERVER_ID) ? await resolveCodexAppsDesignationForRun(db, workspaceId, { accountId: options.accountId }) : null;
|
|
2222
2241
|
options.onResolvedApiIntegrations?.(apiIntegrations);
|
|
@@ -2269,10 +2288,15 @@ async function listInstalledApiIntegrationsForDelegations(db, workspaceId, deleg
|
|
|
2269
2288
|
byServerId.set(integration.serverId, integration);
|
|
2270
2289
|
return [...byServerId.values()];
|
|
2271
2290
|
}
|
|
2291
|
+
function apiIntegrationIsExecutable(integration) {
|
|
2292
|
+
return !(integration.definitionProvenance === "curated" && integration.definitionId === "google-drive");
|
|
2293
|
+
}
|
|
2272
2294
|
function settingsWithApiIntegrationServers(settings, integrations) {
|
|
2273
2295
|
if (integrations.length === 0) return settings;
|
|
2274
2296
|
const existingIds = new Set(settings.mcpServers.map((server) => server.id));
|
|
2275
|
-
const dynamicServers = integrations.filter(
|
|
2297
|
+
const dynamicServers = integrations.filter(
|
|
2298
|
+
(integration) => apiIntegrationIsExecutable(integration) && !existingIds.has(integration.serverId)
|
|
2299
|
+
).map((integration) => ({
|
|
2276
2300
|
id: integration.serverId,
|
|
2277
2301
|
name: integration.name,
|
|
2278
2302
|
// Local adapters never send MCP traffic to this URL. Keeping the exact
|
|
@@ -3445,9 +3469,7 @@ function storedConnectionRef(config) {
|
|
|
3445
3469
|
// src/domain/personal-connection-delegations.ts
|
|
3446
3470
|
import {
|
|
3447
3471
|
GOOGLE_DRIVE_PROVIDER_DOMAIN,
|
|
3448
|
-
GOOGLE_DRIVE_PUBLICATION_SERVER_ID
|
|
3449
|
-
GoogleDriveConnectionMetadata,
|
|
3450
|
-
googleDriveScopesAllowCapability
|
|
3472
|
+
GOOGLE_DRIVE_PUBLICATION_SERVER_ID
|
|
3451
3473
|
} from "@opengeni/contracts/google-drive";
|
|
3452
3474
|
import {
|
|
3453
3475
|
isPersonalGitHubConnection,
|
|
@@ -4039,14 +4061,14 @@ function personalConnectionDelegationsFromParent(input) {
|
|
|
4039
4061
|
const ref = server.connectionRef;
|
|
4040
4062
|
if (!isNativeSubjectConnectionRef(ref)) return [];
|
|
4041
4063
|
const delegation = input.parentDelegations.find(
|
|
4042
|
-
(candidate) => candidate.connectionType !== "atlassian" && candidate.serverId === server.id && sameProviderDomain(candidate.providerDomain, ref.providerDomain) && (!ref.kind || !candidate.kind || candidate.kind === ref.kind)
|
|
4064
|
+
(candidate) => candidate.connectionType !== "atlassian" && candidate.serverId !== GOOGLE_DRIVE_PUBLICATION_SERVER_ID && candidate.serverId === server.id && sameProviderDomain(candidate.providerDomain, ref.providerDomain) && (!ref.kind || !candidate.kind || candidate.kind === ref.kind)
|
|
4043
4065
|
);
|
|
4044
4066
|
return delegation ? [{ ...delegation }] : [];
|
|
4045
4067
|
});
|
|
4046
4068
|
const projected = [
|
|
4047
4069
|
...mcp,
|
|
4048
4070
|
...input.parentDelegations.filter(
|
|
4049
|
-
(item) => item.connectionType === "social" || item.connectionType === "github_personal"
|
|
4071
|
+
(item) => item.connectionType === "social" || item.connectionType === "github_personal"
|
|
4050
4072
|
).map((item) => ({ ...item }))
|
|
4051
4073
|
];
|
|
4052
4074
|
const requestedGitHub = personalGitHubRepositoryResources(input.personalGitHubResources ?? []);
|
|
@@ -4076,52 +4098,8 @@ function personalConnectionDelegationsFromParent(input) {
|
|
|
4076
4098
|
}
|
|
4077
4099
|
return inherited;
|
|
4078
4100
|
}
|
|
4079
|
-
function googleDrivePublicationDelegationFromVisibleConnections(
|
|
4080
|
-
|
|
4081
|
-
const eligible = input.connections.filter((connection2) => {
|
|
4082
|
-
if (connection2.subjectId !== input.subjectId || connection2.status !== "active" || !connection2.authorityId || connection2.kind !== "oauth2" || !sameProviderDomain(connection2.providerDomain, GOOGLE_DRIVE_PROVIDER_DOMAIN) || !googleDriveScopesAllowCapability(connection2.grantedScopes, "publish_file")) {
|
|
4083
|
-
return false;
|
|
4084
|
-
}
|
|
4085
|
-
const metadata = GoogleDriveConnectionMetadata.safeParse(connection2.metadata);
|
|
4086
|
-
return Boolean(
|
|
4087
|
-
metadata.success && metadata.data.outputDestination && metadata.data.lifecycle?.state !== "paused" && (!metadata.data.lifecycle || metadata.data.lifecycle.state === "active")
|
|
4088
|
-
);
|
|
4089
|
-
});
|
|
4090
|
-
const selectedEligible = selection ? eligible.filter((connection2) => connection2.id === selection.connectionId) : eligible;
|
|
4091
|
-
if (selection && selectedEligible.length !== 1) {
|
|
4092
|
-
throw new ConnectionAccountSelectionError(
|
|
4093
|
-
"Google Drive publication authority selection is unavailable",
|
|
4094
|
-
{
|
|
4095
|
-
version: 1,
|
|
4096
|
-
reason: "selected_account_unavailable",
|
|
4097
|
-
accounts: [
|
|
4098
|
-
{
|
|
4099
|
-
serverId: GOOGLE_DRIVE_PUBLICATION_SERVER_ID,
|
|
4100
|
-
connectionId: selection.connectionId,
|
|
4101
|
-
reason: "selection_unavailable"
|
|
4102
|
-
}
|
|
4103
|
-
]
|
|
4104
|
-
}
|
|
4105
|
-
);
|
|
4106
|
-
}
|
|
4107
|
-
if (!selection && selectedEligible.length !== 1) return null;
|
|
4108
|
-
const connection = selectedEligible[0];
|
|
4109
|
-
if (selection && selection.serverId !== GOOGLE_DRIVE_PUBLICATION_SERVER_ID) {
|
|
4110
|
-
throw new Error("Google Drive publication account selection is invalid");
|
|
4111
|
-
}
|
|
4112
|
-
const frozenMetadata = GoogleDriveConnectionMetadata.parse(connection.metadata);
|
|
4113
|
-
if (!frozenMetadata.outputDestination) {
|
|
4114
|
-
throw new Error("Google Drive publication destination disappeared during acceptance");
|
|
4115
|
-
}
|
|
4116
|
-
return {
|
|
4117
|
-
serverId: GOOGLE_DRIVE_PUBLICATION_SERVER_ID,
|
|
4118
|
-
connectionId: connection.id,
|
|
4119
|
-
originWorkspaceId: connection.workspaceId,
|
|
4120
|
-
ownerSubjectId: input.subjectId,
|
|
4121
|
-
providerDomain: connection.providerDomain,
|
|
4122
|
-
kind: connection.kind,
|
|
4123
|
-
outputDestination: frozenMetadata.outputDestination
|
|
4124
|
-
};
|
|
4101
|
+
function googleDrivePublicationDelegationFromVisibleConnections(_input) {
|
|
4102
|
+
return null;
|
|
4125
4103
|
}
|
|
4126
4104
|
function personalAtlassianDelegationsFromVisibleConnections(_input) {
|
|
4127
4105
|
return [];
|
|
@@ -4392,6 +4370,22 @@ async function availableMcpAccountBindings(input) {
|
|
|
4392
4370
|
});
|
|
4393
4371
|
}
|
|
4394
4372
|
async function freezePersonalConnectionDelegations(input) {
|
|
4373
|
+
const retiredSelections = (input.authoritySelections ?? []).filter(
|
|
4374
|
+
(selection) => selection.serverId === GOOGLE_DRIVE_PUBLICATION_SERVER_ID
|
|
4375
|
+
);
|
|
4376
|
+
if (retiredSelections.length > 0) {
|
|
4377
|
+
throw new ConnectionAccountSelectionError(
|
|
4378
|
+
"Native Google Drive publishing has been retired; select the Google Drive MCP connection",
|
|
4379
|
+
{
|
|
4380
|
+
version: 1,
|
|
4381
|
+
reason: "selected_account_unavailable",
|
|
4382
|
+
accounts: retiredSelections.map((selection) => ({
|
|
4383
|
+
...selection,
|
|
4384
|
+
reason: "connector_unavailable"
|
|
4385
|
+
}))
|
|
4386
|
+
}
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4395
4389
|
const servers = selectedPersonalConnectionServers(input.settings, input.tools);
|
|
4396
4390
|
const includeFirstPartyConnections = input.tools.some((tool) => tool.id === "opengeni");
|
|
4397
4391
|
const personalGitHubResources = personalGitHubRepositoryResources(input.resources ?? []);
|
|
@@ -4426,7 +4420,7 @@ async function freezePersonalConnectionDelegations(input) {
|
|
|
4426
4420
|
});
|
|
4427
4421
|
return inherited.filter((item) => {
|
|
4428
4422
|
if (item.serverId === GOOGLE_DRIVE_PUBLICATION_SERVER_ID) {
|
|
4429
|
-
return
|
|
4423
|
+
return false;
|
|
4430
4424
|
}
|
|
4431
4425
|
if (item.connectionType === "atlassian") {
|
|
4432
4426
|
return false;
|
|
@@ -4462,9 +4456,6 @@ async function freezePersonalConnectionDelegations(input) {
|
|
|
4462
4456
|
});
|
|
4463
4457
|
const selectedMcpServerIds = new Set(servers.map((server) => server.id));
|
|
4464
4458
|
const supportedSelectionIds = new Set(selectedMcpServerIds);
|
|
4465
|
-
if (input.googleDrivePublicationEnabled) {
|
|
4466
|
-
supportedSelectionIds.add(GOOGLE_DRIVE_PUBLICATION_SERVER_ID);
|
|
4467
|
-
}
|
|
4468
4459
|
if (personalGitHubResources.length > 0) {
|
|
4469
4460
|
supportedSelectionIds.add(PERSONAL_GITHUB_CONNECTION_SURFACE_ID);
|
|
4470
4461
|
}
|
|
@@ -4519,18 +4510,9 @@ async function freezePersonalConnectionDelegations(input) {
|
|
|
4519
4510
|
subjectId: ownerSubjectId,
|
|
4520
4511
|
connections: visibleConnections
|
|
4521
4512
|
}) : [];
|
|
4522
|
-
const googleDriveAuthoritySelection = input.googleDrivePublicationEnabled ? (input.authoritySelections ?? []).find(
|
|
4523
|
-
(selection) => selection.serverId === GOOGLE_DRIVE_PUBLICATION_SERVER_ID
|
|
4524
|
-
) : void 0;
|
|
4525
|
-
const googleDrivePublication = input.googleDrivePublicationEnabled ? googleDrivePublicationDelegationFromVisibleConnections({
|
|
4526
|
-
subjectId: ownerSubjectId,
|
|
4527
|
-
connections: visibleConnections,
|
|
4528
|
-
...googleDriveAuthoritySelection ? { authoritySelection: googleDriveAuthoritySelection } : {}
|
|
4529
|
-
}) : null;
|
|
4530
4513
|
return [
|
|
4531
4514
|
...mcp,
|
|
4532
4515
|
...personalGitHub ? [personalGitHub] : [],
|
|
4533
|
-
...googleDrivePublication ? [googleDrivePublication] : [],
|
|
4534
4516
|
...[...latest.values()].map((connection) => ({
|
|
4535
4517
|
serverId: `social:${connection.provider}`,
|
|
4536
4518
|
connectionId: connection.id,
|
|
@@ -14607,7 +14589,6 @@ async function createSessionForRequestInFileScope(unresolvedDeps, grant, workspa
|
|
|
14607
14589
|
firstPartyMcpTools,
|
|
14608
14590
|
settings.mcpServers
|
|
14609
14591
|
);
|
|
14610
|
-
const googleDrivePublicationEnabled = firstPartyMcpTools.includes("editable_artifact_export") && firstPartyMcpTools.includes("editable_artifact_export_status") && (!firstPartyMcpPermissions?.length || firstPartyMcpPermissions.includes("artifacts:read") && firstPartyMcpPermissions.includes("artifacts:publish"));
|
|
14611
14592
|
const atlassianEnabled = firstPartyMcpTools.some((tool) => tool.startsWith("atlassian_")) && (!firstPartyMcpPermissions?.length || firstPartyMcpPermissions.includes("connections:read"));
|
|
14612
14593
|
const connectionAccountTools = sessionToolsForConnectionAccounts({
|
|
14613
14594
|
session: { tools, toolPolicy },
|
|
@@ -14629,7 +14610,6 @@ async function createSessionForRequestInFileScope(unresolvedDeps, grant, workspa
|
|
|
14629
14610
|
resources,
|
|
14630
14611
|
source: connectionDelegationSource,
|
|
14631
14612
|
authoritySelections: payload.connectionAccounts,
|
|
14632
|
-
googleDrivePublicationEnabled,
|
|
14633
14613
|
atlassianEnabled
|
|
14634
14614
|
})
|
|
14635
14615
|
);
|
|
@@ -15310,11 +15290,6 @@ async function acceptSessionUserMessageInFileScope(deps, grant, workspaceId, ses
|
|
|
15310
15290
|
connectionWorkspace.settings
|
|
15311
15291
|
)
|
|
15312
15292
|
});
|
|
15313
|
-
const existingEffectiveFirstPartyTools = resolveSessionFirstPartyMcpTools3(
|
|
15314
|
-
settings,
|
|
15315
|
-
existingSession,
|
|
15316
|
-
connectionWorkspace.settings
|
|
15317
|
-
);
|
|
15318
15293
|
const { personalConnectionDelegations, mcpAccountBindings, connectionAccountIntent } = await freezeConnectionAccounts({
|
|
15319
15294
|
db,
|
|
15320
15295
|
accountId: grant.accountId,
|
|
@@ -15324,7 +15299,6 @@ async function acceptSessionUserMessageInFileScope(deps, grant, workspaceId, ses
|
|
|
15324
15299
|
resources: [...existingSession.resources, ...requestedResources],
|
|
15325
15300
|
source: connectionDelegationSource,
|
|
15326
15301
|
targetSessionId: sessionId,
|
|
15327
|
-
googleDrivePublicationEnabled: existingEffectiveFirstPartyTools.includes("editable_artifact_export") && existingEffectiveFirstPartyTools.includes("editable_artifact_export_status") && (!existingSession.firstPartyMcpPermissions?.length || existingSession.firstPartyMcpPermissions.includes("artifacts:read") && existingSession.firstPartyMcpPermissions.includes("artifacts:publish")),
|
|
15328
15302
|
atlassianEnabled: existingSession.firstPartyMcpTools.some((tool) => tool.startsWith("atlassian_")) && (!existingSession.firstPartyMcpPermissions?.length || existingSession.firstPartyMcpPermissions.includes("connections:read")),
|
|
15329
15303
|
...input.connectionAccounts ? { authoritySelections: input.connectionAccounts } : {}
|
|
15330
15304
|
});
|
|
@@ -16334,7 +16308,6 @@ async function freezeSessionRealtimeConnectionAccounts(input) {
|
|
|
16334
16308
|
resources: session.resources,
|
|
16335
16309
|
source: personalConnectionDelegationSourceForGrant(grant),
|
|
16336
16310
|
targetSessionId: sessionId,
|
|
16337
|
-
googleDrivePublicationEnabled: effectiveFirstPartyTools.includes("editable_artifact_export") && effectiveFirstPartyTools.includes("editable_artifact_export_status") && (!session.firstPartyMcpPermissions?.length || session.firstPartyMcpPermissions.includes("artifacts:read") && session.firstPartyMcpPermissions.includes("artifacts:publish")),
|
|
16338
16311
|
atlassianEnabled: effectiveFirstPartyTools.some((tool) => tool.startsWith("atlassian_")) && (!session.firstPartyMcpPermissions?.length || session.firstPartyMcpPermissions.includes("connections:read"))
|
|
16339
16312
|
});
|
|
16340
16313
|
}
|
|
@@ -16366,14 +16339,13 @@ async function resolveContinuedConnectionAccounts(input) {
|
|
|
16366
16339
|
session,
|
|
16367
16340
|
workspace.settings
|
|
16368
16341
|
);
|
|
16369
|
-
let googleDrivePublicationEnabled = effectiveFirstPartyTools.includes("editable_artifact_export") && effectiveFirstPartyTools.includes("editable_artifact_export_status") && (!session.firstPartyMcpPermissions?.length || session.firstPartyMcpPermissions.includes("artifacts:read") && session.firstPartyMcpPermissions.includes("artifacts:publish"));
|
|
16370
16342
|
const atlassianEnabled = effectiveFirstPartyTools.some((tool) => tool.startsWith("atlassian_")) && (!session.firstPartyMcpPermissions?.length || session.firstPartyMcpPermissions.includes("connections:read"));
|
|
16371
16343
|
const withoutPersonalRepositories = (from) => {
|
|
16372
16344
|
const personal = new Set(personalGitHubRepositoryResources(from));
|
|
16373
16345
|
return from.filter((resource) => !personal.has(resource));
|
|
16374
16346
|
};
|
|
16375
16347
|
let resources = principalSubjectId ? session.resources : withoutPersonalRepositories(session.resources);
|
|
16376
|
-
const applies = (selection) => selection.serverId === GOOGLE_DRIVE_PUBLICATION_SERVER_ID2 ?
|
|
16348
|
+
const applies = (selection) => selection.serverId === GOOGLE_DRIVE_PUBLICATION_SERVER_ID2 ? false : selection.serverId === PERSONAL_GITHUB_CONNECTION_SURFACE_ID2 ? personalGitHubRepositoryResources(resources).length > 0 : tools.some((tool) => tool.kind === "mcp" && tool.id === selection.serverId);
|
|
16377
16349
|
let selections = intent.selections.filter(applies);
|
|
16378
16350
|
const gaps = [];
|
|
16379
16351
|
for (let round = 0; ; round += 1) {
|
|
@@ -16387,7 +16359,6 @@ async function resolveContinuedConnectionAccounts(input) {
|
|
|
16387
16359
|
resources,
|
|
16388
16360
|
source: principalSubjectId ? { kind: "subject", subjectId: principalSubjectId, accountId } : { kind: "none" },
|
|
16389
16361
|
targetSessionId: sessionId,
|
|
16390
|
-
googleDrivePublicationEnabled,
|
|
16391
16362
|
atlassianEnabled,
|
|
16392
16363
|
authoritySelections: selections
|
|
16393
16364
|
});
|
|
@@ -16415,7 +16386,6 @@ async function resolveContinuedConnectionAccounts(input) {
|
|
|
16415
16386
|
);
|
|
16416
16387
|
selections = selections.filter((selection) => !dropped.has(selection.serverId));
|
|
16417
16388
|
tools = tools.filter((tool) => !(tool.kind === "mcp" && dropped.has(tool.id)));
|
|
16418
|
-
if (dropped.has(GOOGLE_DRIVE_PUBLICATION_SERVER_ID2)) googleDrivePublicationEnabled = false;
|
|
16419
16389
|
if (dropped.has(PERSONAL_GITHUB_CONNECTION_SURFACE_ID2)) {
|
|
16420
16390
|
resources = withoutPersonalRepositories(resources);
|
|
16421
16391
|
}
|
|
@@ -16456,6 +16426,7 @@ function integrationSourceForOrganizationPolicy(policy, source) {
|
|
|
16456
16426
|
}
|
|
16457
16427
|
var dedicated = [
|
|
16458
16428
|
{ key: "gmail", label: "Gmail" },
|
|
16429
|
+
{ key: "google-drive", label: "Google Drive" },
|
|
16459
16430
|
{ key: "atlassian", label: "Atlassian (Jira and Confluence)" },
|
|
16460
16431
|
{ key: "slack-personal", label: "Slack personal accounts" },
|
|
16461
16432
|
{ key: "slack-bot", label: "Slack workspace bots" },
|
|
@@ -23123,6 +23094,11 @@ function personalGitHubActionPolicyActor(input) {
|
|
|
23123
23094
|
}
|
|
23124
23095
|
|
|
23125
23096
|
// src/domain/scheduled-tasks.ts
|
|
23097
|
+
import {
|
|
23098
|
+
GOOGLE_DRIVE_NATIVE_RETIRED_MESSAGE,
|
|
23099
|
+
isRetiredNativeGoogleDriveSource,
|
|
23100
|
+
isRetiredNativeGoogleDriveTask
|
|
23101
|
+
} from "@opengeni/contracts/google-drive-native-retirement";
|
|
23126
23102
|
import {
|
|
23127
23103
|
getSessionTurnClaudeProviderAccountAuthoritySnapshot as getSessionTurnClaudeProviderAccountAuthoritySnapshot2,
|
|
23128
23104
|
getScheduledTaskClaudeProviderAccountAuthoritySnapshot as getScheduledTaskClaudeProviderAccountAuthoritySnapshot2
|
|
@@ -23137,7 +23113,6 @@ import {
|
|
|
23137
23113
|
SCHEDULED_TASK_OCCURRENCE_PAYLOAD_INGRESS_HEADROOM_BYTES
|
|
23138
23114
|
} from "@opengeni/contracts";
|
|
23139
23115
|
import {
|
|
23140
|
-
allowedFirstPartyMcpToolsForSession as allowedFirstPartyMcpToolsForSession2,
|
|
23141
23116
|
resolveSessionFirstPartyMcpTools as resolveSessionFirstPartyMcpTools5,
|
|
23142
23117
|
resolveFirstPartyMcpToolPolicy as resolveFirstPartyMcpToolPolicy2
|
|
23143
23118
|
} from "@opengeni/config";
|
|
@@ -23407,17 +23382,8 @@ async function scheduledConnectionTools(db, workspaceId, settings, target, taskT
|
|
|
23407
23382
|
)
|
|
23408
23383
|
}).toolRefs;
|
|
23409
23384
|
}
|
|
23410
|
-
function scheduledConnectionSurfaceEligibility(
|
|
23411
|
-
|
|
23412
|
-
settings,
|
|
23413
|
-
{ ...target, toolPolicy: target.toolPolicy },
|
|
23414
|
-
workspaceSettings
|
|
23415
|
-
) : allowedFirstPartyMcpToolsForSession2(settings, target?.firstPartyMcpTools);
|
|
23416
|
-
const permissions = target?.firstPartyMcpPermissions ?? DEFAULT_FIRST_PARTY_MCP_PERMISSIONS3;
|
|
23417
|
-
return {
|
|
23418
|
-
googleDrivePublicationEnabled: tools.includes("editable_artifact_export") && tools.includes("editable_artifact_export_status") && permissions.includes("artifacts:read") && permissions.includes("artifacts:publish"),
|
|
23419
|
-
atlassianEnabled: false
|
|
23420
|
-
};
|
|
23385
|
+
function scheduledConnectionSurfaceEligibility(_settings, _target, _workspaceSettings = {}) {
|
|
23386
|
+
return { googleDrivePublicationEnabled: false, atlassianEnabled: false };
|
|
23421
23387
|
}
|
|
23422
23388
|
function isScheduledTaskMachinePrincipal(grant) {
|
|
23423
23389
|
return grant.principalKind === "api_key" || grant.principalKind === "configured_key";
|
|
@@ -23927,6 +23893,8 @@ var SCHEDULED_TASK_PAUSED_TRIGGER_MESSAGE = "This schedule is paused, so it cann
|
|
|
23927
23893
|
async function triggerScheduledTaskForGrant(db, grant, workflowClient, input) {
|
|
23928
23894
|
await db.transaction(async (tx) => {
|
|
23929
23895
|
await assertScheduledTaskMutationOwner(tx, grant, input.task.id);
|
|
23896
|
+
if (isRetiredNativeGoogleDriveTask(input.task))
|
|
23897
|
+
throw new HTTPException31(410, { message: GOOGLE_DRIVE_NATIVE_RETIRED_MESSAGE });
|
|
23930
23898
|
if (isRetiredNativeAtlassianTask(input.task))
|
|
23931
23899
|
throw new HTTPException31(410, { message: ATLASSIAN_NATIVE_RETIRED_MESSAGE });
|
|
23932
23900
|
if (input.task.status === "paused")
|
|
@@ -24301,6 +24269,8 @@ async function validatedScheduledTaskUpdateWithoutAudience(input) {
|
|
|
24301
24269
|
expectedExecutionDigest: input.existing.executionDigest
|
|
24302
24270
|
};
|
|
24303
24271
|
const requestedKnowledgeSource = input.payload.agentConfig?.knowledgeSource ?? null;
|
|
24272
|
+
if (isRetiredNativeGoogleDriveTask(input.existing) && (input.payload.status === "active" || requestedKnowledgeSource))
|
|
24273
|
+
throw new HTTPException31(410, { message: GOOGLE_DRIVE_NATIVE_RETIRED_MESSAGE });
|
|
24304
24274
|
if (isRetiredNativeAtlassianTask(input.existing) && (input.payload.status === "active" || requestedKnowledgeSource))
|
|
24305
24275
|
throw new HTTPException31(410, { message: ATLASSIAN_NATIVE_RETIRED_MESSAGE });
|
|
24306
24276
|
const existingKnowledgeSource = scheduledTaskKnowledgeSource(input.existing);
|
|
@@ -24691,6 +24661,8 @@ async function restoreScheduledTask(db, previous) {
|
|
|
24691
24661
|
});
|
|
24692
24662
|
}
|
|
24693
24663
|
async function validateKnowledgeSourceSyncAction(input) {
|
|
24664
|
+
if (isRetiredNativeGoogleDriveSource(input.action))
|
|
24665
|
+
throw new HTTPException31(410, { message: GOOGLE_DRIVE_NATIVE_RETIRED_MESSAGE });
|
|
24694
24666
|
if (isRetiredNativeAtlassianSource(input.action))
|
|
24695
24667
|
throw new HTTPException31(410, { message: ATLASSIAN_NATIVE_RETIRED_MESSAGE });
|
|
24696
24668
|
if (input.action.initiatingSubjectId !== input.grant.subjectId) {
|
|
@@ -25071,7 +25043,7 @@ function trimmedScheduledTaskName(name) {
|
|
|
25071
25043
|
|
|
25072
25044
|
// src/domain/scheduled-task-access.ts
|
|
25073
25045
|
import {
|
|
25074
|
-
allowedFirstPartyMcpToolsForSession as
|
|
25046
|
+
allowedFirstPartyMcpToolsForSession as allowedFirstPartyMcpToolsForSession2,
|
|
25075
25047
|
resolveFirstPartyMcpToolPolicy as resolveFirstPartyMcpToolPolicy3
|
|
25076
25048
|
} from "@opengeni/config";
|
|
25077
25049
|
import {
|
|
@@ -25190,7 +25162,7 @@ function sameMembers(left, right) {
|
|
|
25190
25162
|
function planScheduledTaskOpenGeniTools(input) {
|
|
25191
25163
|
const stored2 = input.creatorPolicy?.firstPartyMcpTools;
|
|
25192
25164
|
if (!stored2) return { missing: [], policy: null };
|
|
25193
|
-
const effective = new Set(
|
|
25165
|
+
const effective = new Set(allowedFirstPartyMcpToolsForSession2(input.settings, stored2));
|
|
25194
25166
|
const missing = resolveFirstPartyMcpToolPolicy3(input.settings).default.filter(
|
|
25195
25167
|
(tool) => !effective.has(tool) && !input.leaveOut?.has(tool)
|
|
25196
25168
|
);
|
|
@@ -30205,6 +30177,8 @@ import {
|
|
|
30205
30177
|
gmailToolSupportsScopes,
|
|
30206
30178
|
isOfficialGmailMcpConfig,
|
|
30207
30179
|
isOfficialSlackMcpConfig,
|
|
30180
|
+
isOfficialDriveMcpConfig,
|
|
30181
|
+
mergeDriveMcpTools,
|
|
30208
30182
|
sessionMcpApprovalConnectionId
|
|
30209
30183
|
} from "@opengeni/runtime";
|
|
30210
30184
|
var ConnectorConnectionRequiredError = class extends HTTPException39 {
|
|
@@ -30398,7 +30372,8 @@ async function listTools(input, target) {
|
|
|
30398
30372
|
throw legacyMcpClientError(error);
|
|
30399
30373
|
})
|
|
30400
30374
|
);
|
|
30401
|
-
|
|
30375
|
+
const completeTools = isOfficialDriveMcpConfig(target.server) ? mergeDriveMcpTools(tools) : tools;
|
|
30376
|
+
return completeTools.filter(
|
|
30402
30377
|
(tool) => !target.server.allowedTools || target.server.allowedTools.includes(tool.name)
|
|
30403
30378
|
);
|
|
30404
30379
|
}
|
|
@@ -30761,6 +30736,7 @@ export {
|
|
|
30761
30736
|
appendRigSetupCommand,
|
|
30762
30737
|
applyCapabilityEnablement,
|
|
30763
30738
|
applyGitHubRepositoryBindings,
|
|
30739
|
+
applyGoogleConnectorSetupAvailability,
|
|
30764
30740
|
applyInitialSessionUsageLimit,
|
|
30765
30741
|
applyOperatorOAuthClientRequirement,
|
|
30766
30742
|
applySessionAgentConfigWriteThrough,
|