@composio/core 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{tool.types-CB_4JKhV.d.mts → BaseProvider-BvHvJLXc.d.mts} +24346 -24345
  2. package/dist/{tool.types-CwbAy9l_.d.cts → BaseProvider-CVbQxTNa.d.cts} +24346 -24345
  3. package/dist/{CustomTool-PSRHsd85.d.cts → CustomTool-C-IUByoU.d.cts} +1 -1
  4. package/dist/{CustomTool-BFkwL1aY.d.mts → CustomTool-CChQSp44.d.mts} +1 -1
  5. package/dist/{CustomTool-Bkk0QYzw.cjs → CustomTool-D3-NreIm.cjs} +81 -81
  6. package/dist/{CustomTool-IIUhFtP8.mjs → CustomTool-D5s-aADw.mjs} +76 -76
  7. package/dist/{FileToolModifier.utils.neutral-B7P7wn-b.mjs → FileToolModifier.utils.neutral-BpSceNK8.mjs} +1 -7
  8. package/dist/{FileToolModifier.utils.neutral-Dfwqgimk.cjs → FileToolModifier.utils.neutral-DSBQs9-i.cjs} +2 -8
  9. package/dist/{Telemetry-Dm-0sewu.cjs → Telemetry-BQ_pl5AK.cjs} +34 -9
  10. package/dist/{Telemetry-kgWlkavX.mjs → Telemetry-DQax33Gh.mjs} +34 -9
  11. package/dist/{composio-Dzlk0Wj4.d.mts → composio-BlASKqjQ.d.mts} +216 -237
  12. package/dist/{composio-BnLWW0B6.d.cts → composio-pcA13w87.d.cts} +216 -237
  13. package/dist/{customTool.types-oV5boR1w.d.mts → customTool.types-DLIORcYN.d.mts} +195 -138
  14. package/dist/{customTool.types-BVgnEbR2.d.cts → customTool.types-QtkAZQma.d.cts} +195 -138
  15. package/dist/experimental/index.cjs +1 -1
  16. package/dist/experimental/index.d.cts +2 -2
  17. package/dist/experimental/index.d.mts +3 -3
  18. package/dist/experimental/index.mjs +1 -1
  19. package/dist/index.cjs +623 -654
  20. package/dist/index.d.cts +415 -18
  21. package/dist/index.d.mts +415 -18
  22. package/dist/index.mjs +617 -652
  23. package/dist/models/Files.node.cjs +1 -1
  24. package/dist/models/Files.node.mjs +1 -1
  25. package/dist/{types-4vkdo_RG.d.cts → types-DRG5qLxI.d.cts} +2 -2
  26. package/dist/{types-AcoPzTnm.d.mts → types-J2KCXP8R.d.mts} +2 -2
  27. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
  28. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +4 -4
  29. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
  30. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +4 -4
  31. package/dist/utils/modifiers/FileToolModifier.node.cjs +38 -21
  32. package/dist/utils/modifiers/FileToolModifier.node.d.cts +1 -1
  33. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  34. package/dist/utils/modifiers/FileToolModifier.node.mjs +38 -21
  35. package/dist/utils/modifiers/FileToolModifier.workerd.cjs +1 -1
  36. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +1 -1
  37. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  38. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  39. package/package.json +12 -3
@@ -1,5 +1,5 @@
1
1
  require('../FileModifierErrors-BYJBHiay.cjs');
2
- const require_Telemetry = require('../Telemetry-Dm-0sewu.cjs');
2
+ const require_Telemetry = require('../Telemetry-BQ_pl5AK.cjs');
3
3
  const require_fileUtils_node = require('../fileUtils.node-DtnSRMWa.cjs');
4
4
 
5
5
  //#region src/models/Files.node.ts
@@ -1,6 +1,6 @@
1
1
  import "../chunk-CWQeghP5.mjs";
2
2
  import "../FileModifierErrors-C7z16Dfi.mjs";
3
- import { t as telemetry } from "../Telemetry-kgWlkavX.mjs";
3
+ import { t as telemetry } from "../Telemetry-DQax33Gh.mjs";
4
4
  import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-Dq7ebZPC.mjs";
5
5
 
6
6
  //#region src/models/Files.node.ts
@@ -1,5 +1,5 @@
1
- import { q as BaseComposioProvider } from "./tool.types-CwbAy9l_.cjs";
2
- import { n as ComposioConfig } from "./composio-BnLWW0B6.cjs";
1
+ import { n as BaseComposioProvider } from "./BaseProvider-CVbQxTNa.cjs";
2
+ import { n as ComposioConfig } from "./composio-pcA13w87.cjs";
3
3
 
4
4
  //#region src/utils/config-defaults/types.d.ts
5
5
 
@@ -1,5 +1,5 @@
1
- import { q as BaseComposioProvider } from "./tool.types-CB_4JKhV.mjs";
2
- import { n as ComposioConfig } from "./composio-Dzlk0Wj4.mjs";
1
+ import { n as BaseComposioProvider } from "./BaseProvider-BvHvJLXc.mjs";
2
+ import { n as ComposioConfig } from "./composio-BlASKqjQ.mjs";
3
3
 
4
4
  //#region src/utils/config-defaults/types.d.ts
5
5
 
@@ -1,5 +1,5 @@
1
- import "../../composio-BnLWW0B6.cjs";
2
- import { t as ConfigDefaults } from "../../types-4vkdo_RG.cjs";
1
+ import "../../composio-pcA13w87.cjs";
2
+ import { t as ConfigDefaults } from "../../types-DRG5qLxI.cjs";
3
3
 
4
4
  //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
5
5
  declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,7 +1,7 @@
1
- import "../../tool.types-CB_4JKhV.mjs";
2
- import "../../customTool.types-oV5boR1w.mjs";
3
- import "../../composio-Dzlk0Wj4.mjs";
4
- import { t as ConfigDefaults } from "../../types-AcoPzTnm.mjs";
1
+ import "../../BaseProvider-BvHvJLXc.mjs";
2
+ import "../../customTool.types-DLIORcYN.mjs";
3
+ import "../../composio-BlASKqjQ.mjs";
4
+ import { t as ConfigDefaults } from "../../types-J2KCXP8R.mjs";
5
5
 
6
6
  //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
7
7
  declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,5 +1,5 @@
1
- import "../../composio-BnLWW0B6.cjs";
2
- import { t as ConfigDefaults } from "../../types-4vkdo_RG.cjs";
1
+ import "../../composio-pcA13w87.cjs";
2
+ import { t as ConfigDefaults } from "../../types-DRG5qLxI.cjs";
3
3
 
4
4
  //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
5
5
  declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,7 +1,7 @@
1
- import "../../tool.types-CB_4JKhV.mjs";
2
- import "../../customTool.types-oV5boR1w.mjs";
3
- import "../../composio-Dzlk0Wj4.mjs";
4
- import { t as ConfigDefaults } from "../../types-AcoPzTnm.mjs";
1
+ import "../../BaseProvider-BvHvJLXc.mjs";
2
+ import "../../customTool.types-DLIORcYN.mjs";
3
+ import "../../composio-BlASKqjQ.mjs";
4
+ import { t as ConfigDefaults } from "../../types-J2KCXP8R.mjs";
5
5
 
6
6
  //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
7
7
  declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,8 +1,39 @@
1
1
  const require_FileModifierErrors = require('../../FileModifierErrors-BYJBHiay.cjs');
2
- const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-Dfwqgimk.cjs');
2
+ const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-DSBQs9-i.cjs');
3
3
  const require_fileUtils_node = require('../../fileUtils.node-DtnSRMWa.cjs');
4
4
 
5
5
  //#region src/utils/modifiers/FileToolModifier.node.ts
6
+ const getSchemaVariants = (schema) => [
7
+ ...schema?.anyOf ?? [],
8
+ ...schema?.oneOf ?? [],
9
+ ...schema?.allOf ?? []
10
+ ];
11
+ const jsonSchemaTypeMatchesValue = (schema, value) => {
12
+ const schemaType = schema.type;
13
+ if (Array.isArray(schemaType)) return schemaType.some((type) => jsonSchemaTypeMatchesValue({
14
+ ...schema,
15
+ type
16
+ }, value));
17
+ if (schemaType === void 0) {
18
+ if (schema.properties) return require_FileToolModifier_utils_neutral.isPlainObject(value);
19
+ if (schema.items) return Array.isArray(value);
20
+ return false;
21
+ }
22
+ switch (schemaType) {
23
+ case "array": return Array.isArray(value);
24
+ case "object": return require_FileToolModifier_utils_neutral.isPlainObject(value);
25
+ case "string": return typeof value === "string";
26
+ case "integer": return Number.isInteger(value);
27
+ case "number": return typeof value === "number";
28
+ case "boolean": return typeof value === "boolean";
29
+ case "null": return value === null;
30
+ default: return false;
31
+ }
32
+ };
33
+ const findSchemaVariantWithFileProperty = (schema, property, value) => {
34
+ const candidates = getSchemaVariants(schema).filter((variant) => require_FileToolModifier_utils_neutral.schemaHasFileProperty(variant, property));
35
+ return candidates.find((candidate) => jsonSchemaTypeMatchesValue(candidate, value)) ?? candidates[0];
36
+ };
6
37
  /**
7
38
  * Recursively walks a runtime value and its matching JSON-Schema node,
8
39
  * uploading any string path whose schema node has `file_uploadable: true`.
@@ -64,15 +95,8 @@ const hydrateFiles = async (value, schema, ctx) => {
64
95
  fileUploadPathDenySegments: ctx.fileUploadPathDenySegments
65
96
  });
66
97
  }
67
- const schemaVariants = [
68
- ...schema?.anyOf ?? [],
69
- ...schema?.oneOf ?? [],
70
- ...schema?.allOf ?? []
71
- ];
72
- if (schemaVariants.length > 0) {
73
- const firstUploadableVariant = schemaVariants.find(require_FileToolModifier_utils_neutral.schemaHasFileUploadable);
74
- if (firstUploadableVariant) return hydrateFiles(value, firstUploadableVariant, ctx);
75
- }
98
+ const uploadableVariant = findSchemaVariantWithFileProperty(schema, "file_uploadable", value);
99
+ if (uploadableVariant) return hydrateFiles(value, uploadableVariant, ctx);
76
100
  if (schema?.type === "object" && schema.properties && require_FileToolModifier_utils_neutral.isPlainObject(value)) {
77
101
  const transformed = {};
78
102
  for (const [k, v] of Object.entries(value)) transformed[k] = await hydrateFiles(v, schema.properties[k], ctx);
@@ -130,17 +154,10 @@ const downloadS3File = async (value, ctx) => {
130
154
  const hydrateDownloads = async (value, schema, ctx) => {
131
155
  if (require_FileToolModifier_utils_neutral.isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
132
156
  if (schema?.file_downloadable && require_FileToolModifier_utils_neutral.isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
133
- const schemaVariants = [
134
- ...schema?.anyOf ?? [],
135
- ...schema?.oneOf ?? [],
136
- ...schema?.allOf ?? []
137
- ];
138
- if (schemaVariants.length > 0) {
139
- const downloadableVariants = schemaVariants.filter(require_FileToolModifier_utils_neutral.schemaHasFileDownloadable);
140
- let result = value;
141
- for (const variant of downloadableVariants) result = await hydrateDownloads(result, variant, ctx);
142
- if (downloadableVariants.length === 0) return hydrateDownloads(value, void 0, ctx);
143
- return result;
157
+ if (getSchemaVariants(schema).length > 0) {
158
+ const downloadableVariant = findSchemaVariantWithFileProperty(schema, "file_downloadable", value);
159
+ if (downloadableVariant) return hydrateDownloads(value, downloadableVariant, ctx);
160
+ return hydrateDownloads(value, void 0, ctx);
144
161
  }
145
162
  if (require_FileToolModifier_utils_neutral.isPlainObject(value)) {
146
163
  const pairs = await Promise.all(Object.entries(value).map(async ([k, v]) => [k, await hydrateDownloads(v, schema?.properties?.[k], ctx)]));
@@ -1,4 +1,4 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CwbAy9l_.cjs";
1
+ import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-CVbQxTNa.cjs";
2
2
  import ComposioClient from "@composio/client";
3
3
 
4
4
  //#region src/utils/modifiers/FileToolModifier.node.d.ts
@@ -1,4 +1,4 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CB_4JKhV.mjs";
1
+ import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-BvHvJLXc.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
 
4
4
  //#region src/utils/modifiers/FileToolModifier.node.d.ts
@@ -1,9 +1,40 @@
1
1
  import "../../chunk-CWQeghP5.mjs";
2
2
  import { a as ComposioSensitiveFilePathBlockedError, c as logger_default, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-C7z16Dfi.mjs";
3
- import { i as transformProperties, n as schemaHasFileDownloadable, r as schemaHasFileUploadable, t as isPlainObject } from "../../FileToolModifier.utils.neutral-B7P7wn-b.mjs";
3
+ import { i as transformProperties, n as schemaHasFileProperty, t as isPlainObject } from "../../FileToolModifier.utils.neutral-BpSceNK8.mjs";
4
4
  import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../../fileUtils.node-Dq7ebZPC.mjs";
5
5
 
6
6
  //#region src/utils/modifiers/FileToolModifier.node.ts
7
+ const getSchemaVariants = (schema) => [
8
+ ...schema?.anyOf ?? [],
9
+ ...schema?.oneOf ?? [],
10
+ ...schema?.allOf ?? []
11
+ ];
12
+ const jsonSchemaTypeMatchesValue = (schema, value) => {
13
+ const schemaType = schema.type;
14
+ if (Array.isArray(schemaType)) return schemaType.some((type) => jsonSchemaTypeMatchesValue({
15
+ ...schema,
16
+ type
17
+ }, value));
18
+ if (schemaType === void 0) {
19
+ if (schema.properties) return isPlainObject(value);
20
+ if (schema.items) return Array.isArray(value);
21
+ return false;
22
+ }
23
+ switch (schemaType) {
24
+ case "array": return Array.isArray(value);
25
+ case "object": return isPlainObject(value);
26
+ case "string": return typeof value === "string";
27
+ case "integer": return Number.isInteger(value);
28
+ case "number": return typeof value === "number";
29
+ case "boolean": return typeof value === "boolean";
30
+ case "null": return value === null;
31
+ default: return false;
32
+ }
33
+ };
34
+ const findSchemaVariantWithFileProperty = (schema, property, value) => {
35
+ const candidates = getSchemaVariants(schema).filter((variant) => schemaHasFileProperty(variant, property));
36
+ return candidates.find((candidate) => jsonSchemaTypeMatchesValue(candidate, value)) ?? candidates[0];
37
+ };
7
38
  /**
8
39
  * Recursively walks a runtime value and its matching JSON-Schema node,
9
40
  * uploading any string path whose schema node has `file_uploadable: true`.
@@ -65,15 +96,8 @@ const hydrateFiles = async (value, schema, ctx) => {
65
96
  fileUploadPathDenySegments: ctx.fileUploadPathDenySegments
66
97
  });
67
98
  }
68
- const schemaVariants = [
69
- ...schema?.anyOf ?? [],
70
- ...schema?.oneOf ?? [],
71
- ...schema?.allOf ?? []
72
- ];
73
- if (schemaVariants.length > 0) {
74
- const firstUploadableVariant = schemaVariants.find(schemaHasFileUploadable);
75
- if (firstUploadableVariant) return hydrateFiles(value, firstUploadableVariant, ctx);
76
- }
99
+ const uploadableVariant = findSchemaVariantWithFileProperty(schema, "file_uploadable", value);
100
+ if (uploadableVariant) return hydrateFiles(value, uploadableVariant, ctx);
77
101
  if (schema?.type === "object" && schema.properties && isPlainObject(value)) {
78
102
  const transformed = {};
79
103
  for (const [k, v] of Object.entries(value)) transformed[k] = await hydrateFiles(v, schema.properties[k], ctx);
@@ -131,17 +155,10 @@ const downloadS3File = async (value, ctx) => {
131
155
  const hydrateDownloads = async (value, schema, ctx) => {
132
156
  if (isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
133
157
  if (schema?.file_downloadable && isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
134
- const schemaVariants = [
135
- ...schema?.anyOf ?? [],
136
- ...schema?.oneOf ?? [],
137
- ...schema?.allOf ?? []
138
- ];
139
- if (schemaVariants.length > 0) {
140
- const downloadableVariants = schemaVariants.filter(schemaHasFileDownloadable);
141
- let result = value;
142
- for (const variant of downloadableVariants) result = await hydrateDownloads(result, variant, ctx);
143
- if (downloadableVariants.length === 0) return hydrateDownloads(value, void 0, ctx);
144
- return result;
158
+ if (getSchemaVariants(schema).length > 0) {
159
+ const downloadableVariant = findSchemaVariantWithFileProperty(schema, "file_downloadable", value);
160
+ if (downloadableVariant) return hydrateDownloads(value, downloadableVariant, ctx);
161
+ return hydrateDownloads(value, void 0, ctx);
145
162
  }
146
163
  if (isPlainObject(value)) {
147
164
  const pairs = await Promise.all(Object.entries(value).map(async ([k, v]) => [k, await hydrateDownloads(v, schema?.properties?.[k], ctx)]));
@@ -1,4 +1,4 @@
1
- const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-Dfwqgimk.cjs');
1
+ const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-DSBQs9-i.cjs');
2
2
 
3
3
  //#region src/utils/modifiers/FileToolModifier.workerd.ts
4
4
  const UNSUPPORTED_MESSAGE = "File upload/download modifiers are not available on edge runtimes yet. Please set `dangerouslyAllowAutoUploadDownloadFiles: false` (or unset it; it defaults to false) or run Composio in another JS runtime (Node.js / Bun).";
@@ -1,4 +1,4 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CwbAy9l_.cjs";
1
+ import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-CVbQxTNa.cjs";
2
2
  import ComposioClient from "@composio/client";
3
3
 
4
4
  //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
@@ -1,4 +1,4 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CB_4JKhV.mjs";
1
+ import { gn as Tool, xn as ToolExecuteResponse, yn as ToolExecuteParams } from "../../BaseProvider-BvHvJLXc.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
 
4
4
  //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
@@ -1,4 +1,4 @@
1
- import { i as transformProperties } from "../../FileToolModifier.utils.neutral-B7P7wn-b.mjs";
1
+ import { i as transformProperties } from "../../FileToolModifier.utils.neutral-BpSceNK8.mjs";
2
2
 
3
3
  //#region src/utils/modifiers/FileToolModifier.workerd.ts
4
4
  const UNSUPPORTED_MESSAGE = "File upload/download modifiers are not available on edge runtimes yet. Please set `dangerouslyAllowAutoUploadDownloadFiles: false` (or unset it; it defaults to false) or run Composio in another JS runtime (Node.js / Bun).";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@composio/core",
3
3
  "type": "module",
4
- "version": "0.9.1",
4
+ "version": "0.11.0",
5
5
  "description": "",
6
6
  "main": "dist/index.mjs",
7
7
  "publishConfig": {
@@ -137,14 +137,14 @@
137
137
  "tsx": "^4.20.5",
138
138
  "typedoc": "^0.28.5",
139
139
  "typescript": "^5.9.2",
140
- "vitest": "^3.2.4",
140
+ "vitest": "^4.1.0",
141
141
  "zod": "^4.1.0"
142
142
  },
143
143
  "peerDependencies": {
144
144
  "zod": "^3.25 || ^4"
145
145
  },
146
146
  "dependencies": {
147
- "@composio/client": "0.1.0-alpha.71",
147
+ "@composio/client": "0.1.0-alpha.72",
148
148
  "@types/json-schema": "^7.0.15",
149
149
  "chalk": "^4.1.2",
150
150
  "openai": "^6.16.0",
@@ -154,6 +154,15 @@
154
154
  "@composio/json-schema-to-zod": "0.1.20"
155
155
  },
156
156
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
157
+ "repository": {
158
+ "type": "git",
159
+ "url": "https://github.com/ComposioHQ/composio.git",
160
+ "directory": "ts/packages/core"
161
+ },
162
+ "bugs": {
163
+ "url": "https://github.com/ComposioHQ/composio/issues"
164
+ },
165
+ "homepage": "https://github.com/ComposioHQ/composio/tree/main/ts/packages/core#readme",
157
166
  "scripts": {
158
167
  "clean": "git clean -xdf node_modules",
159
168
  "build": "pnpm exec tsdown",