@mastra/client-js 0.0.0-update-scorers-api-20250801170445 → 0.0.0-usechat-duplicate-20251016110554

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +1050 -3
  2. package/README.md +6 -8
  3. package/dist/client.d.ts +57 -44
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/index.cjs +1735 -850
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.ts +3 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1734 -851
  10. package/dist/index.js.map +1 -1
  11. package/dist/resources/a2a.d.ts +15 -18
  12. package/dist/resources/a2a.d.ts.map +1 -1
  13. package/dist/resources/agent-builder.d.ts +160 -0
  14. package/dist/resources/agent-builder.d.ts.map +1 -0
  15. package/dist/resources/agent.d.ts +89 -17
  16. package/dist/resources/agent.d.ts.map +1 -1
  17. package/dist/resources/base.d.ts +1 -1
  18. package/dist/resources/base.d.ts.map +1 -1
  19. package/dist/resources/index.d.ts +10 -10
  20. package/dist/resources/index.d.ts.map +1 -1
  21. package/dist/resources/mcp-tool.d.ts +4 -3
  22. package/dist/resources/mcp-tool.d.ts.map +1 -1
  23. package/dist/resources/memory-thread.d.ts +3 -3
  24. package/dist/resources/memory-thread.d.ts.map +1 -1
  25. package/dist/resources/network-memory-thread.d.ts +3 -3
  26. package/dist/resources/network-memory-thread.d.ts.map +1 -1
  27. package/dist/resources/observability.d.ts +35 -0
  28. package/dist/resources/observability.d.ts.map +1 -0
  29. package/dist/resources/tool.d.ts +4 -3
  30. package/dist/resources/tool.d.ts.map +1 -1
  31. package/dist/resources/vector.d.ts +7 -4
  32. package/dist/resources/vector.d.ts.map +1 -1
  33. package/dist/resources/workflow.d.ts +129 -14
  34. package/dist/resources/workflow.d.ts.map +1 -1
  35. package/dist/tools.d.ts +22 -0
  36. package/dist/tools.d.ts.map +1 -0
  37. package/dist/types.d.ts +100 -43
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/utils/index.d.ts +2 -0
  40. package/dist/utils/index.d.ts.map +1 -1
  41. package/dist/utils/process-client-tools.d.ts.map +1 -1
  42. package/dist/utils/process-mastra-stream.d.ts +11 -0
  43. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  44. package/dist/utils/zod-to-json-schema.d.ts +2 -104
  45. package/dist/utils/zod-to-json-schema.d.ts.map +1 -1
  46. package/package.json +24 -16
  47. package/dist/adapters/agui.d.ts +0 -23
  48. package/dist/adapters/agui.d.ts.map +0 -1
  49. package/dist/resources/legacy-workflow.d.ts +0 -87
  50. package/dist/resources/legacy-workflow.d.ts.map +0 -1
  51. package/dist/resources/network.d.ts +0 -30
  52. package/dist/resources/network.d.ts.map +0 -1
  53. package/dist/resources/vNextNetwork.d.ts +0 -42
  54. package/dist/resources/vNextNetwork.d.ts.map +0 -1
  55. package/eslint.config.js +0 -6
  56. package/integration-tests/agui-adapter.test.ts +0 -122
  57. package/integration-tests/package.json +0 -18
  58. package/integration-tests/src/mastra/index.ts +0 -35
  59. package/integration-tests/vitest.config.ts +0 -9
  60. package/src/adapters/agui.test.ts +0 -322
  61. package/src/adapters/agui.ts +0 -239
  62. package/src/client.ts +0 -623
  63. package/src/example.ts +0 -95
  64. package/src/index.test.ts +0 -1226
  65. package/src/index.ts +0 -3
  66. package/src/resources/a2a.ts +0 -88
  67. package/src/resources/agent.ts +0 -785
  68. package/src/resources/base.ts +0 -76
  69. package/src/resources/index.ts +0 -10
  70. package/src/resources/legacy-workflow.ts +0 -242
  71. package/src/resources/mcp-tool.ts +0 -48
  72. package/src/resources/memory-thread.test.ts +0 -285
  73. package/src/resources/memory-thread.ts +0 -99
  74. package/src/resources/network-memory-thread.test.ts +0 -269
  75. package/src/resources/network-memory-thread.ts +0 -81
  76. package/src/resources/network.ts +0 -86
  77. package/src/resources/tool.ts +0 -45
  78. package/src/resources/vNextNetwork.ts +0 -194
  79. package/src/resources/vector.ts +0 -83
  80. package/src/resources/workflow.ts +0 -410
  81. package/src/types.ts +0 -502
  82. package/src/utils/index.ts +0 -11
  83. package/src/utils/process-client-tools.ts +0 -32
  84. package/src/utils/zod-to-json-schema.ts +0 -10
  85. package/src/v2-messages.test.ts +0 -180
  86. package/tsconfig.build.json +0 -9
  87. package/tsconfig.json +0 -5
  88. package/tsup.config.ts +0 -22
  89. package/vitest.config.js +0 -8
@@ -1,3 +1,5 @@
1
1
  import { RuntimeContext } from '@mastra/core/runtime-context';
2
2
  export declare function parseClientRuntimeContext(runtimeContext?: RuntimeContext | Record<string, any>): Record<string, any> | undefined;
3
+ export declare function base64RuntimeContext(runtimeContext?: Record<string, any>): string | undefined;
4
+ export declare function runtimeContextQueryString(runtimeContext?: RuntimeContext | Record<string, any>): string;
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,wBAAgB,yBAAyB,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,mCAQ9F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,wBAAgB,yBAAyB,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,mCAQ9F;AAED,wBAAgB,oBAAoB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS,CAK7F;AAED,wBAAgB,yBAAyB,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAOvG"}
@@ -1 +1 @@
1
- {"version":3,"file":"process-client-tools.d.ts","sourceRoot":"","sources":["../../src/utils/process-client-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CA2B9F"}
1
+ {"version":3,"file":"process-client-tools.d.ts","sourceRoot":"","sources":["../../src/utils/process-client-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CA2B9F"}
@@ -0,0 +1,11 @@
1
+ import type { ReadableStream } from 'stream/web';
2
+ import type { ChunkType, NetworkChunkType } from '@mastra/core/stream';
3
+ export declare function processMastraNetworkStream({ stream, onChunk, }: {
4
+ stream: ReadableStream<Uint8Array>;
5
+ onChunk: (chunk: NetworkChunkType) => Promise<void>;
6
+ }): Promise<void>;
7
+ export declare function processMastraStream({ stream, onChunk, }: {
8
+ stream: ReadableStream<Uint8Array>;
9
+ onChunk: (chunk: ChunkType) => Promise<void>;
10
+ }): Promise<void>;
11
+ //# sourceMappingURL=process-mastra-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-mastra-stream.d.ts","sourceRoot":"","sources":["../../src/utils/process-mastra-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAiDvE,wBAAsB,0BAA0B,CAAC,EAC/C,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD,iBAKA;AAED,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C,iBAKA"}
@@ -1,105 +1,3 @@
1
- import { ZodSchema } from 'zod';
2
- export declare function zodToJsonSchema<T extends ZodSchema | any>(zodSchema: T): T | ({
3
- anyOf: import("zod-to-json-schema").JsonSchema7DateType[];
4
- } & {
5
- title?: string;
6
- default?: any;
7
- description?: string;
8
- markdownDescription?: string;
9
- } & {
10
- $schema?: string | undefined;
11
- definitions?: {
12
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
13
- } | undefined;
14
- }) | ({
15
- type: "object" | "array";
16
- } & {
17
- title?: string;
18
- default?: any;
19
- description?: string;
20
- markdownDescription?: string;
21
- } & {
22
- $schema?: string | undefined;
23
- definitions?: {
24
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
25
- } | undefined;
26
- }) | ({
27
- type: ("string" | "number" | "boolean" | "integer" | "null") | ("string" | "number" | "boolean" | "integer" | "null")[];
28
- } & {
29
- title?: string;
30
- default?: any;
31
- description?: string;
32
- markdownDescription?: string;
33
- } & {
34
- $schema?: string | undefined;
35
- definitions?: {
36
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
37
- } | undefined;
38
- }) | ({
39
- anyOf: import("zod-to-json-schema").JsonSchema7Type[];
40
- } & {
41
- title?: string;
42
- default?: any;
43
- description?: string;
44
- markdownDescription?: string;
45
- } & {
46
- $schema?: string | undefined;
47
- definitions?: {
48
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
49
- } | undefined;
50
- }) | (import("zod-to-json-schema").JsonSchema7UndefinedType & {
51
- title?: string;
52
- default?: any;
53
- description?: string;
54
- markdownDescription?: string;
55
- } & {
56
- $schema?: string | undefined;
57
- definitions?: {
58
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
59
- } | undefined;
60
- }) | (import("zod-to-json-schema").JsonSchema7AnyType & {
61
- title?: string;
62
- default?: any;
63
- description?: string;
64
- markdownDescription?: string;
65
- } & {
66
- $schema?: string | undefined;
67
- definitions?: {
68
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
69
- } | undefined;
70
- }) | ({
71
- anyOf: [import("zod-to-json-schema").JsonSchema7Type, import("zod-to-json-schema").JsonSchema7NullType];
72
- } & {
73
- title?: string;
74
- default?: any;
75
- description?: string;
76
- markdownDescription?: string;
77
- } & {
78
- $schema?: string | undefined;
79
- definitions?: {
80
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
81
- } | undefined;
82
- }) | ({
83
- type: [string, "null"];
84
- } & {
85
- title?: string;
86
- default?: any;
87
- description?: string;
88
- markdownDescription?: string;
89
- } & {
90
- $schema?: string | undefined;
91
- definitions?: {
92
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
93
- } | undefined;
94
- }) | (import("zod-to-json-schema").JsonSchema7AllOfType & {
95
- title?: string;
96
- default?: any;
97
- description?: string;
98
- markdownDescription?: string;
99
- } & {
100
- $schema?: string | undefined;
101
- definitions?: {
102
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
103
- } | undefined;
104
- });
1
+ import type { ZodType } from 'zod';
2
+ export declare function zodToJsonSchema<T extends ZodType | any>(zodSchema: T): any;
105
3
  //# sourceMappingURL=zod-to-json-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/utils/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGhC,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMtE"}
1
+ {"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/utils/zod-to-json-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAgBnC,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC,OAYpE"}
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.0.0-update-scorers-api-20250801170445",
3
+ "version": "0.0.0-usechat-duplicate-20251016110554",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
8
  "main": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "CHANGELOG.md"
12
+ ],
9
13
  "exports": {
10
14
  ".": {
11
15
  "import": {
@@ -13,7 +17,7 @@
13
17
  "default": "./dist/index.js"
14
18
  },
15
19
  "require": {
16
- "types": "./dist/index.d.cts",
20
+ "types": "./dist/index.d.ts",
17
21
  "default": "./dist/index.cjs"
18
22
  }
19
23
  },
@@ -21,41 +25,45 @@
21
25
  },
22
26
  "repository": {
23
27
  "type": "git",
24
- "url": "https://github.com/mastra-ai/mastra.git",
28
+ "url": "git+https://github.com/mastra-ai/mastra.git",
25
29
  "directory": "client-sdks/client-js"
26
30
  },
27
- "homepage": "https://github.com/mastra-ai/mastra/tree/main/client-sdks/client-js#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/mastra-ai/mastra/issues"
33
+ },
34
+ "homepage": "https://mastra.ai",
28
35
  "license": "Apache-2.0",
29
36
  "dependencies": {
30
- "@ag-ui/client": "^0.0.35",
31
37
  "@ai-sdk/ui-utils": "^1.2.11",
32
38
  "@lukeed/uuid": "^2.0.1",
33
39
  "json-schema": "^0.4.0",
34
40
  "rxjs": "7.8.1",
35
- "zod": "^3.25.67",
36
- "zod-to-json-schema": "^3.24.5",
37
- "@mastra/core": "0.0.0-update-scorers-api-20250801170445"
41
+ "zod-to-json-schema": "^3.24.6",
42
+ "@mastra/core": "0.0.0-usechat-duplicate-20251016110554"
38
43
  },
39
44
  "peerDependencies": {
40
- "zod": "^3.0.0"
45
+ "zod": "^3.25.0 || ^4.0.0"
41
46
  },
42
47
  "devDependencies": {
43
- "@babel/preset-env": "^7.28.0",
48
+ "@babel/preset-env": "^7.28.3",
44
49
  "@babel/preset-typescript": "^7.27.1",
45
- "@tsconfig/recommended": "^1.0.9",
50
+ "@tsconfig/recommended": "^1.0.10",
46
51
  "@types/json-schema": "^7.0.15",
47
52
  "@types/node": "^20.19.0",
53
+ "zod": "^3.25.76",
48
54
  "ai": "^4.3.19",
55
+ "eslint": "^9.36.0",
49
56
  "tsup": "^8.5.0",
50
57
  "typescript": "^5.8.3",
51
58
  "vitest": "^3.2.4",
52
- "@internal/lint": "0.0.0-update-scorers-api-20250801170445"
59
+ "@internal/types-builder": "0.0.0-usechat-duplicate-20251016110554",
60
+ "@internal/lint": "0.0.0-usechat-duplicate-20251016110554"
53
61
  },
54
62
  "scripts": {
55
- "build": "tsup --silent --config tsup.config.ts",
63
+ "lint": "eslint .",
64
+ "build": "tsup --config tsup.config.ts",
56
65
  "dev": "pnpm build --watch",
57
- "test": "vitest run && pnpm run test:integration",
58
- "test:unit": "vitest run",
59
- "test:integration": "cd integration-tests && pnpm test"
66
+ "test": "vitest",
67
+ "test:unit": "vitest run"
60
68
  }
61
69
  }
@@ -1,23 +0,0 @@
1
- import type { AgentConfig, BaseEvent, Message, RunAgentInput } from '@ag-ui/client';
2
- import { AbstractAgent } from '@ag-ui/client';
3
- import type { CoreMessage } from '@mastra/core';
4
- import { Observable } from 'rxjs';
5
- import type { Agent } from '../resources/agent';
6
- interface MastraAgentConfig extends AgentConfig {
7
- agent: Agent;
8
- agentId: string;
9
- resourceId?: string;
10
- }
11
- export declare class AGUIAdapter extends AbstractAgent {
12
- agent: Agent;
13
- resourceId?: string;
14
- constructor({ agent, agentId, resourceId, ...rest }: MastraAgentConfig);
15
- protected run(input: RunAgentInput): Observable<BaseEvent>;
16
- }
17
- /**
18
- * Generates a UUID v4 that works in both browser and Node.js environments
19
- */
20
- export declare function generateUUID(): string;
21
- export declare function convertMessagesToMastraMessages(messages: Message[]): CoreMessage[];
22
- export {};
23
- //# sourceMappingURL=agui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agui.d.ts","sourceRoot":"","sources":["../../src/adapters/agui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,WAAY,SAAQ,aAAa;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;gBACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB;IAStE,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC;CA+G3D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAgCrC;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAkDlF"}
@@ -1,87 +0,0 @@
1
- import type { ClientOptions, LegacyWorkflowRunResult, GetLegacyWorkflowRunsResponse, GetWorkflowRunsParams, GetLegacyWorkflowResponse } from '../types';
2
- import { BaseResource } from './base';
3
- export declare class LegacyWorkflow extends BaseResource {
4
- private workflowId;
5
- constructor(options: ClientOptions, workflowId: string);
6
- /**
7
- * Retrieves details about the legacy workflow
8
- * @returns Promise containing legacy workflow details including steps and graphs
9
- */
10
- details(): Promise<GetLegacyWorkflowResponse>;
11
- /**
12
- * Retrieves all runs for a legacy workflow
13
- * @param params - Parameters for filtering runs
14
- * @returns Promise containing legacy workflow runs array
15
- */
16
- runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
17
- /**
18
- * Creates a new legacy workflow run
19
- * @returns Promise containing the generated run ID
20
- */
21
- createRun(params?: {
22
- runId?: string;
23
- }): Promise<{
24
- runId: string;
25
- }>;
26
- /**
27
- * Starts a legacy workflow run synchronously without waiting for the workflow to complete
28
- * @param params - Object containing the runId and triggerData
29
- * @returns Promise containing success message
30
- */
31
- start(params: {
32
- runId: string;
33
- triggerData: Record<string, any>;
34
- }): Promise<{
35
- message: string;
36
- }>;
37
- /**
38
- * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
39
- * @param stepId - ID of the step to resume
40
- * @param runId - ID of the legacy workflow run
41
- * @param context - Context to resume the legacy workflow with
42
- * @returns Promise containing the legacy workflow resume results
43
- */
44
- resume({ stepId, runId, context, }: {
45
- stepId: string;
46
- runId: string;
47
- context: Record<string, any>;
48
- }): Promise<{
49
- message: string;
50
- }>;
51
- /**
52
- * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
53
- * @param params - Object containing the optional runId and triggerData
54
- * @returns Promise containing the workflow execution results
55
- */
56
- startAsync(params: {
57
- runId?: string;
58
- triggerData: Record<string, any>;
59
- }): Promise<LegacyWorkflowRunResult>;
60
- /**
61
- * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
62
- * @param params - Object containing the runId, stepId, and context
63
- * @returns Promise containing the workflow resume results
64
- */
65
- resumeAsync(params: {
66
- runId: string;
67
- stepId: string;
68
- context: Record<string, any>;
69
- }): Promise<LegacyWorkflowRunResult>;
70
- /**
71
- * Creates an async generator that processes a readable stream and yields records
72
- * separated by the Record Separator character (\x1E)
73
- *
74
- * @param stream - The readable stream to process
75
- * @returns An async generator that yields parsed records
76
- */
77
- private streamProcessor;
78
- /**
79
- * Watches legacy workflow transitions in real-time
80
- * @param runId - Optional run ID to filter the watch stream
81
- * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
82
- */
83
- watch({ runId }: {
84
- runId?: string;
85
- }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
86
- }
87
- //# sourceMappingURL=legacy-workflow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacy-workflow.d.ts","sourceRoot":"","sources":["../../src/resources/legacy-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,qBAAa,cAAe,SAAQ,YAAY;IAG5C,OAAO,CAAC,UAAU;gBADlB,OAAO,EAAE,aAAa,EACd,UAAU,EAAE,MAAM;IAK5B;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAI7C;;;;OAIG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAyB5E;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAYlE;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAOhG;;;;;;OAMG;IACH,MAAM,CAAC,EACL,MAAM,EACN,KAAK,EACL,OAAO,GACR,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAUhC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAa1G;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAUpC;;;;;;OAMG;YACY,eAAe;IAgE9B;;;;OAIG;IACG,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI;CAiB/F"}
@@ -1,30 +0,0 @@
1
- import { processDataStream } from '@ai-sdk/ui-utils';
2
- import type { GenerateReturn } from '@mastra/core';
3
- import type { JSONSchema7 } from 'json-schema';
4
- import type { ZodSchema } from 'zod';
5
- import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types';
6
- import { BaseResource } from './base';
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
@@ -1 +0,0 @@
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,cAAc,CAAC;AACnD,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"}
@@ -1,42 +0,0 @@
1
- import type { WatchEvent } from '@mastra/core/workflows';
2
- import type { ClientOptions, GetVNextNetworkResponse, GenerateVNextNetworkResponse, LoopVNextNetworkResponse, GenerateOrStreamVNextNetworkParams, LoopStreamVNextNetworkParams } from '../types';
3
- import { BaseResource } from './base';
4
- import type { RuntimeContext } from '@mastra/core/runtime-context';
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"vNextNetwork.d.ts","sourceRoot":"","sources":["../../src/resources/vNextNetwork.ts"],"names":[],"mappings":"AAAA,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;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,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"}
package/eslint.config.js DELETED
@@ -1,6 +0,0 @@
1
- import { createConfig } from '@internal/lint/eslint';
2
-
3
- const config = await createConfig();
4
-
5
- /** @type {import("eslint").Linter.Config[]} */
6
- export default [...config];
@@ -1,122 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { createServer } from 'node:net';
3
- import path from 'node:path';
4
- import type { BaseEvent } from '@ag-ui/client';
5
- import { describe, it, expect, beforeAll, afterAll } from 'vitest';
6
- import { AGUIAdapter } from '../src/adapters/agui';
7
-
8
- // Helper to find an available port
9
- async function getAvailablePort(): Promise<number> {
10
- return new Promise((resolve, reject) => {
11
- const server = createServer();
12
- server.listen(0, () => {
13
- const { port } = server.address() as { port: number };
14
- server.close(() => resolve(port));
15
- });
16
- server.on('error', reject);
17
- });
18
- }
19
-
20
- describe('AGUIAdapter Integration Tests', () => {
21
- let mastraServer: ReturnType<typeof spawn>;
22
- let port: number;
23
-
24
- beforeAll(async () => {
25
- port = await getAvailablePort();
26
-
27
- // Run mastra dev from the integration tests directory using the built CLI
28
- const cliPath = path.resolve(import.meta.dirname, '..', '..', '..', 'packages', 'cli', 'dist', 'index.js');
29
- mastraServer = spawn('node', [cliPath, 'dev', '--port', port.toString()], {
30
- cwd: path.resolve(import.meta.dirname),
31
- stdio: 'pipe',
32
- detached: true, // Run in a new process group so we can kill it and children
33
- });
34
-
35
- // Wait for server to be ready
36
- await new Promise<void>((resolve, reject) => {
37
- let output = '';
38
- mastraServer.stdout?.on('data', data => {
39
- output += data.toString();
40
- console.log(output);
41
- if (output.includes('http://localhost:')) {
42
- resolve();
43
- }
44
- });
45
- mastraServer.stderr?.on('data', data => {
46
- console.error('Mastra server error:', data.toString());
47
- });
48
-
49
- setTimeout(() => reject(new Error('Mastra server failed to start')), 10000);
50
- });
51
- });
52
-
53
- afterAll(() => {
54
- // Kill the server and its process group
55
- if (mastraServer?.pid) {
56
- try {
57
- process.kill(-mastraServer.pid, 'SIGTERM');
58
- } catch (e) {
59
- console.error('Failed to kill Mastra server:', e);
60
- }
61
- }
62
- });
63
-
64
- it('should correctly pass parameters to agent stream method with real server', async () => {
65
- // Create a client agent that communicates with the real server
66
- const { Agent: ClientAgent } = await import('../src/resources/agent');
67
- const clientAgent = new ClientAgent(
68
- {
69
- baseUrl: `http://localhost:${port}`,
70
- apiKey: 'test-key',
71
- },
72
- 'test',
73
- );
74
-
75
- const adapter = new AGUIAdapter({
76
- agent: clientAgent,
77
- agentId: 'test',
78
- resourceId: 'testAgent',
79
- });
80
-
81
- const input = {
82
- threadId: 'test-thread-id',
83
- runId: 'test-run-id',
84
- messages: [
85
- {
86
- id: '1',
87
- role: 'user' as const,
88
- content: 'Hello',
89
- },
90
- ],
91
- tools: [],
92
- context: [],
93
- };
94
-
95
- const observable = adapter['run'](input);
96
- const events: BaseEvent[] = [];
97
-
98
- await new Promise<void>((resolve, reject) => {
99
- observable.subscribe({
100
- next: (event: BaseEvent) => events.push(event),
101
- complete: () => resolve(),
102
- error: (error: any) => reject(error),
103
- });
104
- });
105
-
106
- // Verify we received the expected events
107
- expect(events).toHaveLength(7); // RUN_STARTED, TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT (x3), TEXT_MESSAGE_END, RUN_FINISHED
108
- expect(events[0].type).toBe('RUN_STARTED');
109
- expect(events[1].type).toBe('TEXT_MESSAGE_START');
110
- expect(events[2].type).toBe('TEXT_MESSAGE_CONTENT');
111
- expect(events[3].type).toBe('TEXT_MESSAGE_CONTENT');
112
- expect(events[4].type).toBe('TEXT_MESSAGE_CONTENT');
113
- expect(events[5].type).toBe('TEXT_MESSAGE_END');
114
- expect(events[6].type).toBe('RUN_FINISHED');
115
-
116
- // Verify the content was streamed correctly
117
- const contentEvents = events.filter(e => e.type === 'TEXT_MESSAGE_CONTENT') as any[];
118
- expect(contentEvents[0].delta).toBe('Hello');
119
- expect(contentEvents[1].delta).toBe(' from');
120
- expect(contentEvents[2].delta).toBe(' agent');
121
- });
122
- });
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@mastra/client-js-integration-tests",
3
- "private": true,
4
- "version": "0.1.0",
5
- "scripts": {
6
- "test": "vitest run",
7
- "test:watch": "vitest"
8
- },
9
- "dependencies": {
10
- "@ag-ui/client": "^0.0.27",
11
- "@mastra/client-js": "workspace:*",
12
- "@mastra/core": "workspace:*",
13
- "ai": "^4.3.19"
14
- },
15
- "devDependencies": {
16
- "vitest": "^3.2.4"
17
- }
18
- }
@@ -1,35 +0,0 @@
1
- import { Mastra } from '@mastra/core';
2
- import { Agent } from '@mastra/core/agent';
3
- import { MockLanguageModelV1 } from 'ai/test';
4
- import { simulateReadableStream } from 'ai';
5
-
6
- const mockModel = new MockLanguageModelV1({
7
- doStream: async () => ({
8
- stream: simulateReadableStream({
9
- chunks: [
10
- { type: 'text-delta', textDelta: 'Hello' },
11
- { type: 'text-delta', textDelta: ' from' },
12
- { type: 'text-delta', textDelta: ' agent' },
13
- {
14
- type: 'finish',
15
- finishReason: 'stop',
16
- logprobs: undefined,
17
- usage: { completionTokens: 3, promptTokens: 10 },
18
- },
19
- ],
20
- }),
21
- rawCall: { rawPrompt: null, rawSettings: {} },
22
- }),
23
- });
24
-
25
- const testAgent = new Agent({
26
- name: 'test',
27
- instructions: 'You are a test agent',
28
- model: mockModel,
29
- });
30
-
31
- export const mastra = new Mastra({
32
- agents: {
33
- test: testAgent,
34
- },
35
- });
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- testTimeout: 30000, // 30 seconds for integration tests
7
- hookTimeout: 20000, // 20 seconds for setup/teardown
8
- },
9
- });