@mastra/client-js 0.0.0-remove-cloud-span-transform-20250425214156 → 0.0.0-remove-unused-import-20250909212718
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/CHANGELOG.md +1827 -2
- package/LICENSE.md +11 -42
- package/README.md +7 -4
- package/dist/client.d.ts +280 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/example.d.ts +2 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/index.cjs +2568 -177
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -691
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2563 -176
- package/dist/index.js.map +1 -0
- package/dist/resources/a2a.d.ts +41 -0
- package/dist/resources/a2a.d.ts.map +1 -0
- package/dist/resources/agent-builder.d.ts +161 -0
- package/dist/resources/agent-builder.d.ts.map +1 -0
- package/dist/resources/agent.d.ts +155 -0
- package/dist/resources/agent.d.ts.map +1 -0
- package/dist/resources/base.d.ts +13 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/index.d.ts +13 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/legacy-workflow.d.ts +87 -0
- package/dist/resources/legacy-workflow.d.ts.map +1 -0
- package/dist/resources/mcp-tool.d.ts +27 -0
- package/dist/resources/mcp-tool.d.ts.map +1 -0
- package/dist/resources/memory-thread.d.ts +53 -0
- package/dist/resources/memory-thread.d.ts.map +1 -0
- package/dist/resources/network-memory-thread.d.ts +47 -0
- package/dist/resources/network-memory-thread.d.ts.map +1 -0
- package/dist/resources/network.d.ts +30 -0
- package/dist/resources/network.d.ts.map +1 -0
- package/dist/resources/observability.d.ts +19 -0
- package/dist/resources/observability.d.ts.map +1 -0
- package/dist/resources/tool.d.ts +23 -0
- package/dist/resources/tool.d.ts.map +1 -0
- package/dist/resources/vNextNetwork.d.ts +42 -0
- package/dist/resources/vNextNetwork.d.ts.map +1 -0
- package/dist/resources/vector.d.ts +48 -0
- package/dist/resources/vector.d.ts.map +1 -0
- package/dist/resources/workflow.d.ts +169 -0
- package/dist/resources/workflow.d.ts.map +1 -0
- package/dist/types.d.ts +462 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/process-client-tools.d.ts +3 -0
- package/dist/utils/process-client-tools.d.ts.map +1 -0
- package/dist/utils/process-mastra-stream.d.ts +7 -0
- package/dist/utils/process-mastra-stream.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema.d.ts +3 -0
- package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
- package/package.json +39 -19
- package/dist/index.d.cts +0 -691
- package/eslint.config.js +0 -6
- package/src/client.ts +0 -232
- package/src/example.ts +0 -65
- package/src/index.test.ts +0 -710
- package/src/index.ts +0 -2
- package/src/resources/agent.ts +0 -205
- package/src/resources/base.ts +0 -70
- package/src/resources/index.ts +0 -8
- package/src/resources/memory-thread.ts +0 -53
- package/src/resources/network.ts +0 -92
- package/src/resources/tool.ts +0 -32
- package/src/resources/vector.ts +0 -83
- package/src/resources/vnext-workflow.ts +0 -225
- package/src/resources/workflow.ts +0 -215
- package/src/types.ts +0 -237
- package/tsconfig.json +0 -5
- package/vitest.config.js +0 -8
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
+
import type { GenerateReturn } from '@mastra/core/llm';
|
|
3
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
4
|
+
import type { ZodSchema } from 'zod';
|
|
5
|
+
import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types.js';
|
|
6
|
+
import { BaseResource } from './base.js';
|
|
7
|
+
export declare class Network extends BaseResource {
|
|
8
|
+
private networkId;
|
|
9
|
+
constructor(options: ClientOptions, networkId: string);
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves details about the network
|
|
12
|
+
* @returns Promise containing network details
|
|
13
|
+
*/
|
|
14
|
+
details(): Promise<GetNetworkResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Generates a response from the agent
|
|
17
|
+
* @param params - Generation parameters including prompt
|
|
18
|
+
* @returns Promise containing the generated response
|
|
19
|
+
*/
|
|
20
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn<any, Output, StructuredOutput>>;
|
|
21
|
+
/**
|
|
22
|
+
* Streams a response from the agent
|
|
23
|
+
* @param params - Stream parameters including prompt
|
|
24
|
+
* @returns Promise containing the enhanced Response object with processDataStream method
|
|
25
|
+
*/
|
|
26
|
+
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
27
|
+
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/resources/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGhG,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,OAAQ,SAAQ,YAAY;IAGrC,OAAO,CAAC,SAAS;gBADjB,OAAO,EAAE,aAAa,EACd,SAAS,EAAE,MAAM;IAK3B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAItC;;;;OAIG;IACH,QAAQ,CACN,MAAM,SAAS,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EAC9D,gBAAgB,SAAS,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EACxE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAazF;;;;OAIG;IACG,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,EACpE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,OAAO,CACR,QAAQ,GAAG;QACT,iBAAiB,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACzG,CACF;CA4BF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AITraceRecord, AITracesPaginatedArg } from '@mastra/core/storage';
|
|
2
|
+
import type { ClientOptions, GetAITracesResponse } from '../types.js';
|
|
3
|
+
import { BaseResource } from './base.js';
|
|
4
|
+
export declare class Observability extends BaseResource {
|
|
5
|
+
constructor(options: ClientOptions);
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves a specific AI trace by ID
|
|
8
|
+
* @param traceId - ID of the trace to retrieve
|
|
9
|
+
* @returns Promise containing the AI trace with all its spans
|
|
10
|
+
*/
|
|
11
|
+
getTrace(traceId: string): Promise<AITraceRecord>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves paginated list of AI traces with optional filtering
|
|
14
|
+
* @param params - Parameters for pagination and filtering
|
|
15
|
+
* @returns Promise containing paginated traces and pagination info
|
|
16
|
+
*/
|
|
17
|
+
getTraces(params: AITracesPaginatedArg): Promise<GetAITracesResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=observability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../src/resources/observability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAkCtE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
2
|
+
import type { GetToolResponse, ClientOptions } from '../types.js';
|
|
3
|
+
import { BaseResource } from './base.js';
|
|
4
|
+
export declare class Tool extends BaseResource {
|
|
5
|
+
private toolId;
|
|
6
|
+
constructor(options: ClientOptions, toolId: string);
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves details about the tool
|
|
9
|
+
* @returns Promise containing tool details including description and schemas
|
|
10
|
+
*/
|
|
11
|
+
details(): Promise<GetToolResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Executes the tool with the provided parameters
|
|
14
|
+
* @param params - Parameters required for tool execution
|
|
15
|
+
* @returns Promise containing the tool execution results
|
|
16
|
+
*/
|
|
17
|
+
execute(params: {
|
|
18
|
+
data: any;
|
|
19
|
+
runId?: string;
|
|
20
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/resources/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,IAAK,SAAQ,YAAY;IAGlC,OAAO,CAAC,MAAM;gBADd,OAAO,EAAE,aAAa,EACd,MAAM,EAAE,MAAM;IAKxB;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAInC;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CAiBpH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
2
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
3
|
+
import type { ClientOptions, GetVNextNetworkResponse, GenerateVNextNetworkResponse, LoopVNextNetworkResponse, GenerateOrStreamVNextNetworkParams, LoopStreamVNextNetworkParams } from '../types.js';
|
|
4
|
+
import { BaseResource } from './base.js';
|
|
5
|
+
export declare class VNextNetwork extends BaseResource {
|
|
6
|
+
private networkId;
|
|
7
|
+
constructor(options: ClientOptions, networkId: string);
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves details about the network
|
|
10
|
+
* @returns Promise containing vNext network details
|
|
11
|
+
*/
|
|
12
|
+
details(): Promise<GetVNextNetworkResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a response from the v-next network
|
|
15
|
+
* @param params - Generation parameters including message
|
|
16
|
+
* @returns Promise containing the generated response
|
|
17
|
+
*/
|
|
18
|
+
generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a response from the v-next network using multiple primitives
|
|
21
|
+
* @param params - Generation parameters including message
|
|
22
|
+
* @returns Promise containing the generated response
|
|
23
|
+
*/
|
|
24
|
+
loop(params: {
|
|
25
|
+
message: string;
|
|
26
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
27
|
+
}): Promise<LoopVNextNetworkResponse>;
|
|
28
|
+
private streamProcessor;
|
|
29
|
+
/**
|
|
30
|
+
* Streams a response from the v-next network
|
|
31
|
+
* @param params - Stream parameters including message
|
|
32
|
+
* @returns Promise containing the results
|
|
33
|
+
*/
|
|
34
|
+
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Streams a response from the v-next network loop
|
|
37
|
+
* @param params - Stream parameters including message
|
|
38
|
+
* @returns Promise containing the results
|
|
39
|
+
*/
|
|
40
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=vNextNetwork.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vNextNetwork.d.ts","sourceRoot":"","sources":["../../src/resources/vNextNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,4BAA4B,EAC5B,wBAAwB,EACxB,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,qBAAa,YAAa,SAAQ,YAAY;IAG1C,OAAO,CAAC,SAAS;gBADjB,OAAO,EAAE,aAAa,EACd,SAAS,EAAE,MAAM;IAK3B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAI3C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAU3F;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACvD,GAAG,OAAO,CAAC,wBAAwB,CAAC;YAUtB,eAAe;IAgE9B;;;;OAIG;IACG,MAAM,CAAC,MAAM,EAAE,kCAAkC,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;IA2B/F;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,4BAA4B,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;CA0B9F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CreateIndexParams, GetVectorIndexResponse, QueryVectorParams, QueryVectorResponse, ClientOptions, UpsertVectorParams } from '../types.js';
|
|
2
|
+
import { BaseResource } from './base.js';
|
|
3
|
+
export declare class Vector extends BaseResource {
|
|
4
|
+
private vectorName;
|
|
5
|
+
constructor(options: ClientOptions, vectorName: string);
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves details about a specific vector index
|
|
8
|
+
* @param indexName - Name of the index to get details for
|
|
9
|
+
* @returns Promise containing vector index details
|
|
10
|
+
*/
|
|
11
|
+
details(indexName: string): Promise<GetVectorIndexResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Deletes a vector index
|
|
14
|
+
* @param indexName - Name of the index to delete
|
|
15
|
+
* @returns Promise indicating deletion success
|
|
16
|
+
*/
|
|
17
|
+
delete(indexName: string): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a list of all available indexes
|
|
22
|
+
* @returns Promise containing array of index names
|
|
23
|
+
*/
|
|
24
|
+
getIndexes(): Promise<{
|
|
25
|
+
indexes: string[];
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new vector index
|
|
29
|
+
* @param params - Parameters for index creation including dimension and metric
|
|
30
|
+
* @returns Promise indicating creation success
|
|
31
|
+
*/
|
|
32
|
+
createIndex(params: CreateIndexParams): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Upserts vectors into an index
|
|
37
|
+
* @param params - Parameters containing vectors, metadata, and optional IDs
|
|
38
|
+
* @returns Promise containing array of vector IDs
|
|
39
|
+
*/
|
|
40
|
+
upsert(params: UpsertVectorParams): Promise<string[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Queries vectors in an index
|
|
43
|
+
* @param params - Query parameters including query vector and search options
|
|
44
|
+
* @returns Promise containing query results
|
|
45
|
+
*/
|
|
46
|
+
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=vector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../src/resources/vector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,MAAO,SAAQ,YAAY;IAGpC,OAAO,CAAC,UAAU;gBADlB,OAAO,EAAE,aAAa,EACd,UAAU,EAAE,MAAM;IAK5B;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI3D;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAMxD;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAI5C;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAOrE;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOrD;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAM/D"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
2
|
+
import type { ClientOptions, GetWorkflowResponse, GetWorkflowRunsResponse, GetWorkflowRunsParams, WorkflowRunResult, WorkflowWatchResult, GetWorkflowRunByIdResponse, GetWorkflowRunExecutionResultResponse } from '../types.js';
|
|
3
|
+
import { BaseResource } from './base.js';
|
|
4
|
+
export declare class Workflow extends BaseResource {
|
|
5
|
+
private workflowId;
|
|
6
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
7
|
+
/**
|
|
8
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
9
|
+
* separated by the Record Separator character (\x1E)
|
|
10
|
+
*
|
|
11
|
+
* @param stream - The readable stream to process
|
|
12
|
+
* @returns An async generator that yields parsed records
|
|
13
|
+
*/
|
|
14
|
+
private streamProcessor;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves details about the workflow
|
|
17
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
18
|
+
*/
|
|
19
|
+
details(): Promise<GetWorkflowResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves all runs for a workflow
|
|
22
|
+
* @param params - Parameters for filtering runs
|
|
23
|
+
* @returns Promise containing workflow runs array
|
|
24
|
+
*/
|
|
25
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves a specific workflow run by its ID
|
|
28
|
+
* @param runId - The ID of the workflow run to retrieve
|
|
29
|
+
* @returns Promise containing the workflow run details
|
|
30
|
+
*/
|
|
31
|
+
runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the execution result for a specific workflow run by its ID
|
|
34
|
+
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
35
|
+
* @returns Promise containing the workflow run execution result
|
|
36
|
+
*/
|
|
37
|
+
runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Cancels a specific workflow run by its ID
|
|
40
|
+
* @param runId - The ID of the workflow run to cancel
|
|
41
|
+
* @returns Promise containing a success message
|
|
42
|
+
*/
|
|
43
|
+
cancelRun(runId: string): Promise<{
|
|
44
|
+
message: string;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Sends an event to a specific workflow run by its ID
|
|
48
|
+
* @param params - Object containing the runId, event and data
|
|
49
|
+
* @returns Promise containing a success message
|
|
50
|
+
*/
|
|
51
|
+
sendRunEvent(params: {
|
|
52
|
+
runId: string;
|
|
53
|
+
event: string;
|
|
54
|
+
data: unknown;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
message: string;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new workflow run
|
|
60
|
+
* @param params - Optional object containing the optional runId
|
|
61
|
+
* @returns Promise containing the runId of the created run
|
|
62
|
+
*/
|
|
63
|
+
createRun(params?: {
|
|
64
|
+
runId?: string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
runId: string;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new workflow run (alias for createRun)
|
|
70
|
+
* @param params - Optional object containing the optional runId
|
|
71
|
+
* @returns Promise containing the runId of the created run
|
|
72
|
+
*/
|
|
73
|
+
createRunAsync(params?: {
|
|
74
|
+
runId?: string;
|
|
75
|
+
}): Promise<{
|
|
76
|
+
runId: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
80
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
81
|
+
* @returns Promise containing success message
|
|
82
|
+
*/
|
|
83
|
+
start(params: {
|
|
84
|
+
runId: string;
|
|
85
|
+
inputData: Record<string, any>;
|
|
86
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
message: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
92
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
93
|
+
* @returns Promise containing success message
|
|
94
|
+
*/
|
|
95
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
96
|
+
step: string | string[];
|
|
97
|
+
runId: string;
|
|
98
|
+
resumeData?: Record<string, any>;
|
|
99
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
message: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
105
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
106
|
+
* @returns Promise containing the workflow execution results
|
|
107
|
+
*/
|
|
108
|
+
startAsync(params: {
|
|
109
|
+
runId?: string;
|
|
110
|
+
inputData: Record<string, any>;
|
|
111
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
112
|
+
}): Promise<WorkflowRunResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Starts a workflow run and returns a stream
|
|
115
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
116
|
+
* @returns Promise containing the workflow execution results
|
|
117
|
+
*/
|
|
118
|
+
stream(params: {
|
|
119
|
+
runId?: string;
|
|
120
|
+
inputData: Record<string, any>;
|
|
121
|
+
runtimeContext?: RuntimeContext;
|
|
122
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
123
|
+
type: string;
|
|
124
|
+
payload: any;
|
|
125
|
+
}>>;
|
|
126
|
+
/**
|
|
127
|
+
* Starts a workflow run and returns a stream
|
|
128
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
129
|
+
* @returns Promise containing the workflow execution results
|
|
130
|
+
*/
|
|
131
|
+
streamVNext(params: {
|
|
132
|
+
runId?: string;
|
|
133
|
+
inputData: Record<string, any>;
|
|
134
|
+
runtimeContext?: RuntimeContext;
|
|
135
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
136
|
+
type: string;
|
|
137
|
+
payload: any;
|
|
138
|
+
runId: string;
|
|
139
|
+
from: "AGENT" | "WORKFLOW";
|
|
140
|
+
}>>;
|
|
141
|
+
/**
|
|
142
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
143
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
144
|
+
* @returns Promise containing the workflow resume results
|
|
145
|
+
*/
|
|
146
|
+
resumeAsync(params: {
|
|
147
|
+
runId: string;
|
|
148
|
+
step: string | string[];
|
|
149
|
+
resumeData?: Record<string, any>;
|
|
150
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
151
|
+
}): Promise<WorkflowRunResult>;
|
|
152
|
+
/**
|
|
153
|
+
* Watches workflow transitions in real-time
|
|
154
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
155
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
156
|
+
*/
|
|
157
|
+
watch({ runId }: {
|
|
158
|
+
runId?: string;
|
|
159
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
162
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
163
|
+
*
|
|
164
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
165
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
166
|
+
*/
|
|
167
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/resources/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,qCAAqC,EACtC,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,qBAAa,QAAS,SAAQ,YAAY;IAGtC,OAAO,CAAC,UAAU;gBADlB,OAAO,EAAE,aAAa,EACd,UAAU,EAAE,MAAM;IAK5B;;;;;;OAMG;YACY,eAAe;IAgE9B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIvC;;;;OAIG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAyBtE;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAI3D;;;;OAIG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qCAAqC,CAAC;IAIjF;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAA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