@mastra/client-js 0.0.0-tsconfig-compile-20250703214351 → 0.0.0-unified-sidebar-20251010130811
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 +1400 -2
- package/LICENSE.md +11 -42
- package/README.md +6 -7
- package/dist/client.d.ts +278 -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 +1761 -674
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -1164
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1759 -674
- 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 +160 -0
- package/dist/resources/agent-builder.d.ts.map +1 -0
- package/dist/resources/agent.d.ts +184 -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 +11 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/mcp-tool.d.ts +28 -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/observability.d.ts +35 -0
- package/dist/resources/observability.d.ts.map +1 -0
- package/dist/resources/tool.d.ts +24 -0
- package/dist/resources/tool.d.ts.map +1 -0
- package/dist/resources/vector.d.ts +51 -0
- package/dist/resources/vector.d.ts.map +1 -0
- package/dist/resources/workflow.d.ts +269 -0
- package/dist/resources/workflow.d.ts.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/types.d.ts +479 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -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 +11 -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 +27 -15
- package/.turbo/turbo-build.log +0 -19
- package/dist/index.d.cts +0 -1164
- package/eslint.config.js +0 -6
- package/src/adapters/agui.test.ts +0 -180
- package/src/adapters/agui.ts +0 -239
- package/src/client.ts +0 -480
- package/src/example.ts +0 -67
- package/src/index.test.ts +0 -830
- package/src/index.ts +0 -2
- package/src/resources/a2a.ts +0 -88
- package/src/resources/agent.ts +0 -763
- package/src/resources/base.ts +0 -71
- package/src/resources/index.ts +0 -10
- package/src/resources/legacy-workflow.ts +0 -242
- package/src/resources/mcp-tool.ts +0 -48
- package/src/resources/memory-thread.ts +0 -63
- package/src/resources/network-memory-thread.ts +0 -63
- package/src/resources/network.ts +0 -85
- package/src/resources/tool.ts +0 -45
- package/src/resources/vNextNetwork.ts +0 -177
- package/src/resources/vector.ts +0 -83
- package/src/resources/workflow.ts +0 -396
- package/src/types.ts +0 -422
- package/src/utils/index.ts +0 -11
- package/src/utils/process-client-tools.ts +0 -32
- package/src/utils/zod-to-json-schema.ts +0 -10
- package/tsconfig.json +0 -5
- package/vitest.config.js +0 -8
|
@@ -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;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAIxF;;;;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,51 @@
|
|
|
1
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
2
|
+
import type { CreateIndexParams, GetVectorIndexResponse, QueryVectorParams, QueryVectorResponse, ClientOptions, UpsertVectorParams } from '../types.js';
|
|
3
|
+
import { BaseResource } from './base.js';
|
|
4
|
+
export declare class Vector extends BaseResource {
|
|
5
|
+
private vectorName;
|
|
6
|
+
constructor(options: ClientOptions, vectorName: string);
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves details about a specific vector index
|
|
9
|
+
* @param indexName - Name of the index to get details for
|
|
10
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
11
|
+
* @returns Promise containing vector index details
|
|
12
|
+
*/
|
|
13
|
+
details(indexName: string, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetVectorIndexResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Deletes a vector index
|
|
16
|
+
* @param indexName - Name of the index to delete
|
|
17
|
+
* @returns Promise indicating deletion success
|
|
18
|
+
*/
|
|
19
|
+
delete(indexName: string): Promise<{
|
|
20
|
+
success: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a list of all available indexes
|
|
24
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
25
|
+
* @returns Promise containing array of index names
|
|
26
|
+
*/
|
|
27
|
+
getIndexes(runtimeContext?: RuntimeContext | Record<string, any>): Promise<{
|
|
28
|
+
indexes: string[];
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new vector index
|
|
32
|
+
* @param params - Parameters for index creation including dimension and metric
|
|
33
|
+
* @returns Promise indicating creation success
|
|
34
|
+
*/
|
|
35
|
+
createIndex(params: CreateIndexParams): Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Upserts vectors into an index
|
|
40
|
+
* @param params - Parameters containing vectors, metadata, and optional IDs
|
|
41
|
+
* @returns Promise containing array of vector IDs
|
|
42
|
+
*/
|
|
43
|
+
upsert(params: UpsertVectorParams): Promise<string[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Queries vectors in an index
|
|
46
|
+
* @param params - Query parameters including query vector and search options
|
|
47
|
+
* @returns Promise containing query results
|
|
48
|
+
*/
|
|
49
|
+
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
50
|
+
}
|
|
51
|
+
//# 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,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,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;;;;;OAKG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAMlH;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAMxD;;;;OAIG;IACH,UAAU,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAIjG;;;;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,269 @@
|
|
|
1
|
+
import type { TracingOptions } from '@mastra/core/ai-tracing';
|
|
2
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
3
|
+
import type { ClientOptions, GetWorkflowResponse, GetWorkflowRunsResponse, GetWorkflowRunsParams, WorkflowRunResult, WorkflowWatchResult, GetWorkflowRunByIdResponse, GetWorkflowRunExecutionResultResponse, StreamVNextChunkType } from '../types.js';
|
|
4
|
+
import { BaseResource } from './base.js';
|
|
5
|
+
export declare class Workflow extends BaseResource {
|
|
6
|
+
private workflowId;
|
|
7
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
8
|
+
/**
|
|
9
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
10
|
+
* separated by the Record Separator character (\x1E)
|
|
11
|
+
*
|
|
12
|
+
* @param stream - The readable stream to process
|
|
13
|
+
* @returns An async generator that yields parsed records
|
|
14
|
+
*/
|
|
15
|
+
private streamProcessor;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves details about the workflow
|
|
18
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
19
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
20
|
+
*/
|
|
21
|
+
details(runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves all runs for a workflow
|
|
24
|
+
* @param params - Parameters for filtering runs
|
|
25
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
26
|
+
* @returns Promise containing workflow runs array
|
|
27
|
+
*/
|
|
28
|
+
runs(params?: GetWorkflowRunsParams, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunsResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a specific workflow run by its ID
|
|
31
|
+
* @param runId - The ID of the workflow run to retrieve
|
|
32
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
33
|
+
* @returns Promise containing the workflow run details
|
|
34
|
+
*/
|
|
35
|
+
runById(runId: string, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunByIdResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the execution result for a specific workflow run by its ID
|
|
38
|
+
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
39
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
40
|
+
* @returns Promise containing the workflow run execution result
|
|
41
|
+
*/
|
|
42
|
+
runExecutionResult(runId: string, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Cancels a specific workflow run by its ID
|
|
45
|
+
* @param runId - The ID of the workflow run to cancel
|
|
46
|
+
* @returns Promise containing a success message
|
|
47
|
+
*/
|
|
48
|
+
cancelRun(runId: string): Promise<{
|
|
49
|
+
message: string;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Sends an event to a specific workflow run by its ID
|
|
53
|
+
* @param params - Object containing the runId, event and data
|
|
54
|
+
* @returns Promise containing a success message
|
|
55
|
+
*/
|
|
56
|
+
sendRunEvent(params: {
|
|
57
|
+
runId: string;
|
|
58
|
+
event: string;
|
|
59
|
+
data: unknown;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
message: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Use createRunAsync() instead.
|
|
65
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
66
|
+
*/
|
|
67
|
+
createRun(_params?: {
|
|
68
|
+
runId?: string;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
runId: string;
|
|
71
|
+
start: (params: {
|
|
72
|
+
inputData: Record<string, any>;
|
|
73
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
74
|
+
}) => Promise<{
|
|
75
|
+
message: string;
|
|
76
|
+
}>;
|
|
77
|
+
watch: (onRecord: (record: WorkflowWatchResult) => void) => Promise<void>;
|
|
78
|
+
resume: (params: {
|
|
79
|
+
step: string | string[];
|
|
80
|
+
resumeData?: Record<string, any>;
|
|
81
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
82
|
+
}) => Promise<{
|
|
83
|
+
message: string;
|
|
84
|
+
}>;
|
|
85
|
+
stream: (params: {
|
|
86
|
+
inputData: Record<string, any>;
|
|
87
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
88
|
+
}) => Promise<ReadableStream>;
|
|
89
|
+
startAsync: (params: {
|
|
90
|
+
inputData: Record<string, any>;
|
|
91
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
92
|
+
}) => Promise<WorkflowRunResult>;
|
|
93
|
+
resumeAsync: (params: {
|
|
94
|
+
step: string | string[];
|
|
95
|
+
resumeData?: Record<string, any>;
|
|
96
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
97
|
+
}) => Promise<WorkflowRunResult>;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a new workflow run
|
|
101
|
+
* @param params - Optional object containing the optional runId
|
|
102
|
+
* @returns Promise containing the runId of the created run with methods to control execution
|
|
103
|
+
*/
|
|
104
|
+
createRunAsync(params?: {
|
|
105
|
+
runId?: string;
|
|
106
|
+
}): Promise<{
|
|
107
|
+
runId: string;
|
|
108
|
+
start: (params: {
|
|
109
|
+
inputData: Record<string, any>;
|
|
110
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
111
|
+
tracingOptions?: TracingOptions;
|
|
112
|
+
}) => Promise<{
|
|
113
|
+
message: string;
|
|
114
|
+
}>;
|
|
115
|
+
watch: (onRecord: (record: WorkflowWatchResult) => void) => Promise<void>;
|
|
116
|
+
resume: (params: {
|
|
117
|
+
step: string | string[];
|
|
118
|
+
resumeData?: Record<string, any>;
|
|
119
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
120
|
+
tracingOptions?: TracingOptions;
|
|
121
|
+
}) => Promise<{
|
|
122
|
+
message: string;
|
|
123
|
+
}>;
|
|
124
|
+
stream: (params: {
|
|
125
|
+
inputData: Record<string, any>;
|
|
126
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
127
|
+
}) => Promise<ReadableStream>;
|
|
128
|
+
startAsync: (params: {
|
|
129
|
+
inputData: Record<string, any>;
|
|
130
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
131
|
+
tracingOptions?: TracingOptions;
|
|
132
|
+
}) => Promise<WorkflowRunResult>;
|
|
133
|
+
resumeAsync: (params: {
|
|
134
|
+
step: string | string[];
|
|
135
|
+
resumeData?: Record<string, any>;
|
|
136
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
137
|
+
tracingOptions?: TracingOptions;
|
|
138
|
+
}) => Promise<WorkflowRunResult>;
|
|
139
|
+
resumeStreamVNext: (params: {
|
|
140
|
+
step: string | string[];
|
|
141
|
+
resumeData?: Record<string, any>;
|
|
142
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
143
|
+
}) => Promise<ReadableStream>;
|
|
144
|
+
}>;
|
|
145
|
+
/**
|
|
146
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
147
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
148
|
+
* @returns Promise containing success message
|
|
149
|
+
*/
|
|
150
|
+
start(params: {
|
|
151
|
+
runId: string;
|
|
152
|
+
inputData: Record<string, any>;
|
|
153
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
154
|
+
tracingOptions?: TracingOptions;
|
|
155
|
+
}): Promise<{
|
|
156
|
+
message: string;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
160
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
161
|
+
* @returns Promise containing success message
|
|
162
|
+
*/
|
|
163
|
+
resume({ step, runId, resumeData, tracingOptions, ...rest }: {
|
|
164
|
+
step: string | string[];
|
|
165
|
+
runId: string;
|
|
166
|
+
resumeData?: Record<string, any>;
|
|
167
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
168
|
+
tracingOptions?: TracingOptions;
|
|
169
|
+
}): Promise<{
|
|
170
|
+
message: string;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
174
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
175
|
+
* @returns Promise containing the workflow execution results
|
|
176
|
+
*/
|
|
177
|
+
startAsync(params: {
|
|
178
|
+
runId?: string;
|
|
179
|
+
inputData: Record<string, any>;
|
|
180
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
181
|
+
tracingOptions?: TracingOptions;
|
|
182
|
+
}): Promise<WorkflowRunResult>;
|
|
183
|
+
/**
|
|
184
|
+
* Starts a workflow run and returns a stream
|
|
185
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
186
|
+
* @returns Promise containing the workflow execution results
|
|
187
|
+
*/
|
|
188
|
+
stream(params: {
|
|
189
|
+
runId?: string;
|
|
190
|
+
inputData: Record<string, any>;
|
|
191
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
192
|
+
tracingOptions?: TracingOptions;
|
|
193
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
194
|
+
type: string;
|
|
195
|
+
payload: any;
|
|
196
|
+
}>>;
|
|
197
|
+
/**
|
|
198
|
+
* Observes workflow stream for a workflow run
|
|
199
|
+
* @param params - Object containing the runId
|
|
200
|
+
* @returns Promise containing the workflow execution results
|
|
201
|
+
*/
|
|
202
|
+
observeStream(params: {
|
|
203
|
+
runId: string;
|
|
204
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
205
|
+
type: string;
|
|
206
|
+
payload: any;
|
|
207
|
+
}>>;
|
|
208
|
+
/**
|
|
209
|
+
* Starts a workflow run and returns a stream
|
|
210
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
211
|
+
* @returns Promise containing the workflow execution results
|
|
212
|
+
*/
|
|
213
|
+
streamVNext(params: {
|
|
214
|
+
runId?: string;
|
|
215
|
+
inputData?: Record<string, any>;
|
|
216
|
+
runtimeContext?: RuntimeContext;
|
|
217
|
+
closeOnSuspend?: boolean;
|
|
218
|
+
tracingOptions?: TracingOptions;
|
|
219
|
+
}): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
220
|
+
/**
|
|
221
|
+
* Observes workflow vNext stream for a workflow run
|
|
222
|
+
* @param params - Object containing the runId
|
|
223
|
+
* @returns Promise containing the workflow execution results
|
|
224
|
+
*/
|
|
225
|
+
observeStreamVNext(params: {
|
|
226
|
+
runId: string;
|
|
227
|
+
}): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
228
|
+
/**
|
|
229
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
230
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
231
|
+
* @returns Promise containing the workflow resume results
|
|
232
|
+
*/
|
|
233
|
+
resumeAsync(params: {
|
|
234
|
+
runId: string;
|
|
235
|
+
step: string | string[];
|
|
236
|
+
resumeData?: Record<string, any>;
|
|
237
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
238
|
+
tracingOptions?: TracingOptions;
|
|
239
|
+
}): Promise<WorkflowRunResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Resumes a suspended workflow step that uses streamVNext asynchronously and returns a promise that resolves when the workflow is complete
|
|
242
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
243
|
+
* @returns Promise containing the workflow resume results
|
|
244
|
+
*/
|
|
245
|
+
resumeStreamVNext(params: {
|
|
246
|
+
runId: string;
|
|
247
|
+
step: string | string[];
|
|
248
|
+
resumeData?: Record<string, any>;
|
|
249
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
250
|
+
tracingOptions?: TracingOptions;
|
|
251
|
+
}): Promise<ReadableStream>;
|
|
252
|
+
/**
|
|
253
|
+
* Watches workflow transitions in real-time
|
|
254
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
255
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
256
|
+
*/
|
|
257
|
+
watch({ runId }: {
|
|
258
|
+
runId?: string;
|
|
259
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
260
|
+
/**
|
|
261
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
262
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
263
|
+
*
|
|
264
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
265
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
266
|
+
*/
|
|
267
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0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AC;KACjC,GAAG,OAAO,CAAC,cAAc,CAAC;IA8D3B;;;;OAIG;IACG,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI;IAsB1F;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,cAAc;CAgBvF"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToolExecutionOptions } from 'ai';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
export interface ClientToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> {
|
|
4
|
+
context: TSchemaIn extends z.ZodSchema ? z.infer<TSchemaIn> : unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface ClientToolAction<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined> {
|
|
7
|
+
id: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema?: TSchemaIn;
|
|
10
|
+
outputSchema?: TSchemaOut;
|
|
11
|
+
execute?: (context: ClientToolExecutionContext<TSchemaIn>, options?: ToolExecutionOptions) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
12
|
+
}
|
|
13
|
+
export declare class ClientTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined> implements ClientToolAction<TSchemaIn, TSchemaOut> {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema?: TSchemaIn;
|
|
17
|
+
outputSchema?: TSchemaOut;
|
|
18
|
+
execute?: ClientToolAction<TSchemaIn, TSchemaOut>['execute'];
|
|
19
|
+
constructor(opts: ClientToolAction<TSchemaIn, TSchemaOut>);
|
|
20
|
+
}
|
|
21
|
+
export declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined>(opts: ClientToolAction<TSchemaIn, TSchemaOut>): ClientTool<TSchemaIn, TSchemaOut>;
|
|
22
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,MAAM,WAAW,0BAA0B,CAAC,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS;IAC/F,OAAO,EAAE,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;CACvE;AAGD,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS,EACrD,UAAU,SAAS,CAAC,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS;IAEtD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,OAAO,CAAC,EAAE,CACR,OAAO,EAAE,0BAA0B,CAAC,SAAS,CAAC,EAC9C,OAAO,CAAC,EAAE,oBAAoB,KAC3B,OAAO,CAAC,UAAU,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC;CAC9E;AAGD,qBAAa,UAAU,CACrB,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS,EACrD,UAAU,SAAS,CAAC,CAAC,SA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