@mastra/ai-sdk 0.0.0-extract-tool-ui-inp-playground-ui-20251024041825 → 0.0.0-feat-add-query-option-to-playground-20251209160219

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.
@@ -1,10 +1,77 @@
1
+ import type { Mastra } from '@mastra/core/mastra';
2
+ import type { TracingOptions } from '@mastra/core/observability';
3
+ import type { RequestContext } from '@mastra/core/request-context';
1
4
  import { registerApiRoute } from '@mastra/core/server';
5
+ import type { InferUIMessageChunk, UIMessage } from 'ai';
6
+ export type WorkflowStreamHandlerParams = {
7
+ runId?: string;
8
+ resourceId?: string;
9
+ inputData?: Record<string, any>;
10
+ resumeData?: Record<string, any>;
11
+ requestContext?: RequestContext;
12
+ tracingOptions?: TracingOptions;
13
+ step?: string;
14
+ };
15
+ export type WorkflowStreamHandlerOptions = {
16
+ mastra: Mastra;
17
+ workflowId: string;
18
+ params: WorkflowStreamHandlerParams;
19
+ includeTextStreamParts?: boolean;
20
+ };
21
+ /**
22
+ * Framework-agnostic handler for streaming workflow execution in AI SDK-compatible format.
23
+ * Use this function directly when you need to handle workflow streaming outside of Hono or Mastra's own apiRoutes feature.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // Next.js App Router
28
+ * import { handleWorkflowStream } from '@mastra/ai-sdk';
29
+ * import { createUIMessageStreamResponse } from 'ai';
30
+ * import { mastra } from '@/src/mastra';
31
+ *
32
+ * export async function POST(req: Request) {
33
+ * const params = await req.json();
34
+ * const stream = await handleWorkflowStream({
35
+ * mastra,
36
+ * workflowId: 'weatherWorkflow',
37
+ * params,
38
+ * });
39
+ * return createUIMessageStreamResponse({ stream });
40
+ * }
41
+ * ```
42
+ */
43
+ export declare function handleWorkflowStream<UI_MESSAGE extends UIMessage>({ mastra, workflowId, params, includeTextStreamParts, }: WorkflowStreamHandlerOptions): Promise<ReadableStream<InferUIMessageChunk<UI_MESSAGE>>>;
2
44
  export type WorkflowRouteOptions = {
3
45
  path: `${string}:workflowId${string}`;
4
46
  workflow?: never;
47
+ includeTextStreamParts?: boolean;
5
48
  } | {
6
49
  path: string;
7
50
  workflow: string;
51
+ includeTextStreamParts?: boolean;
8
52
  };
9
- export declare function workflowRoute({ path, workflow, }: WorkflowRouteOptions): ReturnType<typeof registerApiRoute>;
53
+ /**
54
+ * Creates a workflow route handler for streaming workflow execution using the AI SDK format.
55
+ *
56
+ * This function registers an HTTP POST endpoint that accepts input data, executes a workflow, and streams the response back to the client in AI SDK-compatible format.
57
+ *
58
+ * @param {WorkflowRouteOptions} options - Configuration options for the workflow route
59
+ * @param {string} [options.path='/api/workflows/:workflowId/stream'] - The route path. Include `:workflowId` for dynamic routing
60
+ * @param {string} [options.workflow] - Fixed workflow ID when not using dynamic routing
61
+ * @param {boolean} [options.includeTextStreamParts=true] - Whether to include text stream parts in the output
62
+ *
63
+ * @example
64
+ * // Dynamic workflow routing
65
+ * workflowRoute({
66
+ * path: '/api/workflows/:workflowId/stream',
67
+ * });
68
+ *
69
+ * @example
70
+ * // Fixed workflow with custom path
71
+ * workflowRoute({
72
+ * path: '/api/data-pipeline/stream',
73
+ * workflow: 'data-processing-workflow',
74
+ * });
75
+ */
76
+ export declare function workflowRoute({ path, workflow, includeTextStreamParts, }: WorkflowRouteOptions): ReturnType<typeof registerApiRoute>;
10
77
  //# sourceMappingURL=workflow-route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-route.d.ts","sourceRoot":"","sources":["../src/workflow-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAUvD,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,GAAG,MAAM,cAAc,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,wBAAgB,aAAa,C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F;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,GAAG,MAAM,cAAc,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7F;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAA0C,EAC1C,QAAQ,EACR,sBAA6B,GAC9B,EAAE,oBAAoB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CA6F5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/ai-sdk",
3
- "version": "0.0.0-extract-tool-ui-inp-playground-ui-20251024041825",
3
+ "version": "0.0.0-feat-add-query-option-to-playground-20251209160219",
4
4
  "description": "Adds custom API routes to be compatible with the AI SDK UI parts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,6 +15,16 @@
15
15
  "default": "./dist/index.cjs"
16
16
  }
17
17
  },
18
+ "./ui": {
19
+ "import": {
20
+ "types": "./dist/ui.d.ts",
21
+ "default": "./dist/ui.js"
22
+ },
23
+ "require": {
24
+ "types": "./dist/ui.d.ts",
25
+ "default": "./dist/ui.cjs"
26
+ }
27
+ },
18
28
  "./package.json": "./package.json"
19
29
  },
20
30
  "files": [
@@ -23,18 +33,21 @@
23
33
  ],
24
34
  "peerDependencies": {
25
35
  "zod": "^3.25.0 || ^4.0.0",
26
- "@mastra/core": "0.0.0-extract-tool-ui-inp-playground-ui-20251024041825"
36
+ "@mastra/core": "0.0.0-feat-add-query-option-to-playground-20251209160219"
27
37
  },
28
38
  "devDependencies": {
29
39
  "@types/json-schema": "^7.0.15",
40
+ "@vitest/coverage-v8": "4.0.12",
41
+ "@vitest/ui": "4.0.12",
30
42
  "eslint": "^9.37.0",
31
43
  "tsup": "^8.5.0",
32
44
  "typescript": "^5.8.3",
33
- "vitest": "^3.2.4",
45
+ "vitest": "4.0.12",
34
46
  "zod": "^3.25.76",
35
- "@internal/lint": "0.0.0-extract-tool-ui-inp-playground-ui-20251024041825",
36
- "@mastra/core": "0.0.0-extract-tool-ui-inp-playground-ui-20251024041825",
37
- "@internal/types-builder": "0.0.0-extract-tool-ui-inp-playground-ui-20251024041825"
47
+ "@internal/lint": "0.0.0-feat-add-query-option-to-playground-20251209160219",
48
+ "@internal/types-builder": "0.0.0-feat-add-query-option-to-playground-20251209160219",
49
+ "@mastra/core": "0.0.0-feat-add-query-option-to-playground-20251209160219",
50
+ "@mastra/libsql": "0.0.0-feat-add-query-option-to-playground-20251209160219"
38
51
  },
39
52
  "keywords": [
40
53
  "mastra",
@@ -52,8 +65,12 @@
52
65
  "url": "https://github.com/mastra-ai/mastra/issues"
53
66
  },
54
67
  "dependencies": {
68
+ "@ai-sdk/provider": "^2.0.0",
55
69
  "ai": "^5.0.60"
56
70
  },
71
+ "engines": {
72
+ "node": ">=22.13.0"
73
+ },
57
74
  "scripts": {
58
75
  "lint": "eslint .",
59
76
  "build": "tsup --config tsup.config.ts",