@mastra/client-js 0.0.0-revert-schema-20250416221206 → 0.0.0-scorers-ui-refactored-20250916094952
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 +2026 -2
- package/LICENSE.md +11 -42
- package/README.md +7 -4
- package/dist/client.d.ts +284 -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 +2865 -130
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -585
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2861 -132
- 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 +175 -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 +90 -0
- package/dist/resources/legacy-workflow.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/network.d.ts +32 -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 +24 -0
- package/dist/resources/tool.d.ts.map +1 -0
- package/dist/resources/vNextNetwork.d.ts +43 -0
- package/dist/resources/vNextNetwork.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 +228 -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 +469 -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 +41 -18
- package/dist/index.d.cts +0 -585
- package/eslint.config.js +0 -6
- package/src/client.ts +0 -223
- 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 -7
- package/src/resources/memory-thread.ts +0 -60
- package/src/resources/network.ts +0 -92
- package/src/resources/tool.ts +0 -32
- package/src/resources/vector.ts +0 -83
- package/src/resources/workflow.ts +0 -215
- package/src/types.ts +0 -224
- package/tsconfig.json +0 -5
- package/vitest.config.js +0 -8
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { StorageThreadType } from '@mastra/core/memory';
|
|
2
|
+
import type { GetMemoryThreadMessagesResponse, ClientOptions, UpdateMemoryThreadParams, GetMemoryThreadMessagesParams } from '../types.js';
|
|
3
|
+
import { BaseResource } from './base.js';
|
|
4
|
+
export declare class NetworkMemoryThread extends BaseResource {
|
|
5
|
+
private threadId;
|
|
6
|
+
private networkId;
|
|
7
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves the memory thread details
|
|
10
|
+
* @returns Promise containing thread details including title and metadata
|
|
11
|
+
*/
|
|
12
|
+
get(): Promise<StorageThreadType>;
|
|
13
|
+
/**
|
|
14
|
+
* Updates the memory thread properties
|
|
15
|
+
* @param params - Update parameters including title and metadata
|
|
16
|
+
* @returns Promise containing updated thread details
|
|
17
|
+
*/
|
|
18
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
19
|
+
/**
|
|
20
|
+
* Deletes the memory thread
|
|
21
|
+
* @returns Promise containing deletion result
|
|
22
|
+
*/
|
|
23
|
+
delete(): Promise<{
|
|
24
|
+
result: string;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves messages associated with the thread
|
|
28
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
29
|
+
* @returns Promise containing thread messages and UI messages
|
|
30
|
+
*/
|
|
31
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Deletes one or more messages from the thread
|
|
34
|
+
* @param messageIds - Can be a single message ID (string), array of message IDs,
|
|
35
|
+
* message object with id property, or array of message objects
|
|
36
|
+
* @returns Promise containing deletion result
|
|
37
|
+
*/
|
|
38
|
+
deleteMessages(messageIds: string | string[] | {
|
|
39
|
+
id: string;
|
|
40
|
+
} | {
|
|
41
|
+
id: string;
|
|
42
|
+
}[]): Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
message: string;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=network-memory-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-memory-thread.d.ts","sourceRoot":"","sources":["../../src/resources/network-memory-thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EACV,+BAA+B,EAC/B,aAAa,EACb,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,mBAAoB,SAAQ,YAAY;IAGjD,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;gBAFjB,OAAO,EAAE,aAAa,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;IAK3B;;;OAGG;IACH,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAIjC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOpE;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAMrC;;;;OAIG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAQ7F;;;;;OAKG;IACH,cAAc,CACZ,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,GAChE,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CASlD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
+
import type { GenerateReturn } from '@mastra/core/llm';
|
|
3
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
4
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
5
|
+
import type { ZodSchema } from 'zod';
|
|
6
|
+
import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types.js';
|
|
7
|
+
import { BaseResource } from './base.js';
|
|
8
|
+
export declare class Network extends BaseResource {
|
|
9
|
+
private networkId;
|
|
10
|
+
constructor(options: ClientOptions, networkId: string);
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves details about the network
|
|
13
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
14
|
+
* @returns Promise containing network details
|
|
15
|
+
*/
|
|
16
|
+
details(runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetNetworkResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a response from the agent
|
|
19
|
+
* @param params - Generation parameters including prompt
|
|
20
|
+
* @returns Promise containing the generated response
|
|
21
|
+
*/
|
|
22
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn<any, Output, StructuredOutput>>;
|
|
23
|
+
/**
|
|
24
|
+
* Streams a response from the agent
|
|
25
|
+
* @param params - Stream parameters including prompt
|
|
26
|
+
* @returns Promise containing the enhanced Response object with processDataStream method
|
|
27
|
+
*/
|
|
28
|
+
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
29
|
+
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
//# 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,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,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;AAIhG,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;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI3F;;;;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,24 @@
|
|
|
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
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
10
|
+
* @returns Promise containing tool details including description and schemas
|
|
11
|
+
*/
|
|
12
|
+
details(runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetToolResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Executes the tool with the provided parameters
|
|
15
|
+
* @param params - Parameters required for tool execution
|
|
16
|
+
* @returns Promise containing the tool execution results
|
|
17
|
+
*/
|
|
18
|
+
execute(params: {
|
|
19
|
+
data: any;
|
|
20
|
+
runId?: string;
|
|
21
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
}
|
|
24
|
+
//# 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;;;;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,43 @@
|
|
|
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
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
11
|
+
* @returns Promise containing vNext network details
|
|
12
|
+
*/
|
|
13
|
+
details(runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetVNextNetworkResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Generates a response from the v-next network
|
|
16
|
+
* @param params - Generation parameters including message
|
|
17
|
+
* @returns Promise containing the generated response
|
|
18
|
+
*/
|
|
19
|
+
generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Generates a response from the v-next network using multiple primitives
|
|
22
|
+
* @param params - Generation parameters including message
|
|
23
|
+
* @returns Promise containing the generated response
|
|
24
|
+
*/
|
|
25
|
+
loop(params: {
|
|
26
|
+
message: string;
|
|
27
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
28
|
+
}): Promise<LoopVNextNetworkResponse>;
|
|
29
|
+
private streamProcessor;
|
|
30
|
+
/**
|
|
31
|
+
* Streams a response from the v-next network
|
|
32
|
+
* @param params - Stream parameters including message
|
|
33
|
+
* @returns Promise containing the results
|
|
34
|
+
*/
|
|
35
|
+
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Streams a response from the v-next network loop
|
|
38
|
+
* @param params - Stream parameters including message
|
|
39
|
+
* @returns Promise containing the results
|
|
40
|
+
*/
|
|
41
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# 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;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAIhG;;;;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,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,228 @@
|
|
|
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
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
18
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
19
|
+
*/
|
|
20
|
+
details(runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves all runs for a workflow
|
|
23
|
+
* @param params - Parameters for filtering runs
|
|
24
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
25
|
+
* @returns Promise containing workflow runs array
|
|
26
|
+
*/
|
|
27
|
+
runs(params?: GetWorkflowRunsParams, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunsResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a specific workflow run by its ID
|
|
30
|
+
* @param runId - The ID of the workflow run to retrieve
|
|
31
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
32
|
+
* @returns Promise containing the workflow run details
|
|
33
|
+
*/
|
|
34
|
+
runById(runId: string, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunByIdResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the execution result for a specific workflow run by its ID
|
|
37
|
+
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
38
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
39
|
+
* @returns Promise containing the workflow run execution result
|
|
40
|
+
*/
|
|
41
|
+
runExecutionResult(runId: string, runtimeContext?: RuntimeContext | Record<string, any>): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Cancels a specific workflow run by its ID
|
|
44
|
+
* @param runId - The ID of the workflow run to cancel
|
|
45
|
+
* @returns Promise containing a success message
|
|
46
|
+
*/
|
|
47
|
+
cancelRun(runId: string): Promise<{
|
|
48
|
+
message: string;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Sends an event to a specific workflow run by its ID
|
|
52
|
+
* @param params - Object containing the runId, event and data
|
|
53
|
+
* @returns Promise containing a success message
|
|
54
|
+
*/
|
|
55
|
+
sendRunEvent(params: {
|
|
56
|
+
runId: string;
|
|
57
|
+
event: string;
|
|
58
|
+
data: unknown;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
message: string;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new workflow run
|
|
64
|
+
* @param params - Optional object containing the optional runId
|
|
65
|
+
* @returns Promise containing the runId of the created run
|
|
66
|
+
*/
|
|
67
|
+
/** @deprecated Use createRunAsync instead */
|
|
68
|
+
createRun(params?: {
|
|
69
|
+
runId?: string;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
runId: string;
|
|
72
|
+
start: (params: {
|
|
73
|
+
inputData: Record<string, any>;
|
|
74
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
75
|
+
}) => Promise<{
|
|
76
|
+
message: string;
|
|
77
|
+
}>;
|
|
78
|
+
watch: (onRecord: (record: WorkflowWatchResult) => void) => Promise<void>;
|
|
79
|
+
resume: (params: {
|
|
80
|
+
step: string | string[];
|
|
81
|
+
resumeData?: Record<string, any>;
|
|
82
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
stream: (params: {
|
|
87
|
+
inputData: Record<string, any>;
|
|
88
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
89
|
+
}) => Promise<ReadableStream>;
|
|
90
|
+
startAsync: (params: {
|
|
91
|
+
inputData: Record<string, any>;
|
|
92
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
93
|
+
}) => Promise<WorkflowRunResult>;
|
|
94
|
+
resumeAsync: (params: {
|
|
95
|
+
step: string | string[];
|
|
96
|
+
resumeData?: Record<string, any>;
|
|
97
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
98
|
+
}) => Promise<WorkflowRunResult>;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a new workflow run (alias for createRun)
|
|
102
|
+
* @param params - Optional object containing the optional runId
|
|
103
|
+
* @returns Promise containing the runId of the created run
|
|
104
|
+
*/
|
|
105
|
+
createRunAsync(params?: {
|
|
106
|
+
runId?: string;
|
|
107
|
+
}): Promise<{
|
|
108
|
+
runId: string;
|
|
109
|
+
start: (params: {
|
|
110
|
+
inputData: Record<string, any>;
|
|
111
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
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
|
+
}) => Promise<{
|
|
121
|
+
message: string;
|
|
122
|
+
}>;
|
|
123
|
+
stream: (params: {
|
|
124
|
+
inputData: Record<string, any>;
|
|
125
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
126
|
+
}) => Promise<ReadableStream>;
|
|
127
|
+
startAsync: (params: {
|
|
128
|
+
inputData: Record<string, any>;
|
|
129
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
130
|
+
}) => Promise<WorkflowRunResult>;
|
|
131
|
+
resumeAsync: (params: {
|
|
132
|
+
step: string | string[];
|
|
133
|
+
resumeData?: Record<string, any>;
|
|
134
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
135
|
+
}) => Promise<WorkflowRunResult>;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
139
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
140
|
+
* @returns Promise containing success message
|
|
141
|
+
*/
|
|
142
|
+
start(params: {
|
|
143
|
+
runId: string;
|
|
144
|
+
inputData: Record<string, any>;
|
|
145
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
146
|
+
}): Promise<{
|
|
147
|
+
message: string;
|
|
148
|
+
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
151
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
152
|
+
* @returns Promise containing success message
|
|
153
|
+
*/
|
|
154
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
155
|
+
step: string | string[];
|
|
156
|
+
runId: string;
|
|
157
|
+
resumeData?: Record<string, any>;
|
|
158
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
159
|
+
}): Promise<{
|
|
160
|
+
message: string;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
164
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
165
|
+
* @returns Promise containing the workflow execution results
|
|
166
|
+
*/
|
|
167
|
+
startAsync(params: {
|
|
168
|
+
runId?: string;
|
|
169
|
+
inputData: Record<string, any>;
|
|
170
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
171
|
+
}): Promise<WorkflowRunResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Starts a workflow run and returns a stream
|
|
174
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
175
|
+
* @returns Promise containing the workflow execution results
|
|
176
|
+
*/
|
|
177
|
+
stream(params: {
|
|
178
|
+
runId?: string;
|
|
179
|
+
inputData: Record<string, any>;
|
|
180
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
181
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
182
|
+
type: string;
|
|
183
|
+
payload: any;
|
|
184
|
+
}>>;
|
|
185
|
+
/**
|
|
186
|
+
* Starts a workflow run and returns a stream
|
|
187
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
188
|
+
* @returns Promise containing the workflow execution results
|
|
189
|
+
*/
|
|
190
|
+
streamVNext(params: {
|
|
191
|
+
runId?: string;
|
|
192
|
+
inputData: Record<string, any>;
|
|
193
|
+
runtimeContext?: RuntimeContext;
|
|
194
|
+
}): Promise<import("stream/web").ReadableStream<{
|
|
195
|
+
type: string;
|
|
196
|
+
payload: any;
|
|
197
|
+
runId: string;
|
|
198
|
+
from: "AGENT" | "WORKFLOW";
|
|
199
|
+
}>>;
|
|
200
|
+
/**
|
|
201
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
202
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
203
|
+
* @returns Promise containing the workflow resume results
|
|
204
|
+
*/
|
|
205
|
+
resumeAsync(params: {
|
|
206
|
+
runId: string;
|
|
207
|
+
step: string | string[];
|
|
208
|
+
resumeData?: Record<string, any>;
|
|
209
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
210
|
+
}): Promise<WorkflowRunResult>;
|
|
211
|
+
/**
|
|
212
|
+
* Watches workflow transitions in real-time
|
|
213
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
214
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
215
|
+
*/
|
|
216
|
+
watch({ runId }: {
|
|
217
|
+
runId?: string;
|
|
218
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
221
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
222
|
+
*
|
|
223
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
224
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
225
|
+
*/
|
|
226
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
227
|
+
}
|
|
228
|
+
//# 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;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAC,EAA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E,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACvD;cA6BkE,MAAM;iBAAW,GAAG;;IAiCvF;;;;OAIG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE;cA+BjG,MAAM;iBAAW,GAAG;eAAS,MAAM;cAAQ,OAAO,GAAG,UAAU;;IAkC3E;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACjC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACvD,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAY9B;;;;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,SA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