@composio/core 0.5.5 → 0.6.1
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/BaseProvider-QPPZprGx.d.mts +26875 -0
- package/dist/BaseProvider-dBg5sg9H.d.cts +26875 -0
- package/dist/FileToolModifier.utils.neutral-BN_L8usp.mjs +78 -0
- package/dist/FileToolModifier.utils.neutral-Bcl7LVf4.cjs +102 -0
- package/dist/Telemetry-Bn5VseVi.mjs +331 -0
- package/dist/Telemetry-DErMJqj0.cjs +337 -0
- package/dist/buffer-BFpVRahf.mjs +382 -0
- package/dist/buffer-CYf1Z6Sd.cjs +478 -0
- package/dist/composio-h_UeXpQT.d.cts +6325 -0
- package/dist/composio-ivOweCw4.d.mts +6325 -0
- package/dist/fileUtils.node-DLp53qm1.cjs +232 -0
- package/dist/fileUtils.node-MOEGtpnI.mjs +219 -0
- package/dist/index.cjs +273 -417
- package/dist/index.d.cts +6 -33161
- package/dist/index.d.mts +6 -33161
- package/dist/index.mjs +182 -325
- package/dist/models/Files.node.cjs +6 -4
- package/dist/models/Files.node.d.cts +1 -1
- package/dist/models/Files.node.d.mts +1 -1
- package/dist/models/Files.node.mjs +4 -2
- package/dist/models/Files.workerd.cjs +1 -1
- package/dist/models/Files.workerd.mjs +1 -1
- package/dist/platform/node.cjs +6 -3
- package/dist/platform/node.d.cts +1 -1
- package/dist/platform/node.d.mts +1 -1
- package/dist/platform/node.mjs +6 -3
- package/dist/platform/workerd.d.cts +1 -1
- package/dist/platform/workerd.d.mts +1 -1
- package/dist/{types-BaUqjuX3.d.mts → types-BF2OQZRP.d.cts} +8 -5
- package/dist/types-BXCpxUsu.d.cts +13 -0
- package/dist/{types-BrsW5suw.d.cts → types-Cvt_yFsu.d.mts} +8 -5
- package/dist/types-anOdQ7KW.d.mts +13 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.cjs +10 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +7 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +8 -0
- package/dist/utils/config-defaults/ConfigDefaults.node.mjs +9 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +10 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +7 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +8 -0
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +9 -0
- package/dist/utils/modifiers/FileToolModifier.node.cjs +172 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +21 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +21 -0
- package/dist/utils/modifiers/FileToolModifier.node.mjs +173 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +27 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +20 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +20 -0
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +27 -0
- package/package.json +25 -1
- package/src/platform/index.ts +1 -1
- package/src/platform/node.ts +17 -9
- package/src/platform/types.ts +9 -5
- package/src/platform/workerd.ts +7 -3
- package/dist/fileUtils-2bnnG7dq.cjs +0 -979
- package/dist/fileUtils-Dbn-fnh5.mjs +0 -900
- /package/dist/{chunk-0j-ceAHr.mjs → chunk-Dx2NuYGI.mjs} +0 -0
- /package/dist/{files.types-B7P5A1Z5.d.mts → files.types-BDqIUdfP.d.mts} +0 -0
- /package/dist/{files.types-D-RzIOHq.d.cts → files.types-nK6eTNnc.d.cts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-Bcl7LVf4.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/modifiers/FileToolModifier.workerd.ts
|
|
4
|
+
const UNSUPPORTED_MESSAGE = "File upload/download modifiers are not available on edge runtimes yet. Please set `autoUploadDownloadFiles: false` or run Composio in another JS runtime (Node.js / Bun).";
|
|
5
|
+
var FileToolModifier = class {
|
|
6
|
+
constructor(_client) {}
|
|
7
|
+
async modifyToolSchema(toolSlug, toolkitSlug, schema) {
|
|
8
|
+
if (!schema.inputParameters?.properties) return schema;
|
|
9
|
+
const properties = require_FileToolModifier_utils_neutral.transformProperties(schema.inputParameters.properties);
|
|
10
|
+
return {
|
|
11
|
+
...schema,
|
|
12
|
+
inputParameters: {
|
|
13
|
+
...schema.inputParameters,
|
|
14
|
+
properties
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async fileUploadModifier(_tool, _options) {
|
|
19
|
+
throw new Error(UNSUPPORTED_MESSAGE);
|
|
20
|
+
}
|
|
21
|
+
async fileDownloadModifier(_tool, _options) {
|
|
22
|
+
throw new Error(UNSUPPORTED_MESSAGE);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.FileToolModifier = FileToolModifier;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { _n as ToolExecuteResponse, fn as Tool, hn as ToolExecuteParams } from "../../BaseProvider-dBg5sg9H.cjs";
|
|
2
|
+
import ComposioClient from "@composio/client";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/modifiers/FileToolModifier.workerd.d.ts
|
|
5
|
+
declare class FileToolModifier {
|
|
6
|
+
constructor(_client: ComposioClient);
|
|
7
|
+
modifyToolSchema(toolSlug: string, toolkitSlug: string, schema: Tool): Promise<Tool>;
|
|
8
|
+
fileUploadModifier(_tool: Tool, _options: {
|
|
9
|
+
toolSlug: string;
|
|
10
|
+
toolkitSlug?: string;
|
|
11
|
+
params: ToolExecuteParams;
|
|
12
|
+
}): Promise<ToolExecuteParams>;
|
|
13
|
+
fileDownloadModifier(_tool: Tool, _options: {
|
|
14
|
+
toolSlug: string;
|
|
15
|
+
toolkitSlug: string;
|
|
16
|
+
result: ToolExecuteResponse;
|
|
17
|
+
}): Promise<ToolExecuteResponse>;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { FileToolModifier };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { _n as ToolExecuteResponse, fn as Tool, hn as ToolExecuteParams } from "../../BaseProvider-QPPZprGx.mjs";
|
|
2
|
+
import ComposioClient from "@composio/client";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/modifiers/FileToolModifier.workerd.d.ts
|
|
5
|
+
declare class FileToolModifier {
|
|
6
|
+
constructor(_client: ComposioClient);
|
|
7
|
+
modifyToolSchema(toolSlug: string, toolkitSlug: string, schema: Tool): Promise<Tool>;
|
|
8
|
+
fileUploadModifier(_tool: Tool, _options: {
|
|
9
|
+
toolSlug: string;
|
|
10
|
+
toolkitSlug?: string;
|
|
11
|
+
params: ToolExecuteParams;
|
|
12
|
+
}): Promise<ToolExecuteParams>;
|
|
13
|
+
fileDownloadModifier(_tool: Tool, _options: {
|
|
14
|
+
toolSlug: string;
|
|
15
|
+
toolkitSlug: string;
|
|
16
|
+
result: ToolExecuteResponse;
|
|
17
|
+
}): Promise<ToolExecuteResponse>;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { FileToolModifier };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { i as transformProperties } from "../../FileToolModifier.utils.neutral-BN_L8usp.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/modifiers/FileToolModifier.workerd.ts
|
|
4
|
+
const UNSUPPORTED_MESSAGE = "File upload/download modifiers are not available on edge runtimes yet. Please set `autoUploadDownloadFiles: false` or run Composio in another JS runtime (Node.js / Bun).";
|
|
5
|
+
var FileToolModifier = class {
|
|
6
|
+
constructor(_client) {}
|
|
7
|
+
async modifyToolSchema(toolSlug, toolkitSlug, schema) {
|
|
8
|
+
if (!schema.inputParameters?.properties) return schema;
|
|
9
|
+
const properties = transformProperties(schema.inputParameters.properties);
|
|
10
|
+
return {
|
|
11
|
+
...schema,
|
|
12
|
+
inputParameters: {
|
|
13
|
+
...schema.inputParameters,
|
|
14
|
+
properties
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async fileUploadModifier(_tool, _options) {
|
|
19
|
+
throw new Error(UNSUPPORTED_MESSAGE);
|
|
20
|
+
}
|
|
21
|
+
async fileDownloadModifier(_tool, _options) {
|
|
22
|
+
throw new Error(UNSUPPORTED_MESSAGE);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { FileToolModifier };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
7
7
|
"publishConfig": {
|
|
@@ -31,6 +31,30 @@
|
|
|
31
31
|
"import": "./dist/models/Files.node.mjs",
|
|
32
32
|
"require": "./dist/models/Files.node.cjs"
|
|
33
33
|
}
|
|
34
|
+
},
|
|
35
|
+
"#file_tool_modifier": {
|
|
36
|
+
"workerd": "./dist/utils/modifiers/FileToolModifier.workerd.mjs",
|
|
37
|
+
"edge-light": "./dist/utils/modifiers/FileToolModifier.workerd.mjs",
|
|
38
|
+
"node": {
|
|
39
|
+
"import": "./dist/utils/modifiers/FileToolModifier.node.mjs",
|
|
40
|
+
"require": "./dist/utils/modifiers/FileToolModifier.node.cjs"
|
|
41
|
+
},
|
|
42
|
+
"default": {
|
|
43
|
+
"import": "./dist/utils/modifiers/FileToolModifier.node.mjs",
|
|
44
|
+
"require": "./dist/utils/modifiers/FileToolModifier.node.cjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"#config_defaults": {
|
|
48
|
+
"workerd": "./dist/utils/config-defaults/ConfigDefaults.workerd.mjs",
|
|
49
|
+
"edge-light": "./dist/utils/config-defaults/ConfigDefaults.workerd.mjs",
|
|
50
|
+
"node": {
|
|
51
|
+
"import": "./dist/utils/config-defaults/ConfigDefaults.node.mjs",
|
|
52
|
+
"require": "./dist/utils/config-defaults/ConfigDefaults.node.cjs"
|
|
53
|
+
},
|
|
54
|
+
"default": {
|
|
55
|
+
"import": "./dist/utils/config-defaults/ConfigDefaults.node.mjs",
|
|
56
|
+
"require": "./dist/utils/config-defaults/ConfigDefaults.node.cjs"
|
|
57
|
+
}
|
|
34
58
|
}
|
|
35
59
|
},
|
|
36
60
|
"exports": {
|
package/src/platform/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { Platform } from './types';
|
|
1
|
+
export type { Platform, Uint8ArrayEncoding } from './types';
|
|
2
2
|
export { platform } from '#platform';
|
package/src/platform/node.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as os from 'node:os';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
-
import type { Platform } from './types';
|
|
4
|
+
import type { Platform, Uint8ArrayEncoding } from './types';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Node.js platform implementation.
|
|
8
8
|
* Provides full file system and OS operations using Node.js built-in modules.
|
|
9
9
|
*/
|
|
10
|
-
export const platform
|
|
10
|
+
export const platform = {
|
|
11
11
|
supportsFileSystem: true,
|
|
12
12
|
|
|
13
13
|
homedir(): string | null {
|
|
@@ -34,18 +34,26 @@ export const platform: Platform = {
|
|
|
34
34
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
35
35
|
},
|
|
36
36
|
|
|
37
|
-
readFileSync(filePath: string, encoding?:
|
|
38
|
-
if (encoding) {
|
|
39
|
-
|
|
37
|
+
readFileSync(filePath: string, encoding?: Uint8ArrayEncoding): string | Uint8Array {
|
|
38
|
+
if (encoding === undefined) {
|
|
39
|
+
const buf = fs.readFileSync(filePath, { encoding: null });
|
|
40
|
+
const uint8 = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
41
|
+
return uint8;
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
|
|
44
|
+
const str = fs.readFileSync(filePath, { encoding });
|
|
45
|
+
return str;
|
|
42
46
|
},
|
|
43
47
|
|
|
44
|
-
writeFileSync(
|
|
48
|
+
writeFileSync(
|
|
49
|
+
filePath: string,
|
|
50
|
+
content: string | Uint8Array,
|
|
51
|
+
encoding?: Uint8ArrayEncoding
|
|
52
|
+
): void {
|
|
45
53
|
if (encoding && typeof content === 'string') {
|
|
46
|
-
fs.writeFileSync(filePath, content, encoding);
|
|
54
|
+
fs.writeFileSync(filePath, content, { encoding });
|
|
47
55
|
} else {
|
|
48
56
|
fs.writeFileSync(filePath, content);
|
|
49
57
|
}
|
|
50
58
|
},
|
|
51
|
-
};
|
|
59
|
+
} as Platform;
|
package/src/platform/types.ts
CHANGED
|
@@ -39,18 +39,20 @@ export interface Platform {
|
|
|
39
39
|
/**
|
|
40
40
|
* Reads a file synchronously and returns its contents.
|
|
41
41
|
* @param filePath - The path to the file.
|
|
42
|
-
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns
|
|
43
|
-
* @returns The file contents as a string (if encoding provided) or
|
|
42
|
+
* @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns an Uint8Array.
|
|
43
|
+
* @returns The file contents as a string (if encoding provided) or Uint8Array.
|
|
44
44
|
*/
|
|
45
|
-
readFileSync(filePath: string, encoding?:
|
|
45
|
+
readFileSync(filePath: string, encoding?: never): Uint8Array;
|
|
46
|
+
readFileSync(filePath: string, encoding: Uint8ArrayEncoding): string;
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Writes content to a file synchronously.
|
|
49
50
|
* @param filePath - The path to the file.
|
|
50
|
-
* @param content - The content to write (string or
|
|
51
|
+
* @param content - The content to write (string or Uint8Array).
|
|
51
52
|
* @param encoding - Optional encoding for string content.
|
|
52
53
|
*/
|
|
53
|
-
writeFileSync(filePath: string, content:
|
|
54
|
+
writeFileSync(filePath: string, content: Uint8Array, encoding?: never): void;
|
|
55
|
+
writeFileSync(filePath: string, content: string, encoding: Uint8ArrayEncoding): void;
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
58
|
* Indicates whether this platform supports file system operations.
|
|
@@ -58,3 +60,5 @@ export interface Platform {
|
|
|
58
60
|
*/
|
|
59
61
|
readonly supportsFileSystem: boolean;
|
|
60
62
|
}
|
|
63
|
+
|
|
64
|
+
export type Uint8ArrayEncoding = 'utf8';
|
package/src/platform/workerd.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Platform } from './types';
|
|
1
|
+
import type { Platform, Uint8ArrayEncoding } from './types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Cloudflare Workers / Edge runtime platform implementation.
|
|
@@ -41,14 +41,18 @@ export const platform: Platform = {
|
|
|
41
41
|
// No-op in edge runtimes - directories cannot be created
|
|
42
42
|
},
|
|
43
43
|
|
|
44
|
-
readFileSync(_filePath: string, _encoding?:
|
|
44
|
+
readFileSync(_filePath: string, _encoding?: Uint8ArrayEncoding): never {
|
|
45
45
|
throw new Error(
|
|
46
46
|
'File system operations are not supported in this runtime environment (Cloudflare Workers/Edge). ' +
|
|
47
47
|
'Use environment variables or external storage services instead.'
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
|
|
51
|
-
writeFileSync(
|
|
51
|
+
writeFileSync(
|
|
52
|
+
_filePath: string,
|
|
53
|
+
_content: string | Uint8Array,
|
|
54
|
+
_encoding?: Uint8ArrayEncoding
|
|
55
|
+
): never {
|
|
52
56
|
throw new Error(
|
|
53
57
|
'File system operations are not supported in this runtime environment (Cloudflare Workers/Edge). ' +
|
|
54
58
|
'Use environment variables or external storage services instead.'
|