@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.
Files changed (57) hide show
  1. package/README.md +62 -247
  2. package/dist/BaseProvider-lCxnjFKQ.d.mts +29395 -0
  3. package/dist/{CustomTool-D9qwyMrv.mjs → CustomTool-C_5NvBsX.mjs} +17 -15
  4. package/dist/{CustomTool-DLf7JeKt.d.mts → CustomTool-CmokRT9q.d.mts} +1 -1
  5. package/dist/{FileModifierErrors-3fSwIWoa.mjs → SsrfErrors-BQRozkeU.mjs} +33 -1
  6. package/dist/{Telemetry-DhGI_J4G.mjs → Telemetry-llfvticE.mjs} +40 -8
  7. package/dist/{jsonSchema-CFKdONpP.mjs → cancellation-W65QRyj2.mjs} +64 -19
  8. package/dist/{composio-BHSQwOUz.d.mts → composio-6C8kHtqc.d.mts} +827 -808
  9. package/dist/{customTool.types-9yFqPjdw.d.mts → customTool.types-kFhNYuzh.d.mts} +502 -502
  10. package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -22
  11. package/dist/{errors-DSIlYfl5.mjs → errors-B165yJUQ.mjs} +74 -74
  12. package/dist/experimental/index.d.mts +2 -2
  13. package/dist/experimental/index.mjs +1 -1
  14. package/dist/{fileUtils.node-BiO1JQsJ.mjs → fileUtils.node-iPFi2o4i.mjs} +182 -68
  15. package/dist/index.d.mts +1451 -1400
  16. package/dist/index.mjs +1408 -1378
  17. package/dist/models/Files.node.mjs +2 -2
  18. package/dist/platform/node.d.mts +1 -1
  19. package/dist/platform/node.mjs +3 -0
  20. package/dist/platform/workerd.d.mts +1 -1
  21. package/dist/platform/workerd.mjs +3 -0
  22. package/dist/sensitiveFileUploadPaths-B1OLsd8F.mjs +114 -0
  23. package/dist/{types-DdoCRzLj.d.mts → types-DY1r-kN9.d.mts} +9 -0
  24. package/dist/{types-BJLCRj9q.d.mts → types-yCrveqAj.d.mts} +2 -2
  25. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  26. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  27. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  28. package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
  29. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  30. package/package.json +10 -10
  31. package/src/errors/SsrfErrors.ts +47 -0
  32. package/src/errors/index.ts +3 -0
  33. package/src/index.ts +10 -0
  34. package/src/models/CustomTool.ts +1 -3
  35. package/src/models/ToolRouterSession.ts +38 -16
  36. package/src/models/Tools.ts +32 -2
  37. package/src/models/Triggers.ts +16 -76
  38. package/src/platform/node.ts +4 -0
  39. package/src/platform/types.ts +10 -0
  40. package/src/platform/workerd.ts +6 -0
  41. package/src/provider/OpenAIProvider.ts +19 -14
  42. package/src/telemetry/Telemetry.ts +9 -6
  43. package/src/telemetry/redact.ts +40 -0
  44. package/src/types/tool.types.ts +36 -32
  45. package/src/utils/fileUtils.node.ts +27 -4
  46. package/src/utils/jsonSchema.ts +58 -0
  47. package/src/utils/modifiers/FileToolModifier.node.ts +2 -1
  48. package/src/utils/sdk.ts +5 -4
  49. package/src/utils/{sensitiveFileUploadPaths.node.ts → sensitiveFileUploadPaths.ts} +29 -13
  50. package/src/utils/ssrfGuard.node.ts +202 -0
  51. package/src/utils/toolkitVersion.ts +21 -2
  52. package/dist/BaseProvider-Brb3o86-.d.mts +0 -29425
  53. package/dist/CustomTool-NpHpqdnU.d.mts +0 -74
  54. package/dist/buffer-PcbMMsgm.mjs +0 -33
  55. package/dist/composio-DfPD7BAi.d.mts +0 -5666
  56. package/dist/customTool.types-D-6YqFdW.d.mts +0 -2826
  57. 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 };
@@ -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 };