@composio/core 0.21.0 → 0.22.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/dist/{CustomTool-BHOYxLZX.d.mts → CustomTool-CKBCElpT.d.mts} +1 -1
- package/dist/{Telemetry-JRJJYS4I.mjs → Telemetry-41JkqpZ7.mjs} +3 -2
- package/dist/{composio-BTZsFajb.d.mts → composio-C-418N1P.d.mts} +80 -166
- package/dist/{customTool.types-D_w21L56.d.mts → customTool.types-CK408sI-.d.mts} +122 -61
- package/dist/experimental/index.d.mts +2 -2
- package/dist/index.d.mts +5 -6
- package/dist/index.mjs +6070 -6259
- package/dist/models/Files.node.mjs +1 -1
- package/dist/{types-CgRsUGqm.d.mts → types-RpMRVn4D.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.workerd.d.mts +1 -1
- package/package.json +4 -4
- package/src/lib/toolRouterParams.ts +18 -10
- package/src/models/AuthConfigs.ts +0 -9
- package/src/models/ConnectionRequest.ts +21 -18
- package/src/models/Logs.ts +2 -2
- package/src/models/ToolRouter.ts +7 -5
- package/src/models/ToolRouterSession.ts +6 -5
- package/src/models/Tools.ts +2 -2
- package/src/models/Usage.ts +2 -1
- package/src/provider/OpenAIProvider.ts +0 -283
- package/src/telemetry/Telemetry.ts +4 -2
- package/src/types/logs.types.ts +9 -1
- package/src/types/tool.types.ts +3 -3
- package/src/types/toolRouter.types.ts +43 -21
- package/src/types/usage.types.ts +2 -0
- package/src/utils/transformers/logs.ts +3 -2
- package/src/utils/transformers/toolRouterResponseTransform.ts +23 -5
- package/src/utils/transformers/usage.ts +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-
|
|
1
|
+
import { a as CreateCustomToolkitParams, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams, t as AnyZodSchema } from "./customTool.types-CK408sI-.mjs";
|
|
2
2
|
import { SessionCreateResponse } from "@composio/client/resources/tool-router/session/session.mjs";
|
|
3
3
|
//#region src/models/CustomTool.d.ts
|
|
4
4
|
/**
|
|
@@ -180,8 +180,9 @@ var TelemetryTransport = class {
|
|
|
180
180
|
*/
|
|
181
181
|
instrument(instance, fileName) {
|
|
182
182
|
const proto = Object.getPrototypeOf(instance);
|
|
183
|
-
const
|
|
184
|
-
|
|
183
|
+
const methodSource = proto === Object.prototype || proto === null ? instance : proto;
|
|
184
|
+
const methodNames = Object.getOwnPropertyNames(methodSource).filter((key) => {
|
|
185
|
+
const descriptor = Object.getOwnPropertyDescriptor(methodSource, key);
|
|
185
186
|
return key !== "constructor" && descriptor && typeof descriptor.value === "function" && descriptor.value.constructor.name === "AsyncFunction";
|
|
186
187
|
});
|
|
187
188
|
const instrumentedClassName = fileName ?? instance.constructor?.name ?? "unknown";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $r as McpServerGetResponse, An as ConnectedAccountRetrieveResponse, Cn as ConnectedAccountListParams, D as Session, Ea as ToolExecuteResponse, Fa as ToolRetrievalOptions, Ha as ToolkitVersionParam, M as SessionWithoutMcp, Mn as ConnectedAccountRevokeResponse, Na as ToolProxyParams, Oa as ToolList, On as ConnectedAccountRefreshOptions, Sa as ToolExecuteMetaParams, Tn as ConnectedAccountListResponse, Un as CreateConnectedAccountLinkOptions, _n as ConnectedAccountCompleteAuthResponse, ar as BaseComposioProvider, ba as SchemaModifierOptions, ci as ExecuteToolFnOptions, er as UpdateConnectedAccountAclParams, et as ToolRouterSessionDeleteResponse, f as CustomToolkit, fi as ToolCallSession, hn as ConnectedAccountCompleteAuthParams, ia as ExecuteToolModifiers, ii as McpUrlResponse, ka as ToolListParams, nr as UpdateConnectedAccountParams, o as CustomTool, oa as ProviderOptions, on as ComposioRequestOptions, or as BaseNonAgenticProvider, qn as CreateConnectedAccountOptions, sa as SessionExecuteMetaModifiers, sn as ConnectionRequest, wa as ToolExecuteParams, xa as Tool, z as ToolRouterCreateSessionConfig } from "./customTool.types-CK408sI-.mjs";
|
|
2
2
|
import ComposioClient, { Composio } from "@composio/client";
|
|
3
3
|
import z, { z as z$1 } from "zod/v3";
|
|
4
4
|
import { Files } from "#files";
|
|
@@ -8,7 +8,6 @@ import { ToolGetInputParams, ToolGetInputResponse, ToolProxyResponse, ToolRetrie
|
|
|
8
8
|
import { TriggersTypeRetrieveEnumResponse } from "@composio/client/resources/index";
|
|
9
9
|
import { AuthConfigDeleteResponse, AuthConfigUpdateResponse, AuthConfigUpdateStatusResponse } from "@composio/client/resources/auth-configs";
|
|
10
10
|
import { OpenAI } from "openai";
|
|
11
|
-
import { Stream } from "openai/streaming";
|
|
12
11
|
//#region src/models/Tools.d.ts
|
|
13
12
|
type ToolRouterSessionExecuteOptions = {
|
|
14
13
|
experimental?: SessionExecuteParams.Experimental;
|
|
@@ -4624,12 +4623,6 @@ declare class Triggers<TProvider extends BaseComposioProvider<unknown, unknown,
|
|
|
4624
4623
|
declare class AuthConfigs {
|
|
4625
4624
|
private client;
|
|
4626
4625
|
constructor(client: ComposioClient);
|
|
4627
|
-
/**
|
|
4628
|
-
* Protected getter for the client instance.
|
|
4629
|
-
* This is primarily used for testing purposes.
|
|
4630
|
-
* @protected
|
|
4631
|
-
*/
|
|
4632
|
-
protected getClient(): ComposioClient;
|
|
4633
4626
|
/**
|
|
4634
4627
|
* Lists authentication configurations based on provided filter criteria.
|
|
4635
4628
|
*
|
|
@@ -5325,13 +5318,17 @@ declare const UsageSummaryResponseSchema: z$1.ZodObject<{
|
|
|
5325
5318
|
totalQuantity: string;
|
|
5326
5319
|
eventCount: number;
|
|
5327
5320
|
}>>;
|
|
5321
|
+
/** Total Instant charge for the window, in USD as an exact decimal string. */
|
|
5322
|
+
instantCharge: z$1.ZodString;
|
|
5328
5323
|
}, "strip", z$1.ZodTypeAny, {
|
|
5324
|
+
instantCharge: string;
|
|
5329
5325
|
entities: Record<string, {
|
|
5330
5326
|
unit: string;
|
|
5331
5327
|
totalQuantity: string;
|
|
5332
5328
|
eventCount: number;
|
|
5333
5329
|
}>;
|
|
5334
5330
|
}, {
|
|
5331
|
+
instantCharge: string;
|
|
5335
5332
|
entities: Record<string, {
|
|
5336
5333
|
unit: string;
|
|
5337
5334
|
totalQuantity: string;
|
|
@@ -5403,6 +5400,7 @@ type UsageBreakdownResponse = z$1.infer<typeof UsageBreakdownResponseSchema>;
|
|
|
5403
5400
|
* ```typescript
|
|
5404
5401
|
* const summary = await composio.experimental.usage.summary();
|
|
5405
5402
|
* console.log(summary.entities.tool_calls?.totalQuantity);
|
|
5403
|
+
* console.log(summary.instantCharge); // exact USD string
|
|
5406
5404
|
*
|
|
5407
5405
|
* const byTool = await composio.experimental.usage.breakdown('tool_calls', {
|
|
5408
5406
|
* groupBy: 'tool_slug',
|
|
@@ -5418,7 +5416,7 @@ declare class Usage {
|
|
|
5418
5416
|
* **Experimental — shape may change in future releases.**
|
|
5419
5417
|
*
|
|
5420
5418
|
* @param {UsageSummaryParams} [params] - Optional range, `entityTypes` and filters
|
|
5421
|
-
* @returns {Promise<UsageSummaryResponse>} Totals keyed by entity type
|
|
5419
|
+
* @returns {Promise<UsageSummaryResponse>} Totals keyed by entity type and the exact USD Instant charge
|
|
5422
5420
|
* @throws {ValidationError} If the params fail validation
|
|
5423
5421
|
*
|
|
5424
5422
|
* @example
|
|
@@ -7176,6 +7174,15 @@ declare const ToolExecutionLogParentSchema: z$1.ZodNullable<z$1.ZodObject<{
|
|
|
7176
7174
|
logId: string;
|
|
7177
7175
|
toolSlug: string;
|
|
7178
7176
|
}>>;
|
|
7177
|
+
/** Tool log metadata, including the optional exact USD Instant charge. */
|
|
7178
|
+
declare const ToolExecutionLogMetadataSchema: z$1.ZodObject<{
|
|
7179
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7180
|
+
}, "strip", z$1.ZodUnknown, z$1.objectOutputType<{
|
|
7181
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7182
|
+
}, z$1.ZodUnknown, "strip">, z$1.objectInputType<{
|
|
7183
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7184
|
+
}, z$1.ZodUnknown, "strip">>;
|
|
7185
|
+
type ToolExecutionLogMetadata = z$1.infer<typeof ToolExecutionLogMetadataSchema>;
|
|
7179
7186
|
/**
|
|
7180
7187
|
* A tool-execution log entry as returned by `composio.logs.search()`.
|
|
7181
7188
|
*/
|
|
@@ -7188,7 +7195,13 @@ declare const ToolExecutionLogSchema: z$1.ZodObject<{
|
|
|
7188
7195
|
status: z$1.ZodEnum<["success", "failed"]>;
|
|
7189
7196
|
level: z$1.ZodEnum<["info", "error", "warn"]>;
|
|
7190
7197
|
message: z$1.ZodOptional<z$1.ZodString>;
|
|
7191
|
-
metadata: z$1.
|
|
7198
|
+
metadata: z$1.ZodObject<{
|
|
7199
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7200
|
+
}, "strip", z$1.ZodUnknown, z$1.objectOutputType<{
|
|
7201
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7202
|
+
}, z$1.ZodUnknown, "strip">, z$1.objectInputType<{
|
|
7203
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7204
|
+
}, z$1.ZodUnknown, "strip">>;
|
|
7192
7205
|
metrics: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
7193
7206
|
parent: z$1.ZodNullable<z$1.ZodObject<{
|
|
7194
7207
|
logId: z$1.ZodString;
|
|
@@ -7204,7 +7217,11 @@ declare const ToolExecutionLogSchema: z$1.ZodObject<{
|
|
|
7204
7217
|
type: string;
|
|
7205
7218
|
status: "success" | "failed";
|
|
7206
7219
|
id: string;
|
|
7207
|
-
metadata:
|
|
7220
|
+
metadata: {
|
|
7221
|
+
instant_charge?: string | undefined;
|
|
7222
|
+
} & {
|
|
7223
|
+
[k: string]: unknown;
|
|
7224
|
+
};
|
|
7208
7225
|
timestamp: string;
|
|
7209
7226
|
level: "error" | "warn" | "info";
|
|
7210
7227
|
metrics: Record<string, unknown>;
|
|
@@ -7217,7 +7234,11 @@ declare const ToolExecutionLogSchema: z$1.ZodObject<{
|
|
|
7217
7234
|
type: string;
|
|
7218
7235
|
status: "success" | "failed";
|
|
7219
7236
|
id: string;
|
|
7220
|
-
metadata:
|
|
7237
|
+
metadata: {
|
|
7238
|
+
instant_charge?: string | undefined;
|
|
7239
|
+
} & {
|
|
7240
|
+
[k: string]: unknown;
|
|
7241
|
+
};
|
|
7221
7242
|
timestamp: string;
|
|
7222
7243
|
level: "error" | "warn" | "info";
|
|
7223
7244
|
metrics: Record<string, unknown>;
|
|
@@ -7238,7 +7259,13 @@ declare const LogSearchResponseSchema: z$1.ZodObject<{
|
|
|
7238
7259
|
status: z$1.ZodEnum<["success", "failed"]>;
|
|
7239
7260
|
level: z$1.ZodEnum<["info", "error", "warn"]>;
|
|
7240
7261
|
message: z$1.ZodOptional<z$1.ZodString>;
|
|
7241
|
-
metadata: z$1.
|
|
7262
|
+
metadata: z$1.ZodObject<{
|
|
7263
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7264
|
+
}, "strip", z$1.ZodUnknown, z$1.objectOutputType<{
|
|
7265
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7266
|
+
}, z$1.ZodUnknown, "strip">, z$1.objectInputType<{
|
|
7267
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7268
|
+
}, z$1.ZodUnknown, "strip">>;
|
|
7242
7269
|
metrics: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
7243
7270
|
parent: z$1.ZodNullable<z$1.ZodObject<{
|
|
7244
7271
|
logId: z$1.ZodString;
|
|
@@ -7254,7 +7281,11 @@ declare const LogSearchResponseSchema: z$1.ZodObject<{
|
|
|
7254
7281
|
type: string;
|
|
7255
7282
|
status: "success" | "failed";
|
|
7256
7283
|
id: string;
|
|
7257
|
-
metadata:
|
|
7284
|
+
metadata: {
|
|
7285
|
+
instant_charge?: string | undefined;
|
|
7286
|
+
} & {
|
|
7287
|
+
[k: string]: unknown;
|
|
7288
|
+
};
|
|
7258
7289
|
timestamp: string;
|
|
7259
7290
|
level: "error" | "warn" | "info";
|
|
7260
7291
|
metrics: Record<string, unknown>;
|
|
@@ -7267,7 +7298,11 @@ declare const LogSearchResponseSchema: z$1.ZodObject<{
|
|
|
7267
7298
|
type: string;
|
|
7268
7299
|
status: "success" | "failed";
|
|
7269
7300
|
id: string;
|
|
7270
|
-
metadata:
|
|
7301
|
+
metadata: {
|
|
7302
|
+
instant_charge?: string | undefined;
|
|
7303
|
+
} & {
|
|
7304
|
+
[k: string]: unknown;
|
|
7305
|
+
};
|
|
7271
7306
|
timestamp: string;
|
|
7272
7307
|
level: "error" | "warn" | "info";
|
|
7273
7308
|
metrics: Record<string, unknown>;
|
|
@@ -7284,7 +7319,11 @@ declare const LogSearchResponseSchema: z$1.ZodObject<{
|
|
|
7284
7319
|
type: string;
|
|
7285
7320
|
status: "success" | "failed";
|
|
7286
7321
|
id: string;
|
|
7287
|
-
metadata:
|
|
7322
|
+
metadata: {
|
|
7323
|
+
instant_charge?: string | undefined;
|
|
7324
|
+
} & {
|
|
7325
|
+
[k: string]: unknown;
|
|
7326
|
+
};
|
|
7288
7327
|
timestamp: string;
|
|
7289
7328
|
level: "error" | "warn" | "info";
|
|
7290
7329
|
metrics: Record<string, unknown>;
|
|
@@ -7300,7 +7339,11 @@ declare const LogSearchResponseSchema: z$1.ZodObject<{
|
|
|
7300
7339
|
type: string;
|
|
7301
7340
|
status: "success" | "failed";
|
|
7302
7341
|
id: string;
|
|
7303
|
-
metadata:
|
|
7342
|
+
metadata: {
|
|
7343
|
+
instant_charge?: string | undefined;
|
|
7344
|
+
} & {
|
|
7345
|
+
[k: string]: unknown;
|
|
7346
|
+
};
|
|
7304
7347
|
timestamp: string;
|
|
7305
7348
|
level: "error" | "warn" | "info";
|
|
7306
7349
|
metrics: Record<string, unknown>;
|
|
@@ -7325,7 +7368,13 @@ declare const ToolExecutionLogDetailSchema: z$1.ZodObject<{
|
|
|
7325
7368
|
status: z$1.ZodEnum<["success", "failed"]>;
|
|
7326
7369
|
level: z$1.ZodEnum<["info", "error", "warn"]>;
|
|
7327
7370
|
message: z$1.ZodOptional<z$1.ZodString>;
|
|
7328
|
-
metadata: z$1.
|
|
7371
|
+
metadata: z$1.ZodObject<{
|
|
7372
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7373
|
+
}, "strip", z$1.ZodUnknown, z$1.objectOutputType<{
|
|
7374
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7375
|
+
}, z$1.ZodUnknown, "strip">, z$1.objectInputType<{
|
|
7376
|
+
instant_charge: z$1.ZodOptional<z$1.ZodString>;
|
|
7377
|
+
}, z$1.ZodUnknown, "strip">>;
|
|
7329
7378
|
metrics: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
7330
7379
|
parent: z$1.ZodNullable<z$1.ZodObject<{
|
|
7331
7380
|
logId: z$1.ZodString;
|
|
@@ -7382,7 +7431,11 @@ declare const ToolExecutionLogDetailSchema: z$1.ZodObject<{
|
|
|
7382
7431
|
status: "success" | "failed";
|
|
7383
7432
|
data: Record<string, unknown>;
|
|
7384
7433
|
id: string;
|
|
7385
|
-
metadata:
|
|
7434
|
+
metadata: {
|
|
7435
|
+
instant_charge?: string | undefined;
|
|
7436
|
+
} & {
|
|
7437
|
+
[k: string]: unknown;
|
|
7438
|
+
};
|
|
7386
7439
|
timestamp: string;
|
|
7387
7440
|
level: "error" | "warn" | "info";
|
|
7388
7441
|
metrics: Record<string, unknown>;
|
|
@@ -7410,7 +7463,11 @@ declare const ToolExecutionLogDetailSchema: z$1.ZodObject<{
|
|
|
7410
7463
|
status: "success" | "failed";
|
|
7411
7464
|
data: Record<string, unknown>;
|
|
7412
7465
|
id: string;
|
|
7413
|
-
metadata:
|
|
7466
|
+
metadata: {
|
|
7467
|
+
instant_charge?: string | undefined;
|
|
7468
|
+
} & {
|
|
7469
|
+
[k: string]: unknown;
|
|
7470
|
+
};
|
|
7414
7471
|
timestamp: string;
|
|
7415
7472
|
level: "error" | "warn" | "info";
|
|
7416
7473
|
metrics: Record<string, unknown>;
|
|
@@ -7457,7 +7514,7 @@ declare class Logs {
|
|
|
7457
7514
|
* pagination.
|
|
7458
7515
|
*
|
|
7459
7516
|
* @param {LogSearchParams} [params] - Filters, `timeRange`, `limit` and `cursor`
|
|
7460
|
-
* @returns {Promise<LogSearchResponse>} Matching logs and the next cursor
|
|
7517
|
+
* @returns {Promise<LogSearchResponse>} Matching logs and the next cursor. Charged calls include `metadata.instant_charge` as an exact USD string.
|
|
7461
7518
|
* @throws {ValidationError} If the params fail validation
|
|
7462
7519
|
*
|
|
7463
7520
|
* @example
|
|
@@ -7477,7 +7534,7 @@ declare class Logs {
|
|
|
7477
7534
|
* source and raw `data`).
|
|
7478
7535
|
*
|
|
7479
7536
|
* @param {string} id - The log id
|
|
7480
|
-
* @returns {Promise<ToolExecutionLogDetail>} The log detail
|
|
7537
|
+
* @returns {Promise<ToolExecutionLogDetail>} The log detail, with an optional exact USD charge in `metadata.instant_charge`
|
|
7481
7538
|
*
|
|
7482
7539
|
* @example
|
|
7483
7540
|
* ```typescript
|
|
@@ -8298,149 +8355,6 @@ declare class OpenAIProvider extends BaseNonAgenticProvider<OpenAiToolCollection
|
|
|
8298
8355
|
*/
|
|
8299
8356
|
handleToolCalls(session: ToolCallSession, chatCompletion: OpenAI.ChatCompletion): Promise<OpenAI.ChatCompletionToolMessageParam[]>;
|
|
8300
8357
|
handleToolCalls(userId: string, chatCompletion: OpenAI.ChatCompletion, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): Promise<OpenAI.ChatCompletionToolMessageParam[]>;
|
|
8301
|
-
/**
|
|
8302
|
-
* Handles all the tool calls from the OpenAI Assistant API.
|
|
8303
|
-
*
|
|
8304
|
-
* This method processes tool calls from an OpenAI Assistant run,
|
|
8305
|
-
* executes each tool call, and returns the tool outputs for submission.
|
|
8306
|
-
*
|
|
8307
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. This method will be removed in the next major version.
|
|
8308
|
-
*
|
|
8309
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8310
|
-
* @param {OpenAI.Beta.Threads.Run} run - The Assistant run object containing tool calls
|
|
8311
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8312
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8313
|
-
* @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} Array of tool outputs for submission
|
|
8314
|
-
*
|
|
8315
|
-
*
|
|
8316
|
-
* @example
|
|
8317
|
-
* ```typescript
|
|
8318
|
-
* // Handle tool calls from an OpenAI Assistant run
|
|
8319
|
-
* const run = {
|
|
8320
|
-
* id: 'run_abc123',
|
|
8321
|
-
* required_action: {
|
|
8322
|
-
* submit_tool_outputs: {
|
|
8323
|
-
* tool_calls: [
|
|
8324
|
-
* {
|
|
8325
|
-
* id: 'call_xyz789',
|
|
8326
|
-
* type: 'function',
|
|
8327
|
-
* function: {
|
|
8328
|
-
* name: 'SEARCH_TOOL',
|
|
8329
|
-
* arguments: '{"query":"composio documentation"}'
|
|
8330
|
-
* }
|
|
8331
|
-
* }
|
|
8332
|
-
* ]
|
|
8333
|
-
* }
|
|
8334
|
-
* }
|
|
8335
|
-
* };
|
|
8336
|
-
*
|
|
8337
|
-
* const toolOutputs = await provider.handleAssistantMessage(
|
|
8338
|
-
* 'user123',
|
|
8339
|
-
* run,
|
|
8340
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8341
|
-
* );
|
|
8342
|
-
*
|
|
8343
|
-
* // Submit tool outputs back to OpenAI
|
|
8344
|
-
* await openai.beta.threads.runs.submitToolOutputs(
|
|
8345
|
-
* thread.id,
|
|
8346
|
-
* run.id,
|
|
8347
|
-
* { tool_outputs: toolOutputs }
|
|
8348
|
-
* );
|
|
8349
|
-
* ```
|
|
8350
|
-
*/
|
|
8351
|
-
handleAssistantMessage(userId: string, run: OpenAI.Beta.Threads.Run, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>;
|
|
8352
|
-
/**
|
|
8353
|
-
* Waits for the assistant stream and handles the tool calls.
|
|
8354
|
-
*
|
|
8355
|
-
* This method processes an OpenAI Assistant stream, handles any tool calls
|
|
8356
|
-
* that require action, and yields each event from the stream. It's designed
|
|
8357
|
-
* for streaming Assistant responses while handling tool calls in real-time.
|
|
8358
|
-
*
|
|
8359
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. It will be removed in the next major version.
|
|
8360
|
-
*
|
|
8361
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8362
|
-
* @param {OpenAI} client - The OpenAI client instance
|
|
8363
|
-
* @param {Stream<OpenAI.Beta.Assistants.AssistantStreamEvent>} runStream - The Assistant run stream
|
|
8364
|
-
* @param {OpenAI.Beta.Threads.Thread} thread - The thread object
|
|
8365
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8366
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8367
|
-
* @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} Generator yielding stream events
|
|
8368
|
-
*
|
|
8369
|
-
*
|
|
8370
|
-
*
|
|
8371
|
-
* @example
|
|
8372
|
-
* ```typescript
|
|
8373
|
-
* // Process an OpenAI Assistant stream with tool calls
|
|
8374
|
-
* const thread = await openai.beta.threads.create();
|
|
8375
|
-
* const runStream = openai.beta.threads.runs.stream(thread.id, {
|
|
8376
|
-
* assistant_id: 'asst_abc123',
|
|
8377
|
-
* tools: provider.wrapTools(composioTools)
|
|
8378
|
-
* });
|
|
8379
|
-
*
|
|
8380
|
-
* // Process the stream and handle tool calls
|
|
8381
|
-
* const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
|
|
8382
|
-
* 'user123',
|
|
8383
|
-
* openai,
|
|
8384
|
-
* runStream,
|
|
8385
|
-
* thread,
|
|
8386
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8387
|
-
* );
|
|
8388
|
-
*
|
|
8389
|
-
* // Consume the stream events
|
|
8390
|
-
* for await (const event of streamProcessor) {
|
|
8391
|
-
* if (event.event === 'thread.message.delta') {
|
|
8392
|
-
* console.log(event.data.delta.content);
|
|
8393
|
-
* }
|
|
8394
|
-
* }
|
|
8395
|
-
* ```
|
|
8396
|
-
*/
|
|
8397
|
-
waitAndHandleAssistantStreamToolCalls(userId: string, client: OpenAI, runStream: Stream<OpenAI.Beta.Assistants.AssistantStreamEvent>, thread: OpenAI.Beta.Threads.Thread, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>;
|
|
8398
|
-
/**
|
|
8399
|
-
* Waits for the assistant tool calls and handles them.
|
|
8400
|
-
*
|
|
8401
|
-
* This method polls an OpenAI Assistant run until it completes or requires action,
|
|
8402
|
-
* handles any tool calls, and returns the final run object. It's designed for
|
|
8403
|
-
* non-streaming Assistant interactions.
|
|
8404
|
-
*
|
|
8405
|
-
* @deprecated Assistant API is deprecated, please use responses or chat completions instead. It will be removed in the next major version.
|
|
8406
|
-
*
|
|
8407
|
-
* @param {string} userId - The user ID for authentication and tracking
|
|
8408
|
-
* @param {OpenAI} client - The OpenAI client instance
|
|
8409
|
-
* @param {OpenAI.Beta.Threads.Run} run - The initial run object
|
|
8410
|
-
* @param {OpenAI.Beta.Threads.Thread} thread - The thread object
|
|
8411
|
-
* @param {ExecuteToolFnOptions} [options] - Optional execution options
|
|
8412
|
-
* @param {ExecuteToolModifiers} [modifiers] - Optional execution modifiers
|
|
8413
|
-
* @returns {Promise<OpenAI.Beta.Threads.Run>} The final run object after completion
|
|
8414
|
-
*
|
|
8415
|
-
* @example
|
|
8416
|
-
* ```typescript
|
|
8417
|
-
* // Process an OpenAI Assistant run with tool calls
|
|
8418
|
-
* const thread = await openai.beta.threads.create();
|
|
8419
|
-
* await openai.beta.threads.messages.create(thread.id, {
|
|
8420
|
-
* role: 'user',
|
|
8421
|
-
* content: 'Find information about Composio'
|
|
8422
|
-
* });
|
|
8423
|
-
*
|
|
8424
|
-
* let run = await openai.beta.threads.runs.create(thread.id, {
|
|
8425
|
-
* assistant_id: 'asst_abc123',
|
|
8426
|
-
* tools: provider.wrapTools(composioTools)
|
|
8427
|
-
* });
|
|
8428
|
-
*
|
|
8429
|
-
* // Wait for the run to complete, handling any tool calls
|
|
8430
|
-
* run = await provider.waitAndHandleAssistantToolCalls(
|
|
8431
|
-
* 'user123',
|
|
8432
|
-
* openai,
|
|
8433
|
-
* run,
|
|
8434
|
-
* thread,
|
|
8435
|
-
* { connectedAccountId: 'conn_xyz456' }
|
|
8436
|
-
* );
|
|
8437
|
-
*
|
|
8438
|
-
* // Get the final messages after run completion
|
|
8439
|
-
* const messages = await openai.beta.threads.messages.list(thread.id);
|
|
8440
|
-
* console.log(messages.data[0].content);
|
|
8441
|
-
* ```
|
|
8442
|
-
*/
|
|
8443
|
-
waitAndHandleAssistantToolCalls(userId: string, client: OpenAI, run: OpenAI.Beta.Threads.Run, thread: OpenAI.Beta.Threads.Thread, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): Promise<OpenAI.Beta.Threads.Runs.Run>;
|
|
8444
8358
|
}
|
|
8445
8359
|
//#endregion
|
|
8446
8360
|
//#region src/types/composio.types.d.ts
|
|
@@ -9030,4 +8944,4 @@ declare class Composio$1<TProvider extends BaseComposioProvider<unknown, unknown
|
|
|
9030
8944
|
flush(): Promise<void>;
|
|
9031
8945
|
}
|
|
9032
8946
|
//#endregion
|
|
9033
|
-
export {
|
|
8947
|
+
export { WebhookEndpointListItemSchema as $, WebhookRequestLike as $n, ToolkitListGrantContextsParamsSchema as $r, UsageOrderBySchema as $t, LogSearchFilterSchema as A, TriggerStatusEnum as An, ToolKitListResponse as Ar, CustomToolkitAuthScheme as At, ToolExecutionLogLevelSchema as B, TriggersTypeListResponseSchema as Bn, ToolkitCategory as Br, CustomToolkitUpsertResponse as Bt, SessionConfigSummarySchema as C, TriggerInstanceManageUpdateParamsSchema as Cn, CreateAuthConfigParamsSchema as Cr, WebhookSubscriptionSetParamsSchema as Ct, LogSearchFilterFieldSchema as D, TriggerInstanceUpsertParamsSchema as Dn, CreateCustomAuthConfigParamsSchema as Dr, MCP as Dt, LogSearchFilterField as E, TriggerInstanceUpsertParams as En, CreateComposioManagedAuthConfigParamsSchema as Er, WebhookVersionSchema as Et, LogSearchTimeRange as F, TriggerType as Fn, ToolkitAuthConfigDetailsSchema as Fr, CustomToolkitSyncParamsSchema as Ft, ToolExecutionLogStatusSchema as G, WebhookPayload as Gn, ToolkitChangelogResponseSchema as Gr, UsageBreakdownParams as Gt, ToolExecutionLogMetadataSchema as H, VerifyWebhookParams as Hn, ToolkitChangelogItem as Hr, Usage as Ht, LogSearchTimeRangeSchema as I, TriggerTypeSchema as In, ToolkitAuthField as Ir, CustomToolkitSyncResponse as It, Webhooks as J, WebhookPayloadV1Schema as Jn, ToolkitGetManyParams as Jr, UsageBreakdownResponseSchema as Jt, WebhookEndpoints as K, WebhookPayloadSchema as Kn, ToolkitConditionalScope as Kr, UsageBreakdownParamsSchema as Kt, ToolExecutionLog as L, TriggersTypeListParams as Ln, ToolkitAuthFieldSchema as Lr, CustomToolkitSyncResponseSchema as Lt, LogSearchParamsSchema as M, TriggerStatuses as Mn, ToolKitMeta as Mr, CustomToolkitDeleteResponse as Mt, LogSearchResponse as N, TriggerSubscribeParamSchema as Nn, ToolKitMetaSchema as Nr, CustomToolkitDeleteResponseSchema as Nt, LogSearchFilterOperator as O, TriggerInstanceUpsertResponse as On, ToolKitItem as Or, Experimental as Ot, LogSearchResponseSchema as P, TriggerSubscribeParams as Pn, ToolkitAuthConfigDetails as Pr, CustomToolkitSyncParams as Pt, WebhookEndpointListItem as Q, WebhookPayloadV3Schema as Qn, ToolkitListGrantContextsParams as Qr, UsageFiltersSchema as Qt, ToolExecutionLogDetail as R, TriggersTypeListParamsSchema as Rn, ToolkitAuthFieldsResponse as Rr, CustomToolkitUpsertParams as Rt, SessionConfigSummary as S, TriggerInstanceManageUpdateParams as Sn, CreateAuthConfigParams as Sr, WebhookSubscriptionSetParams as St, LogSearchFilter as T, TriggerInstanceManageUpdateResponseSchema as Tn, CreateAuthConfigResponseSchema as Tr, WebhookSubscriptionUpdateParamsSchema as Tt, ToolExecutionLogParentSchema as U, VerifyWebhookParamsSchema as Un, ToolkitChangelogItemSchema as Ur, UsageBreakdownGroup as Ut, ToolExecutionLogMetadata as V, TriggersTypeRetrieveResponse as Vn, ToolkitCategorySchema as Vr, CustomToolkitUpsertResponseSchema as Vt, ToolExecutionLogSchema as W, VerifyWebhookResult as Wn, ToolkitChangelogResponse as Wr, UsageBreakdownGroupSchema as Wt, WebhookEndpointCreateParams as X, WebhookPayloadV2Schema as Xn, ToolkitGrantContextDimension as Xr, UsageEntitySummarySchema as Xt, WebhookEndpoint as Y, WebhookPayloadV2 as Yn, ToolkitGetManySlugsSchema as Yr, UsageEntitySummary as Yt, WebhookEndpointCreateParamsSchema as Z, WebhookPayloadV3 as Zn, ToolkitGrantContextDimensionSchema as Zr, UsageFilters as Zt, SessionConfigListResponse as _, ToolkitsGetManyParamsSchema as _i, TriggerInstanceListActiveResponseItem as _n, AuthCustomConfigUpdateParamsSchema as _r, WebhookSubscriptionListResponse as _t, ComposioLogger as a, ToolkitRecommendScopesParams as ai, DefaultWebhookSubscriptionEvents as an, AuthConfigCreationToolAccessConfigSchema as ar, WebhookEndpointReplaceParamsSchema as at, SessionConfigPolicySchema as b, TriggerInstanceManageDeleteResponse as bn, AuthSchemeType as br, WebhookSubscriptionRotateSecretResponseSchema as bt, Keyring as c, ToolkitRecommendScopesResponseSchema as ci, ParseWebhookOptions as cn, AuthConfigListResponse as cr, WebhookEndpointUpdateParamsSchema as ct, KeyringTransferKeysResponse as d, ToolkitRetrieveResponse as di, TriggerData as dn, AuthConfigRetrieveResponseSchema as dr, WebhookSubscriptionEventType as dt, ToolkitListGrantContextsResponse as ei, UsageOrderDirectionSchema as en, WebhookSubscription as er, WebhookEndpointListParams as et, KeyringTransferKeysResponseSchema as f, ToolkitRetrieveResponseSchema as fi, TriggerEvent as fn, AuthConfigToolAccessConfigSchema as fr, WebhookSubscriptionEventTypeSchema as ft, SessionConfigListParamsSchema as g, ToolkitVersionChangelogSchema as gi, TriggerInstanceListActiveResponse as gn, AuthConfigUpdateParamsSchema as gr, WebhookSubscriptionListParamsSchema as gt, SessionConfigListParams as h, ToolkitVersionChangelog as hi, TriggerInstanceListActiveParamsSchema as hn, AuthConfigUpdateParams as hr, WebhookSubscriptionListParams as ht, OpenAIProvider as i, ToolkitMangedByEnumSchema as ii, UsageSummaryResponseSchema as in, WebhookVersions as ir, WebhookEndpointReplaceParams as it, LogSearchParams as j, TriggerStatusType as jn, ToolKitListResponseSchema as jr, CustomToolkitAuthSchemeSchema as jt, LogSearchFilterOperatorSchema as k, TriggerInstanceUpsertResponseSchema as kn, ToolKitItemSchema as kr, CustomToolkits as kt, KeyringTransferKey as l, ToolkitRetrieveCategoriesResponse as li, SetWebhookSubscriptionParams as ln, AuthConfigListResponseSchema as lr, WebhookSubscriptionDeleteResponse as lt, SessionConfig as m, ToolkitSortByEnumSchema as mi, TriggerInstanceListActiveParams as mn, AuthConfigTypes as mr, WebhookSubscriptionEventTypesResponseSchema as mt, ComposioConfig as n, ToolkitListParams as ni, UsageSummaryParamsSchema as nn, WebhookTriggerPayloadV3Schema as nr, WebhookEndpointListResponse as nt, LogLevel as o, ToolkitRecommendScopesParamsSchema as oi, IncomingTriggerPayload as on, AuthConfigListParams as or, WebhookEndpointSchema as ot, SessionConfigs as p, ToolkitSortByEnum as pi, TriggerEventData as pn, AuthConfigType as pr, WebhookSubscriptionEventTypesResponse as pt, WebhookSubscriptions as q, WebhookPayloadV1 as qn, ToolkitConditionalScopeSchema as qr, UsageBreakdownResponse as qt, Sessions as r, ToolkitMangedByEnum as ri, UsageSummaryResponse as rn, WebhookVersion as rr, WebhookEndpointListResponseSchema as rt, logger as s, ToolkitRecommendScopesResponse as si, IncomingTriggerPayloadSchema as sn, AuthConfigListParamsSchema as sr, WebhookEndpointUpdateParams as st, Composio$1 as t, ToolkitListGrantContextsResponseSchema as ti, UsageSummaryParams as tn, WebhookTriggerPayloadV3 as tr, WebhookEndpointListParamsSchema as tt, KeyringTransferKeySchema as u, ToolkitRetrieveCategoriesResponseSchema as ui, SetWebhookSubscriptionParamsSchema as un, AuthConfigRetrieveResponse as ur, WebhookSubscriptionDeleteResponseSchema as ut, SessionConfigListResponseSchema as v, ToolkitsListParamsSchema as vi, TriggerInstanceListActiveResponseItemSchema as vn, AuthDefaultConfigUpdateParamsSchema as vr, WebhookSubscriptionListResponseSchema as vt, Logs as w, TriggerInstanceManageUpdateResponse as wn, CreateAuthConfigResponse as wr, WebhookSubscriptionUpdateParams as wt, SessionConfigSchema as x, TriggerInstanceManageDeleteResponseSchema as xn, AuthSchemeTypes as xr, WebhookSubscriptionSchema as xt, SessionConfigPolicy as y, TriggerInstanceListActiveResponseSchema as yn, AuthSchemeEnum as yr, WebhookSubscriptionRotateSecretResponse as yt, ToolExecutionLogDetailSchema as z, TriggersTypeListResponse as zn, ToolkitAuthFieldsResponseSchema as zr, CustomToolkitUpsertParamsSchema as zt };
|