@composio/core 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomTool-BHOYxLZX.d.mts → CustomTool-CnHdegDK.d.mts} +1 -1
- package/dist/{CustomTool-B-_VjWpy.mjs → CustomTool-CnJxXr07.mjs} +1 -1
- package/dist/{Telemetry-JRJJYS4I.mjs → Telemetry-41JkqpZ7.mjs} +3 -2
- package/dist/{cancellation-DV8CIi52.mjs → cancellation-BQibgpRG.mjs} +166 -34
- package/dist/{composio-BTZsFajb.d.mts → composio-Dq708dZS.d.mts} +81 -185
- package/dist/{customTool.types-D_w21L56.d.mts → customTool.types-B8lVpHOP.d.mts} +77 -59
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +4 -4
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +2 -2
- package/dist/{errors-Dyiu3ifQ.mjs → errors-BN15NcCW.mjs} +34 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.d.mts +46 -6
- package/dist/index.mjs +315 -363
- package/dist/models/Files.node.mjs +1 -1
- package/dist/platform/node.d.mts +1 -1
- package/dist/platform/node.mjs +13 -0
- package/dist/platform/workerd.d.mts +1 -1
- package/dist/platform/workerd.mjs +3 -0
- package/dist/{types-D5A2wzBl.d.mts → types-DuVZKrXO.d.mts} +2 -0
- package/dist/{types-CgRsUGqm.d.mts → types-eTw8Yw7Y.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/package.json +10 -7
- package/src/errors/ToolRouterErrors.ts +65 -0
- package/src/lib/toolRouterParams.ts +8 -10
- package/src/models/AuthConfigs.ts +0 -9
- package/src/models/ConnectionRequest.ts +21 -18
- package/src/models/CustomToolkits.ts +1 -1
- package/src/models/Logs.ts +2 -2
- package/src/models/RemoteFile.ts +24 -5
- package/src/models/SessionContext.ts +24 -4
- package/src/models/ToolRouter.ts +3 -3
- package/src/models/ToolRouterSession.ts +45 -13
- package/src/models/Tools.ts +21 -37
- package/src/models/Usage.ts +2 -1
- package/src/models/customToolExecution.ts +10 -0
- package/src/platform/node.ts +16 -0
- package/src/platform/types.ts +3 -0
- package/src/platform/workerd.ts +4 -0
- package/src/provider/BaseProvider.ts +2 -1
- package/src/provider/OpenAIProvider.ts +0 -283
- package/src/telemetry/Telemetry.ts +4 -2
- package/src/types/logs.types.ts +9 -1
- package/src/types/tool.types.ts +8 -3
- package/src/types/toolRouter.types.ts +27 -19
- package/src/types/usage.types.ts +2 -0
- package/src/utils/jsonSchema.ts +191 -36
- package/src/utils/retries.ts +20 -0
- package/src/utils/safePath.ts +135 -54
- package/src/utils/session.ts +31 -2
- package/src/utils/transformers/logs.ts +3 -2
- package/src/utils/transformers/toolRouterResponseTransform.ts +69 -12
- package/src/utils/transformers/usage.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { 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_DIR, p as getEnvVariable, r as ComposioError, s as DEFAULT_BASE_URL, t as ComposioBlockedInternalUrlError, u as TEMP_FILES_DIRECTORY_NAME } from "./SsrfErrors-DiQldIdC.mjs";
|
|
2
|
-
import { A as
|
|
2
|
+
import { $ as ComposioAuthConfigNotFoundError, A as ComposioInvalidModifierError, B as ConnectionRequestFailedError, C as ValidationError, D as ToolkitErrorCodes, E as ComposioToolkitNotFoundError, F as ComposioToolNotFoundError, G as ComposioConnectedAccountRevocationNotSupportedError, H as ComposioAclOnlyForSharedError, I as ComposioToolVersionRequiredError, J as ComposioMultipleConnectedAccountsError, K as ComposioFailedToCreateConnectedAccountLink, L as ToolErrorCodes, M as ComposioProviderNotDefinedError, N as ComposioToolExecutionError, O as ComposioGlobalExecuteToolFnNotSetError, P as ComposioToolFetchError, Q as AuthConfigErrorCodes, R as handleToolExecutionError, S as JsonSchemaToZodError, T as ComposioToolkitFetchError, U as ComposioConnectedAccountNotFoundError, V as ConnectionRequestTimeoutError, W as ComposioConnectedAccountNotRevokableError, X as ComposioSharedConnectionNotAccessibleError, Y as ComposioSharedAccessDeniedError, Z as ConnectedAccountErrorCodes, _ as ComposioRequestCancelledError, a as RemoteFileDownloadError, b as isRequestAbortError, c as ComposioFailedToGetSDKRealtimeCredentialsError, d as ComposioTriggerTypeNotFoundError, f as ComposioWebhookPayloadError, g as ComposioNoAPIKeyError, h as ComposioAPIKeyKindError, i as ToolRouterErrorCodes, j as ComposioInvalidToolArgumentsError, k as ComposioInvalidExecuteFunctionError, l as ComposioFailedToSubscribeToPusherChannelError, m as TriggerErrorCodes, n as ComposioSessionConfigConflictError, o as RemoteFileErrorCodes, p as ComposioWebhookSignatureVerificationError, q as ComposioLegacyConnectedAccountsEndpointRetiredError, r as ComposioToolInputRequiredError, s as ComposioFailedToCreatePusherClientError, t as ComposioMCPDestinationError, u as ComposioFailedToUnsubscribeFromPusherChannelError, v as ComposioScopeConfigError, w as ValidationErrorCodes, x as JsonSchemaRefResolutionError, y as SDKErrorCodes, z as ConnectionRequestErrorCodes } from "./errors-BN15NcCW.mjs";
|
|
3
3
|
import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "./FileModifierErrors-CdGSABoq.mjs";
|
|
4
4
|
import { n as dropEmptyFileUploads, o as isPlainObject, s as schemaHasFileUploadable } from "./FileToolModifier.utils.neutral-DWFpnsj2.mjs";
|
|
5
|
-
import { a as jsonSchemaToZodSchema, c as toStrictJsonSchema, i as ensureObjectTypeOnProperties, n as deduplicateJsonSchemaRequiredArrays, o as omitNullToolArguments, r as dereferenceJsonSchema, s as removeNonRequiredProperties, t as withCancellation } from "./cancellation-
|
|
6
|
-
import { t as telemetry } from "./Telemetry-
|
|
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-BQibgpRG.mjs";
|
|
6
|
+
import { t as telemetry } from "./Telemetry-41JkqpZ7.mjs";
|
|
7
7
|
import { a as readResponseBodyWithLimit, i as MAX_URL_UPLOAD_SIZE_BYTES, l as getRandomShortId, n as assertSafeFileUploadPath, o as arrayBufferToBase64, r as isBlockedSensitiveFileUploadPath, t as BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS } from "./sensitiveFileUploadPaths-BlLp-Yo2.mjs";
|
|
8
|
-
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-
|
|
9
|
-
import ComposioClient, { APIError, BadRequestError, ConflictError } from "@composio/client";
|
|
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-CnJxXr07.mjs";
|
|
9
|
+
import ComposioClient, { APIError, BadRequestError, ConflictError, VERSION } 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
14
|
import semver from "semver";
|
|
15
15
|
import { Files } from "#files";
|
|
16
|
+
import identity from "#client_identity" with { type: "json" };
|
|
17
|
+
import { z as z$2 } from "zod";
|
|
16
18
|
import { ssrfSafeFetch, ssrfSafeFetchWhereSupported } from "#ssrf_guard";
|
|
17
19
|
|
|
18
20
|
//#region src/types/authConfigs.types.ts
|
|
@@ -993,7 +995,7 @@ const CustomAuthParamsSchema = z$1.object({
|
|
|
993
995
|
* Parameters for tool execution.
|
|
994
996
|
*
|
|
995
997
|
* @property {boolean} [allowTracing] - Enable tracing for this tool execution
|
|
996
|
-
* @property {string} [connectedAccountId] -
|
|
998
|
+
* @property {string} [connectedAccountId] - Connected account ID, or `instant_account` to explicitly use the Composio Instant account
|
|
997
999
|
* @property {CustomAuthParams} [customAuthParams] - Custom authentication parameters
|
|
998
1000
|
* @property {CustomConnectionData} [customConnectionData] - Custom connection data (takes priority over customAuthParams)
|
|
999
1001
|
* @property {Record<string, unknown>} [arguments] - The arguments to pass to the tool
|
|
@@ -1049,8 +1051,8 @@ const ToolExecuteResponseSchema = z$1.object({
|
|
|
1049
1051
|
successful: z$1.boolean(),
|
|
1050
1052
|
logId: z$1.string().optional(),
|
|
1051
1053
|
sessionInfo: z$1.unknown().optional(),
|
|
1052
|
-
/** Actual
|
|
1053
|
-
|
|
1054
|
+
/** Actual Instant usage charge when the Session opts into returning it. */
|
|
1055
|
+
instantCharge: z$1.unknown().optional()
|
|
1054
1056
|
});
|
|
1055
1057
|
const ToolProxyParamsSchema = z$1.object({
|
|
1056
1058
|
endpoint: z$1.string(),
|
|
@@ -1069,6 +1071,11 @@ const ToolProxyParamsSchema = z$1.object({
|
|
|
1069
1071
|
})).optional(),
|
|
1070
1072
|
connectedAccountId: z$1.string().optional(),
|
|
1071
1073
|
/**
|
|
1074
|
+
* The user the connected account belongs to. Projects with 2FA enabled check it
|
|
1075
|
+
* against the connected account, and require it for orgs created on or after
|
|
1076
|
+
*/
|
|
1077
|
+
userId: z$1.string().optional(),
|
|
1078
|
+
/**
|
|
1072
1079
|
* @deprecated
|
|
1073
1080
|
*/
|
|
1074
1081
|
customConnectionData: CustomConnectionDataSchema.describe("DEPRECATED: This field is deprecated and will be removed in the future.").optional()
|
|
@@ -1181,8 +1188,57 @@ function resolveEffectiveUploadAllowlist(userDirs) {
|
|
|
1181
1188
|
return Array.isArray(resolved) ? resolved : [];
|
|
1182
1189
|
}
|
|
1183
1190
|
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region src/utils/retries.ts
|
|
1193
|
+
/**
|
|
1194
|
+
* Request options for a call that executes a tool or proxies an API call: the
|
|
1195
|
+
* caller's options with retries disabled.
|
|
1196
|
+
*
|
|
1197
|
+
* These calls are non-idempotent writes. The client retries timeouts,
|
|
1198
|
+
* connection errors, and 408/409/429/5xx responses by default, and a retry
|
|
1199
|
+
* after the backend already acted duplicates the side effect (e.g. sends the
|
|
1200
|
+
* same email twice). The backend does not deduplicate executions, so every
|
|
1201
|
+
* execution path must go through this helper. Reads keep the default retries.
|
|
1202
|
+
* See https://github.com/ComposioHQ/composio/issues/3654.
|
|
1203
|
+
*
|
|
1204
|
+
* @internal
|
|
1205
|
+
*/
|
|
1206
|
+
function withoutRetries(requestOptions) {
|
|
1207
|
+
return {
|
|
1208
|
+
...requestOptions,
|
|
1209
|
+
maxRetries: 0
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1184
1213
|
//#endregion
|
|
1185
1214
|
//#region src/utils/transformers/toolRouterResponseTransform.ts
|
|
1215
|
+
/** The `result_type` values of a call that ran. `input_required` is raised before this is read. */
|
|
1216
|
+
const ExecutedResponseSchema = z.object({ result_type: z.enum(["completed", "failed"]) });
|
|
1217
|
+
/**
|
|
1218
|
+
* Whether a session tool execution succeeded. `resultType` decides: a `failed`
|
|
1219
|
+
* execution is not successful even when its `error` is `null` or empty.
|
|
1220
|
+
*/
|
|
1221
|
+
function isExecutionSuccessful(result) {
|
|
1222
|
+
return result.resultType === "completed";
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Narrows an execute-family response to the variants that carry a result.
|
|
1226
|
+
* `input_required` means the call did not run: it is raised as a
|
|
1227
|
+
* {@link ComposioToolInputRequiredError} instead of being returned as a result
|
|
1228
|
+
* it is not.
|
|
1229
|
+
*/
|
|
1230
|
+
function assertNotInputRequired(raw, subject) {
|
|
1231
|
+
if (raw.result_type !== "input_required") return;
|
|
1232
|
+
throw new ComposioToolInputRequiredError(subject, {
|
|
1233
|
+
inputRequests: Object.fromEntries(Object.entries(raw.input_requests).map(([id, request]) => [id, {
|
|
1234
|
+
type: request.type,
|
|
1235
|
+
mode: request.mode,
|
|
1236
|
+
message: request.message,
|
|
1237
|
+
requestedSchema: request.requested_schema
|
|
1238
|
+
}])),
|
|
1239
|
+
requestState: raw.request_state
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1186
1242
|
function transformSearchResult(raw) {
|
|
1187
1243
|
return {
|
|
1188
1244
|
index: raw.index,
|
|
@@ -1223,7 +1279,7 @@ function transformToolkitConnectionStatus(raw) {
|
|
|
1223
1279
|
statusMessage: raw.status_message,
|
|
1224
1280
|
connectionDetails: raw.connection_details,
|
|
1225
1281
|
currentUserInfo: raw.current_user_info,
|
|
1226
|
-
...raw.
|
|
1282
|
+
...raw.instant_account !== void 0 && { instantAccount: { allowedToolSlugs: raw.instant_account.allowed_tool_slugs } }
|
|
1227
1283
|
};
|
|
1228
1284
|
}
|
|
1229
1285
|
/**
|
|
@@ -1253,13 +1309,20 @@ function transformSearchResponse(raw) {
|
|
|
1253
1309
|
}
|
|
1254
1310
|
/**
|
|
1255
1311
|
* Transforms a raw session execute API response to camelCase.
|
|
1312
|
+
*
|
|
1313
|
+
* @throws {ComposioToolInputRequiredError} If the tool asked for user input instead of running
|
|
1314
|
+
* @throws {ValidationError} If the response carries no `result_type`, or one this SDK does not know
|
|
1256
1315
|
*/
|
|
1257
|
-
function transformExecuteResponse(raw) {
|
|
1316
|
+
function transformExecuteResponse(raw, toolSlug) {
|
|
1317
|
+
assertNotInputRequired(raw, `Tool ${toolSlug}`);
|
|
1318
|
+
const executed = ExecutedResponseSchema.safeParse(raw);
|
|
1319
|
+
if (!executed.success) throw new ValidationError(`Tool ${toolSlug} returned an execute response without a known result_type`, { cause: executed.error });
|
|
1258
1320
|
return {
|
|
1259
1321
|
data: raw.data,
|
|
1260
1322
|
error: raw.error,
|
|
1261
1323
|
logId: raw.log_id,
|
|
1262
|
-
|
|
1324
|
+
resultType: executed.data.result_type,
|
|
1325
|
+
...raw.instant_charge !== void 0 && { instantCharge: raw.instant_charge }
|
|
1263
1326
|
};
|
|
1264
1327
|
}
|
|
1265
1328
|
|
|
@@ -1298,10 +1361,6 @@ var Tools = class {
|
|
|
1298
1361
|
* Scoped per-instance so a fresh `Composio` starts with a clean slate.
|
|
1299
1362
|
*/
|
|
1300
1363
|
warnedAutoUploadDisabledForTool = /* @__PURE__ */ new Set();
|
|
1301
|
-
/**
|
|
1302
|
-
* Lazily-built sibling client with retries disabled; see `clientWithoutRetries`.
|
|
1303
|
-
*/
|
|
1304
|
-
clientWithoutRetriesCache;
|
|
1305
1364
|
constructor(client, config) {
|
|
1306
1365
|
if (!client) throw new Error("ComposioClient is required");
|
|
1307
1366
|
if (!config?.provider) throw new ComposioProviderNotDefinedError("Provider not passed into Tools instance");
|
|
@@ -1322,24 +1381,6 @@ var Tools = class {
|
|
|
1322
1381
|
telemetry.instrument(this, "Tools");
|
|
1323
1382
|
}
|
|
1324
1383
|
/**
|
|
1325
|
-
* A cached sibling client that never retries requests, mirroring Python's
|
|
1326
|
-
* `client.without_retries`.
|
|
1327
|
-
*
|
|
1328
|
-
* Used for non-idempotent writes (`tools.execute` / `tools.proxy`), where a
|
|
1329
|
-
* silent retry after a read timeout can duplicate a side effect (e.g. send an
|
|
1330
|
-
* email twice). Reads keep the default retry behaviour, and so do other writes
|
|
1331
|
-
* (`toolRouter.session.execute`, auth-config and connected-account mutations):
|
|
1332
|
-
* the durable fix there is backend-honoured idempotency keys, tracked
|
|
1333
|
-
* separately.
|
|
1334
|
-
*
|
|
1335
|
-
* Cached rather than rebuilt per call because `withOptions` constructs a fresh
|
|
1336
|
-
* client; its options never change, so one per `Tools` instance suffices.
|
|
1337
|
-
*/
|
|
1338
|
-
get clientWithoutRetries() {
|
|
1339
|
-
if (!this.clientWithoutRetriesCache) this.clientWithoutRetriesCache = this.client.withOptions({ maxRetries: 0 });
|
|
1340
|
-
return this.clientWithoutRetriesCache;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
1384
|
* Transforms tool data from snake_case API format to camelCase for internal SDK use.
|
|
1344
1385
|
*
|
|
1345
1386
|
* This method standardizes the property naming convention for tools retrieved from the Composio API,
|
|
@@ -1841,7 +1882,7 @@ var Tools = class {
|
|
|
1841
1882
|
version: toolkitVersion,
|
|
1842
1883
|
text: body.text
|
|
1843
1884
|
};
|
|
1844
|
-
const result = await withCancellation(() => this.
|
|
1885
|
+
const result = await withCancellation(() => this.client.tools.execute(tool.slug, executeBody, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
1845
1886
|
return this.transformToolExecuteResponse(result);
|
|
1846
1887
|
} catch (error) {
|
|
1847
1888
|
if (error instanceof ComposioRequestCancelledError) throw error;
|
|
@@ -1993,14 +2034,14 @@ var Tools = class {
|
|
|
1993
2034
|
enable_auto_workbench_offload: true
|
|
1994
2035
|
};
|
|
1995
2036
|
if (options?.experimental) executePayload.experimental = options.experimental;
|
|
1996
|
-
const response = await withCancellation(() => this.client.toolRouter.session.execute(body.sessionId, executePayload, requestOptions), requestOptions?.signal);
|
|
1997
|
-
const { data, error, logId,
|
|
2037
|
+
const response = await withCancellation(() => this.client.toolRouter.session.execute(body.sessionId, executePayload, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
2038
|
+
const { data, error, logId, resultType, instantCharge } = transformExecuteResponse(response, toolSlug);
|
|
1998
2039
|
let result = {
|
|
1999
2040
|
data,
|
|
2000
2041
|
error,
|
|
2001
|
-
successful:
|
|
2042
|
+
successful: isExecutionSuccessful({ resultType }),
|
|
2002
2043
|
logId,
|
|
2003
|
-
...
|
|
2044
|
+
...instantCharge !== void 0 && { instantCharge }
|
|
2004
2045
|
};
|
|
2005
2046
|
if (modifiers?.afterExecute) result = await modifiers.afterExecute({
|
|
2006
2047
|
toolSlug,
|
|
@@ -2070,6 +2111,7 @@ var Tools = class {
|
|
|
2070
2111
|
* @param {string} body.endpoint - Path relative to the toolkit's base URL, or an absolute URL
|
|
2071
2112
|
* @param {'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'} body.method - HTTP method
|
|
2072
2113
|
* @param {string} [body.connectedAccountId] - The connected account to authenticate as
|
|
2114
|
+
* @param {string} [body.userId] - The user the connected account belongs to. Projects with 2FA enabled check it against the connected account and may require it
|
|
2073
2115
|
* @param {unknown} [body.body] - JSON request body
|
|
2074
2116
|
* @param {Array<{ in: 'query' | 'header'; name: string; value: string | number }>} [body.parameters] - Extra query parameters or headers
|
|
2075
2117
|
* @returns {Promise<ToolProxyResponse>} The upstream status, headers, and parsed body
|
|
@@ -2104,6 +2146,7 @@ var Tools = class {
|
|
|
2104
2146
|
method: toolProxyParams.data.method,
|
|
2105
2147
|
body: toolProxyParams.data.body,
|
|
2106
2148
|
connected_account_id: toolProxyParams.data.connectedAccountId,
|
|
2149
|
+
user_id: toolProxyParams.data.userId,
|
|
2107
2150
|
parameters,
|
|
2108
2151
|
/**
|
|
2109
2152
|
* @deprecated The `customConnectionData` proxy param is deprecated and will be
|
|
@@ -2111,7 +2154,7 @@ var Tools = class {
|
|
|
2111
2154
|
*/
|
|
2112
2155
|
custom_connection_data: toolProxyParams.data.customConnectionData
|
|
2113
2156
|
};
|
|
2114
|
-
return withCancellation(() => this.
|
|
2157
|
+
return withCancellation(() => this.client.tools.proxy(proxyBody, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
2115
2158
|
}
|
|
2116
2159
|
};
|
|
2117
2160
|
|
|
@@ -2458,14 +2501,6 @@ var AuthConfigs = class {
|
|
|
2458
2501
|
telemetry.instrument(this, "AuthConfigs");
|
|
2459
2502
|
}
|
|
2460
2503
|
/**
|
|
2461
|
-
* Protected getter for the client instance.
|
|
2462
|
-
* This is primarily used for testing purposes.
|
|
2463
|
-
* @protected
|
|
2464
|
-
*/
|
|
2465
|
-
getClient() {
|
|
2466
|
-
return this.client;
|
|
2467
|
-
}
|
|
2468
|
-
/**
|
|
2469
2504
|
* Lists authentication configurations based on provided filter criteria.
|
|
2470
2505
|
*
|
|
2471
2506
|
* This method retrieves auth configs from the Composio API, transforms them to the SDK format,
|
|
@@ -3104,16 +3139,22 @@ const transformConnectedAccountCompleteAuthResponse = (response) => {
|
|
|
3104
3139
|
* @param {string} connectedAccountId - The ID of the connected account
|
|
3105
3140
|
* @param {ConnectedAccountStatus} [status] - Initial status of the connection
|
|
3106
3141
|
* @param {string | null} [redirectUrl] - OAuth redirect URL if applicable
|
|
3107
|
-
* @returns {
|
|
3108
|
-
* Connection request object with state and methods
|
|
3142
|
+
* @returns {ConnectionRequest} Connection request object with state and methods
|
|
3109
3143
|
*/
|
|
3110
3144
|
function createConnectionRequest(client, connectedAccountId, status, redirectUrl) {
|
|
3111
|
-
const
|
|
3145
|
+
const request = {
|
|
3112
3146
|
id: connectedAccountId,
|
|
3113
3147
|
status: status || ConnectedAccountStatuses.INITIATED,
|
|
3114
|
-
redirectUrl
|
|
3148
|
+
redirectUrl,
|
|
3149
|
+
waitForConnection,
|
|
3150
|
+
toJSON: () => ({
|
|
3151
|
+
id: request.id,
|
|
3152
|
+
status: request.status,
|
|
3153
|
+
redirectUrl: request.redirectUrl
|
|
3154
|
+
}),
|
|
3155
|
+
toString: () => JSON.stringify(request.toJSON(), null, 2)
|
|
3115
3156
|
};
|
|
3116
|
-
telemetry.instrument(
|
|
3157
|
+
telemetry.instrument(request, "ConnectionRequest");
|
|
3117
3158
|
/**
|
|
3118
3159
|
* Waits for the connection request to complete and become active.
|
|
3119
3160
|
*
|
|
@@ -3148,41 +3189,34 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
|
|
|
3148
3189
|
];
|
|
3149
3190
|
const failIfTerminal = (response) => {
|
|
3150
3191
|
if (terminalErrorStates.includes(response.status)) throw new ConnectionRequestFailedError(`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`, { meta: {
|
|
3151
|
-
connectedAccountId:
|
|
3192
|
+
connectedAccountId: request.id,
|
|
3152
3193
|
status: response.status,
|
|
3153
3194
|
statusReason: response.status_reason
|
|
3154
3195
|
} });
|
|
3155
3196
|
};
|
|
3156
3197
|
try {
|
|
3157
|
-
const response = await client.connectedAccounts.retrieve(
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
return transformConnectedAccountResponse(response);
|
|
3161
|
-
}
|
|
3198
|
+
const response = await client.connectedAccounts.retrieve(request.id);
|
|
3199
|
+
request.status = response.status;
|
|
3200
|
+
if (response.status === ConnectedAccountStatuses.ACTIVE) return transformConnectedAccountResponse(response);
|
|
3162
3201
|
failIfTerminal(response);
|
|
3163
3202
|
} catch (error) {
|
|
3164
|
-
if (error instanceof ComposioClient.NotFoundError) throw new ComposioConnectedAccountNotFoundError(`Connected account with id ${
|
|
3203
|
+
if (error instanceof ComposioClient.NotFoundError) throw new ComposioConnectedAccountNotFoundError(`Connected account with id ${request.id} not found`, { meta: { connectedAccountId: request.id } });
|
|
3165
3204
|
else throw error;
|
|
3166
3205
|
}
|
|
3167
3206
|
const start = Date.now();
|
|
3168
3207
|
const pollInterval = 1e3;
|
|
3169
3208
|
while (Date.now() - start < timeout) try {
|
|
3170
|
-
const response = await client.connectedAccounts.retrieve(
|
|
3171
|
-
|
|
3209
|
+
const response = await client.connectedAccounts.retrieve(request.id);
|
|
3210
|
+
request.status = response.status;
|
|
3172
3211
|
if (response.status === ConnectedAccountStatuses.ACTIVE) return transformConnectedAccountResponse(response);
|
|
3173
3212
|
failIfTerminal(response);
|
|
3174
3213
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
3175
3214
|
} catch (error) {
|
|
3176
3215
|
throw error;
|
|
3177
3216
|
}
|
|
3178
|
-
throw new ConnectionRequestTimeoutError(`Connection request timed out for ${
|
|
3217
|
+
throw new ConnectionRequestTimeoutError(`Connection request timed out for ${request.id}`);
|
|
3179
3218
|
}
|
|
3180
|
-
return
|
|
3181
|
-
...state,
|
|
3182
|
-
waitForConnection,
|
|
3183
|
-
toJSON: () => ({ ...state }),
|
|
3184
|
-
toString: () => JSON.stringify(state, null, 2)
|
|
3185
|
-
};
|
|
3219
|
+
return request;
|
|
3186
3220
|
}
|
|
3187
3221
|
|
|
3188
3222
|
//#endregion
|
|
@@ -3240,9 +3274,12 @@ const UsageEntitySummarySchema = z$1.object({
|
|
|
3240
3274
|
totalQuantity: z$1.string(),
|
|
3241
3275
|
eventCount: z$1.number()
|
|
3242
3276
|
});
|
|
3243
|
-
const UsageSummaryResponseSchema = z$1.object({
|
|
3244
|
-
/** Aggregates keyed by metering entity type (e.g. `tool_calls`, `sessions`). */
|
|
3245
|
-
entities: z$1.record(z$1.string(), UsageEntitySummarySchema)
|
|
3277
|
+
const UsageSummaryResponseSchema = z$1.object({
|
|
3278
|
+
/** Aggregates keyed by metering entity type (e.g. `tool_calls`, `sessions`). */
|
|
3279
|
+
entities: z$1.record(z$1.string(), UsageEntitySummarySchema),
|
|
3280
|
+
/** Total Instant charge for the window, in USD as an exact decimal string. */
|
|
3281
|
+
instantCharge: z$1.string()
|
|
3282
|
+
});
|
|
3246
3283
|
const UsageBreakdownGroupSchema = z$1.object({
|
|
3247
3284
|
key: z$1.string(),
|
|
3248
3285
|
totalQuantity: z$1.string(),
|
|
@@ -3278,11 +3315,14 @@ const transformUsageBreakdownParams = (params) => ({
|
|
|
3278
3315
|
filters: transformUsageFilters(params.filters)
|
|
3279
3316
|
});
|
|
3280
3317
|
const transformUsageSummaryResponse = (response) => {
|
|
3281
|
-
return transform(response).with(UsageSummaryResponseSchema).using((response) => ({
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3318
|
+
return transform(response).with(UsageSummaryResponseSchema).using((response) => ({
|
|
3319
|
+
entities: Object.fromEntries(Object.entries(response.entities).map(([entityType, entity]) => [entityType, {
|
|
3320
|
+
unit: entity.unit,
|
|
3321
|
+
totalQuantity: entity.total_quantity,
|
|
3322
|
+
eventCount: entity.event_count
|
|
3323
|
+
}])),
|
|
3324
|
+
instantCharge: response.instant_charge
|
|
3325
|
+
}));
|
|
3286
3326
|
};
|
|
3287
3327
|
const transformUsageBreakdownResponse = (response) => {
|
|
3288
3328
|
return transform(response).with(UsageBreakdownResponseSchema).using((response) => ({
|
|
@@ -3308,6 +3348,7 @@ const transformUsageBreakdownResponse = (response) => {
|
|
|
3308
3348
|
* ```typescript
|
|
3309
3349
|
* const summary = await composio.experimental.usage.summary();
|
|
3310
3350
|
* console.log(summary.entities.tool_calls?.totalQuantity);
|
|
3351
|
+
* console.log(summary.instantCharge); // exact USD string
|
|
3311
3352
|
*
|
|
3312
3353
|
* const byTool = await composio.experimental.usage.breakdown('tool_calls', {
|
|
3313
3354
|
* groupBy: 'tool_slug',
|
|
@@ -3326,7 +3367,7 @@ var Usage = class {
|
|
|
3326
3367
|
* **Experimental — shape may change in future releases.**
|
|
3327
3368
|
*
|
|
3328
3369
|
* @param {UsageSummaryParams} [params] - Optional range, `entityTypes` and filters
|
|
3329
|
-
* @returns {Promise<UsageSummaryResponse>} Totals keyed by entity type
|
|
3370
|
+
* @returns {Promise<UsageSummaryResponse>} Totals keyed by entity type and the exact USD Instant charge
|
|
3330
3371
|
* @throws {ValidationError} If the params fail validation
|
|
3331
3372
|
*
|
|
3332
3373
|
* @example
|
|
@@ -3614,7 +3655,7 @@ var CustomToolkits = class {
|
|
|
3614
3655
|
* ```
|
|
3615
3656
|
*/
|
|
3616
3657
|
async delete(slug, requestOptions) {
|
|
3617
|
-
const result = await withCancellation(() => this.client.custom.deleteToolkit(slug, requestOptions), requestOptions?.signal);
|
|
3658
|
+
const result = await withCancellation(() => this.client.custom.deleteToolkit(slug, {}, requestOptions), requestOptions?.signal);
|
|
3618
3659
|
return transformCustomToolkitDeleteResponse(result);
|
|
3619
3660
|
}
|
|
3620
3661
|
};
|
|
@@ -7302,6 +7343,8 @@ const ToolExecutionLogParentSchema = z$1.object({
|
|
|
7302
7343
|
logId: z$1.string(),
|
|
7303
7344
|
toolSlug: z$1.string()
|
|
7304
7345
|
}).nullable();
|
|
7346
|
+
/** Tool log metadata, including the optional exact USD Instant charge. */
|
|
7347
|
+
const ToolExecutionLogMetadataSchema = z$1.object({ instant_charge: z$1.string().optional() }).catchall(z$1.unknown());
|
|
7305
7348
|
/**
|
|
7306
7349
|
* A tool-execution log entry as returned by `composio.logs.search()`.
|
|
7307
7350
|
*/
|
|
@@ -7314,7 +7357,7 @@ const ToolExecutionLogSchema = z$1.object({
|
|
|
7314
7357
|
status: ToolExecutionLogStatusSchema,
|
|
7315
7358
|
level: ToolExecutionLogLevelSchema,
|
|
7316
7359
|
message: z$1.string().optional(),
|
|
7317
|
-
metadata:
|
|
7360
|
+
metadata: ToolExecutionLogMetadataSchema,
|
|
7318
7361
|
metrics: z$1.record(z$1.string(), z$1.unknown()),
|
|
7319
7362
|
parent: ToolExecutionLogParentSchema
|
|
7320
7363
|
});
|
|
@@ -7362,7 +7405,7 @@ const transformToolExecutionLog = (response) => {
|
|
|
7362
7405
|
status: response.status,
|
|
7363
7406
|
level: response.level,
|
|
7364
7407
|
message: response.message,
|
|
7365
|
-
metadata: response.metadata,
|
|
7408
|
+
metadata: ToolExecutionLogMetadataSchema.parse(response.metadata),
|
|
7366
7409
|
metrics: response.metrics,
|
|
7367
7410
|
parent: response.parent ? {
|
|
7368
7411
|
logId: response.parent.log_id,
|
|
@@ -7384,7 +7427,7 @@ const transformToolExecutionLogDetail = (response) => {
|
|
|
7384
7427
|
status: response.status,
|
|
7385
7428
|
level: response.level,
|
|
7386
7429
|
message: response.message,
|
|
7387
|
-
metadata: response.metadata,
|
|
7430
|
+
metadata: ToolExecutionLogMetadataSchema.parse(response.metadata),
|
|
7388
7431
|
metrics: response.metrics,
|
|
7389
7432
|
parent: response.parent ? {
|
|
7390
7433
|
logId: response.parent.log_id,
|
|
@@ -7433,7 +7476,7 @@ var Logs = class {
|
|
|
7433
7476
|
* pagination.
|
|
7434
7477
|
*
|
|
7435
7478
|
* @param {LogSearchParams} [params] - Filters, `timeRange`, `limit` and `cursor`
|
|
7436
|
-
* @returns {Promise<LogSearchResponse>} Matching logs and the next cursor
|
|
7479
|
+
* @returns {Promise<LogSearchResponse>} Matching logs and the next cursor. Charged calls include `metadata.instant_charge` as an exact USD string.
|
|
7437
7480
|
* @throws {ValidationError} If the params fail validation
|
|
7438
7481
|
*
|
|
7439
7482
|
* @example
|
|
@@ -7459,7 +7502,7 @@ var Logs = class {
|
|
|
7459
7502
|
* source and raw `data`).
|
|
7460
7503
|
*
|
|
7461
7504
|
* @param {string} id - The log id
|
|
7462
|
-
* @returns {Promise<ToolExecutionLogDetail>} The log detail
|
|
7505
|
+
* @returns {Promise<ToolExecutionLogDetail>} The log detail, with an optional exact USD charge in `metadata.instant_charge`
|
|
7463
7506
|
*
|
|
7464
7507
|
* @example
|
|
7465
7508
|
* ```typescript
|
|
@@ -7538,16 +7581,16 @@ const ToolRouterConfigManageConnectionsSchema = z.object({
|
|
|
7538
7581
|
const ToolRouterToolkitsParamSchema = z.array(z.string()).describe("List of toolkits to enable in the tool router session");
|
|
7539
7582
|
const ToolRouterToolkitsDisabledConfigSchema = z.object({ disable: ToolRouterToolkitsParamSchema.describe("List of toolkits to disable in the tool router session") }).strict();
|
|
7540
7583
|
const ToolRouterToolkitsEnabledConfigSchema = z.object({ enable: ToolRouterToolkitsParamSchema.describe("List of toolkits to enable in the tool router session") }).strict();
|
|
7541
|
-
/** Experimental
|
|
7542
|
-
const
|
|
7584
|
+
/** Experimental Instant usage policy for a Session. */
|
|
7585
|
+
const ToolRouterInstantSchema = z.union([z.literal(false), z.object({
|
|
7543
7586
|
toolkits: z.union([ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsDisabledConfigSchema]).optional(),
|
|
7544
7587
|
tools: z.record(z.string(), z.union([z.object({ enable: z.array(z.string()) }).strict(), z.object({ disable: z.array(z.string()) }).strict()])).optional(),
|
|
7545
7588
|
/**
|
|
7546
|
-
* Return the actual
|
|
7547
|
-
* visibility only; on update, any policy object still re-enables
|
|
7589
|
+
* Return the actual Instant charge in Session tool responses. Controls
|
|
7590
|
+
* visibility only; on update, any policy object still re-enables Instant
|
|
7548
7591
|
* usage on a Session set to `false`.
|
|
7549
7592
|
*/
|
|
7550
|
-
|
|
7593
|
+
returnInstantCharge: z.boolean().optional()
|
|
7551
7594
|
}).strict()]);
|
|
7552
7595
|
const ToolRouterManageConnectionsConfigSchema = z.object({
|
|
7553
7596
|
enable: z.boolean().optional().describe("Whether to use tools to manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually").default(true),
|
|
@@ -7612,7 +7655,7 @@ const ToolRouterCreateSessionConfigBaseSchema = z.object({
|
|
|
7612
7655
|
ToolRouterToolkitsDisabledConfigSchema,
|
|
7613
7656
|
ToolRouterToolkitsEnabledConfigSchema
|
|
7614
7657
|
]).optional().describe("The toolkits to use in the tool router session"),
|
|
7615
|
-
|
|
7658
|
+
instant: ToolRouterInstantSchema.optional().describe("Experimental Instant usage policy. Omission permits eligible tools when the project allows Instant usage; false disables it for this Session."),
|
|
7616
7659
|
authConfigs: z.record(z.string(), z.string()).describe("The auth configs to use in the tool router session. The key is the toolkit slug, the value is the auth config id.").default({}),
|
|
7617
7660
|
connectedAccounts: z.record(z.string(), z.union([z.string(), z.array(z.string())])).describe("The connected accounts to use in the tool router session. The key is the toolkit slug, the value is a connected account id or an array of ids. Only one account per toolkit is allowed when multi-account mode is disabled.").default({}),
|
|
7618
7661
|
manageConnections: z.union([z.boolean(), ToolRouterConfigManageConnectionsSchema]).optional().default(true).describe("The config for the manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually. If set to an object, you can configure the manage connections settings."),
|
|
@@ -7742,8 +7785,8 @@ const ToolRouterSessionSearchToolkitConnectionStatusSchema = z.object({
|
|
|
7742
7785
|
statusMessage: z.string(),
|
|
7743
7786
|
connectionDetails: z.record(z.string(), z.unknown()).optional(),
|
|
7744
7787
|
currentUserInfo: z.record(z.string(), z.unknown()).optional(),
|
|
7745
|
-
/** Present when the toolkit runs on a Composio
|
|
7746
|
-
|
|
7788
|
+
/** Present when the toolkit runs on a Composio Instant account; only these tools run on it. */
|
|
7789
|
+
instantAccount: z.object({ allowedToolSlugs: z.array(z.string()) }).optional()
|
|
7747
7790
|
});
|
|
7748
7791
|
const ToolRouterSessionSearchResponseSchema = z.object({
|
|
7749
7792
|
success: z.boolean(),
|
|
@@ -7759,8 +7802,14 @@ const ToolRouterSessionExecuteResponseSchema = z.object({
|
|
|
7759
7802
|
data: z.record(z.string(), z.unknown()),
|
|
7760
7803
|
error: z.string().nullable(),
|
|
7761
7804
|
logId: z.string(),
|
|
7762
|
-
/**
|
|
7763
|
-
|
|
7805
|
+
/**
|
|
7806
|
+
* Whether the tool ran and succeeded (`completed`) or ran and failed
|
|
7807
|
+
* (`failed`). A failed execution can carry a `null` or empty `error`, so
|
|
7808
|
+
* read this rather than `error` to tell the two apart.
|
|
7809
|
+
*/
|
|
7810
|
+
resultType: z.enum(["completed", "failed"]),
|
|
7811
|
+
/** Actual Instant usage charge when the Session opts into returning it. */
|
|
7812
|
+
instantCharge: z.unknown().optional()
|
|
7764
7813
|
});
|
|
7765
7814
|
const SessionProxyExecuteParamsSchema = z.object({
|
|
7766
7815
|
/** The toolkit whose connected account to use for auth (e.g. 'gmail', 'github') */
|
|
@@ -7828,7 +7877,7 @@ const ToolRouterUpdateExperimentalSchema = z.object({
|
|
|
7828
7877
|
* `toolkits: []`, which denies every app toolkit).
|
|
7829
7878
|
*/
|
|
7830
7879
|
const ToolRouterUpdateSessionConfigSchema = z.object({
|
|
7831
|
-
|
|
7880
|
+
instant: ToolRouterInstantSchema.optional().describe("Experimental Instant usage policy. False disables it. Any supplied object, even one that only sets returnInstantCharge, re-enables it. Omitted subfields keep their stored values."),
|
|
7832
7881
|
toolkits: z.union([
|
|
7833
7882
|
ToolRouterToolkitsParamSchema,
|
|
7834
7883
|
ToolRouterToolkitsDisabledConfigSchema,
|
|
@@ -8240,7 +8289,7 @@ var BaseProvider = class {
|
|
|
8240
8289
|
const result = await target.execute(toolSlug, arguments_);
|
|
8241
8290
|
return {
|
|
8242
8291
|
...result,
|
|
8243
|
-
successful: result
|
|
8292
|
+
successful: isExecutionSuccessful(result)
|
|
8244
8293
|
};
|
|
8245
8294
|
}
|
|
8246
8295
|
};
|
|
@@ -8456,221 +8505,11 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
8456
8505
|
}
|
|
8457
8506
|
return outputs;
|
|
8458
8507
|
}
|
|
8459
|
-
/**
|
|
8460
|
-
* Handles all the tool calls from the OpenAI Assistant API.
|
|
8461
|
-
*
|
|
8462
|
-
* This method processes tool calls from an OpenAI Assistant run,
|
|
8463
|
-
* executes each tool call, and returns the tool outputs for submission.
|
|
8464
|
-
*
|
|
8465
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. This method will be removed in the next major version.
|
|
8466
|
-
*
|
|
8467
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8468
|
-
* @param {OpenAI.Beta.Threads.Run} run - The Assistant run object containing tool calls
|
|
8469
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8470
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8471
|
-
* @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} Array of tool outputs for submission
|
|
8472
|
-
*
|
|
8473
|
-
*
|
|
8474
|
-
* @example
|
|
8475
|
-
* ```typescript
|
|
8476
|
-
* // Handle tool calls from an OpenAI Assistant run
|
|
8477
|
-
* const run = {
|
|
8478
|
-
* id: 'run_abc123',
|
|
8479
|
-
* required_action: {
|
|
8480
|
-
* submit_tool_outputs: {
|
|
8481
|
-
* tool_calls: [
|
|
8482
|
-
* {
|
|
8483
|
-
* id: 'call_xyz789',
|
|
8484
|
-
* type: 'function',
|
|
8485
|
-
* function: {
|
|
8486
|
-
* name: 'SEARCH_TOOL',
|
|
8487
|
-
* arguments: '{"query":"composio documentation"}'
|
|
8488
|
-
* }
|
|
8489
|
-
* }
|
|
8490
|
-
* ]
|
|
8491
|
-
* }
|
|
8492
|
-
* }
|
|
8493
|
-
* };
|
|
8494
|
-
*
|
|
8495
|
-
* const toolOutputs = await provider.handleAssistantMessage(
|
|
8496
|
-
* 'user123',
|
|
8497
|
-
* run,
|
|
8498
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8499
|
-
* );
|
|
8500
|
-
*
|
|
8501
|
-
* // Submit tool outputs back to OpenAI
|
|
8502
|
-
* await openai.beta.threads.runs.submitToolOutputs(
|
|
8503
|
-
* thread.id,
|
|
8504
|
-
* run.id,
|
|
8505
|
-
* { tool_outputs: toolOutputs }
|
|
8506
|
-
* );
|
|
8507
|
-
* ```
|
|
8508
|
-
*/
|
|
8509
|
-
async handleAssistantMessage(userId, run, options, modifiers) {
|
|
8510
|
-
const tool_calls = run.required_action?.submit_tool_outputs?.tool_calls || [];
|
|
8511
|
-
return await Promise.all(tool_calls.map(async (tool_call) => {
|
|
8512
|
-
logger.debug(`Executing tool call: ${tool_call.id}`);
|
|
8513
|
-
const tool_response = await this.executeToolCall(userId, tool_call, options, modifiers);
|
|
8514
|
-
logger.debug(`Tool call ${tool_call.id} executed with response: ${tool_response}`);
|
|
8515
|
-
return {
|
|
8516
|
-
tool_call_id: tool_call.id,
|
|
8517
|
-
output: JSON.stringify(tool_response)
|
|
8518
|
-
};
|
|
8519
|
-
}));
|
|
8520
|
-
}
|
|
8521
|
-
/**
|
|
8522
|
-
* Waits for the assistant stream and handles the tool calls.
|
|
8523
|
-
*
|
|
8524
|
-
* This method processes an OpenAI Assistant stream, handles any tool calls
|
|
8525
|
-
* that require action, and yields each event from the stream. It's designed
|
|
8526
|
-
* for streaming Assistant responses while handling tool calls in real-time.
|
|
8527
|
-
*
|
|
8528
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. It will be removed in the next major version.
|
|
8529
|
-
*
|
|
8530
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8531
|
-
* @param {OpenAI} client - The OpenAI client instance
|
|
8532
|
-
* @param {Stream<OpenAI.Beta.Assistants.AssistantStreamEvent>} runStream - The Assistant run stream
|
|
8533
|
-
* @param {OpenAI.Beta.Threads.Thread} thread - The thread object
|
|
8534
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8535
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8536
|
-
* @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} Generator yielding stream events
|
|
8537
|
-
*
|
|
8538
|
-
*
|
|
8539
|
-
*
|
|
8540
|
-
* @example
|
|
8541
|
-
* ```typescript
|
|
8542
|
-
* // Process an OpenAI Assistant stream with tool calls
|
|
8543
|
-
* const thread = await openai.beta.threads.create();
|
|
8544
|
-
* const runStream = openai.beta.threads.runs.stream(thread.id, {
|
|
8545
|
-
* assistant_id: 'asst_abc123',
|
|
8546
|
-
* tools: provider.wrapTools(composioTools)
|
|
8547
|
-
* });
|
|
8548
|
-
*
|
|
8549
|
-
* // Process the stream and handle tool calls
|
|
8550
|
-
* const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
|
|
8551
|
-
* 'user123',
|
|
8552
|
-
* openai,
|
|
8553
|
-
* runStream,
|
|
8554
|
-
* thread,
|
|
8555
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8556
|
-
* );
|
|
8557
|
-
*
|
|
8558
|
-
* // Consume the stream events
|
|
8559
|
-
* for await (const event of streamProcessor) {
|
|
8560
|
-
* if (event.event === 'thread.message.delta') {
|
|
8561
|
-
* console.log(event.data.delta.content);
|
|
8562
|
-
* }
|
|
8563
|
-
* }
|
|
8564
|
-
* ```
|
|
8565
|
-
*/
|
|
8566
|
-
async *waitAndHandleAssistantStreamToolCalls(userId, client, runStream, thread, options, modifiers) {
|
|
8567
|
-
let runId = null;
|
|
8568
|
-
for await (const event of runStream) {
|
|
8569
|
-
yield event;
|
|
8570
|
-
if (event.event === "thread.run.created") {
|
|
8571
|
-
const { id } = event.data;
|
|
8572
|
-
runId = id;
|
|
8573
|
-
}
|
|
8574
|
-
if (!runId) continue;
|
|
8575
|
-
if (event.event === "thread.run.requires_action") {
|
|
8576
|
-
const toolOutputs = await this.handleAssistantMessage(userId, event.data, options, modifiers);
|
|
8577
|
-
await client.beta.threads.runs.submitToolOutputs(runId, {
|
|
8578
|
-
thread_id: thread.id,
|
|
8579
|
-
tool_outputs: toolOutputs
|
|
8580
|
-
});
|
|
8581
|
-
}
|
|
8582
|
-
if ([
|
|
8583
|
-
"thread.run.completed",
|
|
8584
|
-
"thread.run.failed",
|
|
8585
|
-
"thread.run.cancelled",
|
|
8586
|
-
"thread.run.expired"
|
|
8587
|
-
].includes(event.event)) break;
|
|
8588
|
-
}
|
|
8589
|
-
if (!runId) throw new Error("No run ID found");
|
|
8590
|
-
let finalRun = await client.beta.threads.runs.retrieve(runId, { thread_id: thread.id });
|
|
8591
|
-
while ([
|
|
8592
|
-
"queued",
|
|
8593
|
-
"in_progress",
|
|
8594
|
-
"requires_action"
|
|
8595
|
-
].includes(finalRun.status)) if (finalRun.status === "requires_action") {
|
|
8596
|
-
const toolOutputs = await this.handleAssistantMessage(userId, finalRun, options, modifiers);
|
|
8597
|
-
finalRun = await client.beta.threads.runs.submitToolOutputs(runId, {
|
|
8598
|
-
thread_id: thread.id,
|
|
8599
|
-
tool_outputs: toolOutputs
|
|
8600
|
-
});
|
|
8601
|
-
} else {
|
|
8602
|
-
finalRun = await client.beta.threads.runs.retrieve(runId, { thread_id: thread.id });
|
|
8603
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8604
|
-
}
|
|
8605
|
-
}
|
|
8606
|
-
/**
|
|
8607
|
-
* Waits for the assistant tool calls and handles them.
|
|
8608
|
-
*
|
|
8609
|
-
* This method polls an OpenAI Assistant run until it completes or requires action,
|
|
8610
|
-
* handles any tool calls, and returns the final run object. It's designed for
|
|
8611
|
-
* non-streaming Assistant interactions.
|
|
8612
|
-
*
|
|
8613
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. It will be removed in the next major version.
|
|
8614
|
-
*
|
|
8615
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8616
|
-
* @param {OpenAI} client - The OpenAI client instance
|
|
8617
|
-
* @param {OpenAI.Beta.Threads.Run} run - The initial run object
|
|
8618
|
-
* @param {OpenAI.Beta.Threads.Thread} thread - The thread object
|
|
8619
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8620
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8621
|
-
* @returns {Promise<OpenAI.Beta.Threads.Run>} The final run object after completion
|
|
8622
|
-
*
|
|
8623
|
-
* @example
|
|
8624
|
-
* ```typescript
|
|
8625
|
-
* // Process an OpenAI Assistant run with tool calls
|
|
8626
|
-
* const thread = await openai.beta.threads.create();
|
|
8627
|
-
* await openai.beta.threads.messages.create(thread.id, {
|
|
8628
|
-
* role: 'user',
|
|
8629
|
-
* content: 'Find information about Composio'
|
|
8630
|
-
* });
|
|
8631
|
-
*
|
|
8632
|
-
* let run = await openai.beta.threads.runs.create(thread.id, {
|
|
8633
|
-
* assistant_id: 'asst_abc123',
|
|
8634
|
-
* tools: provider.wrapTools(composioTools)
|
|
8635
|
-
* });
|
|
8636
|
-
*
|
|
8637
|
-
* // Wait for the run to complete, handling any tool calls
|
|
8638
|
-
* run = await provider.waitAndHandleAssistantToolCalls(
|
|
8639
|
-
* 'user123',
|
|
8640
|
-
* openai,
|
|
8641
|
-
* run,
|
|
8642
|
-
* thread,
|
|
8643
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8644
|
-
* );
|
|
8645
|
-
*
|
|
8646
|
-
* // Get the final messages after run completion
|
|
8647
|
-
* const messages = await openai.beta.threads.messages.list(thread.id);
|
|
8648
|
-
* console.log(messages.data[0].content);
|
|
8649
|
-
* ```
|
|
8650
|
-
*/
|
|
8651
|
-
async waitAndHandleAssistantToolCalls(userId, client, run, thread, options, modifiers) {
|
|
8652
|
-
while ([
|
|
8653
|
-
"queued",
|
|
8654
|
-
"in_progress",
|
|
8655
|
-
"requires_action"
|
|
8656
|
-
].includes(run.status)) {
|
|
8657
|
-
const tool_outputs = await this.handleAssistantMessage(userId, run, options, modifiers);
|
|
8658
|
-
if (run.status === "requires_action") run = await client.beta.threads.runs.submitToolOutputs(run.id, {
|
|
8659
|
-
thread_id: thread.id,
|
|
8660
|
-
tool_outputs
|
|
8661
|
-
});
|
|
8662
|
-
else {
|
|
8663
|
-
run = await client.beta.threads.runs.retrieve(run.id, { thread_id: thread.id });
|
|
8664
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
8665
|
-
}
|
|
8666
|
-
}
|
|
8667
|
-
return run;
|
|
8668
|
-
}
|
|
8669
8508
|
};
|
|
8670
8509
|
|
|
8671
8510
|
//#endregion
|
|
8672
8511
|
//#region package.json
|
|
8673
|
-
var version = "0.
|
|
8512
|
+
var version = "0.23.0";
|
|
8674
8513
|
|
|
8675
8514
|
//#endregion
|
|
8676
8515
|
//#region src/utils/session.ts
|
|
@@ -8695,12 +8534,32 @@ function detectRuntime() {
|
|
|
8695
8534
|
return "UNKNOWN";
|
|
8696
8535
|
}
|
|
8697
8536
|
const RUNTIME_ENV = detectRuntime();
|
|
8537
|
+
const runtimeVersions = z$2.object({
|
|
8538
|
+
Bun: z$2.object({ version: z$2.string() }).optional(),
|
|
8539
|
+
Deno: z$2.object({ version: z$2.object({ deno: z$2.string() }) }).optional()
|
|
8540
|
+
}).safeParse(globalThis);
|
|
8541
|
+
const detectRuntimeVersion = () => {
|
|
8542
|
+
switch (RUNTIME_ENV) {
|
|
8543
|
+
case "BUN": return runtimeVersions.success ? runtimeVersions.data.Bun?.version : void 0;
|
|
8544
|
+
case "DENO": return runtimeVersions.success ? runtimeVersions.data.Deno?.version.deno : void 0;
|
|
8545
|
+
case "NODEJS": return process.versions.node;
|
|
8546
|
+
default: return;
|
|
8547
|
+
}
|
|
8548
|
+
};
|
|
8549
|
+
const RUNTIME_VERSION = detectRuntimeVersion();
|
|
8698
8550
|
function getSessionHeaders(provider) {
|
|
8699
8551
|
return {
|
|
8700
8552
|
"x-framework": provider?.name || "unknown",
|
|
8701
8553
|
"x-source": "TYPESCRIPT_SDK",
|
|
8702
8554
|
"x-runtime": RUNTIME_ENV,
|
|
8703
|
-
"x-
|
|
8555
|
+
"x-client-runtime": RUNTIME_ENV === "CLOUDFLARE_WORKERS" ? "cloudflare" : RUNTIME_ENV.toLowerCase(),
|
|
8556
|
+
"x-sdk-version": identity.version,
|
|
8557
|
+
"x-client-provenance": identity.name,
|
|
8558
|
+
"x-client-version": identity.version,
|
|
8559
|
+
"x-client-language": "typescript",
|
|
8560
|
+
"x-client-library": "@composio/client",
|
|
8561
|
+
"x-client-library-version": VERSION,
|
|
8562
|
+
...RUNTIME_VERSION ? { "x-runtime-version": RUNTIME_VERSION } : {}
|
|
8704
8563
|
};
|
|
8705
8564
|
}
|
|
8706
8565
|
const getDefaultHeaders = (headers, provider) => {
|
|
@@ -8766,12 +8625,12 @@ const transformToolRouterSandboxParams = (params) => {
|
|
|
8766
8625
|
sandbox_size: params.sandboxSize
|
|
8767
8626
|
};
|
|
8768
8627
|
};
|
|
8769
|
-
const
|
|
8628
|
+
const transformToolRouterInstantParams = (config) => {
|
|
8770
8629
|
if (config === false) return false;
|
|
8771
8630
|
return {
|
|
8772
8631
|
...config.toolkits !== void 0 && { toolkits: config.toolkits },
|
|
8773
8632
|
...config.tools !== void 0 && { tools: config.tools },
|
|
8774
|
-
...config.
|
|
8633
|
+
...config.returnInstantCharge !== void 0 && { return_instant_charge: config.returnInstantCharge }
|
|
8775
8634
|
};
|
|
8776
8635
|
};
|
|
8777
8636
|
const transformToolRouterUpdateManageConnectionsParams = (params) => {
|
|
@@ -8832,7 +8691,7 @@ const transformToolRouterToolkitsParams = (params) => {
|
|
|
8832
8691
|
const transformToolRouterUpdateParams = (config) => {
|
|
8833
8692
|
const params = {};
|
|
8834
8693
|
if (config.toolkits !== void 0) params.toolkits = config.toolkits === null ? null : transformToolRouterToolkitsParams(config.toolkits);
|
|
8835
|
-
if (config.
|
|
8694
|
+
if (config.instant !== void 0) params.instant = transformToolRouterInstantParams(config.instant);
|
|
8836
8695
|
if (config.tools !== void 0) params.tools = config.tools === null ? null : transformToolRouterToolsParams(config.tools);
|
|
8837
8696
|
if (config.tags !== void 0) params.tags = config.tags === null ? null : transformToolRouterTagsParams(config.tags);
|
|
8838
8697
|
if (config.authConfigs !== void 0) params.auth_configs = config.authConfigs;
|
|
@@ -9021,13 +8880,19 @@ const FileDeleteResponseSchema = z.object({
|
|
|
9021
8880
|
*/
|
|
9022
8881
|
/**
|
|
9023
8882
|
* Upper bound on a filename, well under the 255-byte limit common to
|
|
9024
|
-
* ext4/APFS/NTFS.
|
|
9025
|
-
* `ENAMETOOLONG` mid-write. Matches
|
|
8883
|
+
* ext4/APFS/NTFS. A longer server-supplied name is truncated to fit rather
|
|
8884
|
+
* than failing with a raw `ENAMETOOLONG` mid-write. Matches
|
|
8885
|
+
* `MAX_COMPONENT_LENGTH` in the Python SDK.
|
|
9026
8886
|
*/
|
|
9027
8887
|
const MAX_FILENAME_BYTES = 128;
|
|
9028
8888
|
/**
|
|
8889
|
+
* Longest extension, in bytes and including its dot, that truncation keeps.
|
|
8890
|
+
* Anything longer is not a real extension and is truncated with the rest.
|
|
8891
|
+
*/
|
|
8892
|
+
const MAX_PRESERVED_EXTENSION_BYTES = 32;
|
|
8893
|
+
/**
|
|
9029
8894
|
* Reserved DOS device names. Writing to one on Windows targets the device
|
|
9030
|
-
* rather than a file.
|
|
8895
|
+
* rather than a file. Prefixed on every platform so behavior does not diverge
|
|
9031
8896
|
* between a POSIX developer machine and a Windows deployment.
|
|
9032
8897
|
*/
|
|
9033
8898
|
const WINDOWS_RESERVED_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -9044,7 +8909,22 @@ const WINDOWS_RESERVED_NAMES = /* @__PURE__ */ new Set([
|
|
|
9044
8909
|
].flatMap((superscript) => [`COM${superscript}`, `LPT${superscript}`])
|
|
9045
8910
|
]);
|
|
9046
8911
|
/** Control characters and characters reserved by Windows. */
|
|
9047
|
-
const WINDOWS_INVALID_CHARS = /[\u0000-\u001f<>:"|?*]
|
|
8912
|
+
const WINDOWS_INVALID_CHARS = /[\u0000-\u001f<>:"|?*]/g;
|
|
8913
|
+
/** Windows drops trailing spaces and dots from a filename. */
|
|
8914
|
+
const TRAILING_SPACES_AND_DOTS = /[. ]+$/;
|
|
8915
|
+
const utf8Length = (value) => new TextEncoder().encode(value).length;
|
|
8916
|
+
const FNV_OFFSET_BASIS_64 = 14695981039346656037n;
|
|
8917
|
+
const FNV_PRIME_64 = 1099511628211n;
|
|
8918
|
+
const UINT64_MASK = 18446744073709551615n;
|
|
8919
|
+
/**
|
|
8920
|
+
* 64-bit FNV-1a of the UTF-8 bytes, as 16 hex digits. Pure and synchronous, so
|
|
8921
|
+
* it runs on every runtime; `_fnv1a64_hex` in the Python SDK matches it.
|
|
8922
|
+
*/
|
|
8923
|
+
function fnv1a64Hex(value) {
|
|
8924
|
+
let hash = FNV_OFFSET_BASIS_64;
|
|
8925
|
+
for (const byte of new TextEncoder().encode(value)) hash = (hash ^ BigInt(byte)) * FNV_PRIME_64 & UINT64_MASK;
|
|
8926
|
+
return hash.toString(16).padStart(16, "0");
|
|
8927
|
+
}
|
|
9048
8928
|
/**
|
|
9049
8929
|
* Python str.strip() whitespace: Unicode White_Space plus U+001C–U+001F.
|
|
9050
8930
|
* Unlike JavaScript trim(), this includes U+0085 and preserves U+FEFF.
|
|
@@ -9087,51 +8967,99 @@ function hasLoneSurrogate(value) {
|
|
|
9087
8967
|
}
|
|
9088
8968
|
return false;
|
|
9089
8969
|
}
|
|
8970
|
+
/** The longest prefix of `value`, by whole code points, that fits in `maxBytes`. */
|
|
8971
|
+
function truncateToBytes(value, maxBytes) {
|
|
8972
|
+
let truncated = "";
|
|
8973
|
+
let bytes = 0;
|
|
8974
|
+
for (const char of value) {
|
|
8975
|
+
bytes += utf8Length(char);
|
|
8976
|
+
if (bytes > maxBytes) break;
|
|
8977
|
+
truncated += char;
|
|
8978
|
+
}
|
|
8979
|
+
return truncated;
|
|
8980
|
+
}
|
|
8981
|
+
/** Splits off a short trailing extension (with its dot); a leading dot is not one. */
|
|
8982
|
+
function splitExtension(name) {
|
|
8983
|
+
const dot = name.lastIndexOf(".");
|
|
8984
|
+
const extension = dot > 0 ? name.slice(dot) : "";
|
|
8985
|
+
return extension && utf8Length(extension) <= MAX_PRESERVED_EXTENSION_BYTES ? [name.slice(0, dot), extension] : [name, ""];
|
|
8986
|
+
}
|
|
8987
|
+
/**
|
|
8988
|
+
* Truncates `name` to `maxBytes`, keeping a short extension so the file still
|
|
8989
|
+
* opens with the right application.
|
|
8990
|
+
*/
|
|
8991
|
+
function fitFilenameBytes(name, maxBytes = 128) {
|
|
8992
|
+
if (utf8Length(name) <= maxBytes) return name;
|
|
8993
|
+
const [stem, extension] = splitExtension(name);
|
|
8994
|
+
return truncateToBytes(stem, maxBytes - utf8Length(extension)) + extension;
|
|
8995
|
+
}
|
|
8996
|
+
/** Adds a copy number before the extension without exceeding the filename byte limit. */
|
|
8997
|
+
function numberedBasename(name, copy) {
|
|
8998
|
+
const suffix = `-${copy}`;
|
|
8999
|
+
const [stem, extension] = splitExtension(name);
|
|
9000
|
+
return truncateToBytes(stem, 128 - utf8Length(extension) - suffix.length) + suffix + extension;
|
|
9001
|
+
}
|
|
9002
|
+
/**
|
|
9003
|
+
* Tags a name that portability changed with a digest of the name it came
|
|
9004
|
+
* from, before the extension: `report?.png` and `report*.png` both become
|
|
9005
|
+
* `report_.png`, and two long names can share a truncated prefix, so without
|
|
9006
|
+
* the tag one download would overwrite the other in a shared directory.
|
|
9007
|
+
*/
|
|
9008
|
+
function tagWithOriginal(portable, original) {
|
|
9009
|
+
const tag = `-${fnv1a64Hex(original)}`;
|
|
9010
|
+
const [stem, extension] = splitExtension(fitFilenameBytes(portable, 128 - tag.length));
|
|
9011
|
+
return stem + tag + extension;
|
|
9012
|
+
}
|
|
9090
9013
|
/**
|
|
9091
|
-
* Collapses an untrusted filename to a bare
|
|
9014
|
+
* Collapses an untrusted filename to a bare basename that is safe to write on
|
|
9015
|
+
* every platform.
|
|
9092
9016
|
*
|
|
9093
|
-
*
|
|
9094
|
-
*
|
|
9095
|
-
*
|
|
9096
|
-
*
|
|
9097
|
-
*
|
|
9098
|
-
*
|
|
9017
|
+
* Names that cannot be written at all are refused: a NUL byte, invalid
|
|
9018
|
+
* Unicode, or no usable basename (empty or a run of dots). A response that
|
|
9019
|
+
* cannot name its own file is malformed or hostile, and inventing a name would
|
|
9020
|
+
* hide that. `""`, `"."` and `".."` make an output path equal to, or escape,
|
|
9021
|
+
* its own directory, which surfaces as a raw `EISDIR` at write time instead of
|
|
9022
|
+
* a validation error.
|
|
9099
9023
|
*
|
|
9100
|
-
* Names that
|
|
9101
|
-
*
|
|
9102
|
-
*
|
|
9103
|
-
*
|
|
9104
|
-
*
|
|
9024
|
+
* Names that are merely unportable are made portable instead, because ordinary
|
|
9025
|
+
* files have them (`report_2026-09-29T10:30:00.csv`, `What is this?.png`), on
|
|
9026
|
+
* every platform so a name does not depend on where the SDK runs:
|
|
9027
|
+
* control and Windows-reserved characters become `_`, names over
|
|
9028
|
+
* {@link MAX_FILENAME_BYTES} are truncated with their extension kept, trailing
|
|
9029
|
+
* spaces and dots are dropped as Windows would, and a resulting reserved
|
|
9030
|
+
* device name gets a `_` prefix. A name any of these rules changed is then
|
|
9031
|
+
* tagged with a digest of the original before its extension
|
|
9032
|
+
* (`report_-<16 hex>.png`) to distinguish ordinary normalization collisions;
|
|
9033
|
+
* a name that was already portable is returned unchanged. A result can still
|
|
9034
|
+
* equal a literal server name, so default saves create files exclusively.
|
|
9035
|
+
* `safe_basename` in
|
|
9036
|
+
* the Python SDK applies the same rules in the same order.
|
|
9105
9037
|
*
|
|
9106
|
-
*
|
|
9107
|
-
*
|
|
9108
|
-
*
|
|
9109
|
-
* hazard checks that follow run on the raw segment so a trailing ASCII space or
|
|
9110
|
-
* dot is refused, not trimmed away. Check the stripped value for trailing dots
|
|
9111
|
-
* too, since stripping whitespace can expose one.
|
|
9038
|
+
* Python-compatible stripping removes surrounding whitespace first, and the
|
|
9039
|
+
* usability check runs last, on the value that gets written, so neither
|
|
9040
|
+
* `"\u00a0.\u00a0"` nor `". ."` can be written as `.` or as its own directory.
|
|
9112
9041
|
*
|
|
9113
9042
|
* @param name - The untrusted filename or relative path to reduce.
|
|
9114
9043
|
* @param label - How the value is described in error messages.
|
|
9115
|
-
* @returns The
|
|
9116
|
-
* @throws ValidationError if `name`
|
|
9044
|
+
* @returns The bare basename to write, adjusted to be portable.
|
|
9045
|
+
* @throws ValidationError if `name` contains a NUL byte or invalid Unicode, or
|
|
9046
|
+
* leaves no usable basename.
|
|
9117
9047
|
*/
|
|
9118
9048
|
function safeBasename(name, label = "filename") {
|
|
9119
|
-
const
|
|
9120
|
-
|
|
9121
|
-
if (!basename || /^\.+$/.test(basename)) throw new ValidationError(`Path traversal detected: ${label} ${JSON.stringify(name)} leaves no usable basename to write to.`);
|
|
9122
|
-
if (rawBasename.includes("\0")) throw new ValidationError(`Refusing to write ${label} containing a NUL byte: ${JSON.stringify(name)}`);
|
|
9123
|
-
if (WINDOWS_INVALID_CHARS.test(rawBasename)) throw new ValidationError(`Refusing to write ${label} containing characters reserved by Windows: ${JSON.stringify(name)}`);
|
|
9124
|
-
if (rawBasename.endsWith(" ") || rawBasename.endsWith(".") || basename.endsWith(".")) throw new ValidationError(`Refusing to write ${label} ending in a space or dot: ${JSON.stringify(name)}`);
|
|
9049
|
+
const basename = untrustedBasename(name).replace(SURROUNDING_WHITESPACE, "");
|
|
9050
|
+
if (basename.includes("\0")) throw new ValidationError(`Refusing to write ${label} containing a NUL byte: ${JSON.stringify(name)}`);
|
|
9125
9051
|
if (hasLoneSurrogate(basename)) throw new ValidationError(`Refusing to write ${label} containing invalid Unicode: ${JSON.stringify(name)}`);
|
|
9126
|
-
const
|
|
9127
|
-
|
|
9128
|
-
const deviceName =
|
|
9129
|
-
if (WINDOWS_RESERVED_NAMES.has(deviceName))
|
|
9130
|
-
|
|
9052
|
+
const fit = (value) => fitFilenameBytes(value).replace(TRAILING_SPACES_AND_DOTS, "");
|
|
9053
|
+
let portable = fit(basename.replace(WINDOWS_INVALID_CHARS, "_"));
|
|
9054
|
+
const deviceName = portable.split(".", 1)[0].replace(/ +$/, "").toUpperCase();
|
|
9055
|
+
if (WINDOWS_RESERVED_NAMES.has(deviceName)) portable = fit(`_${portable}`);
|
|
9056
|
+
if (!portable) throw new ValidationError(`Path traversal detected: ${label} ${JSON.stringify(name)} leaves no usable basename to write to.`);
|
|
9057
|
+
return portable === basename ? portable : tagWithOriginal(portable, basename);
|
|
9131
9058
|
}
|
|
9132
9059
|
|
|
9133
9060
|
//#endregion
|
|
9134
9061
|
//#region src/models/RemoteFile.ts
|
|
9062
|
+
const existingFileError = z$2.object({ code: z$2.literal("EEXIST") });
|
|
9135
9063
|
function getParentDir(filePath) {
|
|
9136
9064
|
const lastSep = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
|
|
9137
9065
|
if (lastSep <= 0) return "";
|
|
@@ -9267,6 +9195,7 @@ var RemoteFile = class RemoteFile {
|
|
|
9267
9195
|
* Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
|
|
9268
9196
|
*
|
|
9269
9197
|
* @param path - Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path.
|
|
9198
|
+
* An existing default destination gets a copy number before its extension.
|
|
9270
9199
|
* @returns The absolute path where the file was saved
|
|
9271
9200
|
* @throws Error if file system is not supported or the save fails
|
|
9272
9201
|
* @throws ValidationError if `path` is omitted and the mount path yields no usable filename
|
|
@@ -9276,12 +9205,24 @@ var RemoteFile = class RemoteFile {
|
|
|
9276
9205
|
const homeDir = platform.homedir();
|
|
9277
9206
|
if (!homeDir) throw new Error("Cannot determine save location: home directory is not available");
|
|
9278
9207
|
const defaultDir = platform.joinPath(homeDir, COMPOSIO_DIR, TEMP_FILES_DIRECTORY_NAME);
|
|
9279
|
-
const
|
|
9208
|
+
const defaultName = path == null ? safeBasename(this.mountRelativePath, "mount path") : "";
|
|
9209
|
+
const savePath = path ?? platform.joinPath(defaultDir, defaultName);
|
|
9280
9210
|
const content = await this.buffer();
|
|
9281
9211
|
const dir = path != null ? getParentDir(savePath) : defaultDir;
|
|
9282
9212
|
if (dir && !platform.existsSync(dir)) platform.mkdirSync(dir);
|
|
9283
|
-
|
|
9284
|
-
|
|
9213
|
+
if (path != null) {
|
|
9214
|
+
platform.writeFileSync(savePath, content);
|
|
9215
|
+
return savePath;
|
|
9216
|
+
}
|
|
9217
|
+
for (let copy = 0;; copy++) {
|
|
9218
|
+
const destination = copy === 0 ? savePath : platform.joinPath(defaultDir, numberedBasename(defaultName, copy));
|
|
9219
|
+
try {
|
|
9220
|
+
platform.writeFileExclusiveSync(destination, content);
|
|
9221
|
+
return destination;
|
|
9222
|
+
} catch (error) {
|
|
9223
|
+
if (!existingFileError.safeParse(error).success) throw error;
|
|
9224
|
+
}
|
|
9225
|
+
}
|
|
9285
9226
|
}
|
|
9286
9227
|
};
|
|
9287
9228
|
|
|
@@ -9651,6 +9592,9 @@ function assertUnambiguousCustomToolSlug(map, slug) {
|
|
|
9651
9592
|
* and wraps the result into the standard response format.
|
|
9652
9593
|
*
|
|
9653
9594
|
* Callers provide a pre-built SessionContext (which may include sibling routing).
|
|
9595
|
+
*
|
|
9596
|
+
* @throws {ComposioToolInputRequiredError} If a call the tool made through the
|
|
9597
|
+
* session context needs user input before it can run
|
|
9654
9598
|
*/
|
|
9655
9599
|
async function executeCustomTool(entry, arguments_, sessionContext, options) {
|
|
9656
9600
|
const { handle } = entry;
|
|
@@ -9671,6 +9615,7 @@ async function executeCustomTool(entry, arguments_, sessionContext, options) {
|
|
|
9671
9615
|
};
|
|
9672
9616
|
} catch (err) {
|
|
9673
9617
|
if (err instanceof ComposioRequestCancelledError) throw err;
|
|
9618
|
+
if (err instanceof ComposioToolInputRequiredError) throw err;
|
|
9674
9619
|
if (options?.signal?.aborted && isRequestAbortError(err)) throw new ComposioRequestCancelledError(void 0, { cause: err instanceof Error ? err : void 0 });
|
|
9675
9620
|
return {
|
|
9676
9621
|
data: {},
|
|
@@ -9738,7 +9683,8 @@ var SessionContextImpl = class {
|
|
|
9738
9683
|
return ToolRouterSessionExecuteResponseSchema.parse({
|
|
9739
9684
|
data: result.data,
|
|
9740
9685
|
error: result.error,
|
|
9741
|
-
logId: ""
|
|
9686
|
+
logId: "",
|
|
9687
|
+
resultType: result.successful ? "completed" : "failed"
|
|
9742
9688
|
});
|
|
9743
9689
|
}
|
|
9744
9690
|
assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
|
|
@@ -9748,8 +9694,8 @@ var SessionContextImpl = class {
|
|
|
9748
9694
|
};
|
|
9749
9695
|
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
9750
9696
|
if (experimental) executeParams.experimental = experimental;
|
|
9751
|
-
const response = await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, requestOptions), requestOptions?.signal);
|
|
9752
|
-
return ToolRouterSessionExecuteResponseSchema.parse(transformExecuteResponse(response));
|
|
9697
|
+
const response = await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
9698
|
+
return ToolRouterSessionExecuteResponseSchema.parse(transformExecuteResponse(response, toolSlug));
|
|
9753
9699
|
}
|
|
9754
9700
|
/**
|
|
9755
9701
|
* Proxy API calls through Composio's auth layer.
|
|
@@ -9761,7 +9707,8 @@ var SessionContextImpl = class {
|
|
|
9761
9707
|
const signal = this.signal;
|
|
9762
9708
|
const requestOptions = signal ? { signal } : void 0;
|
|
9763
9709
|
const clientParams = transformProxyParams(validated.data);
|
|
9764
|
-
const response = await withCancellation(() => this.client.toolRouter.session.proxyExecute(this.sessionId, clientParams, requestOptions), requestOptions?.signal);
|
|
9710
|
+
const response = await withCancellation(() => this.client.toolRouter.session.proxyExecute(this.sessionId, clientParams, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
9711
|
+
assertNotInputRequired(response, `${validated.data.method} proxy call for toolkit ${validated.data.toolkit}`);
|
|
9765
9712
|
return {
|
|
9766
9713
|
status: response.status,
|
|
9767
9714
|
data: response.data,
|
|
@@ -9855,7 +9802,7 @@ var ToolRouterSession = class {
|
|
|
9855
9802
|
execute: {},
|
|
9856
9803
|
search: {},
|
|
9857
9804
|
preload: { tools: [] },
|
|
9858
|
-
|
|
9805
|
+
instant: false
|
|
9859
9806
|
};
|
|
9860
9807
|
if (customToolsMap && !userId) throw new Error("userId is required when custom tools are bound to a session.");
|
|
9861
9808
|
this.sessionId = sessionId;
|
|
@@ -10177,6 +10124,7 @@ var ToolRouterSession = class {
|
|
|
10177
10124
|
* @param options - Optional execution options
|
|
10178
10125
|
* @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.
|
|
10179
10126
|
* @returns The tool execution result
|
|
10127
|
+
* @throws {ComposioToolInputRequiredError} If the tool needs input from the user (for example an approval) before it can run
|
|
10180
10128
|
*/
|
|
10181
10129
|
async execute(toolSlug, arguments_, options, requestOptions) {
|
|
10182
10130
|
const entry = findCustomTool(this.customToolsMap, toolSlug);
|
|
@@ -10186,7 +10134,8 @@ var ToolRouterSession = class {
|
|
|
10186
10134
|
return {
|
|
10187
10135
|
data: result.data,
|
|
10188
10136
|
error: result.error,
|
|
10189
|
-
logId: ""
|
|
10137
|
+
logId: "",
|
|
10138
|
+
resultType: result.successful ? "completed" : "failed"
|
|
10190
10139
|
};
|
|
10191
10140
|
}
|
|
10192
10141
|
assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
|
|
@@ -10197,8 +10146,8 @@ var ToolRouterSession = class {
|
|
|
10197
10146
|
if (options?.account) executeParams.account = options.account;
|
|
10198
10147
|
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
10199
10148
|
if (experimental) executeParams.experimental = experimental;
|
|
10200
|
-
const response = await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, requestOptions), requestOptions?.signal);
|
|
10201
|
-
const transformed = transformExecuteResponse(response);
|
|
10149
|
+
const response = await withCancellation(() => this.client.toolRouter.session.execute(this.sessionId, executeParams, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
10150
|
+
const transformed = transformExecuteResponse(response, toolSlug);
|
|
10202
10151
|
return ToolRouterSessionExecuteResponseSchema.parse(transformed);
|
|
10203
10152
|
}
|
|
10204
10153
|
/**
|
|
@@ -10207,12 +10156,14 @@ var ToolRouterSession = class {
|
|
|
10207
10156
|
*
|
|
10208
10157
|
* @param params - Proxy request parameters (toolkit, endpoint, method, body, headers/query params)
|
|
10209
10158
|
* @returns The proxied API response with status, data, headers
|
|
10159
|
+
* @throws {ComposioToolInputRequiredError} If the call needs input from the user before it can run
|
|
10210
10160
|
*/
|
|
10211
10161
|
async proxyExecute(params, requestOptions) {
|
|
10212
10162
|
const validated = SessionProxyExecuteParamsSchema.safeParse(params);
|
|
10213
10163
|
if (!validated.success) throw new ValidationError("Invalid proxy execute parameters", { cause: validated.error });
|
|
10214
10164
|
const clientParams = transformProxyParams(validated.data);
|
|
10215
|
-
const response = await withCancellation(() => this.client.toolRouter.session.proxyExecute(this.sessionId, clientParams, requestOptions), requestOptions?.signal);
|
|
10165
|
+
const response = await withCancellation(() => this.client.toolRouter.session.proxyExecute(this.sessionId, clientParams, withoutRetries(requestOptions)), requestOptions?.signal);
|
|
10166
|
+
assertNotInputRequired(response, `${validated.data.method} proxy call for toolkit ${validated.data.toolkit}`);
|
|
10216
10167
|
return {
|
|
10217
10168
|
status: response.status,
|
|
10218
10169
|
data: response.data,
|
|
@@ -10413,6 +10364,7 @@ var ToolRouterSession = class {
|
|
|
10413
10364
|
const [localResults, remoteOutcome] = await Promise.all([Promise.all(localPromises), remotePromise ? remotePromise.then((result) => ({ result })).catch((error) => ({ error })) : void 0]);
|
|
10414
10365
|
const remoteTransportFailed = !!remoteOutcome && "error" in remoteOutcome;
|
|
10415
10366
|
const remoteTransportError = remoteTransportFailed ? remoteOutcome.error : null;
|
|
10367
|
+
if (remoteTransportError instanceof ComposioToolInputRequiredError) throw remoteTransportError;
|
|
10416
10368
|
const remoteErrorMessage = remoteTransportFailed ? (remoteTransportError instanceof Error ? remoteTransportError.message : String(remoteTransportError)) || "Remote tool execution failed" : null;
|
|
10417
10369
|
const remoteResult = remoteOutcome && "result" in remoteOutcome ? remoteOutcome.result : void 0;
|
|
10418
10370
|
if (remoteIndices.length === 0 && localResults.length === 1) return localResults[0].result;
|
|
@@ -10458,12 +10410,12 @@ var ToolRouterSession = class {
|
|
|
10458
10410
|
mergedData.error_count = failedCount;
|
|
10459
10411
|
}
|
|
10460
10412
|
const remoteError = remoteErrorMessage ?? (typeof remoteResult?.error === "string" ? remoteResult.error : null);
|
|
10461
|
-
const
|
|
10413
|
+
const hasAnyFailure = localResults.some((r) => !r.result.successful) || remoteResult?.successful === false || !!remoteError;
|
|
10462
10414
|
return {
|
|
10463
10415
|
data: mergedData,
|
|
10464
|
-
error:
|
|
10465
|
-
successful: !
|
|
10466
|
-
...remoteResult?.
|
|
10416
|
+
error: hasAnyFailure ? failedCount > 0 ? `${failedCount} out of ${allResults.length} tools failed` : remoteError : null,
|
|
10417
|
+
successful: !hasAnyFailure,
|
|
10418
|
+
...remoteResult?.instantCharge !== void 0 && { instantCharge: remoteResult.instantCharge }
|
|
10467
10419
|
};
|
|
10468
10420
|
}
|
|
10469
10421
|
};
|
|
@@ -10548,7 +10500,7 @@ var ToolRouter = class {
|
|
|
10548
10500
|
auth_configs: routerConfig.authConfigs,
|
|
10549
10501
|
connected_accounts: connectedAccountsPayload,
|
|
10550
10502
|
toolkits: transformToolRouterToolkitsParams(routerConfig.toolkits),
|
|
10551
|
-
...routerConfig.
|
|
10503
|
+
...routerConfig.instant !== void 0 && { instant: transformToolRouterInstantParams(routerConfig.instant) },
|
|
10552
10504
|
tools: transformToolRouterToolsParams(routerConfig.tools),
|
|
10553
10505
|
tags: transformToolRouterTagsParams(routerConfig.tags),
|
|
10554
10506
|
manage_connections: transformToolRouterManageConnectionsParams(routerConfig.manageConnections),
|
|
@@ -11816,4 +11768,4 @@ const ComposioMcpUpdateResponseSchema = z$1.object({
|
|
|
11816
11768
|
});
|
|
11817
11769
|
|
|
11818
11770
|
//#endregion
|
|
11819
|
-
export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAPIKeyKindError, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioConnectedAccountNotRevokableError, ComposioConnectedAccountRevocationNotSupportedError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMCPDestinationError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioScopeConfigError, ComposioSensitiveFilePathBlockedError, ComposioSessionConfigConflictError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolFetchError, ComposioToolNotFoundError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountCompleteAuthParamsSchema, ConnectedAccountCompleteAuthResponseSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountRevokeResponseSchema, ConnectedAccountRevokedTokenSchema, 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, CustomToolkitAuthSchemeSchema, CustomToolkitDeleteResponseSchema, CustomToolkitSyncParamsSchema, CustomToolkitSyncResponseSchema, CustomToolkitUpsertParamsSchema, CustomToolkitUpsertResponseSchema, CustomToolkits, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, Keyring, KeyringTransferKeySchema, KeyringTransferKeysResponseSchema, LogSearchFilterFieldSchema, LogSearchFilterOperatorSchema, LogSearchFilterSchema, LogSearchParamsSchema, LogSearchResponseSchema, LogSearchTimeRangeSchema, Logs, 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, SessionConfigListParamsSchema, SessionConfigListResponseSchema, SessionConfigPolicySchema, SessionConfigSchema, SessionConfigSummarySchema, SessionConfigs, SessionPreset, SessionProxyExecuteParamsSchema, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolExecutionLogDetailSchema, ToolExecutionLogLevelSchema, ToolExecutionLogParentSchema, ToolExecutionLogSchema, ToolExecutionLogStatusSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterErrorCodes, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterPremiumUsageSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionEnsureConnectedOptionsSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionListConfigHistoryOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateExperimentalSchema, ToolRouterUpdateManageConnectionsSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitChangelogItemSchema, ToolkitChangelogResponseSchema, ToolkitConditionalScopeSchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitGetManySlugsSchema, ToolkitGrantContextDimensionSchema, ToolkitLatestVersionSchema, ToolkitListGrantContextsParamsSchema, ToolkitListGrantContextsResponseSchema, ToolkitMangedByEnumSchema, ToolkitRecommendScopesParamsSchema, ToolkitRecommendScopesResponseSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionChangelogSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsGetManyParamsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, Usage, UsageBreakdownGroupSchema, UsageBreakdownParamsSchema, UsageBreakdownResponseSchema, UsageEntitySummarySchema, UsageFiltersSchema, UsageOrderBySchema, UsageOrderDirectionSchema, UsageSummaryParamsSchema, UsageSummaryResponseSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEndpointCreateParamsSchema, WebhookEndpointListItemSchema, WebhookEndpointListParamsSchema, WebhookEndpointListResponseSchema, WebhookEndpointReplaceParamsSchema, WebhookEndpointSchema, WebhookEndpointUpdateParamsSchema, WebhookEndpoints, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookSubscriptionDeleteResponseSchema, WebhookSubscriptionEventTypeSchema, WebhookSubscriptionEventTypesResponseSchema, WebhookSubscriptionListParamsSchema, WebhookSubscriptionListResponseSchema, WebhookSubscriptionRotateSecretResponseSchema, WebhookSubscriptionSchema, WebhookSubscriptionSetParamsSchema, WebhookSubscriptionUpdateParamsSchema, WebhookSubscriptions, WebhookTriggerPayloadV3Schema, WebhookVersionSchema, WebhookVersions, Webhooks, 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 };
|
|
11771
|
+
export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAPIKeyKindError, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioConnectedAccountNotRevokableError, ComposioConnectedAccountRevocationNotSupportedError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMCPDestinationError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioScopeConfigError, ComposioSensitiveFilePathBlockedError, ComposioSessionConfigConflictError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolFetchError, ComposioToolInputRequiredError, ComposioToolNotFoundError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountCompleteAuthParamsSchema, ConnectedAccountCompleteAuthResponseSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountRevokeResponseSchema, ConnectedAccountRevokedTokenSchema, 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, CustomToolkitAuthSchemeSchema, CustomToolkitDeleteResponseSchema, CustomToolkitSyncParamsSchema, CustomToolkitSyncResponseSchema, CustomToolkitUpsertParamsSchema, CustomToolkitUpsertResponseSchema, CustomToolkits, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, Keyring, KeyringTransferKeySchema, KeyringTransferKeysResponseSchema, LogSearchFilterFieldSchema, LogSearchFilterOperatorSchema, LogSearchFilterSchema, LogSearchParamsSchema, LogSearchResponseSchema, LogSearchTimeRangeSchema, Logs, 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, SessionConfigListParamsSchema, SessionConfigListResponseSchema, SessionConfigPolicySchema, SessionConfigSchema, SessionConfigSummarySchema, SessionConfigs, SessionPreset, SessionProxyExecuteParamsSchema, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolExecutionLogDetailSchema, ToolExecutionLogLevelSchema, ToolExecutionLogMetadataSchema, ToolExecutionLogParentSchema, ToolExecutionLogSchema, ToolExecutionLogStatusSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterErrorCodes, ToolRouterInstantSchema, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionEnsureConnectedOptionsSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionListConfigHistoryOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateExperimentalSchema, ToolRouterUpdateManageConnectionsSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitChangelogItemSchema, ToolkitChangelogResponseSchema, ToolkitConditionalScopeSchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitGetManySlugsSchema, ToolkitGrantContextDimensionSchema, ToolkitLatestVersionSchema, ToolkitListGrantContextsParamsSchema, ToolkitListGrantContextsResponseSchema, ToolkitMangedByEnumSchema, ToolkitRecommendScopesParamsSchema, ToolkitRecommendScopesResponseSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionChangelogSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsGetManyParamsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, Usage, UsageBreakdownGroupSchema, UsageBreakdownParamsSchema, UsageBreakdownResponseSchema, UsageEntitySummarySchema, UsageFiltersSchema, UsageOrderBySchema, UsageOrderDirectionSchema, UsageSummaryParamsSchema, UsageSummaryResponseSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEndpointCreateParamsSchema, WebhookEndpointListItemSchema, WebhookEndpointListParamsSchema, WebhookEndpointListResponseSchema, WebhookEndpointReplaceParamsSchema, WebhookEndpointSchema, WebhookEndpointUpdateParamsSchema, WebhookEndpoints, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookSubscriptionDeleteResponseSchema, WebhookSubscriptionEventTypeSchema, WebhookSubscriptionEventTypesResponseSchema, WebhookSubscriptionListParamsSchema, WebhookSubscriptionListResponseSchema, WebhookSubscriptionRotateSecretResponseSchema, WebhookSubscriptionSchema, WebhookSubscriptionSetParamsSchema, WebhookSubscriptionUpdateParamsSchema, WebhookSubscriptions, WebhookTriggerPayloadV3Schema, WebhookVersionSchema, WebhookVersions, Webhooks, 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 };
|