@composio/core 0.18.0 → 0.19.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.
Files changed (62) hide show
  1. package/dist/{CustomTool-C4tv-GL1.mjs → CustomTool-BMlZfJVz.mjs} +16 -6
  2. package/dist/{CustomTool-BKhHv2hJ.d.mts → CustomTool-CB5vm1Jc.d.mts} +1 -1
  3. package/dist/{FileModifierErrors-B8V8_3VE.mjs → FileModifierErrors-BqFmpRsm.mjs} +1 -1
  4. package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
  5. package/dist/{SsrfErrors-DNJt57GL.mjs → SsrfErrors-C91YhASE.mjs} +137 -13
  6. package/dist/{Telemetry-CBtSnWrm.mjs → Telemetry-HlftxMx6.mjs} +2 -34
  7. package/dist/{cancellation-jUVItfHw.mjs → cancellation-CXpfmiVo.mjs} +7 -5
  8. package/dist/{composio-CldtZUyC.d.mts → composio-DLGaeN70.d.mts} +333 -32
  9. package/dist/{customTool.types-DC5fPOOi.d.mts → customTool.types-BAmEh3MB.d.mts} +131 -38
  10. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +2 -2
  11. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +3 -13
  12. package/dist/docs/reference/sdk-reference/typescript/session.mdx +50 -6
  13. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +4 -4
  14. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +33 -23
  15. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +3 -2
  16. package/dist/{errors-DyZt79fi.mjs → errors-BuEKehbI.mjs} +23 -3
  17. package/dist/experimental/index.d.mts +2 -2
  18. package/dist/experimental/index.mjs +1 -1
  19. package/dist/{fileUtils.node-BwpUOF0s.mjs → fileUtils.node-L7XD8UPr.mjs} +11 -9
  20. package/dist/index.d.mts +164 -104
  21. package/dist/index.mjs +382 -153
  22. package/dist/models/Files.node.d.mts +2 -3
  23. package/dist/models/Files.node.mjs +2 -2
  24. package/dist/models/Files.workerd.d.mts +2 -3
  25. package/dist/platform/node.d.mts +2 -3
  26. package/dist/platform/workerd.d.mts +2 -3
  27. package/dist/{sensitiveFileUploadPaths-B0w8dqpv.mjs → sensitiveFileUploadPaths-B6pBt9lO.mjs} +10 -7
  28. package/dist/{ssrfGuard.node-DlxO8uzr.mjs → ssrfGuard.node-B9xQB4za.mjs} +197 -30
  29. package/dist/{types-BgsRW-XH.d.mts → types-CxLPO0Xq.d.mts} +2 -2
  30. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
  31. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
  32. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
  33. package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
  34. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
  35. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  36. package/dist/utils/ssrfGuard.node.d.mts +19 -10
  37. package/dist/utils/ssrfGuard.node.mjs +1 -1
  38. package/dist/utils/ssrfGuard.workerd.d.mts +12 -4
  39. package/dist/utils/ssrfGuard.workerd.mjs +2 -2
  40. package/package.json +26 -8
  41. package/src/errors/ToolErrors.ts +24 -0
  42. package/src/index.ts +4 -0
  43. package/src/models/CustomTool.ts +41 -6
  44. package/src/models/MCP.ts +29 -15
  45. package/src/models/RemoteFile.ts +54 -36
  46. package/src/models/ToolRouter.ts +1 -0
  47. package/src/models/ToolRouterSession.ts +115 -13
  48. package/src/models/Toolkits.ts +1 -2
  49. package/src/models/Tools.ts +55 -25
  50. package/src/models/Triggers.ts +22 -2
  51. package/src/services/pusher/Pusher.ts +29 -10
  52. package/src/telemetry/redact.ts +133 -6
  53. package/src/types/toolRouter.types.ts +54 -3
  54. package/src/types/toolkit.types.ts +17 -0
  55. package/src/utils/fileUtils.node.ts +10 -2
  56. package/src/utils/jsonSchema.ts +4 -1
  57. package/src/utils/logger.ts +6 -6
  58. package/src/utils/pinnedDispatcher.node.ts +109 -13
  59. package/src/utils/sdk.ts +1 -1
  60. package/src/utils/ssrfGuard.node.ts +153 -27
  61. package/src/utils/ssrfGuard.workerd.ts +15 -1
  62. package/src/utils/transformers/toolkits.ts +79 -2
package/dist/index.mjs CHANGED
@@ -1,17 +1,16 @@
1
- import { a as COMPOSIO_DIR, c as DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID, d as USER_DATA_FILE_NAME, f as constants_exports, i as logger, l as IS_DEVELOPMENT_OR_CI, m as getEnvsWithPrefix, n as SsrfErrorCodes, o as COMPOSIO_LOG_LEVEL, p as getEnvVariable, r as ComposioError, s as DEFAULT_BASE_URL, t as ComposioBlockedInternalUrlError, u as TEMP_FILES_DIRECTORY_NAME } from "./SsrfErrors-DNJt57GL.mjs";
2
- import { A as ToolErrorCodes, B as ComposioSharedAccessDeniedError, C as ComposioInvalidExecuteFunctionError, D as ComposioToolExecutionError, E as ComposioProviderNotDefinedError, F as ComposioAclOnlyForSharedError, H as ConnectedAccountErrorCodes, I as ComposioConnectedAccountNotFoundError, L as ComposioFailedToCreateConnectedAccountLink, M as ConnectionRequestErrorCodes, N as ConnectionRequestFailedError, O as ComposioToolNotFoundError, P as ConnectionRequestTimeoutError, R as ComposioLegacyConnectedAccountsEndpointRetiredError, S as ComposioGlobalExecuteToolFnNotSetError, T as ComposioInvalidToolArgumentsError, U as AuthConfigErrorCodes, V as ComposioSharedConnectionNotAccessibleError, W as ComposioAuthConfigNotFoundError, _ as ValidationError, a as ComposioFailedToSubscribeToPusherChannelError, b as ComposioToolkitNotFoundError, c as ComposioWebhookPayloadError, d as ComposioNoAPIKeyError, f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, i as ComposioFailedToGetSDKRealtimeCredentialsError, j as handleToolExecutionError, k as ComposioToolVersionRequiredError, l as ComposioWebhookSignatureVerificationError, m as isRequestAbortError, n as RemoteFileErrorCodes, o as ComposioFailedToUnsubscribeFromPusherChannelError, p as SDKErrorCodes, r as ComposioFailedToCreatePusherClientError, s as ComposioTriggerTypeNotFoundError, t as RemoteFileDownloadError, u as TriggerErrorCodes, v as ValidationErrorCodes, w as ComposioInvalidModifierError, x as ToolkitErrorCodes, y as ComposioToolkitFetchError, z as ComposioMultipleConnectedAccountsError } from "./errors-DyZt79fi.mjs";
3
- import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "./FileModifierErrors-B8V8_3VE.mjs";
4
- import { n as dropEmptyFileUploads, o as isPlainObject, s as schemaHasFileUploadable } from "./FileToolModifier.utils.neutral-D_YkHwZP.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-jUVItfHw.mjs";
6
- import { t as telemetry } from "./Telemetry-CBtSnWrm.mjs";
7
- import { a as arrayBufferToBase64, c as getRandomShortId, i as readResponseBodyWithLimit, n as assertSafeFileUploadPath, r as isBlockedSensitiveFileUploadPath, t as BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS } from "./sensitiveFileUploadPaths-B0w8dqpv.mjs";
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-C4tv-GL1.mjs";
1
+ import { c as DEFAULT_BASE_URL, d as TEMP_FILES_DIRECTORY_NAME, f as USER_DATA_FILE_NAME, h as getEnvsWithPrefix, i as logger, l as DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID, m as getEnvVariable, n as SsrfErrorCodes, o as COMPOSIO_DIR, p as constants_exports, r as ComposioError, s as COMPOSIO_LOG_LEVEL, t as ComposioBlockedInternalUrlError, u as IS_DEVELOPMENT_OR_CI } from "./SsrfErrors-C91YhASE.mjs";
2
+ import { A as ComposioToolVersionRequiredError, B as ComposioMultipleConnectedAccountsError, C as ComposioInvalidExecuteFunctionError, D as ComposioToolExecutionError, E as ComposioProviderNotDefinedError, F as ConnectionRequestTimeoutError, G as ComposioAuthConfigNotFoundError, H as ComposioSharedConnectionNotAccessibleError, I as ComposioAclOnlyForSharedError, L as ComposioConnectedAccountNotFoundError, M as handleToolExecutionError, N as ConnectionRequestErrorCodes, O as ComposioToolFetchError, P as ConnectionRequestFailedError, R as ComposioFailedToCreateConnectedAccountLink, S as ComposioGlobalExecuteToolFnNotSetError, T as ComposioInvalidToolArgumentsError, U as ConnectedAccountErrorCodes, V as ComposioSharedAccessDeniedError, W as AuthConfigErrorCodes, _ as ValidationError, a as ComposioFailedToSubscribeToPusherChannelError, b as ComposioToolkitNotFoundError, c as ComposioWebhookPayloadError, d as ComposioNoAPIKeyError, f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, i as ComposioFailedToGetSDKRealtimeCredentialsError, j as ToolErrorCodes, k as ComposioToolNotFoundError, l as ComposioWebhookSignatureVerificationError, m as isRequestAbortError, n as RemoteFileErrorCodes, o as ComposioFailedToUnsubscribeFromPusherChannelError, p as SDKErrorCodes, r as ComposioFailedToCreatePusherClientError, s as ComposioTriggerTypeNotFoundError, t as RemoteFileDownloadError, u as TriggerErrorCodes, v as ValidationErrorCodes, w as ComposioInvalidModifierError, x as ToolkitErrorCodes, y as ComposioToolkitFetchError, z as ComposioLegacyConnectedAccountsEndpointRetiredError } from "./errors-BuEKehbI.mjs";
3
+ import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "./FileModifierErrors-BqFmpRsm.mjs";
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-CXpfmiVo.mjs";
6
+ import { t as telemetry } from "./Telemetry-HlftxMx6.mjs";
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-B6pBt9lO.mjs";
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-BMlZfJVz.mjs";
9
9
  import ComposioClient, { APIError, BadRequestError } 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";
13
13
  import { platform } from "#platform";
14
- import { APIError as APIError$1 } from "openai";
15
14
  import semver from "semver";
16
15
  import { Files } from "#files";
17
16
  import { ssrfSafeFetch, ssrfSafeFetchWhereSupported } from "#ssrf_guard";
@@ -1333,14 +1332,16 @@ var Tools = class {
1333
1332
  toolkitSlug,
1334
1333
  params
1335
1334
  }, modifiers?.beforeFileUpload, requestOptions);
1336
- if (modifiers?.beforeExecute) if (typeof modifiers.beforeExecute === "function") {
1337
- modifiedParams = await modifiers.beforeExecute({
1338
- toolSlug,
1339
- toolkitSlug,
1340
- params: modifiedParams
1341
- });
1342
- if (requestOptions?.signal?.aborted) throw new ComposioRequestCancelledError();
1343
- } else throw new ComposioInvalidModifierError("Invalid beforeExecute modifier. Not a function.");
1335
+ if (modifiers?.beforeExecute) {
1336
+ if (typeof modifiers.beforeExecute === "function") {
1337
+ modifiedParams = await modifiers.beforeExecute({
1338
+ toolSlug,
1339
+ toolkitSlug,
1340
+ params: modifiedParams
1341
+ });
1342
+ if (requestOptions?.signal?.aborted) throw new ComposioRequestCancelledError();
1343
+ } else throw new ComposioInvalidModifierError("Invalid beforeExecute modifier. Not a function.");
1344
+ }
1344
1345
  return modifiedParams;
1345
1346
  }
1346
1347
  /**
@@ -1389,12 +1390,14 @@ var Tools = class {
1389
1390
  result: modifiedResult,
1390
1391
  signal: requestOptions?.signal
1391
1392
  });
1392
- if (modifier) if (typeof modifier === "function") modifiedResult = await modifier({
1393
- toolSlug,
1394
- toolkitSlug,
1395
- result: modifiedResult
1396
- });
1397
- else throw new ComposioInvalidModifierError("Invalid afterExecute modifier. Not a function.");
1393
+ if (modifier) {
1394
+ if (typeof modifier === "function") modifiedResult = await modifier({
1395
+ toolSlug,
1396
+ toolkitSlug,
1397
+ result: modifiedResult
1398
+ });
1399
+ else throw new ComposioInvalidModifierError("Invalid afterExecute modifier. Not a function.");
1400
+ }
1398
1401
  return modifiedResult;
1399
1402
  }
1400
1403
  /**
@@ -1593,7 +1596,14 @@ var Tools = class {
1593
1596
  tool = await withCancellation(() => this.client.tools.retrieve(slug, retrieveParams, requestOptions), requestOptions?.signal);
1594
1597
  } catch (error) {
1595
1598
  if (error instanceof ComposioRequestCancelledError) throw error;
1596
- throw new ComposioToolNotFoundError(`Unable to retrieve tool with slug ${slug}`, { cause: error });
1599
+ if (error instanceof APIError && (error.status === 404 || error.status === 400)) throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`, {
1600
+ meta: { slug },
1601
+ cause: error
1602
+ });
1603
+ throw new ComposioToolFetchError(`Unable to retrieve tool with slug ${slug}`, {
1604
+ meta: { slug },
1605
+ cause: error
1606
+ });
1597
1607
  }
1598
1608
  let [modifiedTool] = await this.applyDefaultSchemaModifiers([this.transformToolCases(tool)]);
1599
1609
  if (options?.modifySchema) {
@@ -1801,6 +1811,10 @@ var Tools = class {
1801
1811
  *
1802
1812
  * @example Execute with a specific version (recommended for production)
1803
1813
  * ```typescript
1814
+ * // Look up the tool's current version once, then pin that string in your code or config
1815
+ * const { version } = await composio.tools.getRawComposioToolBySlug('GITHUB_GET_REPOS');
1816
+ * console.log(version); // e.g. '20250909_00'
1817
+ *
1804
1818
  * const result = await composio.tools.execute('GITHUB_GET_REPOS', {
1805
1819
  * userId: 'default',
1806
1820
  * version: '20250909_00',
@@ -1926,47 +1940,62 @@ var Tools = class {
1926
1940
  return withCancellation(() => this.client.tools.retrieveEnum(requestOptions), requestOptions?.signal);
1927
1941
  }
1928
1942
  /**
1929
- * Fetches the input parameters for a given tool.
1943
+ * Generates arguments for a tool from a natural-language description of the task.
1930
1944
  *
1931
- * This method is used to get the input parameters for a tool before executing it.
1945
+ * Composio uses an LLM to fill the tool's input parameters from `text`. Review the
1946
+ * generated arguments before passing them to `tools.execute()`.
1932
1947
  *
1933
- * @param {string} slug - The ID of the tool to find input for
1934
- * @param {ToolGetInputParams} body - The parameters to be passed to the tool
1935
- * @returns {Promise<ToolGetInputResponse>} The input parameters schema for the specified tool
1948
+ * @param {string} slug - The slug of the tool to generate arguments for
1949
+ * @param {ToolGetInputParams} body - The generation request
1950
+ * @param {string} body.text - What you want the tool to do, in natural language
1951
+ * @param {string} [body.custom_description] - Extra context about the tool for the LLM
1952
+ * @param {string} [body.system_prompt] - System prompt that steers the LLM
1953
+ * @param {string} [body.version] - Tool version to generate arguments for
1954
+ * @returns {Promise<ToolGetInputResponse>} The generated `arguments`, or an `error` when generation fails
1936
1955
  *
1937
1956
  * @example
1938
1957
  * ```typescript
1939
- * // Get input parameters for a specific tool
1940
- * const inputParams = await composio.tools.getInput('GITHUB_CREATE_ISSUE', {
1941
- * userId: 'default'
1958
+ * const { arguments: args, error } = await composio.tools.getInput('GITHUB_CREATE_ISSUE', {
1959
+ * text: 'Open an issue in composiohq/composio titled "Docs typo" describing the broken link',
1960
+ * version: '20250909_00',
1942
1961
  * });
1943
- * console.log(inputParams.schema);
1962
+ * if (error) throw new Error(error);
1963
+ * console.log(args); // { owner: 'composiohq', repo: 'composio', title: 'Docs typo', ... }
1944
1964
  * ```
1945
1965
  */
1946
1966
  async getInput(slug, body, requestOptions) {
1947
1967
  return withCancellation(() => this.client.tools.getInput(slug, body, requestOptions), requestOptions?.signal);
1948
1968
  }
1949
1969
  /**
1950
- * Proxies a custom request to a toolkit/integration.
1970
+ * Sends an HTTP request to a toolkit's API, authenticated as a connected account.
1971
+ *
1972
+ * Use it to call an endpoint that no predefined tool covers. Composio injects the
1973
+ * connected account's credentials on the server side.
1951
1974
  *
1952
- * This method allows sending custom requests to a specific toolkit or integration
1953
- * when you need more flexibility than the standard tool execution methods provide.
1975
+ * A relative `endpoint` is appended to the toolkit's base URL, and that base URL can
1976
+ * already include a path. Google Calendar's base URL is
1977
+ * `https://www.googleapis.com/calendar/v3`, so pass `/users/me/calendarList`, not
1978
+ * `/calendar/v3/users/me/calendarList` (which resolves to `/calendar/v3/calendar/v3/...`
1979
+ * and returns a 404 from Google). An absolute URL on the same domain is sent as-is.
1954
1980
  *
1955
- * @param {ToolProxyParams} body - The parameters for the proxy request including toolkit slug and custom data
1956
- * @returns {Promise<ToolProxyResponse>} The response from the proxied request
1981
+ * @param {ToolProxyParams} body - The proxy request
1982
+ * @param {string} body.endpoint - Path relative to the toolkit's base URL, or an absolute URL
1983
+ * @param {'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'} body.method - HTTP method
1984
+ * @param {string} [body.connectedAccountId] - The connected account to authenticate as
1985
+ * @param {unknown} [body.body] - JSON request body
1986
+ * @param {Array<{ in: 'query' | 'header'; name: string; value: string | number }>} [body.parameters] - Extra query parameters or headers
1987
+ * @returns {Promise<ToolProxyResponse>} The upstream status, headers, and parsed body
1957
1988
  *
1958
1989
  * @example
1959
1990
  * ```typescript
1960
- * // Send a custom request to a toolkit
1961
- * const response = await composio.tools.proxyExecute({
1962
- * toolkitSlug: 'github',
1963
- * userId: 'default',
1964
- * data: {
1965
- * endpoint: '/repos/owner/repo/issues',
1966
- * method: 'GET'
1967
- * }
1991
+ * // Google Calendar's base URL is https://www.googleapis.com/calendar/v3
1992
+ * const { status, data } = await composio.tools.proxyExecute({
1993
+ * endpoint: '/users/me/calendarList',
1994
+ * method: 'GET',
1995
+ * connectedAccountId: 'ca_...',
1996
+ * parameters: [{ in: 'query', name: 'maxResults', value: 10 }],
1968
1997
  * });
1969
- * console.log(response.data);
1998
+ * console.log(status, data);
1970
1999
  * ```
1971
2000
  */
1972
2001
  async proxyExecute(body, requestOptions) {
@@ -2052,11 +2081,28 @@ const ToolkitAuthFieldSchema = z$1.object({
2052
2081
  required: z$1.boolean(),
2053
2082
  name: z$1.string(),
2054
2083
  type: z$1.string(),
2055
- default: z$1.string().nullable().optional()
2084
+ default: z$1.string().nullable().optional(),
2085
+ /**
2086
+ * Whether this field holds a secret/credential value. Clients use it to
2087
+ * decide whether to mask the input when collecting the value in their own
2088
+ * UI. The property is absent when the API omits the flag for the field.
2089
+ */
2090
+ isSecret: z$1.boolean().optional(),
2091
+ /**
2092
+ * The legacy template name the API reports for this field, mapped from
2093
+ * `legacy_template_name`. The API declares it as an optional string without
2094
+ * further documenting its semantics.
2095
+ */
2096
+ legacyTemplateName: z$1.string().optional()
2056
2097
  });
2057
2098
  const ToolkitAuthConfigDetailsSchema = z$1.object({
2058
2099
  name: z$1.string(),
2059
2100
  mode: z$1.string(),
2101
+ /**
2102
+ * URL to a page where users can obtain or configure credentials for this
2103
+ * authentication method, e.g. `https://github.com/settings/tokens`.
2104
+ */
2105
+ authHintUrl: z$1.string().nullable().optional(),
2060
2106
  fields: z$1.object({
2061
2107
  authConfigCreation: z$1.object({
2062
2108
  optional: z$1.array(ToolkitAuthFieldSchema),
@@ -2252,7 +2298,8 @@ var AuthConfigs = class {
2252
2298
  show_disabled: parsedQuery?.showDisabled,
2253
2299
  toolkit_slug: parsedQuery?.toolkit
2254
2300
  };
2255
- return transformAuthConfigListResponse(await withCancellation(() => this.client.authConfigs.list(listParams, requestOptions), requestOptions?.signal));
2301
+ const result = await withCancellation(() => this.client.authConfigs.list(listParams, requestOptions), requestOptions?.signal);
2302
+ return transformAuthConfigListResponse(result);
2256
2303
  }
2257
2304
  /**
2258
2305
  * Create a new auth config
@@ -2296,7 +2343,8 @@ var AuthConfigs = class {
2296
2343
  tool_access_config: parsedOptions.data.toolAccessConfig ? { tools_for_connected_account_creation: parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation } : void 0
2297
2344
  }
2298
2345
  };
2299
- return transformCreateAuthConfigResponse(await withCancellation(() => this.client.authConfigs.create(createBody, requestOptions), requestOptions?.signal));
2346
+ const result = await withCancellation(() => this.client.authConfigs.create(createBody, requestOptions), requestOptions?.signal);
2347
+ return transformCreateAuthConfigResponse(result);
2300
2348
  }
2301
2349
  /**
2302
2350
  * Retrieves a specific authentication configuration by its ID.
@@ -2318,7 +2366,8 @@ var AuthConfigs = class {
2318
2366
  * ```
2319
2367
  */
2320
2368
  async get(nanoid, requestOptions) {
2321
- return transformAuthConfigRetrieveResponse(await withCancellation(() => this.client.authConfigs.retrieve(nanoid, requestOptions), requestOptions?.signal));
2369
+ const result = await withCancellation(() => this.client.authConfigs.retrieve(nanoid, requestOptions), requestOptions?.signal);
2370
+ return transformAuthConfigRetrieveResponse(result);
2322
2371
  }
2323
2372
  /**
2324
2373
  * Updates an existing authentication configuration.
@@ -3065,7 +3114,8 @@ var ConnectedAccounts = class {
3065
3114
  ...parsedQuery.data.accountType !== void 0 && { account_type: parsedQuery.data.accountType }
3066
3115
  };
3067
3116
  }
3068
- return transformConnectedAccountListResponse(await withCancellation(() => this.client.connectedAccounts.list(rawQuery, requestOptions), requestOptions?.signal));
3117
+ const result = await withCancellation(() => this.client.connectedAccounts.list(rawQuery, requestOptions), requestOptions?.signal);
3118
+ return transformConnectedAccountListResponse(result);
3069
3119
  }
3070
3120
  /**
3071
3121
  * Compound function to create a new connected account.
@@ -3280,7 +3330,8 @@ var ConnectedAccounts = class {
3280
3330
  * ```
3281
3331
  */
3282
3332
  async get(nanoid, requestOptions) {
3283
- return transformConnectedAccountResponse(await withCancellation(() => this.client.connectedAccounts.retrieve(nanoid, requestOptions), requestOptions?.signal));
3333
+ const response = await withCancellation(() => this.client.connectedAccounts.retrieve(nanoid, requestOptions), requestOptions?.signal);
3334
+ return transformConnectedAccountResponse(response);
3284
3335
  }
3285
3336
  /**
3286
3337
  * Deletes a connected account.
@@ -3445,6 +3496,32 @@ var ConnectedAccounts = class {
3445
3496
 
3446
3497
  //#endregion
3447
3498
  //#region src/utils/transformers/toolkits.ts
3499
+ const transformToolkitAuthField = (field) => ({
3500
+ name: field.name,
3501
+ displayName: field.displayName,
3502
+ description: field.description,
3503
+ type: field.type,
3504
+ required: field.required,
3505
+ ...field.default !== void 0 && { default: field.default },
3506
+ ...field.is_secret !== void 0 && { isSecret: field.is_secret },
3507
+ ...field.legacy_template_name !== void 0 && { legacyTemplateName: field.legacy_template_name }
3508
+ });
3509
+ /**
3510
+ * Normalize one field group to empty lists when the API omits it, the way this
3511
+ * repo's own docs pipeline does (`docs/lib/toolkit-api.ts` defaults a missing
3512
+ * group to `{ required: [], optional: [] }`).
3513
+ *
3514
+ * The generated client declares both groups and both lists as required, but a
3515
+ * response that omits one reached zod and failed validation there. Mapping it
3516
+ * eagerly would instead throw a `TypeError` on the property access, before
3517
+ * validation, turning a handled validation error into a crash of
3518
+ * `toolkits.get()`. Normalizing also leaves the other group usable, which is
3519
+ * typically the one the caller asked for.
3520
+ */
3521
+ const transformToolkitAuthFieldGroup = (group) => ({
3522
+ required: (group?.required ?? []).map(transformToolkitAuthField),
3523
+ optional: (group?.optional ?? []).map(transformToolkitAuthField)
3524
+ });
3448
3525
  const transformToolkitListResponse = (response) => {
3449
3526
  return transform(response).with(ToolKitListResponseSchema).using((response) => response.items.map((item) => ({
3450
3527
  name: item.name,
@@ -3490,9 +3567,10 @@ const transformToolkitRetrieveResponse = (response) => {
3490
3567
  authConfigDetails: response.auth_config_details?.map((authConfig) => ({
3491
3568
  name: authConfig.name,
3492
3569
  mode: authConfig.mode,
3570
+ ...authConfig.auth_hint_url !== void 0 && { authHintUrl: authConfig.auth_hint_url },
3493
3571
  fields: {
3494
- authConfigCreation: authConfig.fields.auth_config_creation,
3495
- connectedAccountInitiation: authConfig.fields.connected_account_initiation
3572
+ authConfigCreation: transformToolkitAuthFieldGroup(authConfig.fields?.auth_config_creation),
3573
+ connectedAccountInitiation: transformToolkitAuthFieldGroup(authConfig.fields?.connected_account_initiation)
3496
3574
  },
3497
3575
  proxy: { baseUrl: authConfig.proxy?.base_url }
3498
3576
  })),
@@ -3549,7 +3627,8 @@ var Toolkits = class {
3549
3627
  cursor: parsedQuery.data.cursor,
3550
3628
  limit: parsedQuery.data.limit
3551
3629
  };
3552
- return transformToolkitListResponse(await withCancellation(() => this.client.toolkits.list(listParams, requestOptions), requestOptions?.signal));
3630
+ const result = await withCancellation(() => this.client.toolkits.list(listParams, requestOptions), requestOptions?.signal);
3631
+ return transformToolkitListResponse(result);
3553
3632
  } catch (error) {
3554
3633
  if (error instanceof ComposioRequestCancelledError) throw error;
3555
3634
  throw new ComposioToolkitFetchError("Failed to fetch toolkits", { cause: error });
@@ -3570,10 +3649,11 @@ var Toolkits = class {
3570
3649
  */
3571
3650
  async getToolkitBySlug(slug, requestOptions) {
3572
3651
  try {
3573
- return transformToolkitRetrieveResponse(await withCancellation(() => this.client.toolkits.retrieve(slug, void 0, requestOptions), requestOptions?.signal));
3652
+ const result = await withCancellation(() => this.client.toolkits.retrieve(slug, void 0, requestOptions), requestOptions?.signal);
3653
+ return transformToolkitRetrieveResponse(result);
3574
3654
  } catch (error) {
3575
3655
  if (error instanceof ComposioRequestCancelledError) throw error;
3576
- if (error instanceof APIError$1 && (error.status === 404 || error.status === 400)) throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
3656
+ if (error instanceof APIError && (error.status === 404 || error.status === 400)) throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
3577
3657
  meta: { slug },
3578
3658
  cause: error
3579
3659
  });
@@ -3650,7 +3730,8 @@ var Toolkits = class {
3650
3730
  * ```
3651
3731
  */
3652
3732
  async listCategories(requestOptions) {
3653
- return transformToolkitRetrieveCategoriesResponse(await withCancellation(() => this.client.toolkits.retrieveCategories(requestOptions), requestOptions?.signal));
3733
+ const result = await withCancellation(() => this.client.toolkits.retrieveCategories(requestOptions), requestOptions?.signal);
3734
+ return transformToolkitRetrieveCategoriesResponse(result);
3654
3735
  }
3655
3736
  /**
3656
3737
  * Authorizes a user to use a toolkit.
@@ -3670,20 +3751,22 @@ var Toolkits = class {
3670
3751
  const composioAuthConfig = new AuthConfigs(this.client);
3671
3752
  let authConfigIdToUse = authConfigId;
3672
3753
  if (!authConfigIdToUse) authConfigIdToUse = (await composioAuthConfig.list({ toolkit: toolkitSlug }, requestOptions)).items[0]?.id;
3673
- if (!authConfigIdToUse) if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) try {
3674
- authConfigIdToUse = (await composioAuthConfig.create(toolkitSlug, {
3675
- type: "use_composio_managed_auth",
3676
- name: `${toolkit.name} Auth Config`
3677
- }, requestOptions)).id;
3678
- } catch (error) {
3679
- if (error instanceof ComposioClient.APIError && error.status === 400) throw new ComposioAuthConfigNotFoundError(`No Default auth config found for toolkit ${toolkitSlug}`, {
3680
- meta: { toolkitSlug },
3681
- cause: error,
3682
- possibleFixes: [`Please Create an auth config for the toolkit ${toolkitSlug} via the dashboard`]
3683
- });
3684
- throw error;
3754
+ if (!authConfigIdToUse) {
3755
+ if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) try {
3756
+ authConfigIdToUse = (await composioAuthConfig.create(toolkitSlug, {
3757
+ type: "use_composio_managed_auth",
3758
+ name: `${toolkit.name} Auth Config`
3759
+ }, requestOptions)).id;
3760
+ } catch (error) {
3761
+ if (error instanceof ComposioClient.APIError && error.status === 400) throw new ComposioAuthConfigNotFoundError(`No Default auth config found for toolkit ${toolkitSlug}`, {
3762
+ meta: { toolkitSlug },
3763
+ cause: error,
3764
+ possibleFixes: [`Please Create an auth config for the toolkit ${toolkitSlug} via the dashboard`]
3765
+ });
3766
+ throw error;
3767
+ }
3768
+ else throw new ComposioAuthConfigNotFoundError(`No auth configs found for toolkit ${toolkitSlug}`, { meta: { toolkitSlug } });
3685
3769
  }
3686
- else throw new ComposioAuthConfigNotFoundError(`No auth configs found for toolkit ${toolkitSlug}`, { meta: { toolkitSlug } });
3687
3770
  return await new ConnectedAccounts(this.client).initiate(userId, authConfigIdToUse, { allowMultiple: true }, requestOptions);
3688
3771
  }
3689
3772
  };
@@ -4048,14 +4131,28 @@ var PusherService = class {
4048
4131
  * @param channelName - The name of the Pusher channel to subscribe to
4049
4132
  * @param event - The event to subscribe to
4050
4133
  * @param fn - The function to call when the event is received
4134
+ * @param onSubscriptionError - Optional callback invoked with the raw payload when the
4135
+ * Pusher subscription fails (for example on auth or permission rejection). Errors thrown
4136
+ * from — or promises rejected by — this callback are contained and logged, never rethrown.
4051
4137
  */
4052
- async subscribe(fn) {
4138
+ async subscribe(fn, onSubscriptionError) {
4053
4139
  try {
4054
4140
  logger.debug(`[PusherService] Subscribing to channel: ${this.pusherChannel}`);
4055
4141
  const channel = await (await this.getPusherClient()).subscribe(this.pusherChannel);
4142
+ const logCallbackFailure = (callbackError) => {
4143
+ const errorMessage = callbackError instanceof Error ? callbackError.message : String(callbackError);
4144
+ logger.error("❌ Error in subscription error callback:", errorMessage);
4145
+ };
4056
4146
  channel.bind("pusher:subscription_error", (data) => {
4057
- const error = data.error ? String(data.error) : "Unknown subscription error";
4058
- throw new ComposioFailedToSubscribeToPusherChannelError(`Trigger subscription error: ${error}`, { cause: error });
4147
+ logger.error("Trigger subscription error:", data);
4148
+ try {
4149
+ Promise.resolve(onSubscriptionError?.(data)).catch(logCallbackFailure);
4150
+ } catch (callbackError) {
4151
+ logCallbackFailure(callbackError);
4152
+ }
4153
+ });
4154
+ channel.bind("pusher:subscription_succeeded", () => {
4155
+ logger.info(`✅ Subscribed to triggers. You should start receiving events now.`);
4059
4156
  });
4060
4157
  const safeCallback = (data) => {
4061
4158
  try {
@@ -4066,7 +4163,6 @@ var PusherService = class {
4066
4163
  }
4067
4164
  };
4068
4165
  this.bindWithChunking(channel, "trigger_to_client", safeCallback);
4069
- logger.info(`✅ Subscribed to triggers. You should start receiving events now.`);
4070
4166
  } catch (error) {
4071
4167
  throw new ComposioFailedToSubscribeToPusherChannelError("Failed to subscribe to Pusher channel", { cause: error });
4072
4168
  }
@@ -4182,7 +4278,8 @@ async function hmacSha256Base64(secret, message) {
4182
4278
  hash: "SHA-256"
4183
4279
  }, false, ["sign"]);
4184
4280
  const signatureData = encoder.encode(message);
4185
- return arrayBufferToBase64(await globalThis.crypto.subtle.sign("HMAC", key, signatureData));
4281
+ const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, signatureData);
4282
+ return arrayBufferToBase64(signatureBuffer);
4186
4283
  }
4187
4284
  /**
4188
4285
  * Constant-time comparison of two strings to prevent timing attacks
@@ -4338,7 +4435,8 @@ var Triggers = class {
4338
4435
  trigger_ids: parsedParams.data.triggerIds,
4339
4436
  trigger_names: parsedParams.data.triggerNames
4340
4437
  } : void 0;
4341
- return transformTriggerInstanceListActiveResponse(await withCancellation(() => this.client.triggerInstances.listActive(listParams, requestOptions), requestOptions?.signal));
4438
+ const result = await withCancellation(() => this.client.triggerInstances.listActive(listParams, requestOptions), requestOptions?.signal);
4439
+ return transformTriggerInstanceListActiveResponse(result);
4342
4440
  }
4343
4441
  /**
4344
4442
  * Create a new trigger instance for a user
@@ -4431,7 +4529,8 @@ var Triggers = class {
4431
4529
  toolkit_slugs: parsedQuery.toolkits,
4432
4530
  toolkit_versions: this.toolkitVersions
4433
4531
  };
4434
- return transformTriggerTypeListResponse(await withCancellation(() => this.client.triggersTypes.list(listParams, requestOptions), requestOptions?.signal));
4532
+ const result = await withCancellation(() => this.client.triggersTypes.list(listParams, requestOptions), requestOptions?.signal);
4533
+ return transformTriggerTypeListResponse(result);
4435
4534
  }
4436
4535
  /**
4437
4536
  * Retrieve a trigger type by its slug for the provided version of the app
@@ -4442,7 +4541,8 @@ var Triggers = class {
4442
4541
  */
4443
4542
  async getType(slug, requestOptions) {
4444
4543
  const retrieveParams = { toolkit_versions: this.toolkitVersions };
4445
- return transformTriggerTypeRetrieveResponse(await withCancellation(() => this.client.triggersTypes.retrieve(slug, retrieveParams, requestOptions), requestOptions?.signal));
4544
+ const result = await withCancellation(() => this.client.triggersTypes.retrieve(slug, retrieveParams, requestOptions), requestOptions?.signal);
4545
+ return transformTriggerTypeRetrieveResponse(result);
4446
4546
  }
4447
4547
  /**
4448
4548
  * Fetches the list of all the available trigger enums
@@ -4471,6 +4571,10 @@ var Triggers = class {
4471
4571
  logger.debug("Trigger does not match connectedAccountId filter", JSON.stringify(filters.connectedAccountId, null, 2));
4472
4572
  return false;
4473
4573
  }
4574
+ if (filters.authConfigId && filters.authConfigId !== data.metadata.connectedAccount.authConfigId) {
4575
+ logger.debug("Trigger does not match authConfigId filter", JSON.stringify(filters.authConfigId, null, 2));
4576
+ return false;
4577
+ }
4474
4578
  if (filters.triggerSlug?.length && !filters.triggerSlug.map((triggerSlug) => triggerSlug.toLowerCase()).includes(data.triggerSlug.toLowerCase())) {
4475
4579
  logger.debug("Trigger does not match triggerSlug filter", JSON.stringify(filters.triggerSlug, null, 2));
4476
4580
  return false;
@@ -4491,6 +4595,10 @@ var Triggers = class {
4491
4595
  *
4492
4596
  * @param fn - The function to call when a trigger is received
4493
4597
  * @param filters - The filters to apply to the triggers
4598
+ * @param onSubscriptionError - Optional callback invoked with the raw Pusher payload when
4599
+ * the underlying subscription fails (for example on auth or permission rejection). The
4600
+ * subscribe promise still resolves; this is the only programmatic signal of the failure.
4601
+ * Errors thrown from — or promises rejected by — the callback are contained and logged.
4494
4602
  *
4495
4603
  * @example
4496
4604
  * ```ts
@@ -4500,7 +4608,7 @@ var Triggers = class {
4500
4608
  * }, );
4501
4609
  * ```
4502
4610
  */
4503
- async subscribe(fn, filters = {}) {
4611
+ async subscribe(fn, filters = {}, onSubscriptionError) {
4504
4612
  if (!fn) throw new Error("Function is required for trigger subscription");
4505
4613
  const parsedFilters = TriggerSubscribeParamSchema.safeParse(filters);
4506
4614
  if (!parsedFilters.success) throw new ValidationError(`Invalid parameters passed to subscribe to triggers`, { cause: parsedFilters.error });
@@ -4514,7 +4622,7 @@ var Triggers = class {
4514
4622
  logger.error("❌ Error in trigger callback:", error);
4515
4623
  }
4516
4624
  else logger.debug("Trigger does not match filters", JSON.stringify(parsedFilters.data, null, 2));
4517
- });
4625
+ }, onSubscriptionError);
4518
4626
  }
4519
4627
  /**
4520
4628
  * Tries to parse data as V1, V2, or V3 webhook payload format.
@@ -4707,11 +4815,14 @@ var Triggers = class {
4707
4815
  const id = getHeader(headers, WEBHOOK_HEADERS.id);
4708
4816
  const timestamp = getHeader(headers, WEBHOOK_HEADERS.timestamp);
4709
4817
  const signature = getHeader(headers, WEBHOOK_HEADERS.signature);
4710
- if (!id || !timestamp || !signature) throw new ValidationError(`Cannot verify webhook: missing signature header(s) ${[
4711
- !id ? `'${WEBHOOK_HEADERS.id}'` : void 0,
4712
- !timestamp ? `'${WEBHOOK_HEADERS.timestamp}'` : void 0,
4713
- !signature ? `'${WEBHOOK_HEADERS.signature}'` : void 0
4714
- ].filter((header) => header !== void 0).join(", ")}. Pass the raw, unparsed request body and ensure the Composio signature headers (${WEBHOOK_HEADERS.id}, ${WEBHOOK_HEADERS.timestamp}, ${WEBHOOK_HEADERS.signature}) are forwarded to triggers.parse(). To parse without verifying, omit 'verifySecret'.`);
4818
+ if (!id || !timestamp || !signature) {
4819
+ const missing = [
4820
+ !id ? `'${WEBHOOK_HEADERS.id}'` : void 0,
4821
+ !timestamp ? `'${WEBHOOK_HEADERS.timestamp}'` : void 0,
4822
+ !signature ? `'${WEBHOOK_HEADERS.signature}'` : void 0
4823
+ ].filter((header) => header !== void 0);
4824
+ throw new ValidationError(`Cannot verify webhook: missing signature header(s) ${missing.join(", ")}. Pass the raw, unparsed request body and ensure the Composio signature headers (${WEBHOOK_HEADERS.id}, ${WEBHOOK_HEADERS.timestamp}, ${WEBHOOK_HEADERS.signature}) are forwarded to triggers.parse(). To parse without verifying, omit 'verifySecret'.`);
4825
+ }
4715
4826
  return this.verifyWebhook({
4716
4827
  payload: body,
4717
4828
  signature,
@@ -4959,7 +5070,8 @@ var Triggers = class {
4959
5070
  if (version === "v1" && value) v1Signatures.push(value);
4960
5071
  }
4961
5072
  if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
4962
- const expectedSignature = await hmacSha256Base64(secret, `${webhookId}.${webhookTimestamp}.${payload}`);
5073
+ const toSign = `${webhookId}.${webhookTimestamp}.${payload}`;
5074
+ const expectedSignature = await hmacSha256Base64(secret, toSign);
4963
5075
  let isValid = false;
4964
5076
  for (const providedSignature of v1Signatures) if (timingSafeEqual(providedSignature, expectedSignature)) {
4965
5077
  isValid = true;
@@ -5146,17 +5258,19 @@ var MCP = class {
5146
5258
  if (config.error) throw new ValidationError("Invalid parameters passed to create mcp config", { cause: config.error });
5147
5259
  const toolkits = [];
5148
5260
  const auth_config_ids = [];
5149
- const custom_tools = config.data.allowedTools ?? [];
5261
+ const allowed_tools = config.data.allowedTools ?? [];
5150
5262
  config.data.toolkits.forEach((toolkit) => {
5151
5263
  if (typeof toolkit === "string") toolkits.push(toolkit);
5152
- else if (toolkit.toolkit) toolkits.push(toolkit.toolkit);
5153
- else if (toolkit.authConfigId) auth_config_ids.push(toolkit.authConfigId);
5264
+ else {
5265
+ if (toolkit.toolkit) toolkits.push(toolkit.toolkit);
5266
+ if (toolkit.authConfigId) auth_config_ids.push(toolkit.authConfigId);
5267
+ }
5154
5268
  });
5155
5269
  const createBody = {
5156
5270
  name,
5157
5271
  toolkits,
5158
5272
  auth_config_ids,
5159
- custom_tools,
5273
+ allowed_tools,
5160
5274
  managed_auth_via_composio: config.data.manuallyManageConnections ? false : true
5161
5275
  };
5162
5276
  const server = await withCancellation(() => this.client.mcp.custom.create(createBody, requestOptions), requestOptions?.signal);
@@ -5216,7 +5330,8 @@ var MCP = class {
5216
5330
  auth_config_ids: params.authConfigs?.length > 0 ? params.authConfigs.join(",") : void 0,
5217
5331
  name: params.name
5218
5332
  };
5219
- return transform(await withCancellation(() => this.client.mcp.list(listParams, requestOptions), requestOptions?.signal)).with(MCPListResponseSchema).using((raw) => ({
5333
+ const listResponse = await withCancellation(() => this.client.mcp.list(listParams, requestOptions), requestOptions?.signal);
5334
+ return transform(listResponse).with(MCPListResponseSchema).using((raw) => ({
5220
5335
  currentPage: raw.current_page,
5221
5336
  totalPages: raw.total_pages,
5222
5337
  items: raw.items.map((item) => ({
@@ -5369,20 +5484,21 @@ var MCP = class {
5369
5484
  if (error) throw new ValidationError("Failed to validate update params", { cause: error });
5370
5485
  const toolkits = [];
5371
5486
  const auth_config_ids = [];
5372
- const custom_tools = params.allowedTools ?? void 0;
5373
5487
  params.toolkits?.forEach((toolkit) => {
5374
5488
  if (typeof toolkit === "string") toolkits.push(toolkit);
5375
- else if (toolkit.toolkit) toolkits.push(toolkit.toolkit);
5376
- else if (toolkit.authConfigId) auth_config_ids.push(toolkit.authConfigId);
5489
+ else {
5490
+ if (toolkit.toolkit) toolkits.push(toolkit.toolkit);
5491
+ if (toolkit.authConfigId) auth_config_ids.push(toolkit.authConfigId);
5492
+ }
5377
5493
  });
5378
5494
  const updateBody = {
5379
- name: params.name ?? void 0,
5380
- ...params.toolkits ? {
5381
- custom_tools,
5495
+ ...params.name !== void 0 ? { name: params.name } : {},
5496
+ ...params.toolkits !== void 0 ? {
5382
5497
  toolkits,
5383
5498
  auth_config_ids
5384
5499
  } : {},
5385
- managed_auth_via_composio: params.manuallyManageConnections ?? void 0
5500
+ ...params.allowedTools !== void 0 ? { allowed_tools: params.allowedTools } : {},
5501
+ ...params.manuallyManageConnections !== void 0 ? { managed_auth_via_composio: !params.manuallyManageConnections } : {}
5386
5502
  };
5387
5503
  return transformMCPItemResponse(await withCancellation(() => this.client.mcp.update(serverId, updateBody, requestOptions), requestOptions?.signal));
5388
5504
  }
@@ -5460,7 +5576,7 @@ function getSDKConfig(baseUrl, apiKey) {
5460
5576
  const baseURLParsed = baseUrl || getEnvVariable("COMPOSIO_BASE_URL") || baseURLFromUserConfig || "https://backend.composio.dev";
5461
5577
  const apiKeyParsed = apiKey || getEnvVariable("COMPOSIO_API_KEY") || apiKeyFromUserConfig || "";
5462
5578
  if (!apiKeyParsed) ComposioError.handleAndThrow(new ComposioNoAPIKeyError());
5463
- logger.debug("Environment", `API Key: ${apiKeyParsed}`);
5579
+ logger.debug("Environment", "API Key: [REDACTED]");
5464
5580
  logger.debug("Environment", `Base URL: ${baseURLParsed}`);
5465
5581
  return {
5466
5582
  baseURL: baseURLParsed,
@@ -6013,7 +6129,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
6013
6129
 
6014
6130
  //#endregion
6015
6131
  //#region package.json
6016
- var version = "0.18.0";
6132
+ var version = "0.19.0";
6017
6133
 
6018
6134
  //#endregion
6019
6135
  //#region src/utils/session.ts
@@ -6346,6 +6462,13 @@ const ToolRouterSessionDeleteResponseSchema = z.object({
6346
6462
  sessionId: z.string(),
6347
6463
  deleted: z.literal(true)
6348
6464
  });
6465
+ const ToolRouterSessionEnsureConnectedOptionsSchema = z.object({
6466
+ callbackUrl: z.string().optional(),
6467
+ alias: z.string().optional(),
6468
+ experimental: ConnectedAccountExperimentalSchema.optional(),
6469
+ /** Max time to wait for a newly-initiated connection to become active, in milliseconds. Defaults to 60000. */
6470
+ timeout: z.number().int().positive().optional()
6471
+ });
6349
6472
 
6350
6473
  //#endregion
6351
6474
  //#region src/lib/toolRouterParams.ts
@@ -6455,18 +6578,24 @@ const transformToolRouterUpdateParams = (config) => {
6455
6578
  for (const [k, v] of Object.entries(config.connectedAccounts)) coerced[k] = typeof v === "string" ? [v] : v;
6456
6579
  params.connected_accounts = coerced;
6457
6580
  }
6458
- if (config.manageConnections !== void 0) if (config.manageConnections === null) params.manage_connections = null;
6459
- else params.manage_connections = transformToolRouterUpdateManageConnectionsParams(config.manageConnections);
6581
+ if (config.manageConnections !== void 0) {
6582
+ if (config.manageConnections === null) params.manage_connections = null;
6583
+ else params.manage_connections = transformToolRouterUpdateManageConnectionsParams(config.manageConnections);
6584
+ }
6460
6585
  const sandboxConfig = config.sandbox !== void 0 ? config.sandbox : config.workbench;
6461
- if (sandboxConfig !== void 0) if (sandboxConfig === null) params.workbench = null;
6462
- else params.workbench = transformToolRouterUpdateSandboxParams(sandboxConfig);
6463
- if (config.multiAccount !== void 0) if (config.multiAccount === null) params.multi_account = null;
6464
- else {
6465
- const ma = {};
6466
- if (config.multiAccount.enable !== void 0) ma.enable = config.multiAccount.enable;
6467
- if (config.multiAccount.maxAccountsPerToolkit !== void 0) ma.max_accounts_per_toolkit = config.multiAccount.maxAccountsPerToolkit;
6468
- if (config.multiAccount.requireExplicitSelection !== void 0) ma.require_explicit_selection = config.multiAccount.requireExplicitSelection;
6469
- params.multi_account = ma;
6586
+ if (sandboxConfig !== void 0) {
6587
+ if (sandboxConfig === null) params.workbench = null;
6588
+ else params.workbench = transformToolRouterUpdateSandboxParams(sandboxConfig);
6589
+ }
6590
+ if (config.multiAccount !== void 0) {
6591
+ if (config.multiAccount === null) params.multi_account = null;
6592
+ else {
6593
+ const ma = {};
6594
+ if (config.multiAccount.enable !== void 0) ma.enable = config.multiAccount.enable;
6595
+ if (config.multiAccount.maxAccountsPerToolkit !== void 0) ma.max_accounts_per_toolkit = config.multiAccount.maxAccountsPerToolkit;
6596
+ if (config.multiAccount.requireExplicitSelection !== void 0) ma.require_explicit_selection = config.multiAccount.requireExplicitSelection;
6597
+ params.multi_account = ma;
6598
+ }
6470
6599
  }
6471
6600
  if (config.preload !== void 0) params.preload = config.preload;
6472
6601
  return params;
@@ -6671,23 +6800,45 @@ var RemoteFile = class RemoteFile {
6671
6800
  get filename() {
6672
6801
  return platform.basename(this.mountRelativePath);
6673
6802
  }
6803
+ downloadError(message, cause, response) {
6804
+ return new RemoteFileDownloadError(message, {
6805
+ statusCode: response?.status,
6806
+ statusText: response?.statusText,
6807
+ downloadUrl: this.downloadUrl,
6808
+ mountRelativePath: this.mountRelativePath,
6809
+ filename: this.filename,
6810
+ cause
6811
+ });
6812
+ }
6813
+ async downloadBytes() {
6814
+ let response;
6815
+ try {
6816
+ response = await ssrfSafeFetchWhereSupported(this.downloadUrl);
6817
+ } catch (error) {
6818
+ if (error instanceof ComposioBlockedInternalUrlError) throw error;
6819
+ throw this.downloadError("Failed to download file", error);
6820
+ }
6821
+ if (!response.ok) {
6822
+ await response.body?.cancel().catch(() => void 0);
6823
+ throw this.downloadError(`Failed to download file: ${response.status} ${response.statusText}`, /* @__PURE__ */ new Error(`HTTP ${response.status}: ${response.statusText}`), response);
6824
+ }
6825
+ try {
6826
+ return {
6827
+ content: response.body ? await readResponseBodyWithLimit(response) : new Uint8Array(await response.arrayBuffer()),
6828
+ contentType: response.headers?.get?.("content-type") ?? ""
6829
+ };
6830
+ } catch (error) {
6831
+ await response.body?.cancel().catch(() => void 0);
6832
+ throw this.downloadError("Failed to read downloaded file", error, response);
6833
+ }
6834
+ }
6674
6835
  /**
6675
6836
  * Fetches the file content as a buffer.
6676
6837
  * @returns The file content as a Uint8Array
6677
6838
  * @throws RemoteFileDownloadError if the fetch fails
6678
6839
  */
6679
6840
  async buffer() {
6680
- const response = await ssrfSafeFetchWhereSupported(this.downloadUrl);
6681
- if (!response.ok) throw new RemoteFileDownloadError(`Failed to download file: ${response.status} ${response.statusText}`, {
6682
- statusCode: response.status,
6683
- statusText: response.statusText,
6684
- downloadUrl: this.downloadUrl,
6685
- mountRelativePath: this.mountRelativePath,
6686
- filename: this.filename,
6687
- cause: /* @__PURE__ */ new Error(`HTTP ${response.status}: ${response.statusText}`)
6688
- });
6689
- const arrayBuffer = await response.arrayBuffer();
6690
- return new Uint8Array(arrayBuffer);
6841
+ return (await this.downloadBytes()).content;
6691
6842
  }
6692
6843
  /**
6693
6844
  * Fetches the file content as UTF-8 text.
@@ -6704,16 +6855,8 @@ var RemoteFile = class RemoteFile {
6704
6855
  * @throws RemoteFileDownloadError if the fetch fails
6705
6856
  */
6706
6857
  async blob() {
6707
- const response = await ssrfSafeFetchWhereSupported(this.downloadUrl);
6708
- if (!response.ok) throw new RemoteFileDownloadError(`Failed to download file: ${response.status} ${response.statusText}`, {
6709
- statusCode: response.status,
6710
- statusText: response.statusText,
6711
- downloadUrl: this.downloadUrl,
6712
- mountRelativePath: this.mountRelativePath,
6713
- filename: this.filename,
6714
- cause: /* @__PURE__ */ new Error(`HTTP ${response.status}: ${response.statusText}`)
6715
- });
6716
- return response.blob();
6858
+ const { content, contentType } = await this.downloadBytes();
6859
+ return new Blob([content], { type: contentType });
6717
6860
  }
6718
6861
  /**
6719
6862
  * Downloads and saves the file to the local filesystem.
@@ -7269,13 +7412,19 @@ const AuthorizeOptionsSchema = z$1.object({
7269
7412
  */
7270
7413
  var ToolRouterSession = class {
7271
7414
  client;
7272
- config;
7415
+ sdkConfig;
7273
7416
  customToolsMap;
7274
7417
  userId;
7275
7418
  sessionId;
7276
7419
  /** Hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`). Exists on every session at runtime, but only surfaced in the type when the session is created with `{ mcp: true }` (which returns `Session`); the default `SessionWithoutMcp` omits `mcp`, so MCP is an explicit opt-in. See https://docs.composio.dev/docs/sessions-via-mcp */
7277
7420
  mcp;
7278
7421
  experimental;
7422
+ /**
7423
+ * Server-side session configuration (toolkit/tool allowlists, tags, preload,
7424
+ * sandbox, manage_connections) as returned by the API. Refreshed in place by
7425
+ * `update()`.
7426
+ */
7427
+ config;
7279
7428
  preload;
7280
7429
  /** Resolved sandbox (code-execution) config returned by the API. `enable` defaults to `true` server-side. */
7281
7430
  sandbox;
@@ -7285,11 +7434,17 @@ var ToolRouterSession = class {
7285
7434
  inlineCustomToolsPayload;
7286
7435
  /** Singleton session context — shared across all custom tool executions */
7287
7436
  sessionContext;
7288
- constructor(client, config, sessionId, mcp, experimentalOverrides, customToolsMap, userId, metadata) {
7437
+ constructor(client, sdkConfig, sessionId, mcp, experimentalOverrides, customToolsMap, userId, metadata) {
7289
7438
  this.client = client;
7290
- this.config = config;
7439
+ this.sdkConfig = sdkConfig;
7291
7440
  this.customToolsMap = customToolsMap;
7292
7441
  this.userId = userId;
7442
+ const config = metadata?.config ?? {
7443
+ user_id: userId ?? "",
7444
+ execute: {},
7445
+ search: {},
7446
+ preload: { tools: [] }
7447
+ };
7293
7448
  if (customToolsMap && !userId) throw new Error("userId is required when custom tools are bound to a session.");
7294
7449
  this.sessionId = sessionId;
7295
7450
  this.mcp = mcp;
@@ -7297,8 +7452,9 @@ var ToolRouterSession = class {
7297
7452
  assistivePrompt: experimentalOverrides?.assistivePrompt,
7298
7453
  files: new ToolRouterSessionFilesMount(client, sessionId)
7299
7454
  };
7300
- this.preload = metadata?.preload ?? { tools: [] };
7301
- this.sandbox = metadata?.workbench;
7455
+ this.config = config;
7456
+ this.preload = metadata?.preload ?? config.preload;
7457
+ this.sandbox = metadata?.workbench ?? config.workbench;
7302
7458
  this.configVersion = metadata?.configVersion;
7303
7459
  this.warnings = metadata?.warnings ?? [];
7304
7460
  this.preloadedCustomToolSlugs = metadata?.preloadedCustomToolSlugs ?? [];
@@ -7325,7 +7481,7 @@ var ToolRouterSession = class {
7325
7481
  * is intercepted: local tools are executed in-process, remote tools are sent to the backend.
7326
7482
  */
7327
7483
  async tools(modifiers, requestOptions) {
7328
- const ToolsModel = new Tools(this.client, this.config);
7484
+ const ToolsModel = new Tools(this.client, this.sdkConfig);
7329
7485
  const rawTools = await ToolsModel.getRawToolRouterSessionTools(this.sessionId, void 0, requestOptions);
7330
7486
  const tools = await this.applySchemaModifier(rawTools, modifiers?.modifySchema);
7331
7487
  const sessionTools = await this.addPreloadedCustomTools(tools, modifiers);
@@ -7338,8 +7494,8 @@ var ToolRouterSession = class {
7338
7494
  assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
7339
7495
  return this.executeBackendSessionTool(ToolsModel, toolSlug, input, modifiers, rawToolBySlug.get(toolSlug.toUpperCase()));
7340
7496
  };
7341
- if (!this.config?.provider) throw new Error("A provider is required when using custom tools with session.tools(). Pass a provider in the Composio constructor.");
7342
- return this.config.provider.wrapTools(sessionTools, routingExecuteFn);
7497
+ if (!this.sdkConfig?.provider) throw new Error("A provider is required when using custom tools with session.tools(). Pass a provider in the Composio constructor.");
7498
+ return this.sdkConfig.provider.wrapTools(sessionTools, routingExecuteFn);
7343
7499
  }
7344
7500
  return modifiers?.modifySchema ? ToolsModel.wrapToolsForToolRouter(this.sessionId, sessionTools, modifiers, rawTools) : ToolsModel.wrapToolsForToolRouter(this.sessionId, sessionTools, modifiers);
7345
7501
  }
@@ -7429,8 +7585,9 @@ var ToolRouterSession = class {
7429
7585
  name: tk.name,
7430
7586
  description: tk.description,
7431
7587
  tools: tk.tools.map((tool) => {
7588
+ const bare = this.customToolsMap.byOriginalSlug.get(tool.slug.toUpperCase());
7432
7589
  return {
7433
- slug: (findCustomToolMapEntryByToolkitAndOriginalSlug(this.customToolsMap, tk.slug, tool.slug) ?? this.customToolsMap.byOriginalSlug.get(tool.slug.toUpperCase()))?.finalSlug ?? tool.slug,
7590
+ slug: (findCustomToolMapEntryByToolkitAndOriginalSlug(this.customToolsMap, tk.slug, tool.slug) ?? (bare?.toolkit && bare.toolkit.toLowerCase() === tk.slug.toLowerCase() ? bare : void 0))?.finalSlug ?? tool.slug,
7434
7591
  name: tool.name,
7435
7592
  description: tool.description,
7436
7593
  toolkit: tk.slug,
@@ -7477,6 +7634,69 @@ var ToolRouterSession = class {
7477
7634
  return createConnectionRequest(this.client, response.connected_account_id, ConnectedAccountStatuses.INITIATED, response.redirect_url);
7478
7635
  }
7479
7636
  /**
7637
+ * Ensure a toolkit has an active connection in this session, reconciling
7638
+ * `authorize()`/`session.link` with the session's active connection state.
7639
+ *
7640
+ * If the session already resolves an ACTIVE connection (or the toolkit is
7641
+ * no-auth), this returns immediately without creating a link — unlike
7642
+ * `authorize()`, which always starts a new link flow, even when one is
7643
+ * already connected. Otherwise it starts the authorization flow and waits
7644
+ * for the new connection to become ACTIVE.
7645
+ *
7646
+ * For interactive flows that should surface the redirect URL instead of
7647
+ * blocking, use `authorize()` and its `waitForConnection()` directly.
7648
+ *
7649
+ * @param toolkit - The toolkit slug to ensure a connection for (e.g. 'github')
7650
+ * @param options - Optional authorization options plus `timeout` (ms to wait
7651
+ * for a newly-initiated connection, default 60000)
7652
+ * @returns The toolkit's canonical slug, whether it was already connected,
7653
+ * and the active connected account (omitted for no-auth toolkits)
7654
+ * @throws {ValidationError} If the options fail validation
7655
+ * @throws {ConnectionRequestTimeoutError} If a newly-initiated connection does
7656
+ * not become active within `timeout`
7657
+ * @throws {ConnectionRequestFailedError} If the new connection enters a failed,
7658
+ * expired, or revoked state
7659
+ *
7660
+ * @example
7661
+ * ```typescript
7662
+ * const session = await composio.sessions.create({ toolkits: ['github'] });
7663
+ * const { wasConnected, connectedAccount } = await session.ensureConnected('github');
7664
+ * if (!wasConnected) console.log('Newly linked:', connectedAccount?.id);
7665
+ * ```
7666
+ */
7667
+ async ensureConnected(toolkit, options, requestOptions) {
7668
+ const parsedOptions = ToolRouterSessionEnsureConnectedOptionsSchema.safeParse(options ?? {});
7669
+ if (!parsedOptions.success) throw new ValidationError("Failed to parse tool router ensureConnected options", { cause: parsedOptions.error });
7670
+ const { callbackUrl, alias, experimental, timeout } = parsedOptions.data;
7671
+ const existing = (await this.toolkits({ toolkits: [toolkit] }, requestOptions)).items.find((item) => item.slug.toLowerCase() === toolkit.toLowerCase());
7672
+ if (existing?.isNoAuth) return {
7673
+ toolkit: existing.slug,
7674
+ wasConnected: true
7675
+ };
7676
+ const activeAccount = existing?.connection?.connectedAccount;
7677
+ if (existing?.connection?.isActive && activeAccount) return {
7678
+ toolkit: existing.slug,
7679
+ wasConnected: true,
7680
+ connectedAccount: {
7681
+ id: activeAccount.id,
7682
+ status: activeAccount.status
7683
+ }
7684
+ };
7685
+ const account = await (await this.authorize(toolkit, {
7686
+ ...callbackUrl !== void 0 && { callbackUrl },
7687
+ ...alias !== void 0 && { alias },
7688
+ ...experimental !== void 0 && { experimental }
7689
+ }, requestOptions)).waitForConnection(timeout);
7690
+ return {
7691
+ toolkit: existing?.slug ?? toolkit,
7692
+ wasConnected: false,
7693
+ connectedAccount: {
7694
+ id: account.id,
7695
+ status: account.status
7696
+ }
7697
+ };
7698
+ }
7699
+ /**
7480
7700
  * Query the connection state of toolkits in the session.
7481
7701
  * Supports pagination and filtering by toolkit slugs.
7482
7702
  */
@@ -7527,20 +7747,22 @@ var ToolRouterSession = class {
7527
7747
  ...params.toolkits?.length ? { toolkits: params.toolkits } : {},
7528
7748
  ...experimental ? { experimental } : {}
7529
7749
  };
7530
- const transformed = transformSearchResponse(await withCancellation(() => this.client.toolRouter.session.search(this.sessionId, searchParams, requestOptions), requestOptions?.signal));
7750
+ const response = await withCancellation(() => this.client.toolRouter.session.search(this.sessionId, searchParams, requestOptions), requestOptions?.signal);
7751
+ const transformed = transformSearchResponse(response);
7531
7752
  return ToolRouterSessionSearchResponseSchema.parse(transformed);
7532
7753
  }
7533
7754
  /**
7534
7755
  * Execute a tool within the session.
7535
7756
  *
7536
- * For custom tools, accepts the original slug (e.g. "GREP") or the
7537
- * full slug (e.g. "LOCAL_GREP"). Custom tools are executed in-process;
7538
- * remote tools are sent to the Composio backend.
7757
+ * For custom tools, accepts the full slug (e.g. "LOCAL_GREP") or the
7758
+ * original slug (e.g. "GREP") when that original slug is unique across
7759
+ * the session's custom tools and toolkits. Custom tools are executed
7760
+ * in-process; remote tools are sent to the Composio backend.
7539
7761
  *
7540
7762
  * @param toolSlug - The tool slug to execute
7541
7763
  * @param arguments_ - Optional tool arguments
7542
7764
  * @param options - Optional execution options
7543
- * @param options.account - Account identifier for direct app tool execution in multi-account sessions. Helper/meta tools either ignore this top-level field or define their own account-selection fields.
7765
+ * @param options.account - Account identifier for direct app tool execution. Accepted on every project: in multi-account sessions it picks the account; on single-account projects it must match one of the session's active connections for the toolkit. Helper/meta tools either ignore this top-level field or define their own account-selection fields.
7544
7766
  * @returns The tool execution result
7545
7767
  */
7546
7768
  async execute(toolSlug, arguments_, options, requestOptions) {
@@ -7562,7 +7784,8 @@ var ToolRouterSession = class {
7562
7784
  if (options?.account) executeParams.account = options.account;
7563
7785
  const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
7564
7786
  if (experimental) executeParams.experimental = experimental;
7565
- const transformed = transformExecuteResponse(await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, requestOptions), requestOptions?.signal));
7787
+ const response = await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, requestOptions), requestOptions?.signal);
7788
+ const transformed = transformExecuteResponse(response);
7566
7789
  return ToolRouterSessionExecuteResponseSchema.parse(transformed);
7567
7790
  }
7568
7791
  /**
@@ -7592,15 +7815,19 @@ var ToolRouterSession = class {
7592
7815
  /**
7593
7816
  * Partially update the session configuration.
7594
7817
  * Only the fields provided will be changed; omitted fields are preserved.
7595
- * Mutates this session's `configVersion`, `preload`, and `warnings` in-place.
7818
+ * Mutates this session's `config`, `configVersion`, `preload`, `sandbox`,
7819
+ * and `warnings` in-place, and resolves to the updated session `config`.
7596
7820
  */
7597
7821
  async update(config, requestOptions) {
7598
- const params = transformToolRouterUpdateParams(ToolRouterUpdateSessionConfigSchema.parse(config));
7822
+ const parsed = ToolRouterUpdateSessionConfigSchema.parse(config);
7823
+ const params = transformToolRouterUpdateParams(parsed);
7599
7824
  const response = await withCancellation(() => this.client.toolRouter.session.patch(this.sessionId, params, requestOptions), requestOptions?.signal);
7600
7825
  this.configVersion = response.config_version;
7826
+ this.config = response.config;
7601
7827
  this.preload = response.config.preload;
7602
7828
  this.sandbox = response.config.workbench;
7603
7829
  this.warnings = response.warnings ?? [];
7830
+ return this.config;
7604
7831
  }
7605
7832
  /**
7606
7833
  * Delete this session.
@@ -7737,6 +7964,7 @@ var ToolRouterSession = class {
7737
7964
  //#region src/models/ToolRouter.ts
7738
7965
  function getSessionMetadata(session) {
7739
7966
  return {
7967
+ config: session.config,
7740
7968
  preload: session.config.preload,
7741
7969
  workbench: session.config.workbench,
7742
7970
  configVersion: session.config_version,
@@ -7748,7 +7976,8 @@ function preloadsAllCustomTools(preload) {
7748
7976
  }
7749
7977
  function prepareInlineCustomTools(options) {
7750
7978
  const { customTools, customToolkits, defaultPreload = false, preloadTools } = options;
7751
- assertNoCustomToolSlugsInPreload(preloadTools, !!(customTools?.length || customToolkits?.length) ? buildCustomToolsMap(customTools ?? [], customToolkits) : void 0);
7979
+ const localCustomToolsMap = !!(customTools?.length || customToolkits?.length) ? buildCustomToolsMap(customTools ?? [], customToolkits) : void 0;
7980
+ assertNoCustomToolSlugsInPreload(preloadTools, localCustomToolsMap);
7752
7981
  const serializedTools = customTools?.length ? serializeCustomTools(customTools, { defaultPreload }) : void 0;
7753
7982
  const serializedToolkits = customToolkits?.length ? serializeCustomToolkits(customToolkits, { defaultPreload }) : void 0;
7754
7983
  return serializedTools || serializedToolkits ? {
@@ -8984,4 +9213,4 @@ const ComposioMcpUpdateResponseSchema = z$1.object({
8984
9213
  });
8985
9214
 
8986
9215
  //#endregion
8987
- export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioSensitiveFilePathBlockedError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolNotFoundError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountStatusSchema, ConnectedAccountStatuses, ConnectedAccountTypeSchema, ConnectedAccountTypes, ConnectionDataSchema, ConnectionExpiredEventSchema, ConnectionRequestErrorCodes, ConnectionRequestFailedError, ConnectionRequestTimeoutError, ConnectionStatus, ConnectionStatuses, CreateAuthConfigParamsSchema, CreateAuthConfigResponseSchema, CreateComposioManagedAuthConfigParamsSchema, CreateConnectedAccountLinkOptionsSchema, CreateConnectedAccountLinkResponseSchema, CreateConnectedAccountOptionsSchema, CreateConnectedAccountParamsSchema, CreateConnectedAccountResponseSchema, CreateCustomAuthConfigParamsSchema, CreateCustomToolBaseSchema, CreateCustomToolkitBaseSchema, CustomAuthParamsSchema, CustomConnectionDataSchema, CustomCreateResponseSchema, CustomOauth1ConnectionDataSchema, CustomOauth2ConnectionDataSchema, CustomToolSlugSchema, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, MCP, MCPAuthOptionsSchema, MCPGenerateURLParamsSchema, MCPGetServerParamsSchema, MCPMultiAppServerSchema, MCPServerCreateResponseSchema, MCPServerListResponseSchema, MCPServerSchema, MCPServerTypeSchema, MCPServerUpdateParamsSchema, MCPSingleAppServerSchema, MCPToolkitConfigSchema, MCPToolkitConfigsArraySchema, McpDeleteResponseSchema, McpListResponseSchema, McpRetrieveResponseSchema, McpUpdateResponseSchema, Oauth1ActiveConnectionDataSchema, Oauth1ConnectionDataSchema, Oauth1ExpiredConnectionDataSchema, Oauth1FailedConnectionDataSchema, Oauth1InactiveConnectionDataSchema, Oauth1InitiatedConnectionDataSchema, Oauth1InitiatingConnectionDataSchema, Oauth2ActiveConnectionDataSchema, Oauth2ConnectionDataSchema, Oauth2ExpiredConnectionDataSchema, Oauth2FailedConnectionDataSchema, Oauth2InactiveConnectionDataSchema, Oauth2InitiatedConnectionDataSchema, Oauth2InitiatingConnectionDataSchema, Oauth2RevokedConnectionDataSchema, OpenAIProvider, RedirectableAuthSchemeSchema, RemoteFile, RemoteFileDataSchema, RemoteFileDownloadError, RemoteFileErrorCodes, SDKErrorCodes, SandboxSizeSchema, SessionPreset, SessionProxyExecuteParamsSchema, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitLatestVersionSchema, ToolkitMangedByEnumSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookTriggerPayloadV3Schema, WebhookVersions, assertSafeFileUploadPath, constants_exports as constants, createConnectionRequest, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, ensureObjectTypeOnProperties, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit, getExtensionFromMimeType, handleToolExecutionError, isBlockedSensitiveFileUploadPath, isRequestAbortError, jsonSchemaToZodSchema, logger, mappingHasRenames, normalizeToolArguments, omitNullToolArguments, removeNonRequiredProperties, restoreOriginalKeys, sanitizeSchemaPropertyKeys, telemetry, toStrictJsonSchema };
9216
+ export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioSensitiveFilePathBlockedError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolFetchError, ComposioToolNotFoundError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountStatusSchema, ConnectedAccountStatuses, ConnectedAccountTypeSchema, ConnectedAccountTypes, ConnectionDataSchema, ConnectionExpiredEventSchema, ConnectionRequestErrorCodes, ConnectionRequestFailedError, ConnectionRequestTimeoutError, ConnectionStatus, ConnectionStatuses, CreateAuthConfigParamsSchema, CreateAuthConfigResponseSchema, CreateComposioManagedAuthConfigParamsSchema, CreateConnectedAccountLinkOptionsSchema, CreateConnectedAccountLinkResponseSchema, CreateConnectedAccountOptionsSchema, CreateConnectedAccountParamsSchema, CreateConnectedAccountResponseSchema, CreateCustomAuthConfigParamsSchema, CreateCustomToolBaseSchema, CreateCustomToolkitBaseSchema, CustomAuthParamsSchema, CustomConnectionDataSchema, CustomCreateResponseSchema, CustomOauth1ConnectionDataSchema, CustomOauth2ConnectionDataSchema, CustomToolSlugSchema, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, MAX_URL_UPLOAD_SIZE_BYTES, MCP, MCPAuthOptionsSchema, MCPGenerateURLParamsSchema, MCPGetServerParamsSchema, MCPMultiAppServerSchema, MCPServerCreateResponseSchema, MCPServerListResponseSchema, MCPServerSchema, MCPServerTypeSchema, MCPServerUpdateParamsSchema, MCPSingleAppServerSchema, MCPToolkitConfigSchema, MCPToolkitConfigsArraySchema, McpDeleteResponseSchema, McpListResponseSchema, McpRetrieveResponseSchema, McpUpdateResponseSchema, Oauth1ActiveConnectionDataSchema, Oauth1ConnectionDataSchema, Oauth1ExpiredConnectionDataSchema, Oauth1FailedConnectionDataSchema, Oauth1InactiveConnectionDataSchema, Oauth1InitiatedConnectionDataSchema, Oauth1InitiatingConnectionDataSchema, Oauth2ActiveConnectionDataSchema, Oauth2ConnectionDataSchema, Oauth2ExpiredConnectionDataSchema, Oauth2FailedConnectionDataSchema, Oauth2InactiveConnectionDataSchema, Oauth2InitiatedConnectionDataSchema, Oauth2InitiatingConnectionDataSchema, Oauth2RevokedConnectionDataSchema, OpenAIProvider, RedirectableAuthSchemeSchema, RemoteFile, RemoteFileDataSchema, RemoteFileDownloadError, RemoteFileErrorCodes, SDKErrorCodes, SandboxSizeSchema, SessionPreset, SessionProxyExecuteParamsSchema, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionEnsureConnectedOptionsSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitLatestVersionSchema, ToolkitMangedByEnumSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookTriggerPayloadV3Schema, WebhookVersions, assertSafeFileUploadPath, constants_exports as constants, createConnectionRequest, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, ensureObjectTypeOnProperties, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit, getExtensionFromMimeType, handleToolExecutionError, isBlockedSensitiveFileUploadPath, isRequestAbortError, jsonSchemaToZodSchema, logger, mappingHasRenames, normalizeToolArguments, omitNullToolArguments, readResponseBodyWithLimit, removeNonRequiredProperties, restoreOriginalKeys, sanitizeSchemaPropertyKeys, telemetry, toStrictJsonSchema };