@mastra/auth 0.0.0-fix-local-pkg-cwd-20251224015404 → 0.0.0-jail-fs-20260105160110

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mastra/auth
2
2
 
3
- ## 0.0.0-fix-local-pkg-cwd-20251224015404
3
+ ## 0.0.0-jail-fs-20260105160110
4
4
 
5
5
  ### Major Changes
6
6
 
@@ -10,6 +10,17 @@
10
10
 
11
11
  ### Patch Changes
12
12
 
13
+ - Add embedded documentation support for Mastra packages ([#11472](https://github.com/mastra-ai/mastra/pull/11472))
14
+
15
+ Mastra packages now include embedded documentation in the published npm package under `dist/docs/`. This enables coding agents and AI assistants to understand and use the framework by reading documentation directly from `node_modules`.
16
+
17
+ Each package includes:
18
+ - **SKILL.md** - Entry point explaining the package's purpose and capabilities
19
+ - **SOURCE_MAP.json** - Machine-readable index mapping exports to types and implementation files
20
+ - **Topic folders** - Conceptual documentation organized by feature area
21
+
22
+ Documentation is driven by the `packages` frontmatter field in MDX files, which maps docs to their corresponding packages. CI validation ensures all docs include this field.
23
+
13
24
  - Allow provider to pass through options to the auth config ([#10284](https://github.com/mastra-ai/mastra/pull/10284))
14
25
 
15
26
  ## 1.0.0-beta.1
@@ -0,0 +1,32 @@
1
+ # @mastra/auth Documentation
2
+
3
+ > Embedded documentation for coding agents
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Read the skill overview
9
+ cat docs/SKILL.md
10
+
11
+ # Get the source map
12
+ cat docs/SOURCE_MAP.json
13
+
14
+ # Read topic documentation
15
+ cat docs/<topic>/01-overview.md
16
+ ```
17
+
18
+ ## Structure
19
+
20
+ ```
21
+ docs/
22
+ ├── SKILL.md # Entry point
23
+ ├── README.md # This file
24
+ ├── SOURCE_MAP.json # Export index
25
+ ├── auth/ (1 files)
26
+ ├── server/ (2 files)
27
+ ```
28
+
29
+ ## Version
30
+
31
+ Package: @mastra/auth
32
+ Version: 1.0.0-beta.1
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: mastra-auth-docs
3
+ description: Documentation for @mastra/auth. Includes links to type definitions and readable implementation code in dist/.
4
+ ---
5
+
6
+ # @mastra/auth Documentation
7
+
8
+ > **Version**: 1.0.0-beta.1
9
+ > **Package**: @mastra/auth
10
+
11
+ ## Quick Navigation
12
+
13
+ Use SOURCE_MAP.json to find any export:
14
+
15
+ ```bash
16
+ cat docs/SOURCE_MAP.json
17
+ ```
18
+
19
+ Each export maps to:
20
+ - **types**: `.d.ts` file with JSDoc and API signatures
21
+ - **implementation**: `.js` chunk file with readable source
22
+ - **docs**: Conceptual documentation in `docs/`
23
+
24
+ ## Top Exports
25
+
26
+
27
+
28
+ See SOURCE_MAP.json for the complete list.
29
+
30
+ ## Available Topics
31
+
32
+ - [Auth](auth/) - 1 file(s)
33
+ - [Server](server/) - 2 file(s)
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": "1.0.0-beta.1",
3
+ "package": "@mastra/auth",
4
+ "exports": {},
5
+ "modules": {}
6
+ }
@@ -0,0 +1,33 @@
1
+ # Auth API Reference
2
+
3
+ > API reference for auth - 1 entries
4
+
5
+
6
+ ---
7
+
8
+ ## Reference: MastraJwtAuth Class
9
+
10
+ > API reference for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens.
11
+
12
+ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Mastra using JSON Web Tokens (JWTs). It verifies incoming requests based on a shared secret and integrates with the Mastra server using the `auth` option.
13
+
14
+ ## Usage example
15
+
16
+ ```typescript title="src/mastra/index.ts"
17
+ import { Mastra } from "@mastra/core";
18
+ import { MastraJwtAuth } from "@mastra/auth";
19
+
20
+ export const mastra = new Mastra({
21
+ server: {
22
+ auth: new MastraJwtAuth({
23
+ secret: "<your-secret>",
24
+ }),
25
+ },
26
+ });
27
+ ```
28
+
29
+ ## Constructor parameters
30
+
31
+ ## Related
32
+
33
+ [MastraJwtAuth](https://mastra.ai/docs/v1/server/auth/jwt)
@@ -0,0 +1,16 @@
1
+ > Learn about different Auth options for your Mastra applications
2
+
3
+ # Auth Overview
4
+
5
+ Mastra lets you choose how you handle authentication, so you can secure access to your application's endpoints using the identity system that fits your stack.
6
+
7
+ You can start with simple shared secret JWT authentication and switch to providers like Supabase, Firebase Auth, Auth0, Clerk, or WorkOS when you need more advanced identity features.
8
+
9
+ ## Available providers
10
+
11
+ - [JSON Web Token (JWT)](https://mastra.ai/docs/v1/server/auth/jwt)
12
+ - [Clerk](https://mastra.ai/docs/v1/server/auth/clerk)
13
+ - [Supabase](https://mastra.ai/docs/v1/server/auth/supabase)
14
+ - [Firebase](https://mastra.ai/docs/v1/server/auth/firebase)
15
+ - [WorkOS](https://mastra.ai/docs/v1/server/auth/workos)
16
+ - [Auth0](https://mastra.ai/docs/v1/server/auth/auth0)
@@ -0,0 +1,100 @@
1
+ > Documentation for the MastraJwtAuth class, which authenticates Mastra applications using JSON Web Tokens.
2
+
3
+ # MastraJwtAuth Class
4
+
5
+ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Mastra using JSON Web Tokens (JWTs). It verifies incoming requests based on a shared secret and integrates with the Mastra server using the `auth` option.
6
+
7
+ ## Installation
8
+
9
+ Before you can use the `MastraJwtAuth` class you have to install the `@mastra/auth` package.
10
+
11
+ ```bash
12
+ npm install @mastra/auth@beta
13
+ ```
14
+
15
+ ## Usage example
16
+
17
+ ```typescript {2,6-8} title="src/mastra/index.ts"
18
+ import { Mastra } from "@mastra/core";
19
+ import { MastraJwtAuth } from "@mastra/auth";
20
+
21
+ export const mastra = new Mastra({
22
+ server: {
23
+ auth: new MastraJwtAuth({
24
+ secret: process.env.MASTRA_JWT_SECRET,
25
+ }),
26
+ },
27
+ });
28
+ ```
29
+
30
+ > **Note:**
31
+
32
+ Visit [MastraJwtAuth](https://mastra.ai/reference/v1/auth/jwt) for all available configuration options.
33
+
34
+ ## Configuring `MastraClient`
35
+
36
+ When `auth` is enabled, all requests made with `MastraClient` must include a valid JWT in the `Authorization` header:
37
+
38
+ ```typescript {6} title="lib/mastra/mastra-client.ts"
39
+ import { MastraClient } from "@mastra/client-js";
40
+
41
+ export const mastraClient = new MastraClient({
42
+ baseUrl: "https://<mastra-api-url>",
43
+ headers: {
44
+ Authorization: `Bearer ${process.env.MASTRA_JWT_TOKEN}`,
45
+ },
46
+ });
47
+ ```
48
+
49
+ > **Note:**
50
+
51
+ Visit [Mastra Client SDK](https://mastra.ai/docs/v1/server/mastra-client) for more configuration options.
52
+
53
+ ### Making authenticated requests
54
+
55
+ Once `MastraClient` is configured, you can send authenticated requests from your frontend application, or use `curl` for quick local testing:
56
+
57
+ **react:**
58
+
59
+ ```tsx title="src/components/test-agent.tsx" copy
60
+ import { mastraClient } from "../../lib/mastra-client";
61
+
62
+ export const TestAgent = () => {
63
+ async function handleClick() {
64
+ const agent = mastraClient.getAgent("weatherAgent");
65
+
66
+ const response = await agent.generate({
67
+ messages: "Weather in London"
68
+ });
69
+
70
+ console.log(response);
71
+ }
72
+
73
+ return <button onClick={handleClick}>Test Agent</button>;
74
+ };
75
+ ```
76
+
77
+
78
+ **curl:**
79
+
80
+ ```bash
81
+ curl -X POST http://localhost:4111/api/agents/weatherAgent/generate \
82
+ -H "Content-Type: application/json" \
83
+ -H "Authorization: Bearer <your-jwt>" \
84
+ -d '{
85
+ "messages": "Weather in London"
86
+ }'
87
+ ```
88
+
89
+
90
+ ## Creating a JWT
91
+
92
+ To authenticate requests to your Mastra server, you'll need a valid JSON Web Token (JWT) signed with your `MASTRA_JWT_SECRET`.
93
+
94
+ The easiest way to generate one is using [jwt.io](https://www.jwt.io/):
95
+
96
+ 1. Select **JWT Encoder**.
97
+ 2. Scroll down to the **Sign JWT: Secret** section.
98
+ 3. Enter your secret (for example: `supersecretdevkeythatishs256safe!`).
99
+ 4. Click **Generate example** to create a valid JWT.
100
+ 5. Copy the generated token and set it as `MASTRA_JWT_TOKEN` in your `.env` file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/auth",
3
- "version": "0.0.0-fix-local-pkg-cwd-20251224015404",
3
+ "version": "0.0.0-jail-fs-20260105160110",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -36,10 +36,10 @@
36
36
  "eslint": "^9.37.0",
37
37
  "tsup": "^8.5.0",
38
38
  "typescript": "^5.8.3",
39
- "vitest": "4.0.12",
40
- "@internal/lint": "0.0.0-fix-local-pkg-cwd-20251224015404",
41
- "@internal/types-builder": "0.0.0-fix-local-pkg-cwd-20251224015404",
42
- "@mastra/core": "0.0.0-fix-local-pkg-cwd-20251224015404"
39
+ "vitest": "4.0.16",
40
+ "@internal/lint": "0.0.0-jail-fs-20260105160110",
41
+ "@internal/types-builder": "0.0.0-jail-fs-20260105160110",
42
+ "@mastra/core": "0.0.0-jail-fs-20260105160110"
43
43
  },
44
44
  "homepage": "https://mastra.ai",
45
45
  "repository": {
@@ -55,6 +55,7 @@
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup --silent --config tsup.config.ts",
58
+ "postbuild": "pnpx tsx ../../scripts/generate-package-docs.ts packages/auth",
58
59
  "build:watch": "tsup --watch --silent --config tsup.config.ts",
59
60
  "test": "vitest run",
60
61
  "lint": "eslint ."