@mastra/react 0.1.0-beta.9 → 1.0.0-beta.24

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,5 +1,322 @@
1
1
  # @mastra/react-hooks
2
2
 
3
+ ## 1.0.0-beta.24
4
+
5
+ ### Major Changes
6
+
7
+ - **Fixed:** Align `Agent.network` with core and update `@mastra/react` network usage. ([#12015](https://github.com/mastra-ai/mastra/pull/12015))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fixed compatibility with updated `@mastra/client-js` generate and stream API signatures ([#12011](https://github.com/mastra-ai/mastra/pull/12011))
12
+
13
+ - Updated dependencies [[`461e448`](https://github.com/mastra-ai/mastra/commit/461e448852fe999506a6046d50b1efc27d8aa378)]:
14
+ - @mastra/client-js@1.0.0-beta.24
15
+
16
+ ## 0.1.0-beta.23
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies:
21
+ - @mastra/client-js@1.0.0-beta.23
22
+
23
+ ## 0.1.0-beta.22
24
+
25
+ ### Patch Changes
26
+
27
+ - Removes the deprecated `threadId` and `resourceId` options from `AgentExecutionOptions`. These have been deprecated for months in favour of the `memory` option. ([#11897](https://github.com/mastra-ai/mastra/pull/11897))
28
+
29
+ ### Breaking Changes
30
+
31
+ #### `@mastra/core`
32
+
33
+ The `threadId` and `resourceId` options have been removed from `agent.generate()` and `agent.stream()`. Use the `memory` option instead:
34
+
35
+ ```ts
36
+ // Before
37
+ await agent.stream('Hello', {
38
+ threadId: 'thread-123',
39
+ resourceId: 'user-456',
40
+ });
41
+
42
+ // After
43
+ await agent.stream('Hello', {
44
+ memory: {
45
+ thread: 'thread-123',
46
+ resource: 'user-456',
47
+ },
48
+ });
49
+ ```
50
+
51
+ #### `@mastra/server`
52
+
53
+ The `threadId`, `resourceId`, and `resourceid` fields have been removed from the main agent execution body schema. The server now expects the `memory` option format in request bodies. Legacy routes (`/api/agents/:agentId/generate-legacy` and `/api/agents/:agentId/stream-legacy`) continue to support the deprecated fields.
54
+
55
+ #### `@mastra/react`
56
+
57
+ The `useChat` hook now internally converts `threadId` to the `memory` option format when making API calls. No changes needed in component code - the hook handles the conversion automatically.
58
+
59
+ #### `@mastra/client-js`
60
+
61
+ When using the client SDK agent methods, use the `memory` option instead of `threadId`/`resourceId`:
62
+
63
+ ```ts
64
+ const agent = client.getAgent('my-agent');
65
+
66
+ // Before
67
+ await agent.generate({
68
+ messages: [...],
69
+ threadId: 'thread-123',
70
+ resourceId: 'user-456',
71
+ });
72
+
73
+ // After
74
+ await agent.generate({
75
+ messages: [...],
76
+ memory: {
77
+ thread: 'thread-123',
78
+ resource: 'user-456',
79
+ },
80
+ });
81
+ ```
82
+
83
+ - Add human-in-the-loop (HITL) support to agent networks ([#11678](https://github.com/mastra-ai/mastra/pull/11678))
84
+ - Add suspend/resume capabilities to agent network
85
+ - Enable auto-resume for suspended network execution via `autoResumeSuspendedTools`
86
+
87
+ `agent.resumeNetwork`, `agent.approveNetworkToolCall`, `agent.declineNetworkToolCall`
88
+
89
+ - Fix text parts incorrectly merging across tool calls ([#11783](https://github.com/mastra-ai/mastra/pull/11783))
90
+
91
+ Previously, when an agent produced text before and after a tool call (e.g., "Let me search for that" → tool call → "Here's what I found"), the text parts would be merged into a single part, losing the separation. This fix introduces a `textId` property to track separate text streams, ensuring each text stream maintains its own text part in the UI message.
92
+
93
+ Fixes #11577
94
+
95
+ - Updated dependencies [[`9d5059e`](https://github.com/mastra-ai/mastra/commit/9d5059eae810829935fb08e81a9bb7ecd5b144a7), [`ef756c6`](https://github.com/mastra-ai/mastra/commit/ef756c65f82d16531c43f49a27290a416611e526), [`610a70b`](https://github.com/mastra-ai/mastra/commit/610a70bdad282079f0c630e0d7bb284578f20151)]:
96
+ - @mastra/client-js@1.0.0-beta.22
97
+
98
+ ## 0.1.0-beta.21
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies:
103
+ - @mastra/client-js@1.0.0-beta.21
104
+
105
+ ## 0.1.0-beta.20
106
+
107
+ ### Patch Changes
108
+
109
+ - Fix TypeScript errors during build declaration generation ([#11682](https://github.com/mastra-ai/mastra/pull/11682))
110
+
111
+ Updated test file `toUIMessage.test.ts` to match current `@mastra/core` types:
112
+ - Changed `error` property from string to `Error` object (per `StepFailure` type)
113
+ - Added missing `resumeSchema` property to `tool-call-approval` payloads (per `ToolCallApprovalPayload` type)
114
+ - Added `zod` as peer/dev dependency for test type support
115
+
116
+ - Fixed agent network not returning text response when routing agent handles requests without delegation. ([#11497](https://github.com/mastra-ai/mastra/pull/11497))
117
+
118
+ **What changed:**
119
+ - Agent networks now correctly stream text responses when the routing agent decides to handle a request itself instead of delegating to sub-agents, workflows, or tools
120
+ - Added fallback in transformers to ensure text is always returned even if core events are missing
121
+
122
+ **Why this matters:**
123
+ Previously, when using `toAISdkV5Stream` or `networkRoute()` outside of the Mastra Studio UI, no text content was returned when the routing agent handled requests directly. This fix ensures consistent behavior across all API routes.
124
+
125
+ Fixes #11219
126
+
127
+ - Display network completion validation results and scorer feedback in the Playground when viewing agent network runs, letting users see pass/fail status and actionable feedback from completion scorers ([#11562](https://github.com/mastra-ai/mastra/pull/11562))
128
+
129
+ - Updated dependencies [[`bc72b52`](https://github.com/mastra-ai/mastra/commit/bc72b529ee4478fe89ecd85a8be47ce0127b82a0), [`c042bd0`](https://github.com/mastra-ai/mastra/commit/c042bd0b743e0e86199d0cb83344ca7690e34a9c), [`e4d366a`](https://github.com/mastra-ai/mastra/commit/e4d366aeb500371dd4210d6aa8361a4c21d87034), [`58e3931`](https://github.com/mastra-ai/mastra/commit/58e3931af9baa5921688566210f00fb0c10479fa), [`08bb631`](https://github.com/mastra-ai/mastra/commit/08bb631ae2b14684b2678e3549d0b399a6f0561e), [`106c960`](https://github.com/mastra-ai/mastra/commit/106c960df5d110ec15ac8f45de8858597fb90ad5)]:
130
+ - @mastra/client-js@1.0.0-beta.20
131
+
132
+ ## 0.1.0-beta.19
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies:
137
+ - @mastra/client-js@1.0.0-beta.19
138
+
139
+ ## 0.1.0-beta.18
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies:
144
+ - @mastra/client-js@1.0.0-beta.18
145
+
146
+ ## 0.1.0-beta.17
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies:
151
+ - @mastra/client-js@1.0.0-beta.17
152
+
153
+ ## 0.1.0-beta.16
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [[`6cbb549`](https://github.com/mastra-ai/mastra/commit/6cbb549475201a2fbf158f0fd7323f6495f46d08)]:
158
+ - @mastra/client-js@1.0.0-beta.16
159
+
160
+ ## 0.1.0-beta.15
161
+
162
+ ### Minor Changes
163
+
164
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
165
+
166
+ ## What changed
167
+
168
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
169
+
170
+ **Before:**
171
+
172
+ ```typescript
173
+ // Old span structure
174
+ span.agentId; // 'my-agent'
175
+ span.toolId; // undefined
176
+ span.workflowId; // undefined
177
+ ```
178
+
179
+ **After:**
180
+
181
+ ```typescript
182
+ // New span structure
183
+ span.entityType; // EntityType.AGENT
184
+ span.entityId; // 'my-agent'
185
+ span.entityName; // 'My Agent'
186
+ ```
187
+
188
+ ## New `listTraces()` API
189
+
190
+ Query traces with filtering, pagination, and sorting:
191
+
192
+ ```typescript
193
+ const { spans, pagination } = await storage.listTraces({
194
+ filters: {
195
+ entityType: EntityType.AGENT,
196
+ entityId: 'my-agent',
197
+ userId: 'user-123',
198
+ environment: 'production',
199
+ status: TraceStatus.SUCCESS,
200
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
201
+ },
202
+ pagination: { page: 0, perPage: 50 },
203
+ orderBy: { field: 'startedAt', direction: 'DESC' },
204
+ });
205
+ ```
206
+
207
+ **Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
208
+
209
+ ## New retrieval methods
210
+ - `getSpan({ traceId, spanId })` - Get a single span
211
+ - `getRootSpan({ traceId })` - Get the root span of a trace
212
+ - `getTrace({ traceId })` - Get all spans for a trace
213
+
214
+ ## Backward compatibility
215
+
216
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
217
+
218
+ ## Migration
219
+
220
+ **Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
221
+
222
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [[`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`632fdb8`](https://github.com/mastra-ai/mastra/commit/632fdb8b3cd9ff6f90399256d526db439fc1758b), [`184f01d`](https://github.com/mastra-ai/mastra/commit/184f01d1f534ec0be9703d3996f2e088b4a560eb)]:
227
+ - @mastra/client-js@1.0.0-beta.15
228
+
229
+ ## 0.1.0-beta.14
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [[`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
234
+ - @mastra/client-js@1.0.0-beta.14
235
+
236
+ ## 0.1.0-beta.13
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies:
241
+ - @mastra/client-js@1.0.0-beta.13
242
+
243
+ ## 0.1.0-beta.12
244
+
245
+ ### Patch Changes
246
+
247
+ - Remove redundant toolCalls from network agent finalResult ([#11189](https://github.com/mastra-ai/mastra/pull/11189))
248
+
249
+ The network agent's `finalResult` was storing `toolCalls` separately even though all tool call information is already present in the `messages` array (as `tool-call` and `tool-result` type messages). This caused significant token waste since the routing agent reads this data from memory on every iteration.
250
+
251
+ **Before:** `finalResult: { text, toolCalls, messages }`
252
+ **After:** `finalResult: { text, messages }`
253
+
254
+ +**Migration:** If you were accessing `finalResult.toolCalls`, retrieve tool calls from `finalResult.messages` by filtering for messages with `type: 'tool-call'`.
255
+
256
+ Updated `@mastra/react` to extract tool calls directly from the `messages` array instead of the removed `toolCalls` field when resolving initial messages from memory.
257
+
258
+ Fixes #11059
259
+
260
+ - Auto resume suspended tools if `autoResumeSuspendedTools: true` ([#11157](https://github.com/mastra-ai/mastra/pull/11157))
261
+
262
+ The flag can be added to `defaultAgentOptions` when creating the agent or to options in `agent.stream` or `agent.generate`
263
+
264
+ ```typescript
265
+ const agent = new Agent({
266
+ //...agent information,
267
+ defaultAgentOptions: {
268
+ autoResumeSuspendedTools: true,
269
+ },
270
+ });
271
+ ```
272
+
273
+ - Updated dependencies [[`9650cce`](https://github.com/mastra-ai/mastra/commit/9650cce52a1d917ff9114653398e2a0f5c3ba808), [`695a621`](https://github.com/mastra-ai/mastra/commit/695a621528bdabeb87f83c2277cf2bb084c7f2b4), [`1b85674`](https://github.com/mastra-ai/mastra/commit/1b85674123708d9b85834dccc9eae601a9d0891c), [`486352b`](https://github.com/mastra-ai/mastra/commit/486352b66c746602b68a95839f830de14c7fb8c0), [`439eaf7`](https://github.com/mastra-ai/mastra/commit/439eaf75447809b05e326666675a4dcbf9c334ce)]:
274
+ - @mastra/client-js@1.0.0-beta.12
275
+
276
+ ## 0.1.0-beta.11
277
+
278
+ ### Patch Changes
279
+
280
+ - Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
281
+
282
+ When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
283
+
284
+ ```typescript showLineNumbers copy
285
+ const run = await workflow.createRun();
286
+ const result = await run.start({ inputData: { message: 'Hello' } });
287
+
288
+ if (result.status === 'tripwire') {
289
+ console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
290
+ console.log('Processor ID:', result.tripwire?.processorId);
291
+ console.log('Retry requested:', result.tripwire?.retry);
292
+ }
293
+ ```
294
+
295
+ Adds new UI state for tripwire in agent chat and workflow UI.
296
+
297
+ This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
298
+
299
+ - Updated dependencies [[`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
300
+ - @mastra/client-js@1.0.0-beta.11
301
+
302
+ ## 0.1.0-beta.10
303
+
304
+ ### Minor Changes
305
+
306
+ - Fix "MessagePartRuntime is not available" error when chatting with agents in Studio playground by replacing deprecated `useMessagePart` hook with `useAssistantState` ([#11039](https://github.com/mastra-ai/mastra/pull/11039))
307
+
308
+ ### Patch Changes
309
+
310
+ - fix: persist data-\* chunks from writer.custom() to memory storage ([#10884](https://github.com/mastra-ai/mastra/pull/10884))
311
+ - Add persistence for custom data chunks (`data-*` parts) emitted via `writer.custom()` in tools
312
+ - Data chunks are now saved to message storage so they survive page refreshes
313
+ - Update `@assistant-ui/react` to v0.11.47 with native `DataMessagePart` support
314
+ - Convert `data-*` parts to `DataMessagePart` format (`{ type: 'data', name: string, data: T }`)
315
+ - Update related `@assistant-ui/*` packages for compatibility
316
+
317
+ - Updated dependencies [[`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d)]:
318
+ - @mastra/client-js@1.0.0-beta.10
319
+
3
320
  ## 0.1.0-beta.9
4
321
 
5
322
  ### Patch Changes
@@ -0,0 +1,249 @@
1
+ import { _ as __commonJS, a as __require2, r as require_token_error } from './index-CIU9zuI1.js';
2
+
3
+ // ../_vendored/ai_v5/dist/chunk-OL3SSKUZ.js
4
+ var require_token_io = __commonJS({
5
+ "../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/token-io.js"(exports, module) {
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var token_io_exports = {};
34
+ __export(token_io_exports, {
35
+ findRootDir: () => findRootDir,
36
+ getUserDataDir: () => getUserDataDir
37
+ });
38
+ module.exports = __toCommonJS(token_io_exports);
39
+ var import_path = __toESM(__require2("path"));
40
+ var import_fs = __toESM(__require2("fs"));
41
+ var import_os = __toESM(__require2("os"));
42
+ var import_token_error = require_token_error();
43
+ function findRootDir() {
44
+ try {
45
+ let dir = process.cwd();
46
+ while (dir !== import_path.default.dirname(dir)) {
47
+ const pkgPath = import_path.default.join(dir, ".vercel");
48
+ if (import_fs.default.existsSync(pkgPath)) {
49
+ return dir;
50
+ }
51
+ dir = import_path.default.dirname(dir);
52
+ }
53
+ } catch (e) {
54
+ throw new import_token_error.VercelOidcTokenError(
55
+ "Token refresh only supported in node server environments"
56
+ );
57
+ }
58
+ throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
59
+ }
60
+ function getUserDataDir() {
61
+ if (process.env.XDG_DATA_HOME) {
62
+ return process.env.XDG_DATA_HOME;
63
+ }
64
+ switch (import_os.default.platform()) {
65
+ case "darwin":
66
+ return import_path.default.join(import_os.default.homedir(), "Library/Application Support");
67
+ case "linux":
68
+ return import_path.default.join(import_os.default.homedir(), ".local/share");
69
+ case "win32":
70
+ if (process.env.LOCALAPPDATA) {
71
+ return process.env.LOCALAPPDATA;
72
+ }
73
+ return null;
74
+ default:
75
+ return null;
76
+ }
77
+ }
78
+ }
79
+ });
80
+ var require_token_util = __commonJS({
81
+ "../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/token-util.js"(exports, module) {
82
+ var __create = Object.create;
83
+ var __defProp = Object.defineProperty;
84
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
85
+ var __getOwnPropNames = Object.getOwnPropertyNames;
86
+ var __getProtoOf = Object.getPrototypeOf;
87
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
88
+ var __export = (target, all) => {
89
+ for (var name in all)
90
+ __defProp(target, name, { get: all[name], enumerable: true });
91
+ };
92
+ var __copyProps = (to, from, except, desc) => {
93
+ if (from && typeof from === "object" || typeof from === "function") {
94
+ for (let key of __getOwnPropNames(from))
95
+ if (!__hasOwnProp.call(to, key) && key !== except)
96
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
97
+ }
98
+ return to;
99
+ };
100
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
101
+ // If the importer is in node compatibility mode or this is not an ESM
102
+ // file that has been converted to a CommonJS file using a Babel-
103
+ // compatible transform (i.e. "__esModule" has not been set), then set
104
+ // "default" to the CommonJS "module.exports" for node compatibility.
105
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
106
+ mod
107
+ ));
108
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
109
+ var token_util_exports = {};
110
+ __export(token_util_exports, {
111
+ assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
112
+ findProjectInfo: () => findProjectInfo,
113
+ getTokenPayload: () => getTokenPayload,
114
+ getVercelCliToken: () => getVercelCliToken,
115
+ getVercelDataDir: () => getVercelDataDir,
116
+ getVercelOidcToken: () => getVercelOidcToken,
117
+ isExpired: () => isExpired,
118
+ loadToken: () => loadToken,
119
+ saveToken: () => saveToken
120
+ });
121
+ module.exports = __toCommonJS(token_util_exports);
122
+ var path = __toESM(__require2("path"));
123
+ var fs = __toESM(__require2("fs"));
124
+ var import_token_error = require_token_error();
125
+ var import_token_io = require_token_io();
126
+ function getVercelDataDir() {
127
+ const vercelFolder = "com.vercel.cli";
128
+ const dataDir = (0, import_token_io.getUserDataDir)();
129
+ if (!dataDir) {
130
+ return null;
131
+ }
132
+ return path.join(dataDir, vercelFolder);
133
+ }
134
+ function getVercelCliToken() {
135
+ const dataDir = getVercelDataDir();
136
+ if (!dataDir) {
137
+ return null;
138
+ }
139
+ const tokenPath = path.join(dataDir, "auth.json");
140
+ if (!fs.existsSync(tokenPath)) {
141
+ return null;
142
+ }
143
+ const token = fs.readFileSync(tokenPath, "utf8");
144
+ if (!token) {
145
+ return null;
146
+ }
147
+ return JSON.parse(token).token;
148
+ }
149
+ async function getVercelOidcToken(authToken, projectId, teamId) {
150
+ try {
151
+ const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
152
+ const res = await fetch(url, {
153
+ method: "POST",
154
+ headers: {
155
+ Authorization: `Bearer ${authToken}`
156
+ }
157
+ });
158
+ if (!res.ok) {
159
+ throw new import_token_error.VercelOidcTokenError(
160
+ `Failed to refresh OIDC token: ${res.statusText}`
161
+ );
162
+ }
163
+ const tokenRes = await res.json();
164
+ assertVercelOidcTokenResponse(tokenRes);
165
+ return tokenRes;
166
+ } catch (e) {
167
+ throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);
168
+ }
169
+ }
170
+ function assertVercelOidcTokenResponse(res) {
171
+ if (!res || typeof res !== "object") {
172
+ throw new TypeError("Expected an object");
173
+ }
174
+ if (!("token" in res) || typeof res.token !== "string") {
175
+ throw new TypeError("Expected a string-valued token property");
176
+ }
177
+ }
178
+ function findProjectInfo() {
179
+ const dir = (0, import_token_io.findRootDir)();
180
+ if (!dir) {
181
+ throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
182
+ }
183
+ try {
184
+ const prjPath = path.join(dir, ".vercel", "project.json");
185
+ if (!fs.existsSync(prjPath)) {
186
+ throw new import_token_error.VercelOidcTokenError("project.json not found");
187
+ }
188
+ const prj = JSON.parse(fs.readFileSync(prjPath, "utf8"));
189
+ if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
190
+ throw new TypeError("Expected a string-valued projectId property");
191
+ }
192
+ return { projectId: prj.projectId, teamId: prj.orgId };
193
+ } catch (e) {
194
+ throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);
195
+ }
196
+ }
197
+ function saveToken(token, projectId) {
198
+ try {
199
+ const dir = (0, import_token_io.getUserDataDir)();
200
+ if (!dir) {
201
+ throw new import_token_error.VercelOidcTokenError("Unable to find user data directory");
202
+ }
203
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
204
+ const tokenJson = JSON.stringify(token);
205
+ fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });
206
+ fs.writeFileSync(tokenPath, tokenJson);
207
+ fs.chmodSync(tokenPath, 432);
208
+ return;
209
+ } catch (e) {
210
+ throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);
211
+ }
212
+ }
213
+ function loadToken(projectId) {
214
+ try {
215
+ const dir = (0, import_token_io.getUserDataDir)();
216
+ if (!dir) {
217
+ return null;
218
+ }
219
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
220
+ if (!fs.existsSync(tokenPath)) {
221
+ return null;
222
+ }
223
+ const token = JSON.parse(fs.readFileSync(tokenPath, "utf8"));
224
+ assertVercelOidcTokenResponse(token);
225
+ return token;
226
+ } catch (e) {
227
+ throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);
228
+ }
229
+ }
230
+ function getTokenPayload(token) {
231
+ const tokenParts = token.split(".");
232
+ if (tokenParts.length !== 3) {
233
+ throw new import_token_error.VercelOidcTokenError("Invalid token");
234
+ }
235
+ const base64 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
236
+ const padded = base64.padEnd(
237
+ base64.length + (4 - base64.length % 4) % 4,
238
+ "="
239
+ );
240
+ return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
241
+ }
242
+ function isExpired(token) {
243
+ return token.exp * 1e3 < Date.now();
244
+ }
245
+ }
246
+ });
247
+
248
+ export { require_token_util as r };
249
+ //# sourceMappingURL=chunk-55VPMN3N-BuLK6rn1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-55VPMN3N-BuLK6rn1.js","sources":["../../../packages/core/dist/chunk-55VPMN3N.js"],"sourcesContent":["import { __commonJS, __require, require_token_error } from './chunk-D22XABFZ.js';\n\n// ../_vendored/ai_v5/dist/chunk-OL3SSKUZ.js\nvar require_token_io = __commonJS({\n \"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/token-io.js\"(exports, module) {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n ));\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n var token_io_exports = {};\n __export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n });\n module.exports = __toCommonJS(token_io_exports);\n var import_path = __toESM(__require(\"path\"));\n var import_fs = __toESM(__require(\"fs\"));\n var import_os = __toESM(__require(\"os\"));\n var import_token_error = require_token_error();\n function findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n }\n function getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n }\n }\n});\nvar require_token_util = __commonJS({\n \"../../../node_modules/.pnpm/@vercel+oidc@3.0.5/node_modules/@vercel/oidc/dist/token-util.js\"(exports, module) {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n ));\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n var token_util_exports = {};\n __export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n });\n module.exports = __toCommonJS(token_util_exports);\n var path = __toESM(__require(\"path\"));\n var fs = __toESM(__require(\"fs\"));\n var import_token_error = require_token_error();\n var import_token_io = require_token_io();\n function getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n }\n function getVercelCliToken() {\n const dataDir = getVercelDataDir();\n if (!dataDir) {\n return null;\n }\n const tokenPath = path.join(dataDir, \"auth.json\");\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = fs.readFileSync(tokenPath, \"utf8\");\n if (!token) {\n return null;\n }\n return JSON.parse(token).token;\n }\n async function getVercelOidcToken(authToken, projectId, teamId) {\n try {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);\n }\n }\n function assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\"Expected an object\");\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\"Expected a string-valued token property\");\n }\n }\n function findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n }\n try {\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\"project.json not found\");\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\"Expected a string-valued projectId property\");\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);\n }\n }\n function saveToken(token, projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find user data directory\");\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 504, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);\n }\n }\n function loadToken(projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n return null;\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);\n }\n }\n function getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\"Invalid token\");\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n }\n function isExpired(token) {\n return token.exp * 1e3 < Date.now();\n }\n }\n});\n\nexport { require_token_util };\n//# sourceMappingURL=chunk-55VPMN3N.js.map\n//# sourceMappingURL=chunk-55VPMN3N.js.map"],"names":["__require"],"mappings":";;AAEA;AACA,IA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