integrate-sdk 0.9.56 → 0.9.58
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/adapters/index.js +79 -34
- package/dist/adapters/solid-start.js +79 -34
- package/dist/adapters/svelte-kit.js +79 -34
- package/dist/ai/anthropic.d.ts.map +1 -1
- package/dist/ai/anthropic.js +11 -2
- package/dist/ai/google.d.ts.map +1 -1
- package/dist/ai/google.js +11 -2
- package/dist/ai/index.js +16 -7
- package/dist/ai/openai.d.ts.map +1 -1
- package/dist/ai/openai.js +11 -2
- package/dist/ai/utils.d.ts +21 -0
- package/dist/ai/utils.d.ts.map +1 -1
- package/dist/ai/utils.js +10 -0
- package/dist/ai/vercel-ai.d.ts.map +1 -1
- package/dist/ai/vercel-ai.js +10 -1
- package/dist/database/index.d.ts +1 -1
- package/dist/database/index.d.ts.map +1 -1
- package/dist/database/index.js +39 -0
- package/dist/index.js +77 -31
- package/dist/integrations.js +77 -31
- package/dist/server.js +239 -162
- package/dist/src/ai/anthropic.d.ts.map +1 -1
- package/dist/src/ai/google.d.ts.map +1 -1
- package/dist/src/ai/openai.d.ts.map +1 -1
- package/dist/src/ai/utils.d.ts +21 -0
- package/dist/src/ai/utils.d.ts.map +1 -1
- package/dist/src/ai/vercel-ai.d.ts.map +1 -1
- package/dist/src/client.d.ts +4 -2
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +19 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/database/index.d.ts +1 -1
- package/dist/src/database/index.d.ts.map +1 -1
- package/dist/src/database/token-store.d.ts +10 -0
- package/dist/src/database/token-store.d.ts.map +1 -1
- package/dist/src/server.d.ts +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -3449,6 +3449,169 @@ class HttpSessionTransport {
|
|
|
3449
3449
|
// src/client.ts
|
|
3450
3450
|
init_integration_summary();
|
|
3451
3451
|
init_library_metadata();
|
|
3452
|
+
|
|
3453
|
+
// src/database/token-store.ts
|
|
3454
|
+
var USABLE_ACCESS_TOKEN_BUFFER_MS = 30 * 1000;
|
|
3455
|
+
var MIN_MEANINGFUL_EXPIRY_MS = Date.UTC(2000, 0, 1);
|
|
3456
|
+
function getRowUpdatedAtMs(row) {
|
|
3457
|
+
return row.updatedAt instanceof Date ? row.updatedAt.getTime() : 0;
|
|
3458
|
+
}
|
|
3459
|
+
function normalizeAccountEmail(value) {
|
|
3460
|
+
if (!value)
|
|
3461
|
+
return null;
|
|
3462
|
+
const normalized = value.trim().toLowerCase();
|
|
3463
|
+
return normalized.length > 0 ? normalized : null;
|
|
3464
|
+
}
|
|
3465
|
+
function normalizeAccountEmailHint(value) {
|
|
3466
|
+
const normalized = normalizeAccountEmail(value);
|
|
3467
|
+
if (!normalized)
|
|
3468
|
+
return null;
|
|
3469
|
+
return normalized.includes("@") ? normalized : null;
|
|
3470
|
+
}
|
|
3471
|
+
function normalizeAccountIdentifier(value) {
|
|
3472
|
+
return normalizeAccountEmail(value);
|
|
3473
|
+
}
|
|
3474
|
+
function normalizeAccountIdHint(value) {
|
|
3475
|
+
if (!value)
|
|
3476
|
+
return null;
|
|
3477
|
+
const normalized = value.trim().toLowerCase();
|
|
3478
|
+
return normalized.length > 0 ? normalized : null;
|
|
3479
|
+
}
|
|
3480
|
+
function normalizeProviderTokenType(value) {
|
|
3481
|
+
const normalized = value?.trim();
|
|
3482
|
+
return normalized && normalized.length > 0 ? normalized : "Bearer";
|
|
3483
|
+
}
|
|
3484
|
+
function hasMeaningfulExpiresAt(value) {
|
|
3485
|
+
if (!value)
|
|
3486
|
+
return false;
|
|
3487
|
+
const ms = value.getTime();
|
|
3488
|
+
return Number.isFinite(ms) && ms >= MIN_MEANINGFUL_EXPIRY_MS;
|
|
3489
|
+
}
|
|
3490
|
+
function hasUsableAccessToken(row, now = Date.now(), bufferMs = USABLE_ACCESS_TOKEN_BUFFER_MS) {
|
|
3491
|
+
if (!row.accessToken)
|
|
3492
|
+
return false;
|
|
3493
|
+
const expiresAt = row.expiresAt;
|
|
3494
|
+
if (!hasMeaningfulExpiresAt(expiresAt))
|
|
3495
|
+
return true;
|
|
3496
|
+
return expiresAt.getTime() > now + bufferMs;
|
|
3497
|
+
}
|
|
3498
|
+
function isLikelyUsableToken(row, now = Date.now()) {
|
|
3499
|
+
return hasUsableAccessToken(row, now) || Boolean(row.refreshToken);
|
|
3500
|
+
}
|
|
3501
|
+
function parseScopes(scope) {
|
|
3502
|
+
if (!scope)
|
|
3503
|
+
return;
|
|
3504
|
+
const scopes = scope.split(" ").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
3505
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
3506
|
+
}
|
|
3507
|
+
function choosePreferredTokenRow(rows) {
|
|
3508
|
+
if (rows.length === 0)
|
|
3509
|
+
return;
|
|
3510
|
+
const sorted = [...rows].sort((left, right) => getRowUpdatedAtMs(right) - getRowUpdatedAtMs(left));
|
|
3511
|
+
return sorted.find((row) => hasUsableAccessToken(row)) ?? sorted.find((row) => Boolean(row.refreshToken)) ?? sorted[0];
|
|
3512
|
+
}
|
|
3513
|
+
function selectProviderTokenRow(rows, email, accountId) {
|
|
3514
|
+
if (rows.length === 0) {
|
|
3515
|
+
return;
|
|
3516
|
+
}
|
|
3517
|
+
const normalizedEmail = normalizeAccountEmailHint(email);
|
|
3518
|
+
const normalizedAccountId = normalizeAccountIdHint(accountId);
|
|
3519
|
+
if (normalizedAccountId && normalizedEmail) {
|
|
3520
|
+
const exactBoth = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedAccountId && normalizeAccountEmail(row.accountEmail) === normalizedEmail);
|
|
3521
|
+
if (exactBoth.length > 0) {
|
|
3522
|
+
return choosePreferredTokenRow(exactBoth);
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
if (normalizedAccountId) {
|
|
3526
|
+
const exactAccountId = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedAccountId);
|
|
3527
|
+
if (exactAccountId.length > 0) {
|
|
3528
|
+
return choosePreferredTokenRow(exactAccountId);
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
if (normalizedEmail) {
|
|
3532
|
+
const exactEmail = rows.filter((row) => normalizeAccountEmail(row.accountEmail) === normalizedEmail);
|
|
3533
|
+
if (exactEmail.length > 0) {
|
|
3534
|
+
return choosePreferredTokenRow(exactEmail);
|
|
3535
|
+
}
|
|
3536
|
+
} else if (email) {
|
|
3537
|
+
const normalizedIdentifier = normalizeAccountIdentifier(email);
|
|
3538
|
+
if (normalizedIdentifier) {
|
|
3539
|
+
const identifierMatches = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedIdentifier);
|
|
3540
|
+
if (identifierMatches.length > 0) {
|
|
3541
|
+
return choosePreferredTokenRow(identifierMatches);
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
if (normalizedAccountId || normalizedEmail) {
|
|
3546
|
+
const legacyRows = rows.filter((row) => !normalizeAccountIdHint(row.accountId) && !normalizeAccountEmail(row.accountEmail));
|
|
3547
|
+
if (legacyRows.length === 1) {
|
|
3548
|
+
return choosePreferredTokenRow(legacyRows);
|
|
3549
|
+
}
|
|
3550
|
+
return;
|
|
3551
|
+
}
|
|
3552
|
+
return choosePreferredTokenRow(rows);
|
|
3553
|
+
}
|
|
3554
|
+
function providerTokenRecordToData(row) {
|
|
3555
|
+
const expiresAt = hasMeaningfulExpiresAt(row.expiresAt) ? row.expiresAt : null;
|
|
3556
|
+
const expiresIn = expiresAt ? Math.max(0, Math.floor((expiresAt.getTime() - Date.now()) / 1000)) : 3600;
|
|
3557
|
+
return {
|
|
3558
|
+
accessToken: row.accessToken,
|
|
3559
|
+
refreshToken: row.refreshToken ?? undefined,
|
|
3560
|
+
tokenType: normalizeProviderTokenType(row.tokenType),
|
|
3561
|
+
expiresIn,
|
|
3562
|
+
expiresAt: expiresAt?.toISOString(),
|
|
3563
|
+
scopes: parseScopes(row.scope),
|
|
3564
|
+
email: row.accountEmail ?? undefined,
|
|
3565
|
+
accountId: row.accountId ?? undefined
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
function listConnectedProvidersFromRows(rows, configuredIntegrationIds) {
|
|
3569
|
+
const allowed = configuredIntegrationIds ? new Set(configuredIntegrationIds) : undefined;
|
|
3570
|
+
const rowsByProvider = new Map;
|
|
3571
|
+
for (const row of rows) {
|
|
3572
|
+
if (allowed && !allowed.has(row.provider))
|
|
3573
|
+
continue;
|
|
3574
|
+
const existing = rowsByProvider.get(row.provider);
|
|
3575
|
+
if (existing) {
|
|
3576
|
+
existing.push(row);
|
|
3577
|
+
} else {
|
|
3578
|
+
rowsByProvider.set(row.provider, [row]);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
const connected = [];
|
|
3582
|
+
for (const [provider, providerRows] of rowsByProvider.entries()) {
|
|
3583
|
+
const selected = selectProviderTokenRow(providerRows);
|
|
3584
|
+
if (selected && isLikelyUsableToken(selected)) {
|
|
3585
|
+
connected.push(provider);
|
|
3586
|
+
}
|
|
3587
|
+
}
|
|
3588
|
+
return connected.sort();
|
|
3589
|
+
}
|
|
3590
|
+
async function listConnectedProviders(configuredIntegrationIds, getProviderToken, context) {
|
|
3591
|
+
if (!context.userId || configuredIntegrationIds.length === 0) {
|
|
3592
|
+
return [];
|
|
3593
|
+
}
|
|
3594
|
+
const connected = [];
|
|
3595
|
+
await Promise.all(configuredIntegrationIds.map(async (provider) => {
|
|
3596
|
+
try {
|
|
3597
|
+
const token = await getProviderToken(provider, undefined, context);
|
|
3598
|
+
if (token?.accessToken || typeof token?.refreshToken === "string" && token.refreshToken.length > 0) {
|
|
3599
|
+
connected.push(provider);
|
|
3600
|
+
}
|
|
3601
|
+
} catch {}
|
|
3602
|
+
}));
|
|
3603
|
+
return connected.sort();
|
|
3604
|
+
}
|
|
3605
|
+
function defaultResolveAccountIdentity(provider, tokenData, emailHint) {
|
|
3606
|
+
const accountEmail = normalizeAccountEmail(emailHint ?? tokenData.email ?? null);
|
|
3607
|
+
let accountId = normalizeAccountIdHint(tokenData.accountId ?? null);
|
|
3608
|
+
if (!accountId && accountEmail) {
|
|
3609
|
+
accountId = `${provider}:${accountEmail}`;
|
|
3610
|
+
}
|
|
3611
|
+
return { accountEmail, accountId };
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
// src/client.ts
|
|
3452
3615
|
init_errors();
|
|
3453
3616
|
init_logger();
|
|
3454
3617
|
|
|
@@ -5314,20 +5477,32 @@ class MCPClientBase {
|
|
|
5314
5477
|
getEnabledTools() {
|
|
5315
5478
|
return Array.from(this.availableTools.values()).filter((tool) => this.enabledToolNames.has(tool.name));
|
|
5316
5479
|
}
|
|
5317
|
-
async getEnabledToolsAsync() {
|
|
5318
|
-
|
|
5319
|
-
|
|
5480
|
+
async getEnabledToolsAsync(options) {
|
|
5481
|
+
const targetIntegrationIds = await this.resolveTargetIntegrationIds(options);
|
|
5482
|
+
if (targetIntegrationIds.size === 0) {
|
|
5483
|
+
return [];
|
|
5320
5484
|
}
|
|
5321
|
-
|
|
5322
|
-
|
|
5485
|
+
const filterToTargets = (tools2) => this.filterToolsToIntegrations(tools2, targetIntegrationIds);
|
|
5486
|
+
const hasCompleteCache = () => {
|
|
5487
|
+
for (const integration of this.integrations) {
|
|
5488
|
+
if (!targetIntegrationIds.has(integration.id))
|
|
5489
|
+
continue;
|
|
5490
|
+
for (const toolName of integration.tools) {
|
|
5491
|
+
if (!this.enabledToolNames.has(toolName))
|
|
5492
|
+
continue;
|
|
5493
|
+
if (!this.availableTools.has(toolName))
|
|
5494
|
+
return false;
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
return this.availableTools.size > 0;
|
|
5498
|
+
};
|
|
5499
|
+
if (this.availableTools.size > 0 && hasCompleteCache()) {
|
|
5500
|
+
return filterToTargets(this.getEnabledTools());
|
|
5323
5501
|
}
|
|
5324
5502
|
const tools = [];
|
|
5325
|
-
const integrationIds = new Set;
|
|
5326
|
-
for (const integration of this.integrations) {
|
|
5327
|
-
integrationIds.add(integration.id);
|
|
5328
|
-
}
|
|
5329
5503
|
const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
|
|
5330
|
-
const
|
|
5504
|
+
const concurrency = options?.fetchConcurrency ?? 8;
|
|
5505
|
+
const integrationToolsResults = await parallelWithLimit2(Array.from(targetIntegrationIds), async (integrationId) => {
|
|
5331
5506
|
try {
|
|
5332
5507
|
const response = await this.callServerToolInternal("list_tools_by_integration", {
|
|
5333
5508
|
integration: integrationId
|
|
@@ -5338,25 +5513,14 @@ class MCPClientBase {
|
|
|
5338
5513
|
if (item.type === "text" && item.text) {
|
|
5339
5514
|
try {
|
|
5340
5515
|
const parsed = JSON.parse(item.text);
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
}
|
|
5350
|
-
}
|
|
5351
|
-
} else if (parsed.tools && Array.isArray(parsed.tools)) {
|
|
5352
|
-
for (const tool of parsed.tools) {
|
|
5353
|
-
if (tool.name && tool.inputSchema) {
|
|
5354
|
-
integrationTools.push({
|
|
5355
|
-
name: tool.name,
|
|
5356
|
-
description: tool.description,
|
|
5357
|
-
inputSchema: tool.inputSchema
|
|
5358
|
-
});
|
|
5359
|
-
}
|
|
5516
|
+
const parsedTools = Array.isArray(parsed) ? parsed : parsed.tools && Array.isArray(parsed.tools) ? parsed.tools : [];
|
|
5517
|
+
for (const tool of parsedTools) {
|
|
5518
|
+
if (tool.name && tool.inputSchema) {
|
|
5519
|
+
integrationTools.push({
|
|
5520
|
+
name: tool.name,
|
|
5521
|
+
description: tool.description,
|
|
5522
|
+
inputSchema: tool.inputSchema
|
|
5523
|
+
});
|
|
5360
5524
|
}
|
|
5361
5525
|
}
|
|
5362
5526
|
} catch {}
|
|
@@ -5368,14 +5532,40 @@ class MCPClientBase {
|
|
|
5368
5532
|
logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
|
|
5369
5533
|
return [];
|
|
5370
5534
|
}
|
|
5371
|
-
},
|
|
5535
|
+
}, concurrency);
|
|
5372
5536
|
for (const integrationTools of integrationToolsResults) {
|
|
5373
5537
|
tools.push(...integrationTools);
|
|
5374
5538
|
}
|
|
5375
5539
|
for (const tool of tools) {
|
|
5376
5540
|
this.availableTools.set(tool.name, tool);
|
|
5377
5541
|
}
|
|
5378
|
-
return tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
5542
|
+
return filterToTargets(tools.filter((tool) => this.enabledToolNames.has(tool.name)));
|
|
5543
|
+
}
|
|
5544
|
+
async resolveTargetIntegrationIds(options) {
|
|
5545
|
+
const configuredIds = this.integrations.map((integration) => integration.id);
|
|
5546
|
+
const configuredSet = new Set(configuredIds);
|
|
5547
|
+
if (options?.integrationIds && options.integrationIds.length > 0) {
|
|
5548
|
+
return new Set(options.integrationIds.filter((id) => configuredSet.has(id)));
|
|
5549
|
+
}
|
|
5550
|
+
if (options?.connectedOnly && options.context?.userId) {
|
|
5551
|
+
const connected = await listConnectedProviders(configuredIds, (provider, email, context) => this.oauthManager.getProviderToken(provider, email, context), options.context);
|
|
5552
|
+
return new Set(connected);
|
|
5553
|
+
}
|
|
5554
|
+
return configuredSet;
|
|
5555
|
+
}
|
|
5556
|
+
filterToolsToIntegrations(tools, integrationIds) {
|
|
5557
|
+
if (integrationIds.size === 0) {
|
|
5558
|
+
return [];
|
|
5559
|
+
}
|
|
5560
|
+
const allowedNames = new Set;
|
|
5561
|
+
for (const integration of this.integrations) {
|
|
5562
|
+
if (!integrationIds.has(integration.id))
|
|
5563
|
+
continue;
|
|
5564
|
+
for (const toolName of integration.tools) {
|
|
5565
|
+
allowedNames.add(toolName);
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5568
|
+
return tools.filter((tool) => this.enabledToolNames.has(tool.name) && allowedNames.has(tool.name));
|
|
5379
5569
|
}
|
|
5380
5570
|
getOAuthConfig(integrationId) {
|
|
5381
5571
|
const integration = this.integrations.find((p) => p.id === integrationId);
|
|
@@ -18330,6 +18520,15 @@ var coerce = {
|
|
|
18330
18520
|
};
|
|
18331
18521
|
var NEVER = INVALID;
|
|
18332
18522
|
// src/ai/utils.ts
|
|
18523
|
+
function toEnabledToolsAsyncOptions(options) {
|
|
18524
|
+
if (!options)
|
|
18525
|
+
return;
|
|
18526
|
+
const { integrationIds, connectedOnly, context, fetchConcurrency } = options;
|
|
18527
|
+
if (integrationIds === undefined && connectedOnly === undefined && context === undefined && fetchConcurrency === undefined) {
|
|
18528
|
+
return;
|
|
18529
|
+
}
|
|
18530
|
+
return { integrationIds, connectedOnly, context, fetchConcurrency };
|
|
18531
|
+
}
|
|
18333
18532
|
function getProviderForTool(client, toolName) {
|
|
18334
18533
|
return client.getProviderForTool?.(toolName);
|
|
18335
18534
|
}
|
|
@@ -18656,7 +18855,7 @@ async function getVercelAITools(client, options) {
|
|
|
18656
18855
|
}
|
|
18657
18856
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
18658
18857
|
await ensureClientConnected(client);
|
|
18659
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
18858
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
18660
18859
|
const vercelTools = {};
|
|
18661
18860
|
let effectiveMode;
|
|
18662
18861
|
if (options?.mode !== undefined) {
|
|
@@ -19962,7 +20161,7 @@ async function getOpenAITools(client, options) {
|
|
|
19962
20161
|
}
|
|
19963
20162
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
19964
20163
|
await ensureClientConnected(client);
|
|
19965
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20164
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
19966
20165
|
let effectiveMode;
|
|
19967
20166
|
if (options?.mode !== undefined) {
|
|
19968
20167
|
effectiveMode = options.mode;
|
|
@@ -20024,7 +20223,7 @@ async function handleOpenAIToolCalls(client, toolCalls, options) {
|
|
|
20024
20223
|
const getCodeModeTool = async () => {
|
|
20025
20224
|
if (cachedCodeModeTool)
|
|
20026
20225
|
return cachedCodeModeTool;
|
|
20027
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20226
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
20028
20227
|
cachedCodeModeTool = buildCodeModeTool(client, {
|
|
20029
20228
|
tools: mcpTools,
|
|
20030
20229
|
providerTokens: options?.providerTokens,
|
|
@@ -20108,7 +20307,7 @@ async function handleAnthropicToolCalls(client, messageContent, options) {
|
|
|
20108
20307
|
const getCodeModeTool = async () => {
|
|
20109
20308
|
if (cachedCodeModeTool)
|
|
20110
20309
|
return cachedCodeModeTool;
|
|
20111
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20310
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
20112
20311
|
cachedCodeModeTool = buildCodeModeTool(client, {
|
|
20113
20312
|
tools: mcpTools,
|
|
20114
20313
|
providerTokens: options?.providerTokens,
|
|
@@ -20159,7 +20358,7 @@ async function getAnthropicTools(client, options) {
|
|
|
20159
20358
|
}
|
|
20160
20359
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
20161
20360
|
await ensureClientConnected(client);
|
|
20162
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20361
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
20163
20362
|
let effectiveMode;
|
|
20164
20363
|
if (options?.mode !== undefined) {
|
|
20165
20364
|
effectiveMode = options.mode;
|
|
@@ -20325,7 +20524,7 @@ async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
|
20325
20524
|
const getCodeModeTool = async () => {
|
|
20326
20525
|
if (cachedCodeModeTool)
|
|
20327
20526
|
return cachedCodeModeTool;
|
|
20328
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20527
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
20329
20528
|
cachedCodeModeTool = buildCodeModeTool(client, {
|
|
20330
20529
|
tools: mcpTools,
|
|
20331
20530
|
providerTokens: finalOptions?.providerTokens,
|
|
@@ -20364,7 +20563,7 @@ async function getGoogleTools(client, options) {
|
|
|
20364
20563
|
}
|
|
20365
20564
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
20366
20565
|
await ensureClientConnected(client);
|
|
20367
|
-
const mcpTools = await client.getEnabledToolsAsync();
|
|
20566
|
+
const mcpTools = await client.getEnabledToolsAsync(toEnabledToolsAsyncOptions(options));
|
|
20368
20567
|
let effectiveMode;
|
|
20369
20568
|
if (options?.mode !== undefined) {
|
|
20370
20569
|
effectiveMode = options.mode;
|
|
@@ -21233,130 +21432,6 @@ function zohoSprintsIntegration(config = {}) {
|
|
|
21233
21432
|
}
|
|
21234
21433
|
};
|
|
21235
21434
|
}
|
|
21236
|
-
// src/database/token-store.ts
|
|
21237
|
-
var USABLE_ACCESS_TOKEN_BUFFER_MS = 30 * 1000;
|
|
21238
|
-
var MIN_MEANINGFUL_EXPIRY_MS = Date.UTC(2000, 0, 1);
|
|
21239
|
-
function getRowUpdatedAtMs(row) {
|
|
21240
|
-
return row.updatedAt instanceof Date ? row.updatedAt.getTime() : 0;
|
|
21241
|
-
}
|
|
21242
|
-
function normalizeAccountEmail(value) {
|
|
21243
|
-
if (!value)
|
|
21244
|
-
return null;
|
|
21245
|
-
const normalized = value.trim().toLowerCase();
|
|
21246
|
-
return normalized.length > 0 ? normalized : null;
|
|
21247
|
-
}
|
|
21248
|
-
function normalizeAccountEmailHint(value) {
|
|
21249
|
-
const normalized = normalizeAccountEmail(value);
|
|
21250
|
-
if (!normalized)
|
|
21251
|
-
return null;
|
|
21252
|
-
return normalized.includes("@") ? normalized : null;
|
|
21253
|
-
}
|
|
21254
|
-
function normalizeAccountIdentifier(value) {
|
|
21255
|
-
return normalizeAccountEmail(value);
|
|
21256
|
-
}
|
|
21257
|
-
function normalizeAccountIdHint(value) {
|
|
21258
|
-
if (!value)
|
|
21259
|
-
return null;
|
|
21260
|
-
const normalized = value.trim().toLowerCase();
|
|
21261
|
-
return normalized.length > 0 ? normalized : null;
|
|
21262
|
-
}
|
|
21263
|
-
function normalizeProviderTokenType(value) {
|
|
21264
|
-
const normalized = value?.trim();
|
|
21265
|
-
return normalized && normalized.length > 0 ? normalized : "Bearer";
|
|
21266
|
-
}
|
|
21267
|
-
function hasMeaningfulExpiresAt(value) {
|
|
21268
|
-
if (!value)
|
|
21269
|
-
return false;
|
|
21270
|
-
const ms = value.getTime();
|
|
21271
|
-
return Number.isFinite(ms) && ms >= MIN_MEANINGFUL_EXPIRY_MS;
|
|
21272
|
-
}
|
|
21273
|
-
function hasUsableAccessToken(row, now = Date.now(), bufferMs = USABLE_ACCESS_TOKEN_BUFFER_MS) {
|
|
21274
|
-
if (!row.accessToken)
|
|
21275
|
-
return false;
|
|
21276
|
-
const expiresAt = row.expiresAt;
|
|
21277
|
-
if (!hasMeaningfulExpiresAt(expiresAt))
|
|
21278
|
-
return true;
|
|
21279
|
-
return expiresAt.getTime() > now + bufferMs;
|
|
21280
|
-
}
|
|
21281
|
-
function isLikelyUsableToken(row, now = Date.now()) {
|
|
21282
|
-
return hasUsableAccessToken(row, now) || Boolean(row.refreshToken);
|
|
21283
|
-
}
|
|
21284
|
-
function parseScopes(scope) {
|
|
21285
|
-
if (!scope)
|
|
21286
|
-
return;
|
|
21287
|
-
const scopes = scope.split(" ").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
21288
|
-
return scopes.length > 0 ? scopes : undefined;
|
|
21289
|
-
}
|
|
21290
|
-
function choosePreferredTokenRow(rows) {
|
|
21291
|
-
if (rows.length === 0)
|
|
21292
|
-
return;
|
|
21293
|
-
const sorted = [...rows].sort((left, right) => getRowUpdatedAtMs(right) - getRowUpdatedAtMs(left));
|
|
21294
|
-
return sorted.find((row) => hasUsableAccessToken(row)) ?? sorted.find((row) => Boolean(row.refreshToken)) ?? sorted[0];
|
|
21295
|
-
}
|
|
21296
|
-
function selectProviderTokenRow(rows, email, accountId) {
|
|
21297
|
-
if (rows.length === 0) {
|
|
21298
|
-
return;
|
|
21299
|
-
}
|
|
21300
|
-
const normalizedEmail = normalizeAccountEmailHint(email);
|
|
21301
|
-
const normalizedAccountId = normalizeAccountIdHint(accountId);
|
|
21302
|
-
if (normalizedAccountId && normalizedEmail) {
|
|
21303
|
-
const exactBoth = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedAccountId && normalizeAccountEmail(row.accountEmail) === normalizedEmail);
|
|
21304
|
-
if (exactBoth.length > 0) {
|
|
21305
|
-
return choosePreferredTokenRow(exactBoth);
|
|
21306
|
-
}
|
|
21307
|
-
}
|
|
21308
|
-
if (normalizedAccountId) {
|
|
21309
|
-
const exactAccountId = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedAccountId);
|
|
21310
|
-
if (exactAccountId.length > 0) {
|
|
21311
|
-
return choosePreferredTokenRow(exactAccountId);
|
|
21312
|
-
}
|
|
21313
|
-
}
|
|
21314
|
-
if (normalizedEmail) {
|
|
21315
|
-
const exactEmail = rows.filter((row) => normalizeAccountEmail(row.accountEmail) === normalizedEmail);
|
|
21316
|
-
if (exactEmail.length > 0) {
|
|
21317
|
-
return choosePreferredTokenRow(exactEmail);
|
|
21318
|
-
}
|
|
21319
|
-
} else if (email) {
|
|
21320
|
-
const normalizedIdentifier = normalizeAccountIdentifier(email);
|
|
21321
|
-
if (normalizedIdentifier) {
|
|
21322
|
-
const identifierMatches = rows.filter((row) => normalizeAccountIdHint(row.accountId) === normalizedIdentifier);
|
|
21323
|
-
if (identifierMatches.length > 0) {
|
|
21324
|
-
return choosePreferredTokenRow(identifierMatches);
|
|
21325
|
-
}
|
|
21326
|
-
}
|
|
21327
|
-
}
|
|
21328
|
-
if (normalizedAccountId || normalizedEmail) {
|
|
21329
|
-
const legacyRows = rows.filter((row) => !normalizeAccountIdHint(row.accountId) && !normalizeAccountEmail(row.accountEmail));
|
|
21330
|
-
if (legacyRows.length === 1) {
|
|
21331
|
-
return choosePreferredTokenRow(legacyRows);
|
|
21332
|
-
}
|
|
21333
|
-
return;
|
|
21334
|
-
}
|
|
21335
|
-
return choosePreferredTokenRow(rows);
|
|
21336
|
-
}
|
|
21337
|
-
function providerTokenRecordToData(row) {
|
|
21338
|
-
const expiresAt = hasMeaningfulExpiresAt(row.expiresAt) ? row.expiresAt : null;
|
|
21339
|
-
const expiresIn = expiresAt ? Math.max(0, Math.floor((expiresAt.getTime() - Date.now()) / 1000)) : 3600;
|
|
21340
|
-
return {
|
|
21341
|
-
accessToken: row.accessToken,
|
|
21342
|
-
refreshToken: row.refreshToken ?? undefined,
|
|
21343
|
-
tokenType: normalizeProviderTokenType(row.tokenType),
|
|
21344
|
-
expiresIn,
|
|
21345
|
-
expiresAt: expiresAt?.toISOString(),
|
|
21346
|
-
scopes: parseScopes(row.scope),
|
|
21347
|
-
email: row.accountEmail ?? undefined,
|
|
21348
|
-
accountId: row.accountId ?? undefined
|
|
21349
|
-
};
|
|
21350
|
-
}
|
|
21351
|
-
function defaultResolveAccountIdentity(provider, tokenData, emailHint) {
|
|
21352
|
-
const accountEmail = normalizeAccountEmail(emailHint ?? tokenData.email ?? null);
|
|
21353
|
-
let accountId = normalizeAccountIdHint(tokenData.accountId ?? null);
|
|
21354
|
-
if (!accountId && accountEmail) {
|
|
21355
|
-
accountId = `${provider}:${accountEmail}`;
|
|
21356
|
-
}
|
|
21357
|
-
return { accountEmail, accountId };
|
|
21358
|
-
}
|
|
21359
|
-
|
|
21360
21435
|
// src/database/trigger-store.ts
|
|
21361
21436
|
function toIsoString(value) {
|
|
21362
21437
|
if (!value)
|
|
@@ -25891,6 +25966,8 @@ export {
|
|
|
25891
25966
|
mapmyfitnessIntegration,
|
|
25892
25967
|
mailchimpIntegration,
|
|
25893
25968
|
lookerIntegration,
|
|
25969
|
+
listConnectedProvidersFromRows,
|
|
25970
|
+
listConnectedProviders,
|
|
25894
25971
|
linkedinIntegration,
|
|
25895
25972
|
linearIntegration,
|
|
25896
25973
|
leverIntegration,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/ai/anthropic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/ai/anthropic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,EAA8B,MAAM,YAAY,CAAC;AAU7I,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AA+ID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,aAAa,EAAE,CAAC,CAmF1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpG,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAkC5I"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/ai/google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/ai/google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,EAA8B,MAAM,YAAY,CAAC;AAa7I,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACL,MAAM,eAAe,CAAC;AAGvB,MAAM,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAC7C,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAC9C,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAuB7B;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAsGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,aAAa,EAAE,kBAAkB,EAAE,GAAG,SAAS,GAAG,IAAI,EACtD,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CA+DnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,CAqGvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/ai/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/ai/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAkE,KAAK,cAAc,EAA8B,MAAM,YAAY,CAAC;AAU7I,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,CAiFvB;AA6GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAyB3H"}
|
package/dist/src/ai/utils.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import type { MCPClient } from "../client.js";
|
|
8
|
+
import type { MCPContext } from "../config/types.js";
|
|
9
|
+
import type { EnabledToolsAsyncOptions } from "../config/types.js";
|
|
8
10
|
/**
|
|
9
11
|
* Options for AI provider tool conversions
|
|
10
12
|
*/
|
|
@@ -38,7 +40,26 @@ export interface AIToolsOptions {
|
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
42
|
providerTokens?: Record<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* Limit tool discovery to specific integration IDs (e.g. `['github', 'gmail']`).
|
|
45
|
+
* Only `list_tools_by_integration` calls for these integrations are made.
|
|
46
|
+
*/
|
|
47
|
+
integrationIds?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* When true with `context.userId`, only fetch tools for integrations the user
|
|
50
|
+
* has OAuth tokens for (via `getProviderToken` / database adapter).
|
|
51
|
+
*/
|
|
52
|
+
connectedOnly?: boolean;
|
|
53
|
+
/** User context for connected-only filtering and multi-tenant token lookup */
|
|
54
|
+
context?: MCPContext;
|
|
55
|
+
/**
|
|
56
|
+
* Max parallel `list_tools_by_integration` requests during cold discovery.
|
|
57
|
+
* @default 8
|
|
58
|
+
*/
|
|
59
|
+
fetchConcurrency?: number;
|
|
41
60
|
}
|
|
61
|
+
/** Map AI helper options to client tool-discovery options */
|
|
62
|
+
export declare function toEnabledToolsAsyncOptions(options?: Pick<AIToolsOptions, "integrationIds" | "connectedOnly" | "context" | "fetchConcurrency">): EnabledToolsAsyncOptions | undefined;
|
|
42
63
|
/**
|
|
43
64
|
* Get the provider for a tool by checking which integration includes it
|
|
44
65
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/ai/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/ai/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,6DAA6D;AAC7D,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,IAAI,CACZ,cAAc,EACd,gBAAgB,GAAG,eAAe,GAAG,SAAS,GAAG,kBAAkB,CACpE,GACA,wBAAwB,GAAG,SAAS,CAYtC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG/F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAqFvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAoD7D;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,GAAG,CAAC,CAuCd;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjF;AAED;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/ai/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/ai/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAUpB;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,gCAyE/B"}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { MCPTool, MCPToolCallResponse } from "./protocol/messages.js";
|
|
6
6
|
import type { MCPIntegration, OAuthConfig } from "./integrations/types.js";
|
|
7
|
-
import type { MCPClientConfig, ToolCallOptions, MCPContext } from "./config/types.js";
|
|
7
|
+
import type { MCPClientConfig, ToolCallOptions, MCPContext, EnabledToolsAsyncOptions } from "./config/types.js";
|
|
8
8
|
import { type AuthenticationError } from "./errors.js";
|
|
9
9
|
import type { GitHubIntegrationClient } from "./integrations/github-client.js";
|
|
10
10
|
import type { GmailIntegrationClient } from "./integrations/gmail-client.js";
|
|
@@ -620,7 +620,9 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
620
620
|
* // tools[0].inputSchema is guaranteed to be populated
|
|
621
621
|
* ```
|
|
622
622
|
*/
|
|
623
|
-
getEnabledToolsAsync(): Promise<MCPTool[]>;
|
|
623
|
+
getEnabledToolsAsync(options?: EnabledToolsAsyncOptions): Promise<MCPTool[]>;
|
|
624
|
+
private resolveTargetIntegrationIds;
|
|
625
|
+
private filterToolsToIntegrations;
|
|
624
626
|
/**
|
|
625
627
|
* Get OAuth configuration for a integration
|
|
626
628
|
*/
|