@composio/core 0.25.0 → 0.26.0
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/{CustomTool-DZY1yLHN.d.mts → CustomTool-DfP4ldQl.d.mts} +1 -1
- package/dist/{cancellation-D-tMPk48.mjs → cancellation-ZoRh6EJQ.mjs} +54 -2
- package/dist/{composio-B8AENilE.d.mts → composio-BMDH-1Qj.d.mts} +19 -11
- package/dist/{customTool.types-Bi6-keZC.d.mts → customTool.types-BoOELgJF.d.mts} +20 -20
- package/dist/experimental/index.d.mts +2 -2
- package/dist/index.d.mts +11 -6
- package/dist/index.mjs +400 -61
- package/dist/{types-BGDMkEUl.d.mts → types-DHNV_T_z.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/package.json +3 -3
- package/src/composio.ts +68 -57
- package/src/lib/toolRouterMcp.ts +2 -0
- package/src/models/ConnectedAccounts.ts +7 -16
- package/src/models/ToolRouter.ts +3 -1
- package/src/models/Tools.ts +1 -4
- package/src/models/Triggers.ts +6 -1
- package/src/services/internal/InternalService.ts +3 -4
- package/src/services/pusher/Pusher.ts +11 -4
- package/src/types/connectedAccountAuthStates.types.ts +2 -1
- package/src/types/requestOptions.types.ts +1 -10
- package/src/types/toolRouter.types.ts +1 -1
- package/src/utils/jsonSchema.ts +76 -4
- package/src/utils/sdk.ts +172 -11
- package/src/utils/toolkitDeprecation.ts +271 -0
- package/src/utils/transformers/connectedAccounts.ts +9 -20
- package/src/utils/transformers/mcp.ts +3 -10
package/dist/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { c as DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID, d as USER_DATA_FILE_NA
|
|
|
2
2
|
import { $ as ComposioAuthConfigNotFoundError, A as ComposioInvalidModifierError, B as ConnectionRequestFailedError, C as ValidationError, D as ToolkitErrorCodes, E as ComposioToolkitNotFoundError, F as ComposioToolNotFoundError, G as ComposioConnectedAccountRevocationNotSupportedError, H as ComposioAclOnlyForSharedError, I as ComposioToolVersionRequiredError, J as ComposioMultipleConnectedAccountsError, K as ComposioFailedToCreateConnectedAccountLink, L as ToolErrorCodes, M as ComposioProviderNotDefinedError, N as ComposioToolExecutionError, O as ComposioGlobalExecuteToolFnNotSetError, P as ComposioToolFetchError, Q as AuthConfigErrorCodes, R as handleToolExecutionError, S as JsonSchemaToZodError, T as ComposioToolkitFetchError, U as ComposioConnectedAccountNotFoundError, V as ConnectionRequestTimeoutError, W as ComposioConnectedAccountNotRevokableError, X as ComposioSharedConnectionNotAccessibleError, Y as ComposioSharedAccessDeniedError, Z as ConnectedAccountErrorCodes, _ as ComposioRequestCancelledError, a as RemoteFileDownloadError, b as isRequestAbortError, c as ComposioFailedToGetSDKRealtimeCredentialsError, d as ComposioTriggerTypeNotFoundError, f as ComposioWebhookPayloadError, g as ComposioNoAPIKeyError, h as ComposioAPIKeyKindError, i as ToolRouterErrorCodes, j as ComposioInvalidToolArgumentsError, k as ComposioInvalidExecuteFunctionError, l as ComposioFailedToSubscribeToPusherChannelError, m as TriggerErrorCodes, n as ComposioSessionConfigConflictError, o as RemoteFileErrorCodes, p as ComposioWebhookSignatureVerificationError, q as ComposioLegacyConnectedAccountsEndpointRetiredError, r as ComposioToolInputRequiredError, s as ComposioFailedToCreatePusherClientError, t as ComposioMCPDestinationError, u as ComposioFailedToUnsubscribeFromPusherChannelError, v as ComposioScopeConfigError, w as ValidationErrorCodes, x as JsonSchemaRefResolutionError, y as SDKErrorCodes, z as ConnectionRequestErrorCodes } from "./errors-Cly0vXFh.mjs";
|
|
3
3
|
import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "./FileModifierErrors-CdGSABoq.mjs";
|
|
4
4
|
import { n as dropEmptyFileUploads, o as isPlainObject, s as schemaHasFileUploadable } from "./FileToolModifier.utils.neutral-DWFpnsj2.mjs";
|
|
5
|
-
import { a as jsonSchemaToZodSchema, c as toStrictJsonSchema, i as ensureObjectTypeOnProperties, n as deduplicateJsonSchemaRequiredArrays, o as omitNullToolArguments, r as dereferenceJsonSchema, s as removeNonRequiredProperties, t as withCancellation } from "./cancellation-
|
|
5
|
+
import { a as jsonSchemaToZodSchema, c as toStrictJsonSchema, i as ensureObjectTypeOnProperties, n as deduplicateJsonSchemaRequiredArrays, o as omitNullToolArguments, r as dereferenceJsonSchema, s as removeNonRequiredProperties, t as withCancellation } from "./cancellation-ZoRh6EJQ.mjs";
|
|
6
6
|
import { t as telemetry } from "./Telemetry-41JkqpZ7.mjs";
|
|
7
7
|
import { a as readResponseBodyWithLimit, i as MAX_URL_UPLOAD_SIZE_BYTES, l as getRandomShortId, n as assertSafeFileUploadPath, o as arrayBufferToBase64, r as isBlockedSensitiveFileUploadPath, t as BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS } from "./sensitiveFileUploadPaths-BlLp-Yo2.mjs";
|
|
8
8
|
import { a as createCustomToolkit, c as getPreloadedCustomToolSlugs, d as CreateCustomToolBaseSchema, f as CreateCustomToolkitBaseSchema, i as createCustomTool, l as serializeCustomToolkits, n as buildCustomToolsMap, o as findCustomToolMapEntryByFinalSlug, p as CustomToolSlugSchema, r as buildCustomToolsMapFromResponse, s as findCustomToolMapEntryByToolkitAndOriginalSlug, t as assertNoCustomToolSlugsInPreload, u as serializeCustomTools } from "./CustomTool-BYHB7sPs.mjs";
|
|
9
|
-
import ComposioClient, { APIError, BadRequestError, ConflictError } from "@composio/client";
|
|
9
|
+
import ComposioClient, { APIError, Auth, BadRequestError, ConflictError, createFetchTransport } from "@composio/client";
|
|
10
10
|
import { FileToolModifier } from "#file_tool_modifier";
|
|
11
11
|
import z, { z as z$1 } from "zod/v3";
|
|
12
12
|
import { CONFIG_DEFAULTS } from "#config_defaults";
|
|
@@ -332,7 +332,7 @@ const S2SOauth2ConnectionDataSchema = z$1.discriminatedUnion("status", [
|
|
|
332
332
|
}).catchall(z$1.unknown())
|
|
333
333
|
]);
|
|
334
334
|
const CustomS2SOauth2ConnectionDataSchema = BaseSchemeRaw.extend({
|
|
335
|
-
access_token: z$1.string()
|
|
335
|
+
access_token: z$1.string(),
|
|
336
336
|
id_token: z$1.string().optional(),
|
|
337
337
|
token_type: z$1.string().optional(),
|
|
338
338
|
refresh_token: z$1.string().nullish().optional(),
|
|
@@ -3053,7 +3053,6 @@ const ConnectedAccountCompleteAuthResponseSchema = z$1.object({
|
|
|
3053
3053
|
* @private
|
|
3054
3054
|
*/
|
|
3055
3055
|
function transformConnectedAccountResponse(response) {
|
|
3056
|
-
const responseWithLabels = response;
|
|
3057
3056
|
const parseState = (state) => {
|
|
3058
3057
|
try {
|
|
3059
3058
|
return state ? ConnectionDataSchema.parse(state) : void 0;
|
|
@@ -3071,8 +3070,8 @@ function transformConnectedAccountResponse(response) {
|
|
|
3071
3070
|
isComposioManaged: response.auth_config.is_composio_managed,
|
|
3072
3071
|
isDisabled: response.auth_config.is_disabled
|
|
3073
3072
|
},
|
|
3074
|
-
wordId:
|
|
3075
|
-
alias:
|
|
3073
|
+
wordId: response.word_id ?? null,
|
|
3074
|
+
alias: response.alias ?? null,
|
|
3076
3075
|
data: response.data ?? void 0,
|
|
3077
3076
|
state: parseState(response.state),
|
|
3078
3077
|
status: response.status,
|
|
@@ -3081,12 +3080,12 @@ function transformConnectedAccountResponse(response) {
|
|
|
3081
3080
|
createdAt: response.created_at,
|
|
3082
3081
|
updatedAt: response.updated_at,
|
|
3083
3082
|
testRequestEndpoint: response.test_request_endpoint,
|
|
3084
|
-
experimental:
|
|
3085
|
-
accountType:
|
|
3086
|
-
aclConfigForShared:
|
|
3087
|
-
allowAllUsers:
|
|
3088
|
-
allowedUserIds:
|
|
3089
|
-
notAllowedUserIds:
|
|
3083
|
+
experimental: response.experimental ? {
|
|
3084
|
+
accountType: response.experimental.account_type,
|
|
3085
|
+
aclConfigForShared: response.experimental.acl_config_for_shared ? {
|
|
3086
|
+
allowAllUsers: response.experimental.acl_config_for_shared.allow_all_users,
|
|
3087
|
+
allowedUserIds: response.experimental.acl_config_for_shared.allowed_user_ids,
|
|
3088
|
+
notAllowedUserIds: response.experimental.acl_config_for_shared.not_allowed_user_ids
|
|
3090
3089
|
} : void 0
|
|
3091
3090
|
} : void 0
|
|
3092
3091
|
}));
|
|
@@ -5503,10 +5502,7 @@ var InternalService = class {
|
|
|
5503
5502
|
* @returns {SDKRealtimeCredentialsResponse} The SDK realtime credentials
|
|
5504
5503
|
*/
|
|
5505
5504
|
async getSDKRealtimeCredentials() {
|
|
5506
|
-
const response = await this.client.
|
|
5507
|
-
method: "get",
|
|
5508
|
-
path: SDK_REALTIME_CREDENTIALS_ENDPOINT
|
|
5509
|
-
});
|
|
5505
|
+
const response = await this.client.get(SDK_REALTIME_CREDENTIALS_ENDPOINT);
|
|
5510
5506
|
const parsedResponse = SDKRealtimeCredentialsResponseSchema.safeParse({
|
|
5511
5507
|
pusherKey: response.pusher_key,
|
|
5512
5508
|
projectId: response.project_id,
|
|
@@ -5574,10 +5570,25 @@ const USER_API_KEY_PREFIX = "uak_";
|
|
|
5574
5570
|
* when project-key auth is disabled.
|
|
5575
5571
|
*/
|
|
5576
5572
|
const PROJECT_API_KEY_HEADER = "x-api-key";
|
|
5573
|
+
/** Header that carries the organization API key (`oak_...`). */
|
|
5574
|
+
const ORG_API_KEY_HEADER = "x-org-api-key";
|
|
5577
5575
|
/** Header carrying the organization nano ID that scopes user-key requests. */
|
|
5578
5576
|
const ORG_ID_HEADER = "x-org-id";
|
|
5579
5577
|
/** Header carrying the project nano ID that scopes user-key requests. */
|
|
5580
5578
|
const PROJECT_ID_HEADER = "x-project-id";
|
|
5579
|
+
/**
|
|
5580
|
+
* Header names the SDK owns: the API client sends a credential from its
|
|
5581
|
+
* `auth` and the scope from its `scope`, and refuses these names in its
|
|
5582
|
+
* `defaultHeaders`. The SDK folds caller-supplied entries into its own
|
|
5583
|
+
* credential and scope options instead of forwarding them.
|
|
5584
|
+
*/
|
|
5585
|
+
const SDK_OWNED_HEADERS = [
|
|
5586
|
+
PROJECT_API_KEY_HEADER,
|
|
5587
|
+
USER_API_KEY_HEADER,
|
|
5588
|
+
ORG_API_KEY_HEADER,
|
|
5589
|
+
ORG_ID_HEADER,
|
|
5590
|
+
PROJECT_ID_HEADER
|
|
5591
|
+
];
|
|
5581
5592
|
const userDataPath = () => {
|
|
5582
5593
|
try {
|
|
5583
5594
|
const homeDir = platform.homedir();
|
|
@@ -5653,8 +5664,9 @@ const findHeader = (headers, name) => {
|
|
|
5653
5664
|
* non-empty value. Matches the header name case-insensitively and ignores
|
|
5654
5665
|
* every other header.
|
|
5655
5666
|
*/
|
|
5656
|
-
const getUserApiKeyHeader = (headers) =>
|
|
5657
|
-
|
|
5667
|
+
const getUserApiKeyHeader = (headers) => getCredentialHeader(headers, USER_API_KEY_HEADER);
|
|
5668
|
+
const getCredentialHeader = (headers, name) => {
|
|
5669
|
+
const header = findHeader(headers, name);
|
|
5658
5670
|
return header && typeof header.value === "string" && header.value.length > 0 ? header : void 0;
|
|
5659
5671
|
};
|
|
5660
5672
|
/**
|
|
@@ -5663,14 +5675,16 @@ const getUserApiKeyHeader = (headers) => {
|
|
|
5663
5675
|
* headers wins: the client treats a caller-placed credential header as the
|
|
5664
5676
|
* credential and suppresses the configured keys. Otherwise the project key
|
|
5665
5677
|
* travels as `x-api-key`, otherwise the resolved user API key as
|
|
5666
|
-
* `x-user-api-key
|
|
5667
|
-
*
|
|
5678
|
+
* `x-user-api-key`, otherwise the organization API key as `x-org-api-key`
|
|
5679
|
+
* (the order {@link toClientAuth} picks them in). Empty when no credential is
|
|
5680
|
+
* held. The environment is never consulted here.
|
|
5668
5681
|
*/
|
|
5669
5682
|
const resolveCredentialHeaders = (input) => {
|
|
5670
5683
|
const userApiKeyHeader = getUserApiKeyHeader(input.defaultHeaders);
|
|
5671
5684
|
if (userApiKeyHeader) return { [USER_API_KEY_HEADER]: userApiKeyHeader.value };
|
|
5672
5685
|
if (hasValue(input.apiKey)) return { [PROJECT_API_KEY_HEADER]: input.apiKey };
|
|
5673
5686
|
if (hasValue(input.userApiKey)) return { [USER_API_KEY_HEADER]: input.userApiKey };
|
|
5687
|
+
if (hasValue(input.orgApiKey)) return { [ORG_API_KEY_HEADER]: input.orgApiKey };
|
|
5674
5688
|
return {};
|
|
5675
5689
|
};
|
|
5676
5690
|
const resolveScopeValue = (option, headers, headerName, optionName) => {
|
|
@@ -5711,11 +5725,21 @@ function resolveSDKScope(options) {
|
|
|
5711
5725
|
projectId
|
|
5712
5726
|
};
|
|
5713
5727
|
}
|
|
5714
|
-
/**
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5728
|
+
/**
|
|
5729
|
+
* The API client `scope` for a resolved SDK scope: the organization and
|
|
5730
|
+
* project nano IDs the client sends as `x-org-id` / `x-project-id`, or
|
|
5731
|
+
* `undefined` when the instance is unscoped.
|
|
5732
|
+
*/
|
|
5733
|
+
const toClientScope = (scope) => scope.orgId && scope.projectId ? {
|
|
5734
|
+
organizationId: scope.orgId,
|
|
5735
|
+
projectId: scope.projectId
|
|
5736
|
+
} : void 0;
|
|
5737
|
+
/**
|
|
5738
|
+
* `headers` without the credential and scope entries the SDK owns (matched
|
|
5739
|
+
* case-insensitively). Those travel through the API client's `auth` and
|
|
5740
|
+
* `scope`, which refuse the same names in `defaultHeaders`.
|
|
5741
|
+
*/
|
|
5742
|
+
const withoutSDKOwnedHeaders = (headers) => headers === void 0 ? void 0 : Object.fromEntries(Object.entries(headers).filter(([name]) => !SDK_OWNED_HEADERS.includes(name.toLowerCase())));
|
|
5719
5743
|
const hasValue = (value) => typeof value === "string" && value.length > 0;
|
|
5720
5744
|
/**
|
|
5721
5745
|
* Mirrors how the API client resolves `userApiKey` / `orgApiKey`: an explicit
|
|
@@ -5733,11 +5757,96 @@ const resolveAlternateCredential = (explicit, envName) => {
|
|
|
5733
5757
|
*/
|
|
5734
5758
|
const resolveUserApiKey = (userApiKey) => resolveAlternateCredential(userApiKey, "COMPOSIO_USER_API_KEY");
|
|
5735
5759
|
/**
|
|
5760
|
+
* The organization API key the instance holds: the `orgApiKey` option when it
|
|
5761
|
+
* was passed (including `null`, which disables the fallback), otherwise
|
|
5762
|
+
* `COMPOSIO_ORG_API_KEY`.
|
|
5763
|
+
*/
|
|
5764
|
+
const resolveOrgApiKey = (orgApiKey) => resolveAlternateCredential(orgApiKey, "COMPOSIO_ORG_API_KEY");
|
|
5765
|
+
/**
|
|
5736
5766
|
* Whether the instance holds a credential other than the project key: a user
|
|
5737
5767
|
* or organization API key (explicit or environment-resolved, as the API client
|
|
5738
|
-
* will see it), or a user API key placed in the default
|
|
5739
|
-
|
|
5740
|
-
|
|
5768
|
+
* will see it), or a user or organization API key placed in the default
|
|
5769
|
+
* headers, which {@link resolveSDKCredentials} folds in.
|
|
5770
|
+
*/
|
|
5771
|
+
const hasAlternateCredential = (options) => resolveUserApiKey(options.userApiKey) !== void 0 || resolveOrgApiKey(options.orgApiKey) !== void 0 || getUserApiKeyHeader(options.defaultHeaders) !== void 0 || getCredentialHeader(options.defaultHeaders, "x-org-api-key") !== void 0;
|
|
5772
|
+
const CREDENTIAL_HEADERS = [
|
|
5773
|
+
PROJECT_API_KEY_HEADER,
|
|
5774
|
+
USER_API_KEY_HEADER,
|
|
5775
|
+
ORG_API_KEY_HEADER
|
|
5776
|
+
];
|
|
5777
|
+
/**
|
|
5778
|
+
* Resolves the credentials of an SDK instance.
|
|
5779
|
+
*
|
|
5780
|
+
* The user and organization keys fall back to `COMPOSIO_USER_API_KEY` and
|
|
5781
|
+
* `COMPOSIO_ORG_API_KEY` when their option is omitted. A non-empty credential
|
|
5782
|
+
* header in `defaultHeaders` (any letter case) is folded in as the credential
|
|
5783
|
+
* it names, and it is the credential the instance sends, as it was when the
|
|
5784
|
+
* header itself went on the wire: an `x-user-api-key` or `x-org-api-key` entry
|
|
5785
|
+
* disables the project key and takes the place of the configured user or
|
|
5786
|
+
* organization key, and an `x-api-key` entry takes the place of the project
|
|
5787
|
+
* key. At most one credential header may be set: the API rejects a request
|
|
5788
|
+
* that carries two.
|
|
5789
|
+
*/
|
|
5790
|
+
function resolveSDKCredentials(input) {
|
|
5791
|
+
const headers = CREDENTIAL_HEADERS.flatMap((name) => {
|
|
5792
|
+
const header = findHeader(input.defaultHeaders, name);
|
|
5793
|
+
return header && hasValue(header.value) ? [{
|
|
5794
|
+
...header,
|
|
5795
|
+
canonical: name
|
|
5796
|
+
}] : [];
|
|
5797
|
+
});
|
|
5798
|
+
if (headers.length > 1) throw new ComposioError("`defaultHeaders` carries more than one credential header", {
|
|
5799
|
+
cause: `The API accepts exactly one credential per request, and \`defaultHeaders\` sets ${headers.map((header) => `\`${header.name}\``).join(" and ")}`,
|
|
5800
|
+
possibleFixes: ["Pass credentials through `apiKey`, `userApiKey` and `orgApiKey` instead of default headers", "Keep at most one of `x-api-key`, `x-user-api-key` and `x-org-api-key` in `defaultHeaders`"]
|
|
5801
|
+
});
|
|
5802
|
+
const userApiKey = resolveUserApiKey(input.userApiKey) ?? null;
|
|
5803
|
+
const orgApiKey = resolveOrgApiKey(input.orgApiKey) ?? null;
|
|
5804
|
+
const [header] = headers;
|
|
5805
|
+
switch (header?.canonical) {
|
|
5806
|
+
case USER_API_KEY_HEADER: return {
|
|
5807
|
+
apiKey: null,
|
|
5808
|
+
userApiKey: header.value,
|
|
5809
|
+
orgApiKey
|
|
5810
|
+
};
|
|
5811
|
+
case ORG_API_KEY_HEADER: return {
|
|
5812
|
+
apiKey: null,
|
|
5813
|
+
userApiKey: null,
|
|
5814
|
+
orgApiKey: header.value
|
|
5815
|
+
};
|
|
5816
|
+
case PROJECT_API_KEY_HEADER: return {
|
|
5817
|
+
apiKey: header.value,
|
|
5818
|
+
userApiKey,
|
|
5819
|
+
orgApiKey
|
|
5820
|
+
};
|
|
5821
|
+
default: return {
|
|
5822
|
+
apiKey: input.apiKey,
|
|
5823
|
+
userApiKey,
|
|
5824
|
+
orgApiKey
|
|
5825
|
+
};
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5828
|
+
/**
|
|
5829
|
+
* The API client `auth` for the credentials of an SDK instance.
|
|
5830
|
+
*
|
|
5831
|
+
* - A project key alone authenticates every request with it.
|
|
5832
|
+
* - A project key with a user and/or organization key selects one per
|
|
5833
|
+
* operation: the project key wherever the operation accepts it, otherwise
|
|
5834
|
+
* the first declared scheme a key is held for.
|
|
5835
|
+
* - Without a project key, the user key authenticates every request (sessions
|
|
5836
|
+
* included, whose operations declare no scheme), and the organization key
|
|
5837
|
+
* does when it is the only one held.
|
|
5838
|
+
*/
|
|
5839
|
+
const toClientAuth = (credentials) => {
|
|
5840
|
+
const { apiKey, userApiKey, orgApiKey } = credentials;
|
|
5841
|
+
if (apiKey !== null) return userApiKey === null && orgApiKey === null ? Auth.project(apiKey) : Auth.auto({
|
|
5842
|
+
project: apiKey,
|
|
5843
|
+
user: userApiKey ?? void 0,
|
|
5844
|
+
organization: orgApiKey ?? void 0
|
|
5845
|
+
});
|
|
5846
|
+
if (userApiKey !== null) return Auth.user(userApiKey);
|
|
5847
|
+
if (orgApiKey !== null) return Auth.organization(orgApiKey);
|
|
5848
|
+
throw new ComposioNoAPIKeyError();
|
|
5849
|
+
};
|
|
5741
5850
|
/**
|
|
5742
5851
|
* Resolves the base URL and project API key the SDK will use.
|
|
5743
5852
|
*
|
|
@@ -5749,7 +5858,8 @@ const hasAlternateCredential = (options) => resolveUserApiKey(options.userApiKey
|
|
|
5749
5858
|
* `api_key` is read, and the resolver only succeeds when the instance holds
|
|
5750
5859
|
* another credential: a `userApiKey` or `orgApiKey` (explicit, or resolved
|
|
5751
5860
|
* from `COMPOSIO_USER_API_KEY` / `COMPOSIO_ORG_API_KEY` the way the API
|
|
5752
|
-
* client does), or a non-empty `x-user-api-key` entry in
|
|
5861
|
+
* client does), or a non-empty `x-user-api-key` or `x-org-api-key` entry in
|
|
5862
|
+
* `defaultHeaders`.
|
|
5753
5863
|
* An `x-api-key` entry in `defaultHeaders` (any letter case) is rejected in
|
|
5754
5864
|
* that mode: the project credential is only ever set from `apiKey`.
|
|
5755
5865
|
*
|
|
@@ -5864,8 +5974,9 @@ var PusherService = class {
|
|
|
5864
5974
|
this.composioClient = client;
|
|
5865
5975
|
this.pusherBaseURL = client.baseURL;
|
|
5866
5976
|
this.authHeaders = resolveCredentialHeaders({
|
|
5867
|
-
apiKey:
|
|
5868
|
-
userApiKey:
|
|
5977
|
+
apiKey: options.apiKey,
|
|
5978
|
+
userApiKey: options.userApiKey,
|
|
5979
|
+
orgApiKey: options.orgApiKey,
|
|
5869
5980
|
defaultHeaders: options.defaultHeaders
|
|
5870
5981
|
});
|
|
5871
5982
|
telemetry.instrument(this, "PusherService");
|
|
@@ -6223,7 +6334,12 @@ var Triggers = class {
|
|
|
6223
6334
|
toolkitVersions;
|
|
6224
6335
|
constructor(client, config) {
|
|
6225
6336
|
this.client = client;
|
|
6226
|
-
this.pusherService = new PusherService(client, {
|
|
6337
|
+
this.pusherService = new PusherService(client, {
|
|
6338
|
+
apiKey: config?.apiKey,
|
|
6339
|
+
userApiKey: config?.userApiKey,
|
|
6340
|
+
orgApiKey: config?.orgApiKey,
|
|
6341
|
+
defaultHeaders: config?.defaultHeaders
|
|
6342
|
+
});
|
|
6227
6343
|
this.toolkitVersions = config?.toolkitVersions ?? CONFIG_DEFAULTS.toolkitVersions;
|
|
6228
6344
|
telemetry.instrument(this, "Triggers");
|
|
6229
6345
|
}
|
|
@@ -8683,7 +8799,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
8683
8799
|
|
|
8684
8800
|
//#endregion
|
|
8685
8801
|
//#region package.json
|
|
8686
|
-
var version = "0.
|
|
8802
|
+
var version = "0.26.0";
|
|
8687
8803
|
|
|
8688
8804
|
//#endregion
|
|
8689
8805
|
//#region src/utils/session.ts
|
|
@@ -10687,7 +10803,8 @@ var ToolRouter = class {
|
|
|
10687
10803
|
/**
|
|
10688
10804
|
* Derives the MCP config for a session from the auth context the session
|
|
10689
10805
|
* request was made with: the project key when one is configured, otherwise
|
|
10690
|
-
* the resolved user API key,
|
|
10806
|
+
* the resolved user API key, otherwise the organization API key, plus the
|
|
10807
|
+
* org/project scope when configured.
|
|
10691
10808
|
* Headers are only attached when the MCP URL shares the client's API
|
|
10692
10809
|
* origin. Any other destination throws when the caller passed `mcp: true`
|
|
10693
10810
|
* and otherwise yields empty headers plus a warning; see
|
|
@@ -10700,6 +10817,7 @@ var ToolRouter = class {
|
|
|
10700
10817
|
apiBaseURL: this.client.baseURL,
|
|
10701
10818
|
apiKey: this.config?.apiKey,
|
|
10702
10819
|
userApiKey: this.config?.userApiKey,
|
|
10820
|
+
orgApiKey: this.config?.orgApiKey,
|
|
10703
10821
|
defaultHeaders: this.config?.defaultHeaders,
|
|
10704
10822
|
orgId: this.config?.orgId,
|
|
10705
10823
|
projectId: this.config?.projectId,
|
|
@@ -10819,6 +10937,231 @@ var Sessions = class extends ToolRouter {
|
|
|
10819
10937
|
}
|
|
10820
10938
|
};
|
|
10821
10939
|
|
|
10940
|
+
//#endregion
|
|
10941
|
+
//#region src/utils/toolkitDeprecation.ts
|
|
10942
|
+
/**
|
|
10943
|
+
* Toolkit version deprecation warnings.
|
|
10944
|
+
*
|
|
10945
|
+
* When a request resolves to a deprecated toolkit version, the API adds a
|
|
10946
|
+
* `Composio-Deprecated-Toolkits` response header (an RFC 9651 structured-field
|
|
10947
|
+
* list). This module parses that header below the generated client, through a
|
|
10948
|
+
* `fetch` wrapper, and warns once per process for each deprecated toolkit
|
|
10949
|
+
* version it sees. The response itself is never read, cloned or altered.
|
|
10950
|
+
*
|
|
10951
|
+
* Example header:
|
|
10952
|
+
*
|
|
10953
|
+
* "GMAIL";version="20250114_00";deprecated=@1779840000;sunset=@1787788800;reason="lifecycle"
|
|
10954
|
+
*/
|
|
10955
|
+
/** Response header name. `Headers.get` is case-insensitive. */
|
|
10956
|
+
const TOOLKIT_DEPRECATION_HEADER = "composio-deprecated-toolkits";
|
|
10957
|
+
/** Anchor of the docs section every warning points at. */
|
|
10958
|
+
const TOOLKIT_DEPRECATION_DOCS_URL = "https://docs.composio.dev/docs/tools-direct/toolkit-versioning#deprecation-and-sunset";
|
|
10959
|
+
/** Versions named per toolkit before the formatter collapses the rest into "and N more". */
|
|
10960
|
+
const MAX_VERSIONS_PER_LINE = 5;
|
|
10961
|
+
/**
|
|
10962
|
+
* The three limits below mirror the `@composio/client` deprecation module,
|
|
10963
|
+
* which reads the same kind of server-controlled header.
|
|
10964
|
+
*/
|
|
10965
|
+
/** A header longer than this is ignored whole rather than parsed. */
|
|
10966
|
+
const MAX_HEADER_LENGTH = 2048;
|
|
10967
|
+
/** A header holding any of these is ignored whole, so nothing partially cleaned reaches the log. */
|
|
10968
|
+
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f]/;
|
|
10969
|
+
/** Keys the process will ever record; past this, new versions are neither recorded nor warned about. */
|
|
10970
|
+
const MAX_TRACKED_VERSIONS = 1024;
|
|
10971
|
+
const DeprecatedToolkitEntrySchema = z$2.object({
|
|
10972
|
+
slug: z$2.string().min(1),
|
|
10973
|
+
version: z$2.string().min(1),
|
|
10974
|
+
deprecatedAt: z$2.date().optional(),
|
|
10975
|
+
sunsetAt: z$2.date().optional(),
|
|
10976
|
+
reason: z$2.string().min(1).optional()
|
|
10977
|
+
});
|
|
10978
|
+
/** Keys (`UPPER(slug)@version`) already warned about in this process. */
|
|
10979
|
+
const warnedToolkitVersions = /* @__PURE__ */ new Set();
|
|
10980
|
+
const dedupeKey = (entry) => `${entry.slug.toUpperCase()}@${entry.version}`;
|
|
10981
|
+
/**
|
|
10982
|
+
* Splits `value` on `delimiter` characters that sit outside double-quoted
|
|
10983
|
+
* strings, honouring backslash escapes inside the quotes. Empty pieces are
|
|
10984
|
+
* dropped and the rest are trimmed.
|
|
10985
|
+
*/
|
|
10986
|
+
const splitOutsideQuotes = (value, delimiter) => {
|
|
10987
|
+
const pieces = [];
|
|
10988
|
+
let current = "";
|
|
10989
|
+
let inString = false;
|
|
10990
|
+
for (let index = 0; index < value.length; index++) {
|
|
10991
|
+
const char = value[index];
|
|
10992
|
+
if (inString) {
|
|
10993
|
+
current += char;
|
|
10994
|
+
if (char === "\\" && index + 1 < value.length) {
|
|
10995
|
+
index += 1;
|
|
10996
|
+
current += value[index];
|
|
10997
|
+
} else if (char === "\"") inString = false;
|
|
10998
|
+
} else if (char === "\"") {
|
|
10999
|
+
inString = true;
|
|
11000
|
+
current += char;
|
|
11001
|
+
} else if (char === delimiter) {
|
|
11002
|
+
pieces.push(current);
|
|
11003
|
+
current = "";
|
|
11004
|
+
} else current += char;
|
|
11005
|
+
}
|
|
11006
|
+
pieces.push(current);
|
|
11007
|
+
return pieces.map((piece) => piece.trim()).filter((piece) => piece.length > 0);
|
|
11008
|
+
};
|
|
11009
|
+
/**
|
|
11010
|
+
* Decodes an sf-string (`"..."` with `\"` and `\\` escapes). Returns
|
|
11011
|
+
* `undefined` for anything that is not a complete, validly escaped sf-string.
|
|
11012
|
+
*/
|
|
11013
|
+
const decodeSfString = (raw) => {
|
|
11014
|
+
const match = /^"((?:[^"\\]|\\.)*)"$/.exec(raw);
|
|
11015
|
+
if (match === null) return void 0;
|
|
11016
|
+
let invalidEscape = false;
|
|
11017
|
+
const decoded = match[1].replace(/\\(.)/g, (_whole, escaped) => {
|
|
11018
|
+
if (escaped === "\"" || escaped === "\\") return escaped;
|
|
11019
|
+
invalidEscape = true;
|
|
11020
|
+
return "";
|
|
11021
|
+
});
|
|
11022
|
+
return invalidEscape ? void 0 : decoded;
|
|
11023
|
+
};
|
|
11024
|
+
/** Decodes an sf-date (`@` followed by Unix seconds). */
|
|
11025
|
+
const decodeSfDate = (raw) => {
|
|
11026
|
+
const match = /^@(-?\d{1,15})$/.exec(raw);
|
|
11027
|
+
if (match === null) return void 0;
|
|
11028
|
+
const date = /* @__PURE__ */ new Date(Number(match[1]) * 1e3);
|
|
11029
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
11030
|
+
};
|
|
11031
|
+
/** Header parameters the SDK understands, by wire name. */
|
|
11032
|
+
const KNOWN_PARAMETERS = /* @__PURE__ */ new Map([
|
|
11033
|
+
["version", {
|
|
11034
|
+
name: "version",
|
|
11035
|
+
kind: "string"
|
|
11036
|
+
}],
|
|
11037
|
+
["reason", {
|
|
11038
|
+
name: "reason",
|
|
11039
|
+
kind: "string"
|
|
11040
|
+
}],
|
|
11041
|
+
["deprecated", {
|
|
11042
|
+
name: "deprecatedAt",
|
|
11043
|
+
kind: "date"
|
|
11044
|
+
}],
|
|
11045
|
+
["sunset", {
|
|
11046
|
+
name: "sunsetAt",
|
|
11047
|
+
kind: "date"
|
|
11048
|
+
}]
|
|
11049
|
+
]);
|
|
11050
|
+
/**
|
|
11051
|
+
* Parses one list item: an sf-string slug followed by `;key=value` parameters.
|
|
11052
|
+
* Unknown parameters are ignored; a known parameter with the wrong type drops
|
|
11053
|
+
* the item.
|
|
11054
|
+
*/
|
|
11055
|
+
const parseItem = (item) => {
|
|
11056
|
+
const [head, ...params] = splitOutsideQuotes(item, ";");
|
|
11057
|
+
if (head === void 0) return void 0;
|
|
11058
|
+
const candidate = { slug: decodeSfString(head) };
|
|
11059
|
+
for (const param of params) {
|
|
11060
|
+
const separator = param.indexOf("=");
|
|
11061
|
+
if (separator === -1) continue;
|
|
11062
|
+
const key = param.slice(0, separator).trim();
|
|
11063
|
+
const rawValue = param.slice(separator + 1).trim();
|
|
11064
|
+
const field = KNOWN_PARAMETERS.get(key);
|
|
11065
|
+
if (field === void 0) continue;
|
|
11066
|
+
const decoded = field.kind === "string" ? decodeSfString(rawValue) : decodeSfDate(rawValue);
|
|
11067
|
+
if (decoded === void 0) return void 0;
|
|
11068
|
+
candidate[field.name] = decoded;
|
|
11069
|
+
}
|
|
11070
|
+
const parsed = DeprecatedToolkitEntrySchema.safeParse(candidate);
|
|
11071
|
+
return parsed.success ? parsed.data : void 0;
|
|
11072
|
+
};
|
|
11073
|
+
/**
|
|
11074
|
+
* Parses a `Composio-Deprecated-Toolkits` header value. Items that fail to
|
|
11075
|
+
* parse are dropped silently; garbage input yields an empty array. Never throws.
|
|
11076
|
+
*/
|
|
11077
|
+
function parseDeprecatedToolkitsHeader(value) {
|
|
11078
|
+
try {
|
|
11079
|
+
const entries = [];
|
|
11080
|
+
for (const item of splitOutsideQuotes(value, ",")) {
|
|
11081
|
+
const entry = parseItem(item);
|
|
11082
|
+
if (entry !== void 0) entries.push(entry);
|
|
11083
|
+
}
|
|
11084
|
+
return entries;
|
|
11085
|
+
} catch {
|
|
11086
|
+
return [];
|
|
11087
|
+
}
|
|
11088
|
+
}
|
|
11089
|
+
const isoDate = (date) => date.toISOString().slice(0, 10);
|
|
11090
|
+
const pinHint = (slug, docsUrl) => {
|
|
11091
|
+
return `Pin a newer version with toolkitVersions: { ${normalizeToolkitSlug(slug)}: '<version>' } or ${`COMPOSIO_TOOLKIT_VERSION_${slug.toUpperCase()}`}. See ${docsUrl}.`;
|
|
11092
|
+
};
|
|
11093
|
+
const formatSingle = (entry, docsUrl) => {
|
|
11094
|
+
let sentence = `[Deprecation] Toolkit ${entry.slug.toUpperCase()} version ${entry.version} was deprecated`;
|
|
11095
|
+
if (entry.deprecatedAt !== void 0) sentence += ` on ${isoDate(entry.deprecatedAt)}`;
|
|
11096
|
+
if (entry.reason !== void 0) sentence += ` (${entry.reason})`;
|
|
11097
|
+
if (entry.sunsetAt !== void 0) sentence += ` and will stop working on ${isoDate(entry.sunsetAt)}`;
|
|
11098
|
+
return `${sentence}. ${pinHint(entry.slug, docsUrl)}`;
|
|
11099
|
+
};
|
|
11100
|
+
const formatGroup = (slug, entries, docsUrl) => {
|
|
11101
|
+
const versions = entries.map((entry) => entry.version);
|
|
11102
|
+
const named = versions.slice(0, MAX_VERSIONS_PER_LINE).join(", ");
|
|
11103
|
+
const remaining = versions.length - MAX_VERSIONS_PER_LINE;
|
|
11104
|
+
let sentence = `[Deprecation] Toolkit ${slug} versions ${remaining > 0 ? `${named} and ${remaining} more` : named} are deprecated`;
|
|
11105
|
+
const sunsets = entries.map((entry) => entry.sunsetAt).filter((date) => date !== void 0).sort((a, b) => a.getTime() - b.getTime());
|
|
11106
|
+
if (sunsets.length > 0) sentence += ` and the earliest will stop working on ${isoDate(sunsets[0])}`;
|
|
11107
|
+
return `${sentence}. ${pinHint(slug, docsUrl)}`;
|
|
11108
|
+
};
|
|
11109
|
+
/**
|
|
11110
|
+
* Renders one warning line per toolkit slug. A slug with a single deprecated
|
|
11111
|
+
* version gets the full sentence with its dates and reason; a slug with several
|
|
11112
|
+
* names at most five versions and collapses the rest into "and N more".
|
|
11113
|
+
*/
|
|
11114
|
+
function formatToolkitDeprecationWarnings(entries, docsUrl = TOOLKIT_DEPRECATION_DOCS_URL) {
|
|
11115
|
+
const groups = /* @__PURE__ */ new Map();
|
|
11116
|
+
for (const entry of entries) {
|
|
11117
|
+
const slug = entry.slug.toUpperCase();
|
|
11118
|
+
const group = groups.get(slug);
|
|
11119
|
+
if (group === void 0) groups.set(slug, [entry]);
|
|
11120
|
+
else group.push(entry);
|
|
11121
|
+
}
|
|
11122
|
+
return Array.from(groups, ([slug, group]) => group.length === 1 ? formatSingle(group[0], docsUrl) : formatGroup(slug, group, docsUrl));
|
|
11123
|
+
}
|
|
11124
|
+
/**
|
|
11125
|
+
* Parses the header on `response`, drops versions already warned about in this
|
|
11126
|
+
* process, records the new ones and warns once per formatted line.
|
|
11127
|
+
*/
|
|
11128
|
+
const warnDeprecatedToolkits = (response) => {
|
|
11129
|
+
const value = response.headers.get(TOOLKIT_DEPRECATION_HEADER);
|
|
11130
|
+
if (value === null || value.length === 0) return;
|
|
11131
|
+
if (value.length > MAX_HEADER_LENGTH || CONTROL_CHARACTERS.test(value)) return;
|
|
11132
|
+
if (warnedToolkitVersions.size >= MAX_TRACKED_VERSIONS) return;
|
|
11133
|
+
const fresh = [];
|
|
11134
|
+
for (const entry of parseDeprecatedToolkitsHeader(value)) {
|
|
11135
|
+
const key = dedupeKey(entry);
|
|
11136
|
+
if (warnedToolkitVersions.has(key) || warnedToolkitVersions.size >= MAX_TRACKED_VERSIONS) continue;
|
|
11137
|
+
warnedToolkitVersions.add(key);
|
|
11138
|
+
fresh.push(entry);
|
|
11139
|
+
}
|
|
11140
|
+
for (const line of formatToolkitDeprecationWarnings(fresh)) logger.warn(line);
|
|
11141
|
+
};
|
|
11142
|
+
/**
|
|
11143
|
+
* Wraps a `fetch` implementation so every response is checked for the
|
|
11144
|
+
* `Composio-Deprecated-Toolkits` header. The wrapper is `this`-independent,
|
|
11145
|
+
* returns the response unchanged on every path and never fails a call over
|
|
11146
|
+
* the header: any error while inspecting it is logged at debug and swallowed.
|
|
11147
|
+
*
|
|
11148
|
+
* When no `baseFetch` is given, `globalThis.fetch` is resolved per call so a
|
|
11149
|
+
* runtime that installs or replaces `fetch` after construction still works.
|
|
11150
|
+
*/
|
|
11151
|
+
function createToolkitDeprecationFetch(baseFetch) {
|
|
11152
|
+
return async (input, init) => {
|
|
11153
|
+
const response = await (baseFetch ?? globalThis.fetch)(input, init);
|
|
11154
|
+
try {
|
|
11155
|
+
warnDeprecatedToolkits(response);
|
|
11156
|
+
} catch (error) {
|
|
11157
|
+
try {
|
|
11158
|
+
logger.debug("Failed to inspect the toolkit deprecation header", error);
|
|
11159
|
+
} catch {}
|
|
11160
|
+
}
|
|
11161
|
+
return response;
|
|
11162
|
+
};
|
|
11163
|
+
}
|
|
11164
|
+
|
|
10822
11165
|
//#endregion
|
|
10823
11166
|
//#region src/composio.ts
|
|
10824
11167
|
/**
|
|
@@ -10838,7 +11181,7 @@ const toClientLogLevel = (level) => {
|
|
|
10838
11181
|
* at call time so a later `logger.configure()` is honoured. The client's
|
|
10839
11182
|
* `info` records (per-request lifecycle) are forwarded as SDK `debug`.
|
|
10840
11183
|
*/
|
|
10841
|
-
const
|
|
11184
|
+
const clientLogForwarder = {
|
|
10842
11185
|
error: (...args) => logger.error(...args),
|
|
10843
11186
|
warn: (...args) => logger.warn(...args),
|
|
10844
11187
|
info: (...args) => logger.debug(...args),
|
|
@@ -11006,11 +11349,13 @@ var Composio = class Composio {
|
|
|
11006
11349
|
userApiKey: config?.userApiKey,
|
|
11007
11350
|
orgApiKey: config?.orgApiKey
|
|
11008
11351
|
});
|
|
11009
|
-
const
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11352
|
+
const credentials = resolveSDKCredentials({
|
|
11353
|
+
apiKey: apiKeyParsed,
|
|
11354
|
+
userApiKey: config?.userApiKey,
|
|
11355
|
+
orgApiKey: config?.orgApiKey,
|
|
11356
|
+
defaultHeaders: config?.defaultHeaders
|
|
11357
|
+
});
|
|
11358
|
+
const defaultHeaders = withoutSDKOwnedHeaders(config?.defaultHeaders);
|
|
11014
11359
|
if (config?.logger !== void 0 || config?.logLevel !== void 0) logger.configure({
|
|
11015
11360
|
level: config.logLevel,
|
|
11016
11361
|
sink: config.logger
|
|
@@ -11027,8 +11372,10 @@ var Composio = class Composio {
|
|
|
11027
11372
|
this.config = {
|
|
11028
11373
|
...config,
|
|
11029
11374
|
baseURL: baseURLParsed,
|
|
11030
|
-
apiKey:
|
|
11031
|
-
|
|
11375
|
+
apiKey: credentials.apiKey,
|
|
11376
|
+
userApiKey: credentials.userApiKey,
|
|
11377
|
+
orgApiKey: credentials.orgApiKey,
|
|
11378
|
+
defaultHeaders,
|
|
11032
11379
|
toolkitVersions: getToolkitVersionsFromEnv(config?.toolkitVersions),
|
|
11033
11380
|
allowTracking: config?.allowTracking ?? CONFIG_DEFAULTS.allowTracking,
|
|
11034
11381
|
dangerouslyAllowAutoUploadDownloadFiles: config?.dangerouslyAllowAutoUploadDownloadFiles ?? CONFIG_DEFAULTS.dangerouslyAllowAutoUploadDownloadFiles,
|
|
@@ -11040,27 +11387,24 @@ var Composio = class Composio {
|
|
|
11040
11387
|
orgId: scope.orgId,
|
|
11041
11388
|
projectId: scope.projectId
|
|
11042
11389
|
};
|
|
11043
|
-
const defaultHeaders = {
|
|
11044
|
-
...this.config.defaultHeaders,
|
|
11045
|
-
...getScopeHeaders(scope)
|
|
11046
|
-
};
|
|
11047
11390
|
/**
|
|
11048
11391
|
* Initialize the Composio SDK client.
|
|
11049
11392
|
* The client is used to make API calls to the Composio API. It sends the
|
|
11050
|
-
*
|
|
11393
|
+
* credential from `auth`, the resolved org/project scope from `scope`, and
|
|
11394
|
+
* the SDK's identity headers from `identity`, and refuses all three in
|
|
11395
|
+
* `defaultHeaders`.
|
|
11051
11396
|
*/
|
|
11052
11397
|
this.client = new ComposioClient({
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
orgApiKey: config?.orgApiKey,
|
|
11398
|
+
auth: toClientAuth(credentials),
|
|
11399
|
+
scope: toClientScope(scope),
|
|
11056
11400
|
baseURL: baseURLParsed,
|
|
11401
|
+
...getEnvVariable("COMPOSIO_ALLOW_INSECURE_HTTP") === "1" ? { allowInsecureHTTP: true } : {},
|
|
11057
11402
|
defaultHeaders,
|
|
11058
11403
|
identity: getClientIdentity(this.provider),
|
|
11059
|
-
logger:
|
|
11060
|
-
logLevel: toClientLogLevel(logger.getLevel())
|
|
11404
|
+
logger: clientLogForwarder,
|
|
11405
|
+
logLevel: toClientLogLevel(logger.getLevel()),
|
|
11406
|
+
transport: createFetchTransport({ fetch: createToolkitDeprecationFetch() })
|
|
11061
11407
|
});
|
|
11062
|
-
this.config.userApiKey = this.client.userApiKey;
|
|
11063
|
-
this.config.orgApiKey = this.client.orgApiKey;
|
|
11064
11408
|
this.tools = new Tools(this.client, this.config);
|
|
11065
11409
|
this.mcp = new MCP(this.client);
|
|
11066
11410
|
this.toolkits = new Toolkits(this.client);
|
|
@@ -11089,7 +11433,7 @@ var Composio = class Composio {
|
|
|
11089
11433
|
* Initialize the client telemetry.
|
|
11090
11434
|
*/
|
|
11091
11435
|
if (this.config.allowTracking) telemetry.setup({
|
|
11092
|
-
apiKey:
|
|
11436
|
+
apiKey: credentials.apiKey ?? "",
|
|
11093
11437
|
baseUrl: baseURLParsed ?? "",
|
|
11094
11438
|
isAgentic: this.provider?._isAgentic || false,
|
|
11095
11439
|
version,
|
|
@@ -11164,14 +11508,9 @@ var Composio = class Composio {
|
|
|
11164
11508
|
* ```
|
|
11165
11509
|
*/
|
|
11166
11510
|
createSession(options) {
|
|
11167
|
-
const userApiKeyHeader = getUserApiKeyHeader(options?.headers) ? void 0 : getUserApiKeyHeader(this.config.defaultHeaders);
|
|
11168
|
-
const sessionHeaders = userApiKeyHeader ? {
|
|
11169
|
-
[userApiKeyHeader.name]: userApiKeyHeader.value,
|
|
11170
|
-
...options?.headers
|
|
11171
|
-
} : options?.headers;
|
|
11172
11511
|
return new Composio({
|
|
11173
11512
|
...this.config,
|
|
11174
|
-
defaultHeaders:
|
|
11513
|
+
defaultHeaders: options?.headers
|
|
11175
11514
|
});
|
|
11176
11515
|
}
|
|
11177
11516
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { dr as BaseComposioProvider } from "./customTool.types-
|
|
2
|
-
import { n as ComposioConfig } from "./composio-
|
|
1
|
+
import { dr as BaseComposioProvider } from "./customTool.types-BoOELgJF.mjs";
|
|
2
|
+
import { n as ComposioConfig } from "./composio-BMDH-1Qj.mjs";
|
|
3
3
|
//#region src/utils/config-defaults/types.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Configuration defaults for Composio.
|