@composio/core 0.28.0 → 0.30.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 +25 -0
- package/dist/{CustomTool-BYHB7sPs.mjs → CustomTool-9Vlb4XaS.mjs} +12 -14
- package/dist/{CustomTool-DyypijT6.d.mts → CustomTool-Dzk3iqfP.d.mts} +10 -11
- package/dist/FileModifierErrors-WrqokuIF.mjs +199 -0
- package/dist/{FileToolModifier.utils.neutral-DWFpnsj2.mjs → FileToolModifier.utils.neutral-BQP85ZJj.mjs} +1 -2
- package/dist/{SsrfErrors-DiQldIdC.mjs → SsrfErrors-BSVMW915.mjs} +49 -26
- package/dist/{Telemetry-D2PJwXKx.mjs → Telemetry-a7SOQXcg.mjs} +6 -10
- package/dist/{composio-CwHMpKXb.d.mts → composio-DaokW5sV.d.mts} +220 -254
- package/dist/{customTool.types-DoItUHkO.d.mts → customTool.types-CpJbzxT6.d.mts} +255 -274
- package/dist/docs/error-consistency.md +3 -3
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +2 -1
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +88 -10
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +48 -10
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +6 -6
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +4 -4
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +5 -1
- package/dist/{errors-Cly0vXFh.mjs → errors-xC13uvaA.mjs} +116 -135
- package/dist/experimental/index.d.mts +17 -3
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-ILI1IjnZ.mjs → fileUtils.node-CAwIbWYH.mjs} +6 -8
- package/dist/{files.types-DeMC_mAW.d.mts → files.types-Dg6HcEzs.d.mts} +0 -2
- package/dist/index.d.mts +73 -78
- package/dist/index.mjs +393 -290
- package/dist/{cancellation-ZoRh6EJQ.mjs → jsonSchema-Cc4EtHRw.mjs} +5 -22
- package/dist/models/Files.node.d.mts +32 -13
- package/dist/models/Files.node.mjs +36 -19
- package/dist/models/Files.workerd.d.mts +8 -3
- package/dist/models/Files.workerd.mjs +1 -2
- package/dist/platform/node.d.mts +2 -4
- package/dist/platform/node.mjs +15 -16
- package/dist/platform/workerd.d.mts +2 -4
- package/dist/platform/workerd.mjs +1 -2
- package/dist/requestOptions.types-DWrTcbss.d.mts +38 -0
- package/dist/rolldown-runtime-ad2WFvuA.mjs +17 -0
- package/dist/{sensitiveFileUploadPaths-BaEORC7-.mjs → sensitiveFileUploadPaths-CSyJ3Ku8.mjs} +22 -12
- package/dist/{ssrfGuard.node-BZ270bcu.mjs → ssrfGuard.node-CdIkwqVu.mjs} +3 -5
- package/dist/{types-DWZWePfZ.d.mts → types-DQdUb7OG.d.mts} +2 -4
- package/dist/{types-DuVZKrXO.d.mts → types-Ds6XbK1m.d.mts} +0 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +2 -4
- package/dist/utils/config-defaults/ConfigDefaults.node.mjs +1 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +2 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +1 -2
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +2 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +7 -8
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +2 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +2 -3
- package/dist/utils/ssrfGuard.node.d.mts +1 -3
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +1 -3
- package/dist/utils/ssrfGuard.workerd.mjs +2 -3
- package/docs/error-consistency.md +3 -3
- package/package.json +12 -13
- package/src/composio.ts +12 -0
- package/src/errors/ComposioError.ts +40 -16
- package/src/errors/ConnectedAccountsErrors.ts +2 -2
- package/src/errors/ToolErrors.ts +177 -28
- package/src/errors/apiErrorDetails.ts +40 -0
- package/src/experimental/index.ts +6 -1
- package/src/lib/toolRouterParams.ts +40 -0
- package/src/models/ConnectedAccounts.ts +2 -2
- package/src/models/ConnectionRequest.ts +44 -32
- package/src/models/CustomTool.ts +25 -30
- package/src/models/CustomToolkits.ts +16 -22
- package/src/models/Experimental.ts +2 -7
- package/src/models/Files.node.ts +68 -37
- package/src/models/RemoteFile.ts +22 -16
- package/src/models/SessionContext.ts +6 -7
- package/src/models/ToolRouter.ts +24 -14
- package/src/models/ToolRouterSession.ts +38 -31
- package/src/models/Tools.ts +274 -30
- package/src/models/Triggers.ts +8 -2
- package/src/types/customTool.types.ts +49 -28
- package/src/types/customToolkits.types.ts +7 -12
- package/src/types/toolRouter.types.ts +39 -17
- package/src/utils/cancellation.ts +5 -1
- package/src/utils/rateLimit.ts +25 -0
- package/src/utils/transformers/customToolkits.ts +2 -2
- package/dist/FileModifierErrors-CdGSABoq.mjs +0 -97
- package/dist/rolldown-runtime-w6R9maHv.mjs +0 -18
- package/src/models/inlineCustomToolsPayload.ts +0 -17
|
@@ -8,7 +8,6 @@ export type CustomToolkitApiKeyField = z.infer<typeof CustomToolkitApiKeyFieldSc
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* How end users authenticate to a custom toolkit.
|
|
11
|
-
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
12
11
|
*/
|
|
13
12
|
export const CustomToolkitAuthSchemeSchema = z.discriminatedUnion('mode', [
|
|
14
13
|
z.object({ mode: z.literal('NO_AUTH') }),
|
|
@@ -50,14 +49,13 @@ const CustomToolkitLogoFileSchema = z.object({
|
|
|
50
49
|
export type CustomToolkitLogoFile = z.infer<typeof CustomToolkitLogoFileSchema>;
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
|
-
* Params for `composio.
|
|
54
|
-
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
52
|
+
* Params for `composio.customToolkits.create()`.
|
|
55
53
|
*/
|
|
56
54
|
export const CustomToolkitCreateParamsSchema = z.object({
|
|
57
55
|
/** Human-readable toolkit name. */
|
|
58
56
|
name: z.string().min(1).max(200),
|
|
59
57
|
/** The MCP server URL. Must use https. */
|
|
60
|
-
|
|
58
|
+
mcpUrl: z.string().url(),
|
|
61
59
|
/** Square PNG or JPEG logo (256-1024px, max 3MB), base64-encoded. Defaults to the MCP logo. */
|
|
62
60
|
logoFile: CustomToolkitLogoFileSchema.optional(),
|
|
63
61
|
/** At least one scheme. Cannot be changed after create. */
|
|
@@ -90,8 +88,7 @@ export const CustomToolkitCreateResponseSchema = z.object({
|
|
|
90
88
|
export type CustomToolkitCreateResponse = z.infer<typeof CustomToolkitCreateResponseSchema>;
|
|
91
89
|
|
|
92
90
|
/**
|
|
93
|
-
* Params for `composio.
|
|
94
|
-
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
91
|
+
* Params for `composio.customToolkits.update()`.
|
|
95
92
|
*/
|
|
96
93
|
export const CustomToolkitUpdateParamsSchema = z
|
|
97
94
|
.object({
|
|
@@ -117,8 +114,7 @@ export const CustomToolkitUpdateResponseSchema = z.object({
|
|
|
117
114
|
export type CustomToolkitUpdateResponse = z.infer<typeof CustomToolkitUpdateResponseSchema>;
|
|
118
115
|
|
|
119
116
|
/**
|
|
120
|
-
* Params for `composio.
|
|
121
|
-
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
117
|
+
* Params for `composio.customToolkits.upsert()`.
|
|
122
118
|
*
|
|
123
119
|
* @deprecated Use `CustomToolkitCreateParams` with `create()`.
|
|
124
120
|
*/
|
|
@@ -135,8 +131,8 @@ export const CustomToolkitUpsertParamsSchema = z.object({
|
|
|
135
131
|
toolkitConfig: z.object({
|
|
136
132
|
/** Human-readable toolkit name. */
|
|
137
133
|
name: z.string().min(1).max(200),
|
|
138
|
-
/** The
|
|
139
|
-
|
|
134
|
+
/** The MCP server URL. Must use https. */
|
|
135
|
+
mcpUrl: z.string().url(),
|
|
140
136
|
/** Square PNG or JPEG logo (256-1024px, max 3MB), base64-encoded. Defaults to the Composio logo. */
|
|
141
137
|
logoFile: CustomToolkitLogoFileSchema.optional(),
|
|
142
138
|
/** At least one scheme. The schemes cannot change once the toolkit exists. */
|
|
@@ -152,8 +148,7 @@ export const CustomToolkitUpsertResponseSchema = z.object({
|
|
|
152
148
|
export type CustomToolkitUpsertResponse = z.infer<typeof CustomToolkitUpsertResponseSchema>;
|
|
153
149
|
|
|
154
150
|
/**
|
|
155
|
-
* Params for `composio.
|
|
156
|
-
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
151
|
+
* Params for `composio.customToolkits.sync()`.
|
|
157
152
|
*/
|
|
158
153
|
export const CustomToolkitSyncParamsSchema = z.object({
|
|
159
154
|
/** Connected account to use when fetching the remote tool definitions. */
|
|
@@ -13,11 +13,11 @@ import type {
|
|
|
13
13
|
SessionExecuteParams,
|
|
14
14
|
} from '@composio/client/resources/tool-router/session';
|
|
15
15
|
import type {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
LocalTool,
|
|
17
|
+
LocalToolkit,
|
|
18
18
|
InlineCustomToolsWirePayload,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
RegisteredLocalTool,
|
|
20
|
+
RegisteredLocalToolkit,
|
|
21
21
|
} from './customTool.types';
|
|
22
22
|
import { PRELOAD_TOOLS_ALL } from '../lib/toolRouterConstants';
|
|
23
23
|
import { addSessionConfigConflictIssue } from '../lib/sessionConfigConflict';
|
|
@@ -517,24 +517,34 @@ const ToolRouterCreateSessionConfigBaseSchema = z
|
|
|
517
517
|
})
|
|
518
518
|
.optional()
|
|
519
519
|
.describe('Configuration for assistive prompt generation'),
|
|
520
|
-
|
|
521
|
-
.array(z.custom<
|
|
520
|
+
localTools: z
|
|
521
|
+
.array(z.custom<LocalTool>())
|
|
522
522
|
.optional()
|
|
523
523
|
.describe(
|
|
524
|
-
'
|
|
524
|
+
'Local tools to include in this session. They run in your process. Created via experimental_createTool() from @composio/core.'
|
|
525
525
|
),
|
|
526
|
-
|
|
527
|
-
.array(z.custom<
|
|
526
|
+
localToolkits: z
|
|
527
|
+
.array(z.custom<LocalToolkit>())
|
|
528
528
|
.optional()
|
|
529
529
|
.describe(
|
|
530
|
-
'
|
|
530
|
+
'Toolkits of local tools to include in this session. Created via experimental_createToolkit() from @composio/core.'
|
|
531
531
|
),
|
|
532
|
+
/** @deprecated Use `localTools` instead. */
|
|
533
|
+
customTools: z
|
|
534
|
+
.array(z.custom<LocalTool>())
|
|
535
|
+
.optional()
|
|
536
|
+
.describe('Deprecated alias for localTools. Accepted for backwards compatibility.'),
|
|
537
|
+
/** @deprecated Use `localToolkits` instead. */
|
|
538
|
+
customToolkits: z
|
|
539
|
+
.array(z.custom<LocalToolkit>())
|
|
540
|
+
.optional()
|
|
541
|
+
.describe('Deprecated alias for localToolkits. Accepted for backwards compatibility.'),
|
|
532
542
|
sessionConfigId: z
|
|
533
543
|
.string()
|
|
534
544
|
.min(1)
|
|
535
545
|
.optional()
|
|
536
546
|
.describe(
|
|
537
|
-
'ID of a saved Session config (`sc_…`) to apply when the session is created. Cannot be combined with toolkits, tools, tags,
|
|
547
|
+
'ID of a saved Session config (`sc_…`) to apply when the session is created. Cannot be combined with toolkits, tools, tags, localTools or localToolkits.'
|
|
538
548
|
),
|
|
539
549
|
/**
|
|
540
550
|
* What happens to a call that needs the user's approval when the
|
|
@@ -558,6 +568,8 @@ const ToolRouterCreateSessionConfigBaseSchema = z
|
|
|
558
568
|
config.tools !== undefined && 'tools',
|
|
559
569
|
config.tags !== undefined && 'tags',
|
|
560
570
|
config.hooks !== undefined && 'hooks',
|
|
571
|
+
config.experimental.localTools !== undefined && 'experimental.localTools',
|
|
572
|
+
config.experimental.localToolkits !== undefined && 'experimental.localToolkits',
|
|
561
573
|
config.experimental.customTools !== undefined && 'experimental.customTools',
|
|
562
574
|
config.experimental.customToolkits !== undefined && 'experimental.customToolkits',
|
|
563
575
|
].filter((field): field is string => field !== false)
|
|
@@ -626,7 +638,11 @@ export const ToolRouterCreateSessionConfigSchema = z
|
|
|
626
638
|
* @param {object} [preload] - Tools to preload into session.tools() and the MCP tool list
|
|
627
639
|
* @param {string[] | 'all'} [preload.tools] - Tool slugs to preload, or "all" to preload every app tool allowed by the session filters. "all" requires a positive filter such as toolkits, tools, or tags; the backend validates and caps the final tool set.
|
|
628
640
|
* @param {object} [experimental] - Experimental features configuration. Not stable; may change or be removed.
|
|
629
|
-
* @param {
|
|
641
|
+
* @param {LocalTool[]} [experimental.localTools] - Local tools to include in this session, created with `experimental_createTool()`. They run in your process.
|
|
642
|
+
* @param {LocalToolkit[]} [experimental.localToolkits] - Toolkits of local tools to include in this session, created with `experimental_createToolkit()`.
|
|
643
|
+
* @param {LocalTool[]} [experimental.customTools] - Deprecated alias for `experimental.localTools`.
|
|
644
|
+
* @param {LocalToolkit[]} [experimental.customToolkits] - Deprecated alias for `experimental.localToolkits`.
|
|
645
|
+
* @param {string} [experimental.sessionConfigId] - ID of a saved Session config (`sc_…`) to apply at creation; see `composio.sessionConfigs`. Cannot be combined with `toolkits`, `tools`, `tags`, `hooks`, `experimental.localTools` or `experimental.localToolkits` (or their deprecated aliases `experimental.customTools` / `experimental.customToolkits`). Per-session fields such as `authConfigs`, `connectedAccounts`, `manageConnections`, `sandbox`, `multiAccount` and `preload` stay allowed.
|
|
630
646
|
*/
|
|
631
647
|
export type ToolRouterCreateSessionConfig =
|
|
632
648
|
InlineAccessCreateSessionConfig | SavedConfigCreateSessionConfig;
|
|
@@ -652,9 +668,11 @@ type SavedConfigCreateSessionConfig = Omit<
|
|
|
652
668
|
hooks?: never;
|
|
653
669
|
experimental: Omit<
|
|
654
670
|
ParsedCreateSessionExperimental,
|
|
655
|
-
'sessionConfigId' | 'customTools' | 'customToolkits'
|
|
671
|
+
'sessionConfigId' | 'localTools' | 'localToolkits' | 'customTools' | 'customToolkits'
|
|
656
672
|
> & {
|
|
657
673
|
sessionConfigId: string;
|
|
674
|
+
localTools?: never;
|
|
675
|
+
localToolkits?: never;
|
|
658
676
|
customTools?: never;
|
|
659
677
|
customToolkits?: never;
|
|
660
678
|
};
|
|
@@ -1468,10 +1486,14 @@ export interface Session<
|
|
|
1468
1486
|
listConfigHistory: ToolRouterSessionListConfigHistoryFn;
|
|
1469
1487
|
/** Proxy an API call through Composio's auth layer using the session's connected account */
|
|
1470
1488
|
proxyExecute: ToolRouterSessionProxyExecuteFn;
|
|
1471
|
-
/** List
|
|
1472
|
-
|
|
1473
|
-
/** List
|
|
1474
|
-
|
|
1489
|
+
/** List local tools registered in this session, with their final slugs and schemas */
|
|
1490
|
+
localTools: (options?: { toolkit?: string }) => RegisteredLocalTool[];
|
|
1491
|
+
/** List toolkits of local tools registered in this session, with final slugs on nested tools */
|
|
1492
|
+
localToolkits: () => RegisteredLocalToolkit[];
|
|
1493
|
+
/** @deprecated Use `localTools()` instead. */
|
|
1494
|
+
customTools: (options?: { toolkit?: string }) => RegisteredLocalTool[];
|
|
1495
|
+
/** @deprecated Use `localToolkits()` instead. */
|
|
1496
|
+
customToolkits: () => RegisteredLocalToolkit[];
|
|
1475
1497
|
/** Experimental features (files, assistive prompt, etc.) */
|
|
1476
1498
|
experimental: SessionExperimental;
|
|
1477
1499
|
}
|
|
@@ -8,7 +8,11 @@ export async function withCancellation<T>(
|
|
|
8
8
|
try {
|
|
9
9
|
return await call();
|
|
10
10
|
} catch (error) {
|
|
11
|
-
|
|
11
|
+
// A raw `fetch` rejects with the signal's reason, so an `AbortSignal.timeout()`
|
|
12
|
+
// surfaces as a `TimeoutError` (or a custom reason passed to `abort()`) that is
|
|
13
|
+
// not abort-shaped. Matching the reason itself still excludes an unrelated
|
|
14
|
+
// failure that merely coincides with a late abort.
|
|
15
|
+
if (signal?.aborted && (isRequestAbortError(error) || error === signal.reason)) {
|
|
12
16
|
const underlyingMessage = error instanceof Error ? error.message : '';
|
|
13
17
|
const message = underlyingMessage
|
|
14
18
|
? `Request was cancelled by the caller: ${underlyingMessage}`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { APIError } from '@composio/client';
|
|
2
|
+
|
|
3
|
+
/** Whether a client error is the API rejecting the request with a 429. */
|
|
4
|
+
export function isRateLimitResponse(error: unknown): error is APIError {
|
|
5
|
+
return error instanceof APIError && error.status === 429;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Seconds a 429 asks the caller to wait, from its `Retry-After` header (seconds or an HTTP date).
|
|
10
|
+
* Undefined when the header is missing or unreadable.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function getRetryAfterSeconds(error: APIError): number | undefined {
|
|
15
|
+
const value = error.headers?.get('retry-after')?.trim();
|
|
16
|
+
if (!value) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const seconds = Number(value);
|
|
20
|
+
if (Number.isFinite(seconds)) {
|
|
21
|
+
return seconds >= 0 ? seconds : undefined;
|
|
22
|
+
}
|
|
23
|
+
const date = Date.parse(value);
|
|
24
|
+
return Number.isNaN(date) ? undefined : Math.max(0, (date - Date.now()) / 1000);
|
|
25
|
+
}
|
|
@@ -73,7 +73,7 @@ export const transformCustomToolkitCreateParams = (
|
|
|
73
73
|
params: CustomToolkitCreateParams
|
|
74
74
|
): RawCustomCreateToolkitParams => ({
|
|
75
75
|
name: params.name,
|
|
76
|
-
|
|
76
|
+
mcp_url: params.mcpUrl,
|
|
77
77
|
logo_file: transformCustomToolkitLogoFile(params.logoFile),
|
|
78
78
|
auth_schemes: params.authSchemes.map(transformCustomToolkitAuthScheme),
|
|
79
79
|
user_id: params.userId,
|
|
@@ -118,7 +118,7 @@ export const transformCustomToolkitUpsertParams = (
|
|
|
118
118
|
slug: params.slug,
|
|
119
119
|
toolkit_config: {
|
|
120
120
|
name: params.toolkitConfig.name,
|
|
121
|
-
|
|
121
|
+
mcp_url: params.toolkitConfig.mcpUrl,
|
|
122
122
|
logo_file: transformCustomToolkitLogoFile(params.toolkitConfig.logoFile),
|
|
123
123
|
auth_schemes: params.toolkitConfig.authSchemes.map(transformCustomToolkitAuthScheme),
|
|
124
124
|
},
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { r as ComposioError } from "./SsrfErrors-DiQldIdC.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/errors/FileModifierErrors.ts
|
|
4
|
-
const FileModifierErrorCodes = {
|
|
5
|
-
FILE_UPLOAD_FAILED: "FILE_UPLOAD_FAILED",
|
|
6
|
-
SENSITIVE_FILE_PATH_BLOCKED: "SENSITIVE_FILE_PATH_BLOCKED",
|
|
7
|
-
FILE_UPLOAD_ABORTED: "FILE_UPLOAD_ABORTED",
|
|
8
|
-
FILE_UPLOAD_PATH_NOT_ALLOWED: "FILE_UPLOAD_PATH_NOT_ALLOWED",
|
|
9
|
-
FILE_NOT_FOUND: "FILE_NOT_FOUND"
|
|
10
|
-
};
|
|
11
|
-
var ComposioFileUploadError = class extends ComposioError {
|
|
12
|
-
constructor(message = "Failed to upload file", options = {}) {
|
|
13
|
-
super(message, {
|
|
14
|
-
...options,
|
|
15
|
-
code: options.code ?? FileModifierErrorCodes.FILE_UPLOAD_FAILED,
|
|
16
|
-
possibleFixes: options.possibleFixes || ["Check if the file exists in the location provided"]
|
|
17
|
-
});
|
|
18
|
-
this.name = "ComposioFileUploadError";
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Thrown when a local file path is refused before upload (sensitive directory or
|
|
23
|
-
* credential-like file name). Subclass of {@link ComposioFileUploadError} so existing
|
|
24
|
-
* `instanceof ComposioFileUploadError` handlers still apply.
|
|
25
|
-
*/
|
|
26
|
-
var ComposioSensitiveFilePathBlockedError = class extends ComposioFileUploadError {
|
|
27
|
-
constructor(message, options = {}) {
|
|
28
|
-
super(message, {
|
|
29
|
-
...options,
|
|
30
|
-
code: FileModifierErrorCodes.SENSITIVE_FILE_PATH_BLOCKED,
|
|
31
|
-
possibleFixes: options.possibleFixes ?? [
|
|
32
|
-
"Use a file outside ~/.ssh, ~/.aws, and other credential locations",
|
|
33
|
-
"Set sensitiveFileUploadProtection: false only if you understand the risk",
|
|
34
|
-
"Add path segments to block with fileUploadPathDenySegments"
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
this.name = "ComposioSensitiveFilePathBlockedError";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Thrown when a `beforeFileUpload` hook returns `false`.
|
|
42
|
-
*/
|
|
43
|
-
var ComposioFileUploadAbortedError = class extends ComposioFileUploadError {
|
|
44
|
-
constructor(message, options = {}) {
|
|
45
|
-
super(message, {
|
|
46
|
-
...options,
|
|
47
|
-
code: FileModifierErrorCodes.FILE_UPLOAD_ABORTED,
|
|
48
|
-
possibleFixes: options.possibleFixes ?? ["Change beforeFileUpload to return a file path to upload, or allow the upload to proceed"]
|
|
49
|
-
});
|
|
50
|
-
this.name = "ComposioFileUploadAbortedError";
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Thrown when automatic file upload during tool execution is attempted from a path
|
|
55
|
-
* that is outside the configured {@link ComposioConfig.fileUploadDirs} allowlist.
|
|
56
|
-
*
|
|
57
|
-
* This only fires for auto-upload (enabled via
|
|
58
|
-
* `dangerouslyAllowAutoUploadDownloadFiles: true`). Manual `composio.files.upload()`
|
|
59
|
-
* calls are never subject to this check.
|
|
60
|
-
*/
|
|
61
|
-
var ComposioFileUploadPathNotAllowedError = class extends ComposioFileUploadError {
|
|
62
|
-
constructor(message, options = {}) {
|
|
63
|
-
super(message, {
|
|
64
|
-
...options,
|
|
65
|
-
code: FileModifierErrorCodes.FILE_UPLOAD_PATH_NOT_ALLOWED,
|
|
66
|
-
possibleFixes: options.possibleFixes ?? [
|
|
67
|
-
"Move the file under one of the directories in `fileUploadDirs`",
|
|
68
|
-
"Stage the file under the default upload dir (`~/.composio/temp`)",
|
|
69
|
-
"Add the containing directory to `fileUploadDirs` when constructing Composio",
|
|
70
|
-
"Pass the file by URL or as a File/Blob object instead of a filesystem path"
|
|
71
|
-
]
|
|
72
|
-
});
|
|
73
|
-
this.name = "ComposioFileUploadPathNotAllowedError";
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Thrown when a local file path passed for upload does not exist on disk.
|
|
78
|
-
* Provides extra debugging context (resolved absolute path, cwd, allowlist state)
|
|
79
|
-
* to help the caller distinguish between "typo" and "not-allowlisted" failures.
|
|
80
|
-
*/
|
|
81
|
-
var ComposioFileNotFoundError = class extends ComposioFileUploadError {
|
|
82
|
-
constructor(message, options = {}) {
|
|
83
|
-
super(message, {
|
|
84
|
-
...options,
|
|
85
|
-
code: FileModifierErrorCodes.FILE_NOT_FOUND,
|
|
86
|
-
possibleFixes: options.possibleFixes ?? [
|
|
87
|
-
"Double-check the path for typos",
|
|
88
|
-
"Remember relative paths are resolved against process.cwd() at upload time",
|
|
89
|
-
"Verify the file exists and the process has read permission"
|
|
90
|
-
]
|
|
91
|
-
});
|
|
92
|
-
this.name = "ComposioFileNotFoundError";
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
export { ComposioSensitiveFilePathBlockedError as a, ComposioFileUploadPathNotAllowedError as i, ComposioFileUploadAbortedError as n, FileModifierErrorCodes as o, ComposioFileUploadError as r, ComposioFileNotFoundError as t };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) {
|
|
6
|
-
__defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
if (!no_symbols) {
|
|
12
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { __exportAll as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SessionExecuteParams,
|
|
3
|
-
SessionSearchParams,
|
|
4
|
-
} from '@composio/client/resources/tool-router/session';
|
|
5
|
-
import type { InlineCustomToolsWirePayload } from '../types/customTool.types';
|
|
6
|
-
|
|
7
|
-
type InlineCustomToolsExperimental =
|
|
8
|
-
| NonNullable<SessionExecuteParams['experimental']>
|
|
9
|
-
| NonNullable<SessionSearchParams['experimental']>;
|
|
10
|
-
|
|
11
|
-
export function inlineCustomToolsExperimental<TExperimental extends InlineCustomToolsExperimental>(
|
|
12
|
-
payload?: InlineCustomToolsWirePayload
|
|
13
|
-
): TExperimental | undefined {
|
|
14
|
-
// Stainless generates endpoint-specific experimental types with the same custom
|
|
15
|
-
// definition shape, so this helper centralizes the structural cast.
|
|
16
|
-
return payload as TExperimental | undefined;
|
|
17
|
-
}
|