@composio/core 0.6.9 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{CustomTool-B0ssIcQn.d.cts → CustomTool-B1b2MXbO.d.cts} +1 -1
  2. package/dist/{CustomTool-Cyo1aJ2l.cjs → CustomTool-Cywkgg64.cjs} +28 -28
  3. package/dist/{CustomTool-AYNimqhf.mjs → CustomTool-D8cxWvi9.mjs} +1 -1
  4. package/dist/{CustomTool-CaO_eE3G.d.mts → CustomTool-VQMc17af.d.mts} +1 -1
  5. package/dist/{ComposioError-CYaI68Mo.cjs → FileModifierErrors-DuKpNYju.cjs} +74 -0
  6. package/dist/{ComposioError-ChkSdxqU.mjs → FileModifierErrors-LQwvd6pa.mjs} +51 -1
  7. package/dist/{Telemetry-CjVa99gU.mjs → Telemetry-BJ2KYlDT.mjs} +1 -1
  8. package/dist/{Telemetry-A89k5RTv.cjs → Telemetry-JZNofztq.cjs} +17 -17
  9. package/dist/{composio-BREEwwMk.d.mts → composio-D8u53qsy.d.mts} +161 -157
  10. package/dist/{composio-COTWSJh4.d.cts → composio-ruMDVx1b.d.cts} +161 -157
  11. package/dist/{customTool.types-DIvgAKNO.d.cts → customTool.types-9jJUADW-.d.cts} +18 -51
  12. package/dist/{customTool.types-jiqAXiST.d.mts → customTool.types-C6-M75bi.d.mts} +18 -51
  13. package/dist/experimental/index.cjs +2 -2
  14. package/dist/experimental/index.d.cts +2 -2
  15. package/dist/experimental/index.d.mts +3 -3
  16. package/dist/experimental/index.mjs +2 -2
  17. package/dist/{fileUtils.node-DF-AY0Td.cjs → fileUtils.node-DsDsZfEl.cjs} +74 -10
  18. package/dist/{fileUtils.node-BOZnseMe.mjs → fileUtils.node-mlBa5nwX.mjs} +67 -5
  19. package/dist/index.cjs +95 -101
  20. package/dist/index.d.cts +31 -7
  21. package/dist/index.d.mts +31 -7
  22. package/dist/index.mjs +34 -44
  23. package/dist/models/Files.node.cjs +9 -5
  24. package/dist/models/Files.node.d.cts +5 -1
  25. package/dist/models/Files.node.d.mts +5 -1
  26. package/dist/models/Files.node.mjs +9 -5
  27. package/dist/platform/node.mjs +7 -7
  28. package/dist/{tool.types-bencsexi.d.mts → tool.types-BGrE7Vqc.d.mts} +34 -21
  29. package/dist/{tool.types-BWc7GUrD.d.cts → tool.types-C5DMrBdm.d.cts} +34 -21
  30. package/dist/{types-mVw5PfwE.d.cts → types-DZaf5VcY.d.cts} +2 -2
  31. package/dist/{types-C7Ld_qbu.d.mts → types-WkBTUiQh.d.mts} +2 -2
  32. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
  33. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +4 -4
  34. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
  35. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +4 -4
  36. package/dist/utils/modifiers/FileToolModifier.node.cjs +55 -24
  37. package/dist/utils/modifiers/FileToolModifier.node.d.cts +3 -2
  38. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -2
  39. package/dist/utils/modifiers/FileToolModifier.node.mjs +51 -20
  40. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +1 -1
  41. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  42. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { $t as ConnectionData, G as BaseComposioProvider, L as SessionMetaToolOptions, en as ConnectionDataSchema, o as Tool, v as ToolProxyParams } from "./tool.types-BWc7GUrD.cjs";
1
+ import { K as BaseComposioProvider, L as SessionMetaToolOptions, en as ConnectionData, o as Tool, tn as ConnectionDataSchema, v as ToolProxyParams } from "./tool.types-C5DMrBdm.cjs";
2
2
  import z$1, { z } from "zod/v3";
3
- import { ConnectedAccountPatchParams as UpdateConnectedAccountParams } from "@composio/client/resources/connected-accounts";
3
+ import { ConnectedAccountUpdateStatusParams as UpdateConnectedAccountParams } from "@composio/client/resources/connected-accounts";
4
4
  import { Composio } from "@composio/client";
5
5
  import { ToolExecuteResponse } from "@composio/client/resources/tools";
6
6
  import { SessionCreateParams, SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
@@ -299,45 +299,11 @@ declare const ConnectedAccountRefreshOptionsSchema: z.ZodObject<{
299
299
  }>;
300
300
  type ConnectedAccountRefreshOptions = z.infer<typeof ConnectedAccountRefreshOptionsSchema>;
301
301
  declare const UpdateConnectedAccountParamsSchema: z.ZodObject<{
302
- alias: z.ZodOptional<z.ZodString>;
303
- connection: z.ZodOptional<z.ZodObject<{
304
- state: z.ZodObject<{
305
- authScheme: z.ZodEnum<["BEARER_TOKEN", "API_KEY", "BASIC", "BASIC_WITH_JWT", "GOOGLE_SERVICE_ACCOUNT", "SERVICE_ACCOUNT"]>;
306
- val: z.ZodRecord<z.ZodString, z.ZodUnknown>;
307
- }, "strip", z.ZodTypeAny, {
308
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
309
- val: Record<string, unknown>;
310
- }, {
311
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
312
- val: Record<string, unknown>;
313
- }>;
314
- }, "strip", z.ZodTypeAny, {
315
- state: {
316
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
317
- val: Record<string, unknown>;
318
- };
319
- }, {
320
- state: {
321
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
322
- val: Record<string, unknown>;
323
- };
324
- }>>;
302
+ enabled: z.ZodBoolean;
325
303
  }, "strip", z.ZodTypeAny, {
326
- connection?: {
327
- state: {
328
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
329
- val: Record<string, unknown>;
330
- };
331
- } | undefined;
332
- alias?: string | undefined;
304
+ enabled: boolean;
333
305
  }, {
334
- connection?: {
335
- state: {
336
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
337
- val: Record<string, unknown>;
338
- };
339
- } | undefined;
340
- alias?: string | undefined;
306
+ enabled: boolean;
341
307
  }>;
342
308
  //#endregion
343
309
  //#region src/types/connectionRequest.types.d.ts
@@ -1143,8 +1109,8 @@ declare const ToolkitConnectionStateSchema: z$1.ZodObject<{
1143
1109
  } | undefined;
1144
1110
  }>>;
1145
1111
  }, "strip", z$1.ZodTypeAny, {
1146
- slug: string;
1147
1112
  name: string;
1113
+ slug: string;
1148
1114
  isNoAuth: boolean;
1149
1115
  logo?: string | undefined;
1150
1116
  connection?: {
@@ -1160,8 +1126,8 @@ declare const ToolkitConnectionStateSchema: z$1.ZodObject<{
1160
1126
  } | undefined;
1161
1127
  } | undefined;
1162
1128
  }, {
1163
- slug: string;
1164
1129
  name: string;
1130
+ slug: string;
1165
1131
  logo?: string | undefined;
1166
1132
  isNoAuth?: boolean | undefined;
1167
1133
  connection?: {
@@ -1232,8 +1198,8 @@ declare const ToolkitConnectionsDetailsSchema: z$1.ZodObject<{
1232
1198
  } | undefined;
1233
1199
  }>>;
1234
1200
  }, "strip", z$1.ZodTypeAny, {
1235
- slug: string;
1236
1201
  name: string;
1202
+ slug: string;
1237
1203
  isNoAuth: boolean;
1238
1204
  logo?: string | undefined;
1239
1205
  connection?: {
@@ -1249,8 +1215,8 @@ declare const ToolkitConnectionsDetailsSchema: z$1.ZodObject<{
1249
1215
  } | undefined;
1250
1216
  } | undefined;
1251
1217
  }, {
1252
- slug: string;
1253
1218
  name: string;
1219
+ slug: string;
1254
1220
  logo?: string | undefined;
1255
1221
  isNoAuth?: boolean | undefined;
1256
1222
  connection?: {
@@ -1266,12 +1232,12 @@ declare const ToolkitConnectionsDetailsSchema: z$1.ZodObject<{
1266
1232
  } | undefined;
1267
1233
  } | undefined;
1268
1234
  }>, "many">;
1269
- nextCursor: z$1.ZodOptional<z$1.ZodString>;
1235
+ cursor: z$1.ZodOptional<z$1.ZodString>;
1270
1236
  totalPages: z$1.ZodNumber;
1271
1237
  }, "strip", z$1.ZodTypeAny, {
1272
1238
  items: {
1273
- slug: string;
1274
1239
  name: string;
1240
+ slug: string;
1275
1241
  isNoAuth: boolean;
1276
1242
  logo?: string | undefined;
1277
1243
  connection?: {
@@ -1288,11 +1254,11 @@ declare const ToolkitConnectionsDetailsSchema: z$1.ZodObject<{
1288
1254
  } | undefined;
1289
1255
  }[];
1290
1256
  totalPages: number;
1291
- nextCursor?: string | undefined;
1257
+ cursor?: string | undefined;
1292
1258
  }, {
1293
1259
  items: {
1294
- slug: string;
1295
1260
  name: string;
1261
+ slug: string;
1296
1262
  logo?: string | undefined;
1297
1263
  isNoAuth?: boolean | undefined;
1298
1264
  connection?: {
@@ -1309,7 +1275,7 @@ declare const ToolkitConnectionsDetailsSchema: z$1.ZodObject<{
1309
1275
  } | undefined;
1310
1276
  }[];
1311
1277
  totalPages: number;
1312
- nextCursor?: string | undefined;
1278
+ cursor?: string | undefined;
1313
1279
  }>;
1314
1280
  type ToolkitConnectionsDetails = z$1.infer<typeof ToolkitConnectionsDetailsSchema>;
1315
1281
  type ToolkitConnectionState = z$1.infer<typeof ToolkitConnectionStateSchema>;
@@ -1330,24 +1296,25 @@ type ToolRouterMCPServerConfig = z$1.infer<typeof ToolRouterMCPServerConfigSchem
1330
1296
  type ToolRouterToolsFn<TToolCollection, TTool, TProvider extends BaseComposioProvider<TToolCollection, TTool, unknown>> = (modifiers?: SessionMetaToolOptions) => Promise<ReturnType<TProvider['wrapTools']>>;
1331
1297
  type ToolRouterAuthorizeFn = (toolkit: string, options?: {
1332
1298
  callbackUrl?: string;
1299
+ alias?: string;
1333
1300
  }) => Promise<ConnectionRequest>;
1334
1301
  declare const ToolRouterToolkitsOptionsSchema: z$1.ZodObject<{
1335
1302
  toolkits: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString, "many">>;
1336
- nextCursor: z$1.ZodOptional<z$1.ZodString>;
1303
+ cursor: z$1.ZodOptional<z$1.ZodString>;
1337
1304
  limit: z$1.ZodOptional<z$1.ZodNumber>;
1338
1305
  isConnected: z$1.ZodOptional<z$1.ZodBoolean>;
1339
1306
  search: z$1.ZodOptional<z$1.ZodString>;
1340
1307
  }, "strip", z$1.ZodTypeAny, {
1341
- nextCursor?: string | undefined;
1342
1308
  toolkits?: string[] | undefined;
1343
1309
  limit?: number | undefined;
1344
1310
  search?: string | undefined;
1311
+ cursor?: string | undefined;
1345
1312
  isConnected?: boolean | undefined;
1346
1313
  }, {
1347
- nextCursor?: string | undefined;
1348
1314
  toolkits?: string[] | undefined;
1349
1315
  limit?: number | undefined;
1350
1316
  search?: string | undefined;
1317
+ cursor?: string | undefined;
1351
1318
  isConnected?: boolean | undefined;
1352
1319
  }>;
1353
1320
  type ToolRouterToolkitsOptions = z$1.infer<typeof ToolRouterToolkitsOptionsSchema>;
@@ -1,7 +1,7 @@
1
- import { $t as ConnectionData, G as BaseComposioProvider, L as SessionMetaToolOptions, en as ConnectionDataSchema, o as Tool, v as ToolProxyParams } from "./tool.types-bencsexi.mjs";
1
+ import { K as BaseComposioProvider, L as SessionMetaToolOptions, en as ConnectionData, o as Tool, tn as ConnectionDataSchema, v as ToolProxyParams } from "./tool.types-BGrE7Vqc.mjs";
2
2
  import { Composio } from "@composio/client";
3
3
  import z, { z as z$1 } from "zod/v3";
4
- import { ConnectedAccountPatchParams as UpdateConnectedAccountParams } from "@composio/client/resources/connected-accounts";
4
+ import { ConnectedAccountUpdateStatusParams as UpdateConnectedAccountParams } from "@composio/client/resources/connected-accounts";
5
5
  import { ToolExecuteResponse } from "@composio/client/resources/tools";
6
6
  import { SessionCreateParams, SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
7
7
 
@@ -299,45 +299,11 @@ declare const ConnectedAccountRefreshOptionsSchema: z$1.ZodObject<{
299
299
  }>;
300
300
  type ConnectedAccountRefreshOptions = z$1.infer<typeof ConnectedAccountRefreshOptionsSchema>;
301
301
  declare const UpdateConnectedAccountParamsSchema: z$1.ZodObject<{
302
- alias: z$1.ZodOptional<z$1.ZodString>;
303
- connection: z$1.ZodOptional<z$1.ZodObject<{
304
- state: z$1.ZodObject<{
305
- authScheme: z$1.ZodEnum<["BEARER_TOKEN", "API_KEY", "BASIC", "BASIC_WITH_JWT", "GOOGLE_SERVICE_ACCOUNT", "SERVICE_ACCOUNT"]>;
306
- val: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
307
- }, "strip", z$1.ZodTypeAny, {
308
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
309
- val: Record<string, unknown>;
310
- }, {
311
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
312
- val: Record<string, unknown>;
313
- }>;
314
- }, "strip", z$1.ZodTypeAny, {
315
- state: {
316
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
317
- val: Record<string, unknown>;
318
- };
319
- }, {
320
- state: {
321
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
322
- val: Record<string, unknown>;
323
- };
324
- }>>;
302
+ enabled: z$1.ZodBoolean;
325
303
  }, "strip", z$1.ZodTypeAny, {
326
- connection?: {
327
- state: {
328
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
329
- val: Record<string, unknown>;
330
- };
331
- } | undefined;
332
- alias?: string | undefined;
304
+ enabled: boolean;
333
305
  }, {
334
- connection?: {
335
- state: {
336
- authScheme: "API_KEY" | "BASIC" | "BEARER_TOKEN" | "GOOGLE_SERVICE_ACCOUNT" | "BASIC_WITH_JWT" | "SERVICE_ACCOUNT";
337
- val: Record<string, unknown>;
338
- };
339
- } | undefined;
340
- alias?: string | undefined;
306
+ enabled: boolean;
341
307
  }>;
342
308
  //#endregion
343
309
  //#region src/types/connectionRequest.types.d.ts
@@ -1143,8 +1109,8 @@ declare const ToolkitConnectionStateSchema: z.ZodObject<{
1143
1109
  } | undefined;
1144
1110
  }>>;
1145
1111
  }, "strip", z.ZodTypeAny, {
1146
- slug: string;
1147
1112
  name: string;
1113
+ slug: string;
1148
1114
  isNoAuth: boolean;
1149
1115
  logo?: string | undefined;
1150
1116
  connection?: {
@@ -1160,8 +1126,8 @@ declare const ToolkitConnectionStateSchema: z.ZodObject<{
1160
1126
  } | undefined;
1161
1127
  } | undefined;
1162
1128
  }, {
1163
- slug: string;
1164
1129
  name: string;
1130
+ slug: string;
1165
1131
  logo?: string | undefined;
1166
1132
  isNoAuth?: boolean | undefined;
1167
1133
  connection?: {
@@ -1232,8 +1198,8 @@ declare const ToolkitConnectionsDetailsSchema: z.ZodObject<{
1232
1198
  } | undefined;
1233
1199
  }>>;
1234
1200
  }, "strip", z.ZodTypeAny, {
1235
- slug: string;
1236
1201
  name: string;
1202
+ slug: string;
1237
1203
  isNoAuth: boolean;
1238
1204
  logo?: string | undefined;
1239
1205
  connection?: {
@@ -1249,8 +1215,8 @@ declare const ToolkitConnectionsDetailsSchema: z.ZodObject<{
1249
1215
  } | undefined;
1250
1216
  } | undefined;
1251
1217
  }, {
1252
- slug: string;
1253
1218
  name: string;
1219
+ slug: string;
1254
1220
  logo?: string | undefined;
1255
1221
  isNoAuth?: boolean | undefined;
1256
1222
  connection?: {
@@ -1266,12 +1232,12 @@ declare const ToolkitConnectionsDetailsSchema: z.ZodObject<{
1266
1232
  } | undefined;
1267
1233
  } | undefined;
1268
1234
  }>, "many">;
1269
- nextCursor: z.ZodOptional<z.ZodString>;
1235
+ cursor: z.ZodOptional<z.ZodString>;
1270
1236
  totalPages: z.ZodNumber;
1271
1237
  }, "strip", z.ZodTypeAny, {
1272
1238
  items: {
1273
- slug: string;
1274
1239
  name: string;
1240
+ slug: string;
1275
1241
  isNoAuth: boolean;
1276
1242
  logo?: string | undefined;
1277
1243
  connection?: {
@@ -1288,11 +1254,11 @@ declare const ToolkitConnectionsDetailsSchema: z.ZodObject<{
1288
1254
  } | undefined;
1289
1255
  }[];
1290
1256
  totalPages: number;
1291
- nextCursor?: string | undefined;
1257
+ cursor?: string | undefined;
1292
1258
  }, {
1293
1259
  items: {
1294
- slug: string;
1295
1260
  name: string;
1261
+ slug: string;
1296
1262
  logo?: string | undefined;
1297
1263
  isNoAuth?: boolean | undefined;
1298
1264
  connection?: {
@@ -1309,7 +1275,7 @@ declare const ToolkitConnectionsDetailsSchema: z.ZodObject<{
1309
1275
  } | undefined;
1310
1276
  }[];
1311
1277
  totalPages: number;
1312
- nextCursor?: string | undefined;
1278
+ cursor?: string | undefined;
1313
1279
  }>;
1314
1280
  type ToolkitConnectionsDetails = z.infer<typeof ToolkitConnectionsDetailsSchema>;
1315
1281
  type ToolkitConnectionState = z.infer<typeof ToolkitConnectionStateSchema>;
@@ -1330,24 +1296,25 @@ type ToolRouterMCPServerConfig = z.infer<typeof ToolRouterMCPServerConfigSchema>
1330
1296
  type ToolRouterToolsFn<TToolCollection, TTool, TProvider extends BaseComposioProvider<TToolCollection, TTool, unknown>> = (modifiers?: SessionMetaToolOptions) => Promise<ReturnType<TProvider['wrapTools']>>;
1331
1297
  type ToolRouterAuthorizeFn = (toolkit: string, options?: {
1332
1298
  callbackUrl?: string;
1299
+ alias?: string;
1333
1300
  }) => Promise<ConnectionRequest>;
1334
1301
  declare const ToolRouterToolkitsOptionsSchema: z.ZodObject<{
1335
1302
  toolkits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1336
- nextCursor: z.ZodOptional<z.ZodString>;
1303
+ cursor: z.ZodOptional<z.ZodString>;
1337
1304
  limit: z.ZodOptional<z.ZodNumber>;
1338
1305
  isConnected: z.ZodOptional<z.ZodBoolean>;
1339
1306
  search: z.ZodOptional<z.ZodString>;
1340
1307
  }, "strip", z.ZodTypeAny, {
1341
- nextCursor?: string | undefined;
1342
1308
  toolkits?: string[] | undefined;
1343
1309
  limit?: number | undefined;
1344
1310
  search?: string | undefined;
1311
+ cursor?: string | undefined;
1345
1312
  isConnected?: boolean | undefined;
1346
1313
  }, {
1347
- nextCursor?: string | undefined;
1348
1314
  toolkits?: string[] | undefined;
1349
1315
  limit?: number | undefined;
1350
1316
  search?: string | undefined;
1317
+ cursor?: string | undefined;
1351
1318
  isConnected?: boolean | undefined;
1352
1319
  }>;
1353
1320
  type ToolRouterToolkitsOptions = z.infer<typeof ToolRouterToolkitsOptionsSchema>;
@@ -1,5 +1,5 @@
1
- require('../ComposioError-CYaI68Mo.cjs');
2
- const require_CustomTool = require('../CustomTool-Cyo1aJ2l.cjs');
1
+ require('../FileModifierErrors-DuKpNYju.cjs');
2
+ const require_CustomTool = require('../CustomTool-Cywkgg64.cjs');
3
3
 
4
4
  exports.experimental_createTool = require_CustomTool.createCustomTool;
5
5
  exports.experimental_createToolkit = require_CustomTool.createCustomToolkit;
@@ -1,3 +1,3 @@
1
- import { C as SessionContext, a as CustomTool, i as CreateCustomToolkitParams, m as CustomToolkit, n as CreateCustomToolParams, s as CustomToolExecuteFn } from "../customTool.types-DIvgAKNO.cjs";
2
- import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-B0ssIcQn.cjs";
1
+ import { C as SessionContext, a as CustomTool, i as CreateCustomToolkitParams, m as CustomToolkit, n as CreateCustomToolParams, s as CustomToolExecuteFn } from "../customTool.types-9jJUADW-.cjs";
2
+ import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-B1b2MXbO.cjs";
3
3
  export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
@@ -1,4 +1,4 @@
1
- import "../tool.types-bencsexi.mjs";
2
- import { C as SessionContext, a as CustomTool, i as CreateCustomToolkitParams, m as CustomToolkit, n as CreateCustomToolParams, s as CustomToolExecuteFn } from "../customTool.types-jiqAXiST.mjs";
3
- import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-CaO_eE3G.mjs";
1
+ import "../tool.types-BGrE7Vqc.mjs";
2
+ import { C as SessionContext, a as CustomTool, i as CreateCustomToolkitParams, m as CustomToolkit, n as CreateCustomToolParams, s as CustomToolExecuteFn } from "../customTool.types-C6-M75bi.mjs";
3
+ import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-VQMc17af.mjs";
4
4
  export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
@@ -1,5 +1,5 @@
1
1
  import "../chunk-CWQeghP5.mjs";
2
- import "../ComposioError-ChkSdxqU.mjs";
3
- import { n as createCustomTool, r as createCustomToolkit } from "../CustomTool-AYNimqhf.mjs";
2
+ import "../FileModifierErrors-LQwvd6pa.mjs";
3
+ import { n as createCustomTool, r as createCustomToolkit } from "../CustomTool-D8cxWvi9.mjs";
4
4
 
5
5
  export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
@@ -1,10 +1,73 @@
1
1
  const require_chunk = require('./chunk-CQwRTUmo.cjs');
2
- const require_ComposioError = require('./ComposioError-CYaI68Mo.cjs');
2
+ const require_FileModifierErrors = require('./FileModifierErrors-DuKpNYju.cjs');
3
3
  const require_buffer = require('./buffer-BjWptbNH.cjs');
4
4
  let _platform = require("#platform");
5
+ let node_fs = require("node:fs");
6
+ node_fs = require_chunk.__toESM(node_fs);
7
+ let node_path = require("node:path");
8
+ node_path = require_chunk.__toESM(node_path);
5
9
  let node_crypto = require("node:crypto");
6
10
  node_crypto = require_chunk.__toESM(node_crypto);
7
11
 
12
+ //#region src/utils/sensitiveFileUploadPaths.node.ts
13
+ /**
14
+ * Blocks accidental upload of local files from well-known secret/credential locations
15
+ * during auto file upload (and {@link getFileDataAfterUploadingToS3}).
16
+ */
17
+ /**
18
+ * Path segments (a single path component) that indicate a sensitive directory when
19
+ * they appear anywhere in a resolved local path. Compared case-insensitively on Windows.
20
+ */
21
+ const BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS = [
22
+ ".ssh",
23
+ ".aws",
24
+ ".azure",
25
+ ".gnupg",
26
+ ".kube",
27
+ ".docker",
28
+ ".claude",
29
+ ".password-store",
30
+ "keychains"
31
+ ];
32
+ const SECRET_LIKE_BASENAME = /^(\.env(\.|$)|\.netrc$|\.pgpass$)/i;
33
+ /** Default SSH private key basenames (public keys like id_rsa.pub are allowed). */
34
+ const DEFAULT_PRIVATE_KEY_BASENAME = /^id_(rsa|ed25519|ecdsa|dsa|ecdsa_sk)(\.old)?$/i;
35
+ /**
36
+ * Returns normalized path segments, resolving symlinks when the path exists.
37
+ */
38
+ function normalizePathSegments(filePath) {
39
+ const absolute = node_path.resolve(filePath);
40
+ let resolved = absolute;
41
+ try {
42
+ if (node_fs.default.existsSync(absolute)) resolved = node_fs.default.realpathSync(absolute);
43
+ } catch {}
44
+ return resolved.split(/[/\\]+/).filter(Boolean);
45
+ }
46
+ function getSensitiveFileUploadPathBlockReason(filePath, additionalDenySegments) {
47
+ const segments = normalizePathSegments(filePath);
48
+ const isWin = process.platform === "win32";
49
+ const deny = new Set([...BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, ...(additionalDenySegments ?? []).map((s) => s.trim()).filter(Boolean)].map((s) => isWin ? s.toLowerCase() : s));
50
+ const segmentsForMatch = isWin ? segments.map((s) => s.toLowerCase()) : segments;
51
+ for (let i = 0; i < segments.length; i++) if (deny.has(segmentsForMatch[i])) return `path segment "${segments[i]}" is in the sensitive file upload denylist`;
52
+ const basename = segments.length > 0 ? segments[segments.length - 1] : "";
53
+ if (basename) {
54
+ if (SECRET_LIKE_BASENAME.test(basename) || DEFAULT_PRIVATE_KEY_BASENAME.test(basename)) return `file name "${basename}" looks like a credential, env, or private key file`;
55
+ if (basename.toLowerCase() === "credentials") return "file name \"credentials\" is often used for cloud/API credential stores";
56
+ }
57
+ return null;
58
+ }
59
+ /**
60
+ * @throws {ComposioSensitiveFilePathBlockedError} if the path is not allowed
61
+ */
62
+ function assertSafeFileUploadPath(filePath, options) {
63
+ const reason = getSensitiveFileUploadPathBlockReason(filePath, options?.additionalDenySegments);
64
+ if (reason) throw new require_FileModifierErrors.ComposioSensitiveFilePathBlockedError(`Refusing to upload: ${reason}. To upload from this path anyway, set sensitiveFileUploadProtection: false on Composio (not recommended) or use a copy outside sensitive locations.`, { meta: {
65
+ filePath,
66
+ reason
67
+ } });
68
+ }
69
+
70
+ //#endregion
8
71
  //#region src/utils/fileUtils.node.ts
9
72
  const getExtensionFromMimeType = (mimeType) => {
10
73
  const mimeToExt = {
@@ -110,7 +173,7 @@ const uploadFileToS3 = async (fileName, content, toolSlug, toolkitSlug, mimeType
110
173
  tool_slug: toolSlug,
111
174
  toolkit_slug: toolkitSlug
112
175
  });
113
- require_ComposioError.logger_default.debug(`Uploading ${key} file to S3: ${key}`);
176
+ require_FileModifierErrors.logger_default.debug(`Uploading ${key} file to S3: ${key}`);
114
177
  const uploadBuffer = new Uint8Array(contentBytes.byteLength);
115
178
  uploadBuffer.set(contentBytes);
116
179
  const uploadResponse = await fetch(signedURL, {
@@ -136,12 +199,13 @@ const readFile = async (file) => {
136
199
  else return await readFileContent(file);
137
200
  throw new Error("Invalid file type");
138
201
  };
139
- const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client }) => {
202
+ const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client, sensitiveFileUploadProtection, fileUploadPathDenySegments }) => {
140
203
  if (!file) throw new Error("Either path or blob must be provided");
204
+ if (sensitiveFileUploadProtection !== false && typeof file === "string" && !file.startsWith("http")) assertSafeFileUploadPath(file, { additionalDenySegments: fileUploadPathDenySegments });
141
205
  const fileData = await readFile(file);
142
- require_ComposioError.logger_default.debug(`Uploading file to S3...`);
206
+ require_FileModifierErrors.logger_default.debug(`Uploading file to S3...`);
143
207
  const s3key = await uploadFileToS3(_platform.platform.basename(fileData.fileName), fileData.content, toolSlug, toolkitSlug, fileData.mimeType, client);
144
- require_ComposioError.logger_default.debug(`Done! File uploaded to S3: ${s3key}`, JSON.stringify(fileData, null, 2));
208
+ require_FileModifierErrors.logger_default.debug(`Done! File uploaded to S3: ${s3key}`, JSON.stringify(fileData, null, 2));
145
209
  return {
146
210
  name: fileData.fileName,
147
211
  mimetype: fileData.mimeType,
@@ -169,7 +233,7 @@ const getComposioDir = (createDirIfNotExists = false) => {
169
233
  try {
170
234
  const homeDir = _platform.platform.homedir();
171
235
  if (!homeDir) return null;
172
- const composioDir = _platform.platform.joinPath(homeDir, require_ComposioError.COMPOSIO_DIR);
236
+ const composioDir = _platform.platform.joinPath(homeDir, require_FileModifierErrors.COMPOSIO_DIR);
173
237
  if (createDirIfNotExists && _platform.platform.supportsFileSystem && !_platform.platform.existsSync(composioDir)) _platform.platform.mkdirSync(composioDir);
174
238
  return composioDir;
175
239
  } catch (_error) {
@@ -185,7 +249,7 @@ const getComposioTempFilesDir = (createDirIfNotExists = false) => {
185
249
  try {
186
250
  const homeDir = _platform.platform.homedir();
187
251
  if (!homeDir) return null;
188
- const composioFilesDir = _platform.platform.joinPath(homeDir, require_ComposioError.COMPOSIO_DIR, require_ComposioError.TEMP_FILES_DIRECTORY_NAME);
252
+ const composioFilesDir = _platform.platform.joinPath(homeDir, require_FileModifierErrors.COMPOSIO_DIR, require_FileModifierErrors.TEMP_FILES_DIRECTORY_NAME);
189
253
  if (createDirIfNotExists && _platform.platform.supportsFileSystem && !_platform.platform.existsSync(composioFilesDir)) _platform.platform.mkdirSync(composioFilesDir);
190
254
  return composioFilesDir;
191
255
  } catch (_error) {
@@ -202,18 +266,18 @@ const getComposioTempFilesDir = (createDirIfNotExists = false) => {
202
266
  const saveFile = (file, content, isTempFile = false) => {
203
267
  try {
204
268
  if (!_platform.platform.supportsFileSystem) {
205
- require_ComposioError.logger_default.debug("File system operations are not supported in this runtime environment");
269
+ require_FileModifierErrors.logger_default.debug("File system operations are not supported in this runtime environment");
206
270
  return null;
207
271
  }
208
272
  const composioFilesDir = isTempFile ? getComposioTempFilesDir(true) : getComposioDir(true);
209
273
  if (!composioFilesDir) return null;
210
274
  const filePath = _platform.platform.joinPath(composioFilesDir, _platform.platform.basename(file));
211
- require_ComposioError.logger_default.info(`Saving file to: ${filePath}`);
275
+ require_FileModifierErrors.logger_default.info(`Saving file to: ${filePath}`);
212
276
  if (content instanceof Uint8Array) _platform.platform.writeFileSync(filePath, content);
213
277
  else _platform.platform.writeFileSync(filePath, content, "utf8");
214
278
  return filePath;
215
279
  } catch (_error) {
216
- require_ComposioError.logger_default.debug(`Error saving file: ${_error}`);
280
+ require_FileModifierErrors.logger_default.debug(`Error saving file: ${_error}`);
217
281
  return null;
218
282
  }
219
283
  };
@@ -1,8 +1,69 @@
1
- import { c as TEMP_FILES_DIRECTORY_NAME, n as logger_default, r as COMPOSIO_DIR } from "./ComposioError-ChkSdxqU.mjs";
1
+ import { f as TEMP_FILES_DIRECTORY_NAME, o as logger_default, r as ComposioSensitiveFilePathBlockedError, s as COMPOSIO_DIR } from "./FileModifierErrors-LQwvd6pa.mjs";
2
2
  import { i as getRandomShortId, n as base64ToUint8Array, r as uint8ArrayToBase64 } from "./buffer-yOtEsT4J.mjs";
3
3
  import { platform } from "#platform";
4
+ import fs from "node:fs";
5
+ import * as path from "node:path";
4
6
  import crypto from "node:crypto";
5
7
 
8
+ //#region src/utils/sensitiveFileUploadPaths.node.ts
9
+ /**
10
+ * Blocks accidental upload of local files from well-known secret/credential locations
11
+ * during auto file upload (and {@link getFileDataAfterUploadingToS3}).
12
+ */
13
+ /**
14
+ * Path segments (a single path component) that indicate a sensitive directory when
15
+ * they appear anywhere in a resolved local path. Compared case-insensitively on Windows.
16
+ */
17
+ const BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS = [
18
+ ".ssh",
19
+ ".aws",
20
+ ".azure",
21
+ ".gnupg",
22
+ ".kube",
23
+ ".docker",
24
+ ".claude",
25
+ ".password-store",
26
+ "keychains"
27
+ ];
28
+ const SECRET_LIKE_BASENAME = /^(\.env(\.|$)|\.netrc$|\.pgpass$)/i;
29
+ /** Default SSH private key basenames (public keys like id_rsa.pub are allowed). */
30
+ const DEFAULT_PRIVATE_KEY_BASENAME = /^id_(rsa|ed25519|ecdsa|dsa|ecdsa_sk)(\.old)?$/i;
31
+ /**
32
+ * Returns normalized path segments, resolving symlinks when the path exists.
33
+ */
34
+ function normalizePathSegments(filePath) {
35
+ const absolute = path.resolve(filePath);
36
+ let resolved = absolute;
37
+ try {
38
+ if (fs.existsSync(absolute)) resolved = fs.realpathSync(absolute);
39
+ } catch {}
40
+ return resolved.split(/[/\\]+/).filter(Boolean);
41
+ }
42
+ function getSensitiveFileUploadPathBlockReason(filePath, additionalDenySegments) {
43
+ const segments = normalizePathSegments(filePath);
44
+ const isWin = process.platform === "win32";
45
+ const deny = new Set([...BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, ...(additionalDenySegments ?? []).map((s) => s.trim()).filter(Boolean)].map((s) => isWin ? s.toLowerCase() : s));
46
+ const segmentsForMatch = isWin ? segments.map((s) => s.toLowerCase()) : segments;
47
+ for (let i = 0; i < segments.length; i++) if (deny.has(segmentsForMatch[i])) return `path segment "${segments[i]}" is in the sensitive file upload denylist`;
48
+ const basename = segments.length > 0 ? segments[segments.length - 1] : "";
49
+ if (basename) {
50
+ if (SECRET_LIKE_BASENAME.test(basename) || DEFAULT_PRIVATE_KEY_BASENAME.test(basename)) return `file name "${basename}" looks like a credential, env, or private key file`;
51
+ if (basename.toLowerCase() === "credentials") return "file name \"credentials\" is often used for cloud/API credential stores";
52
+ }
53
+ return null;
54
+ }
55
+ /**
56
+ * @throws {ComposioSensitiveFilePathBlockedError} if the path is not allowed
57
+ */
58
+ function assertSafeFileUploadPath(filePath, options) {
59
+ const reason = getSensitiveFileUploadPathBlockReason(filePath, options?.additionalDenySegments);
60
+ if (reason) throw new ComposioSensitiveFilePathBlockedError(`Refusing to upload: ${reason}. To upload from this path anyway, set sensitiveFileUploadProtection: false on Composio (not recommended) or use a copy outside sensitive locations.`, { meta: {
61
+ filePath,
62
+ reason
63
+ } });
64
+ }
65
+
66
+ //#endregion
6
67
  //#region src/utils/fileUtils.node.ts
7
68
  const getExtensionFromMimeType = (mimeType) => {
8
69
  const mimeToExt = {
@@ -83,13 +144,13 @@ const readFileContent = async (filePath) => {
83
144
  throw new Error(`Error reading file at ${filePath}: ${error}`);
84
145
  }
85
146
  };
86
- const readFileContentFromURL = async (path) => {
87
- const response = await fetch(path);
147
+ const readFileContentFromURL = async (path$1) => {
148
+ const response = await fetch(path$1);
88
149
  if (!response.ok) throw new Error(`Failed to fetch file: ${response.statusText}`);
89
150
  const arrayBuffer = await response.arrayBuffer();
90
151
  const content = new Uint8Array(arrayBuffer);
91
152
  const mimeType = response.headers.get("content-type") || "application/octet-stream";
92
- const pathname = new URL(path).pathname;
153
+ const pathname = new URL(path$1).pathname;
93
154
  let fileName = platform.basename(pathname);
94
155
  if (!fileName || fileName === "/") fileName = generateTimestampedFilename(getExtensionFromMimeType(mimeType));
95
156
  else if (!fileName.includes(".")) fileName = generateTimestampedFilename(getExtensionFromMimeType(mimeType));
@@ -134,8 +195,9 @@ const readFile = async (file) => {
134
195
  else return await readFileContent(file);
135
196
  throw new Error("Invalid file type");
136
197
  };
137
- const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client }) => {
198
+ const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client, sensitiveFileUploadProtection, fileUploadPathDenySegments }) => {
138
199
  if (!file) throw new Error("Either path or blob must be provided");
200
+ if (sensitiveFileUploadProtection !== false && typeof file === "string" && !file.startsWith("http")) assertSafeFileUploadPath(file, { additionalDenySegments: fileUploadPathDenySegments });
139
201
  const fileData = await readFile(file);
140
202
  logger_default.debug(`Uploading file to S3...`);
141
203
  const s3key = await uploadFileToS3(platform.basename(fileData.fileName), fileData.content, toolSlug, toolkitSlug, fileData.mimeType, client);