@composio/core 0.24.0 → 0.25.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 (48) hide show
  1. package/dist/{CustomTool-CnJxXr07.mjs → CustomTool-BYHB7sPs.mjs} +1 -1
  2. package/dist/{CustomTool-CNJysHMK.d.mts → CustomTool-DZY1yLHN.d.mts} +1 -1
  3. package/dist/{cancellation-BQibgpRG.mjs → cancellation-D-tMPk48.mjs} +1 -1
  4. package/dist/{composio-BFTtZj82.d.mts → composio-B8AENilE.d.mts} +22 -10
  5. package/dist/{customTool.types-D57QrTns.d.mts → customTool.types-Bi6-keZC.d.mts} +326 -3
  6. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +10 -10
  7. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +2 -2
  8. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +22 -22
  9. package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -8
  10. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +2 -2
  11. package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -1
  12. package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +2 -2
  13. package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -5
  14. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +15 -15
  15. package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -1
  16. package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -5
  17. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +10 -10
  18. package/dist/docs/reference/sdk-reference/typescript/session.mdx +56 -21
  19. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +6 -6
  20. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +22 -22
  21. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +18 -18
  22. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +25 -25
  23. package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -6
  24. package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +14 -14
  25. package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -13
  26. package/dist/{errors-BN15NcCW.mjs → errors-Cly0vXFh.mjs} +5 -5
  27. package/dist/experimental/index.d.mts +2 -2
  28. package/dist/experimental/index.mjs +1 -1
  29. package/dist/index.d.mts +11 -8
  30. package/dist/index.mjs +301 -143
  31. package/dist/{types-q8TwAngA.d.mts → types-BGDMkEUl.d.mts} +2 -2
  32. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  33. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  34. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  35. package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
  36. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  37. package/package.json +4 -4
  38. package/src/composio.ts +19 -16
  39. package/src/errors/ToolRouterErrors.ts +5 -5
  40. package/src/lib/toolRouterParams.ts +28 -16
  41. package/src/models/ToolRouter.ts +5 -0
  42. package/src/models/ToolRouterSession.ts +17 -0
  43. package/src/models/Triggers.ts +8 -6
  44. package/src/services/pusher/Pusher.ts +159 -88
  45. package/src/types/pusher.types.ts +2 -0
  46. package/src/types/toolRouter.types.ts +103 -17
  47. package/src/utils/session.ts +25 -47
  48. package/src/utils/userCallback.ts +41 -0
@@ -1,5 +1,5 @@
1
- import { lr as BaseComposioProvider } from "./customTool.types-D57QrTns.mjs";
2
- import { n as ComposioConfig } from "./composio-BFTtZj82.mjs";
1
+ import { dr as BaseComposioProvider } from "./customTool.types-Bi6-keZC.mjs";
2
+ import { n as ComposioConfig } from "./composio-B8AENilE.mjs";
3
3
  //#region src/utils/config-defaults/types.d.ts
4
4
  /**
5
5
  * Configuration defaults for Composio.
@@ -1,4 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-q8TwAngA.mjs";
1
+ import { t as ConfigDefaults } from "../../types-BGDMkEUl.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
3
3
  export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-q8TwAngA.mjs";
1
+ import { t as ConfigDefaults } from "../../types-BGDMkEUl.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
3
3
  export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Aa as ToolExecuteResponse, Oa as ToolExecuteParams, Ta as Tool } from "../../customTool.types-D57QrTns.mjs";
1
+ import { Aa as ToolExecuteParams, Da as Tool, Ma as ToolExecuteResponse } from "../../customTool.types-Bi6-keZC.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.node.d.ts
4
4
  export declare class FileToolModifier {
@@ -1,8 +1,8 @@
1
1
  import { i as logger } from "../../SsrfErrors-DiQldIdC.mjs";
2
- import { _ as ComposioRequestCancelledError } from "../../errors-BN15NcCW.mjs";
2
+ import { _ as ComposioRequestCancelledError } from "../../errors-Cly0vXFh.mjs";
3
3
  import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-CdGSABoq.mjs";
4
4
  import { a as isEmptyFileValue, c as transformProperties, i as getSchemaVariants, l as walkFileUploadableLeaves, o as isPlainObject, r as findSchemaVariantWithFileProperty, t as DELETE_VALUE } from "../../FileToolModifier.utils.neutral-DWFpnsj2.mjs";
5
- import { r as dereferenceJsonSchema, t as withCancellation } from "../../cancellation-BQibgpRG.mjs";
5
+ import { r as dereferenceJsonSchema, t as withCancellation } from "../../cancellation-D-tMPk48.mjs";
6
6
  import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-DNLhLg0W.mjs";
7
7
 
8
8
  //#region src/utils/modifiers/FileToolModifier.node.ts
@@ -1,4 +1,4 @@
1
- import { Aa as ToolExecuteResponse, Oa as ToolExecuteParams, Ta as Tool } from "../../customTool.types-D57QrTns.mjs";
1
+ import { Aa as ToolExecuteParams, Da as Tool, Ma as ToolExecuteResponse } from "../../customTool.types-Bi6-keZC.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
4
4
  export declare class FileToolModifier {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "engines": {
5
5
  "node": ">=22.22.3"
6
6
  },
7
- "version": "0.24.0",
7
+ "version": "0.25.0",
8
8
  "description": "",
9
9
  "main": "dist/index.mjs",
10
10
  "publishConfig": {
@@ -117,7 +117,7 @@
117
117
  "ajv": "^8.20.0",
118
118
  "fast-check": "^4.10.2",
119
119
  "hono": "^4.13.13",
120
- "tsdown": "^0.23.0",
120
+ "tsdown": "^0.23.1",
121
121
  "tsx": "^4.23.15",
122
122
  "typedoc": "^0.28.20",
123
123
  "typescript": "npm:@typescript/typescript6@^6.0.2",
@@ -128,10 +128,10 @@
128
128
  "zod": ">=3.25.76 <5"
129
129
  },
130
130
  "dependencies": {
131
- "@composio/client": "2.0.0-rc.14",
131
+ "@composio/client": "2.0.0-rc.17",
132
132
  "@types/json-schema": "^7.0.15",
133
133
  "is-fs-case-sensitive": "^2.0.0",
134
- "openai": "^7.31.0",
134
+ "openai": "^7.32.0",
135
135
  "picocolors": "^1.1.1",
136
136
  "pusher-js": "^8.6.0",
137
137
  "semver": "^7.8.5",
package/src/composio.ts CHANGED
@@ -31,7 +31,7 @@ import { version } from '../package.json';
31
31
  import type { ComposioRequestHeaders } from './types/composio.types';
32
32
  import type { ComposioRequestOptions } from './types/requestOptions.types';
33
33
  import { Files } from '#files';
34
- import { getDefaultHeaders } from './utils/session';
34
+ import { getClientIdentity } from './utils/session';
35
35
  import { ToolkitVersionParam } from './types/tool.types';
36
36
  import { ToolRouter } from './models/ToolRouter';
37
37
  import { Sessions } from './models/Sessions';
@@ -171,8 +171,15 @@ export type ComposioConfig<
171
171
  * `x-user-api-key` is the one header the SDK treats as a credential: together
172
172
  * with `apiKey: null` it authenticates requests with a Composio user API key
173
173
  * instead of a project key. The project key is only ever set from `apiKey`:
174
- * an `x-api-key` entry is rejected when `apiKey` is `null`. Every other
175
- * header is passed through untouched.
174
+ * an `x-api-key` entry is rejected when `apiKey` is `null`.
175
+ *
176
+ * The SDK reports itself through the API client's identity headers
177
+ * (`x-client-provenance`, `x-client-version`, `x-client-library`,
178
+ * `x-client-library-version`, `x-client-language`, `x-client-runtime`,
179
+ * `x-sdk-version`, `x-source`, `x-framework`, `x-runtime` and
180
+ * `x-runtime-version`); an entry naming one of them is rejected with a
181
+ * `ComposioError` from `@composio/client`. Every other header is passed
182
+ * through untouched.
176
183
  * @example
177
184
  * ```typescript
178
185
  * const composio = new Composio({
@@ -514,14 +521,12 @@ export class Composio<
514
521
 
515
522
  // The resolved scope is the single source of the x-org-id / x-project-id
516
523
  // headers: it travels via `this.config` to clones and to the MCP export.
517
- const defaultHeaders = getDefaultHeaders(
518
- { ...this.config.defaultHeaders, ...getScopeHeaders(scope) },
519
- this.provider
520
- );
524
+ const defaultHeaders = { ...this.config.defaultHeaders, ...getScopeHeaders(scope) };
521
525
 
522
526
  /**
523
527
  * Initialize the Composio SDK client.
524
- * The client is used to make API calls to the Composio API.
528
+ * The client is used to make API calls to the Composio API. It sends the
529
+ * SDK's identity headers from `identity`, and refuses them in `defaultHeaders`.
525
530
  */
526
531
  this.client = new ComposioClient({
527
532
  apiKey: apiKeyParsed,
@@ -529,6 +534,7 @@ export class Composio<
529
534
  orgApiKey: config?.orgApiKey,
530
535
  baseURL: baseURLParsed,
531
536
  defaultHeaders: defaultHeaders,
537
+ identity: getClientIdentity(this.provider),
532
538
  logger: clientLoggerAdapter,
533
539
  logLevel: toClientLogLevel(logger.getLevel()),
534
540
  });
@@ -638,8 +644,8 @@ export class Composio<
638
644
  * instance directly with the headers you need: `new Composio({ ...existingConfig, defaultHeaders })`.
639
645
  * For one-off overrides, pass per-call `requestOptions` where supported.
640
646
  *
641
- * @param {MergedRequestInit} fetchOptions - Custom request options to be used for all API calls in this session.
642
- * This follows the Fetch API RequestInit interface with additional options.
647
+ * @param {object} [options] - Options for the new instance.
648
+ * @param {ComposioRequestHeaders} [options.headers] - Headers sent with every API call the new instance makes.
643
649
  * @returns {Composio<TProvider>} A new Composio instance with the custom request options applied.
644
650
  *
645
651
  * @example
@@ -669,12 +675,9 @@ export class Composio<
669
675
  const userApiKeyHeader = getUserApiKeyHeader(options?.headers)
670
676
  ? undefined
671
677
  : getUserApiKeyHeader(this.config.defaultHeaders);
672
- const sessionHeaders = getDefaultHeaders(
673
- userApiKeyHeader
674
- ? { [userApiKeyHeader.name]: userApiKeyHeader.value, ...options?.headers }
675
- : options?.headers,
676
- this.provider
677
- );
678
+ const sessionHeaders = userApiKeyHeader
679
+ ? { [userApiKeyHeader.name]: userApiKeyHeader.value, ...options?.headers }
680
+ : options?.headers;
678
681
  return new Composio({
679
682
  ...this.config,
680
683
  defaultHeaders: sessionHeaders,
@@ -80,9 +80,9 @@ export class ComposioSessionConfigConflictError extends ComposioError {
80
80
  *
81
81
  * `inputRequests` holds the questions, keyed by the ID the answers must
82
82
  * reuse. `requestState` is the opaque `request_state` the API returned; when
83
- * present it must be sent back unchanged together with the answers. The SDK
84
- * does not submit answers yet, so nothing was executed and the call is not
85
- * retried.
83
+ * present it must be sent back unchanged together with the answers. Nothing
84
+ * was executed and the call is not retried: to answer, repeat the same call
85
+ * with `inputResponses` and `requestState` in its options.
86
86
  */
87
87
  export class ComposioToolInputRequiredError extends ComposioError {
88
88
  /** Questions for the user, keyed by the ID the answers must reuse. */
@@ -104,12 +104,12 @@ export class ComposioToolInputRequiredError extends ComposioError {
104
104
  const count = Object.keys(details.inputRequests).length;
105
105
  super(
106
106
  `${subject} requires user input before it can run (${count} input request${count === 1 ? '' : 's'}) and was not executed. ` +
107
- 'The questions are on `inputRequests` and the opaque `request_state` to send back with the answers is on `requestState`.',
107
+ "The questions are on `inputRequests`. Repeat the call with the answers in `inputResponses` and this error's `requestState`.",
108
108
  {
109
109
  ...options,
110
110
  code: ToolRouterErrorCodes.TOOL_INPUT_REQUIRED,
111
111
  possibleFixes: options.possibleFixes ?? [
112
- 'Collect the answers described by `inputRequests`, then call the session execute endpoint again with `input_responses` and the unchanged `request_state`',
112
+ 'Collect the answers described by `inputRequests`, then repeat the same call with `{ inputResponses, requestState }` in its options',
113
113
  'Remove the tool, its toolkit or its tags from the `require_approval` lists of the session configuration if no approval is intended',
114
114
  ],
115
115
  }
@@ -29,14 +29,18 @@ type ParsedCreateSessionConfig = TypeOf<typeof ToolRouterCreateSessionConfigSche
29
29
  /** Parsed update input; the public `ToolRouterUpdateSessionConfig` is a union over it. */
30
30
  type ParsedUpdateSessionConfig = TypeOf<typeof ToolRouterUpdateSessionConfigSchema>;
31
31
 
32
+ /** A toolkit's entry in the session `tools` map, as sent on create and update. */
33
+ type SessionToolsEntry = NonNullable<SessionCreateParams['tools']>[string];
34
+
35
+ /** `require_approval` when the caller set an approval list, nothing otherwise. */
36
+ const requireApprovalParam = <T extends string>(
37
+ requireApproval: T[] | undefined
38
+ ): { require_approval?: T[] } =>
39
+ requireApproval !== undefined ? { require_approval: requireApproval } : {};
40
+
32
41
  export const transformToolRouterToolsParams = (
33
42
  params?: Record<string, ToolRouterToolsParam | ToolRouterConfigTools> | undefined
34
- ):
35
- | Record<
36
- string,
37
- SessionCreateParams.Enable | SessionCreateParams.Disable | SessionCreateParams.Tags
38
- >
39
- | undefined => {
43
+ ): Record<string, SessionToolsEntry> | undefined => {
40
44
  if (!params) {
41
45
  return undefined;
42
46
  }
@@ -53,14 +57,16 @@ export const transformToolRouterToolsParams = (
53
57
  if (Array.isArray(data)) {
54
58
  acc[key] = { enable: data };
55
59
  } else if ('enable' in data) {
56
- acc[key] = { enable: data.enable };
60
+ acc[key] = { enable: data.enable, ...requireApprovalParam(data.requireApproval) };
57
61
  } else if ('disable' in data) {
58
- acc[key] = { disable: data.disable };
62
+ acc[key] = { disable: data.disable, ...requireApprovalParam(data.requireApproval) };
59
63
  } else if ('tags' in data) {
60
64
  const tags = transformToolRouterTagsParams(data.tags);
61
65
  if (tags) {
62
- acc[key] = { tags };
66
+ acc[key] = { tags, ...requireApprovalParam(data.requireApproval) };
63
67
  }
68
+ } else {
69
+ acc[key] = { require_approval: data.requireApproval };
64
70
  }
65
71
  } else {
66
72
  throw new ValidationError(parsedResult.error.message);
@@ -70,10 +76,7 @@ export const transformToolRouterToolsParams = (
70
76
  }
71
77
  return acc;
72
78
  },
73
- {} as Record<
74
- string,
75
- SessionCreateParams.Enable | SessionCreateParams.Disable | SessionCreateParams.Tags
76
- >
79
+ {} as Record<string, SessionToolsEntry>
77
80
  );
78
81
  return result;
79
82
  }
@@ -91,6 +94,7 @@ export const transformToolRouterTagsParams = (
91
94
  return {
92
95
  enable: params.enable,
93
96
  disable: params.disable,
97
+ ...requireApprovalParam(params.requireApproval),
94
98
  };
95
99
  }
96
100
  };
@@ -276,6 +280,9 @@ const transformToolRouterUpdateExperimentalParams = (
276
280
  if (config.sessionConfigId !== undefined) {
277
281
  result.session_config_id = config.sessionConfigId;
278
282
  }
283
+ if (config.noElicitationSupportFallback !== undefined) {
284
+ result.no_elicitation_support_fallback = config.noElicitationSupportFallback;
285
+ }
279
286
  return result;
280
287
  };
281
288
 
@@ -332,7 +339,7 @@ export const transformToolRouterMultiAccountParams = (
332
339
 
333
340
  export const transformToolRouterToolkitsParams = (
334
341
  params?: ParsedCreateSessionConfig['toolkits']
335
- ): SessionCreateParams.Enable | SessionCreateParams.Disable | undefined => {
342
+ ): NonNullable<SessionCreateParams['toolkits']> | undefined => {
336
343
  if (!params) {
337
344
  return undefined;
338
345
  }
@@ -342,8 +349,13 @@ export const transformToolRouterToolkitsParams = (
342
349
  return { enable: params };
343
350
  }
344
351
 
345
- // Otherwise return as-is (already in enable/disable format)
346
- return params as SessionCreateParams.Enable | SessionCreateParams.Disable;
352
+ if ('enable' in params) {
353
+ return { enable: params.enable, ...requireApprovalParam(params.requireApproval) };
354
+ }
355
+ if ('disable' in params) {
356
+ return { disable: params.disable, ...requireApprovalParam(params.requireApproval) };
357
+ }
358
+ return { require_approval: params.requireApproval };
347
359
  };
348
360
 
349
361
  /**
@@ -240,6 +240,11 @@ export class ToolRouter<
240
240
  experimentalPayload.session_config_id = routerConfig.experimental.sessionConfigId;
241
241
  }
242
242
 
243
+ if (routerConfig.experimental?.noElicitationSupportFallback !== undefined) {
244
+ experimentalPayload.no_elicitation_support_fallback =
245
+ routerConfig.experimental.noElicitationSupportFallback;
246
+ }
247
+
243
248
  if (routerConfig.experimental?.assistivePrompt?.userTimezone) {
244
249
  experimentalPayload.assistive_prompt_config = {
245
250
  user_timezone: routerConfig.experimental.assistivePrompt.userTimezone,
@@ -21,6 +21,7 @@ import {
21
21
  ToolRouterSessionExecuteResponseSchema,
22
22
  ToolRouterSessionProxyExecuteResponse,
23
23
  ToolRouterSessionExecuteOptions,
24
+ ToolRouterSessionExecuteMetaOptions,
24
25
  ToolRouterSessionMetaToolSlug,
25
26
  ToolRouterSessionConfig,
26
27
  ToolRouterSessionMetadata,
@@ -98,6 +99,16 @@ import { getSourceSessionConfig } from '../lib/toolRouterSourceSessionConfig';
98
99
  import { deleteToolRouterSession } from '../lib/toolRouterSessionDelete';
99
100
 
100
101
  const COMPOSIO_MULTI_EXECUTE_TOOL = 'COMPOSIO_MULTI_EXECUTE_TOOL';
102
+
103
+ /** The request fields that carry the user's answers to an earlier `input_required` call. */
104
+ function inputResponseParams(
105
+ options: ToolRouterSessionExecuteMetaOptions | undefined
106
+ ): Pick<SessionExecuteParams, 'input_responses' | 'request_state'> {
107
+ return {
108
+ ...(options?.inputResponses !== undefined && { input_responses: options.inputResponses }),
109
+ ...(options?.requestState !== undefined && { request_state: options.requestState }),
110
+ };
111
+ }
101
112
  export const DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX =
102
113
  '[Direct tool - call directly, no search needed beforehand.]';
103
114
 
@@ -684,6 +695,8 @@ export class ToolRouterSession<
684
695
  * @param arguments_ - Optional tool arguments
685
696
  * @param options - Optional execution options
686
697
  * @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.
698
+ * @param options.inputResponses - Experimental. The user's answers to an earlier `ComposioToolInputRequiredError`, keyed by the IDs in its `inputRequests`. Repeat the same call with them.
699
+ * @param options.requestState - Experimental. The `requestState` of that error, sent back unchanged.
687
700
  * @returns The tool execution result
688
701
  * @throws {ComposioToolInputRequiredError} If the tool needs input from the user (for example an approval) before it can run
689
702
  */
@@ -720,6 +733,7 @@ export class ToolRouterSession<
720
733
  const executeParams: SessionExecuteParams = {
721
734
  tool_slug: toolSlug,
722
735
  arguments: arguments_ ?? {},
736
+ ...inputResponseParams(options),
723
737
  };
724
738
  if (options?.account) {
725
739
  executeParams.account = options.account;
@@ -754,6 +768,7 @@ export class ToolRouterSession<
754
768
  *
755
769
  * @param slug - The meta tool slug to execute
756
770
  * @param arguments_ - Optional meta tool arguments
771
+ * @param options - Experimental. The user's answers to an earlier `ComposioToolInputRequiredError` (`inputResponses`) and its `requestState`, as in `session.execute()`
757
772
  * @returns The tool execution result, in the same shape as `session.execute()`
758
773
  * @throws {ComposioToolInputRequiredError} If the tool needs input from the user (for example an approval) before it can run
759
774
  *
@@ -767,11 +782,13 @@ export class ToolRouterSession<
767
782
  async executeMeta(
768
783
  slug: ToolRouterSessionMetaToolSlug,
769
784
  arguments_?: Record<string, unknown>,
785
+ options?: ToolRouterSessionExecuteMetaOptions,
770
786
  requestOptions?: ComposioRequestOptions
771
787
  ): Promise<ToolRouterSessionExecuteResponse> {
772
788
  const executeMetaParams: SessionExecuteMetaParams = {
773
789
  slug,
774
790
  arguments: arguments_ ?? {},
791
+ ...inputResponseParams(options),
775
792
  };
776
793
  const experimental = inlineCustomToolsExperimental<SessionExecuteMetaParams.Experimental>(
777
794
  this.inlineCustomToolsPayload
@@ -60,6 +60,7 @@ import { hmacSha256Base64, timingSafeEqual } from '../utils/crypto';
60
60
  import { CONFIG_DEFAULTS } from '../utils/config-defaults';
61
61
  import { ComposioRequestOptions } from '../types/requestOptions.types';
62
62
  import { withCancellation } from '../utils/cancellation';
63
+ import { invokeUserCallback } from '../utils/userCallback';
63
64
 
64
65
  /**
65
66
  * Safely converts a value to a string, returning the default if the value is null, undefined, or empty.
@@ -525,7 +526,8 @@ export class Triggers<TProvider extends BaseComposioProvider<unknown, unknown, u
525
526
  /**
526
527
  * Subscribe to all the triggers
527
528
  *
528
- * @param fn - The function to call when a trigger is received
529
+ * @param fn - The function to call when a trigger is received. It may be `async`. Errors
530
+ * thrown from — or promises rejected by — the function are contained and logged.
529
531
  * @param filters - The filters to apply to the triggers
530
532
  * @param onSubscriptionError - Optional callback invoked with the raw Pusher payload when
531
533
  * the underlying subscription fails (for example on auth or permission rejection). The
@@ -563,11 +565,7 @@ export class Triggers<TProvider extends BaseComposioProvider<unknown, unknown, u
563
565
  const parsedData = this.parsePusherPayload(_data);
564
566
 
565
567
  if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData)) {
566
- try {
567
- fn(parsedData);
568
- } catch (error) {
569
- logger.error('❌ Error in trigger callback:', error);
570
- }
568
+ invokeUserCallback('❌ Error in trigger callback:', () => fn(parsedData));
571
569
  } else {
572
570
  logger.debug('Trigger does not match filters', JSON.stringify(parsedFilters.data, null, 2));
573
571
  }
@@ -700,6 +698,10 @@ export class Triggers<TProvider extends BaseComposioProvider<unknown, unknown, u
700
698
  /**
701
699
  * Unsubscribe from all the triggers
702
700
  *
701
+ * Ends every subscription made with {@link subscribe} on this instance, including one that is
702
+ * still connecting, and closes the realtime connection so that a script can exit. A later
703
+ * `subscribe()` opens a new connection.
704
+ *
703
705
  * @returns {Promise<void>}
704
706
  *
705
707
  * @example