@composio/core 0.13.1 → 0.14.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/README.md +62 -247
- package/dist/BaseProvider-lCxnjFKQ.d.mts +29395 -0
- package/dist/{CustomTool-D9qwyMrv.mjs → CustomTool-C_5NvBsX.mjs} +17 -15
- package/dist/{CustomTool-DLf7JeKt.d.mts → CustomTool-CmokRT9q.d.mts} +1 -1
- package/dist/{FileModifierErrors-3fSwIWoa.mjs → SsrfErrors-BQRozkeU.mjs} +33 -1
- package/dist/{Telemetry-DhGI_J4G.mjs → Telemetry-llfvticE.mjs} +40 -8
- package/dist/{jsonSchema-CFKdONpP.mjs → cancellation-W65QRyj2.mjs} +64 -19
- package/dist/{composio-BHSQwOUz.d.mts → composio-6C8kHtqc.d.mts} +827 -808
- package/dist/{customTool.types-9yFqPjdw.d.mts → customTool.types-kFhNYuzh.d.mts} +502 -502
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -22
- package/dist/{errors-DSIlYfl5.mjs → errors-B165yJUQ.mjs} +74 -74
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-BiO1JQsJ.mjs → fileUtils.node-iPFi2o4i.mjs} +182 -68
- package/dist/index.d.mts +1451 -1400
- package/dist/index.mjs +1408 -1378
- package/dist/models/Files.node.mjs +2 -2
- package/dist/platform/node.d.mts +1 -1
- package/dist/platform/node.mjs +3 -0
- package/dist/platform/workerd.d.mts +1 -1
- package/dist/platform/workerd.mjs +3 -0
- package/dist/sensitiveFileUploadPaths-B1OLsd8F.mjs +114 -0
- package/dist/{types-DdoCRzLj.d.mts → types-DY1r-kN9.d.mts} +9 -0
- package/dist/{types-BJLCRj9q.d.mts → types-yCrveqAj.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 +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/package.json +10 -10
- package/src/errors/SsrfErrors.ts +47 -0
- package/src/errors/index.ts +3 -0
- package/src/index.ts +10 -0
- package/src/models/CustomTool.ts +1 -3
- package/src/models/ToolRouterSession.ts +38 -16
- package/src/models/Tools.ts +32 -2
- package/src/models/Triggers.ts +16 -76
- package/src/platform/node.ts +4 -0
- package/src/platform/types.ts +10 -0
- package/src/platform/workerd.ts +6 -0
- package/src/provider/OpenAIProvider.ts +19 -14
- package/src/telemetry/Telemetry.ts +9 -6
- package/src/telemetry/redact.ts +40 -0
- package/src/types/tool.types.ts +36 -32
- package/src/utils/fileUtils.node.ts +27 -4
- package/src/utils/jsonSchema.ts +58 -0
- package/src/utils/modifiers/FileToolModifier.node.ts +2 -1
- package/src/utils/sdk.ts +5 -4
- package/src/utils/{sensitiveFileUploadPaths.node.ts → sensitiveFileUploadPaths.ts} +29 -13
- package/src/utils/ssrfGuard.node.ts +202 -0
- package/src/utils/toolkitVersion.ts +21 -2
- package/dist/BaseProvider-Brb3o86-.d.mts +0 -29425
- package/dist/CustomTool-NpHpqdnU.d.mts +0 -74
- package/dist/buffer-PcbMMsgm.mjs +0 -33
- package/dist/composio-DfPD7BAi.d.mts +0 -5666
- package/dist/customTool.types-D-6YqFdW.d.mts +0 -2826
- package/dist/types-CCh8qvui.d.mts +0 -12
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-D-6YqFdW.mjs";
|
|
2
|
-
import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/models/CustomTool.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Create a custom tool for use in tool router sessions.
|
|
7
|
-
*
|
|
8
|
-
* The returned object is a lightweight reference containing the tool's metadata
|
|
9
|
-
* and execute function. Pass it to `composio.create(userId, { experimental: { customTools: [...] } })`
|
|
10
|
-
* to bind it to a session.
|
|
11
|
-
*
|
|
12
|
-
* Just return the result data from `execute`, or throw an error.
|
|
13
|
-
* The SDK wraps it into the standard response format internally.
|
|
14
|
-
*
|
|
15
|
-
* **Slug naming:** The slug you provide is automatically prefixed with `LOCAL_` when
|
|
16
|
-
* exposed to the agent (e.g. `'GREP'` becomes `LOCAL_GREP`). If the tool is inside a
|
|
17
|
-
* custom toolkit, the toolkit slug is also included (e.g. `LOCAL_DEV_TOOLS_GREP`).
|
|
18
|
-
* The `LOCAL_` prefix is reserved and cannot be used in your slug.
|
|
19
|
-
*
|
|
20
|
-
* @param slug - Unique tool identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
21
|
-
* @param options - Tool definition including name, schema, and execute function
|
|
22
|
-
* @returns A CustomTool to pass to session creation
|
|
23
|
-
*
|
|
24
|
-
* @example Standalone tool (no auth)
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const grep = createCustomTool('GREP', {
|
|
27
|
-
* name: 'Grep Search',
|
|
28
|
-
* description: 'Search for patterns in files',
|
|
29
|
-
* inputParams: z.object({ pattern: z.string(), path: z.string() }),
|
|
30
|
-
* execute: async (input) => ({ matches: [] }),
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example Tool extending a Composio toolkit (inherits auth)
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const getImportant = createCustomTool('GET_IMPORTANT_EMAILS', {
|
|
37
|
-
* name: 'Get Important Emails',
|
|
38
|
-
* description: 'Fetch high-priority emails',
|
|
39
|
-
* extendsToolkit: 'gmail',
|
|
40
|
-
* inputParams: z.object({ limit: z.number().default(10) }),
|
|
41
|
-
* execute: async (input, ctx) => {
|
|
42
|
-
* // Same response shape as session.execute(): { data, error, logId }
|
|
43
|
-
* const result = await ctx.execute('GMAIL_SEARCH', { query: 'is:important' });
|
|
44
|
-
* return { emails: result.data };
|
|
45
|
-
* },
|
|
46
|
-
* });
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
declare function createCustomTool<T extends AnyZodSchema>(slug: string, options: CreateCustomToolParams<T>): CustomTool;
|
|
50
|
-
/**
|
|
51
|
-
* Create a custom toolkit that groups related tools.
|
|
52
|
-
*
|
|
53
|
-
* Tools passed here must NOT have `extendsToolkit` set — they inherit the toolkit identity instead.
|
|
54
|
-
*
|
|
55
|
-
* **Slug naming:** The toolkit slug becomes part of the final tool slug exposed to the agent.
|
|
56
|
-
* For example, a toolkit `'DEV_TOOLS'` with a tool `'GREP'` produces `LOCAL_DEV_TOOLS_GREP`.
|
|
57
|
-
* The `LOCAL_` prefix is reserved and cannot be used in your slug.
|
|
58
|
-
*
|
|
59
|
-
* @param slug - Unique toolkit identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
60
|
-
* @param options - Toolkit definition including name, description, and tools
|
|
61
|
-
* @returns A CustomToolkit to pass to session creation
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* const devTools = createCustomToolkit('DEV_TOOLS', {
|
|
66
|
-
* name: 'Dev Tools',
|
|
67
|
-
* description: 'Local dev utilities',
|
|
68
|
-
* tools: [grepTool, sedTool],
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
declare function createCustomToolkit(slug: string, options: CreateCustomToolkitParams): CustomToolkit;
|
|
73
|
-
//#endregion
|
|
74
|
-
export { createCustomToolkit as n, createCustomTool as t };
|
package/dist/buffer-PcbMMsgm.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//#region src/utils/uuid.ts
|
|
2
|
-
function getRandomUUID() {
|
|
3
|
-
return globalThis.crypto.randomUUID();
|
|
4
|
-
}
|
|
5
|
-
function getRandomShortId() {
|
|
6
|
-
return getRandomUUID().slice(0, 8).replace(/-/g, "");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/utils/buffer.ts
|
|
11
|
-
/**
|
|
12
|
-
* Convert ArrayBuffer to base64.
|
|
13
|
-
*/
|
|
14
|
-
function arrayBufferToBase64(buffer) {
|
|
15
|
-
const bytes = new Uint8Array(buffer);
|
|
16
|
-
let binary = "";
|
|
17
|
-
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
18
|
-
return btoa(binary);
|
|
19
|
-
}
|
|
20
|
-
const base64ToUint8Array = (base64) => {
|
|
21
|
-
const binary = atob(base64);
|
|
22
|
-
const bytes = new Uint8Array(binary.length);
|
|
23
|
-
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
24
|
-
return bytes;
|
|
25
|
-
};
|
|
26
|
-
const uint8ArrayToBase64 = (bytes) => {
|
|
27
|
-
let binary = "";
|
|
28
|
-
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
29
|
-
return btoa(binary);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { getRandomUUID as a, getRandomShortId as i, base64ToUint8Array as n, uint8ArrayToBase64 as r, arrayBufferToBase64 as t };
|