@mastra/server 1.59.1-alpha.0 → 1.60.0-alpha.2
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 +16 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +34 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/handlers/agent-controller.cjs +9 -10
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +9 -10
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.60.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`7e096f0`](https://github.com/mastra-ai/mastra/commit/7e096f02f0dddbf09b85d306458351245ed2f886), [`8f0a332`](https://github.com/mastra-ai/mastra/commit/8f0a3321bf180368d76fe7b36aa1a8f60f00b6de), [`b098de9`](https://github.com/mastra-ai/mastra/commit/b098de9d7cb9f672e0883a5c716465a3a689693d), [`ef6e295`](https://github.com/mastra-ai/mastra/commit/ef6e295b59bc25a5b61b633a89c97bcfce9fb465), [`208e1b3`](https://github.com/mastra-ai/mastra/commit/208e1b39f30f4b386e494394e9d71d96f0f90241), [`c938d34`](https://github.com/mastra-ai/mastra/commit/c938d34739936c8ecbabd67ad6a4a4396f41c4c6), [`1d9a0ea`](https://github.com/mastra-ai/mastra/commit/1d9a0ea4a9901baee6cd56737243bd6d1f631ac0), [`3667679`](https://github.com/mastra-ai/mastra/commit/3667679db057edfb086846d13369fdda4902ad65), [`49696e8`](https://github.com/mastra-ai/mastra/commit/49696e8e42f870674a0a58f5abcd22cc54dd2864), [`512100a`](https://github.com/mastra-ai/mastra/commit/512100a7d8b7e9c920f2590c6b3612f5de0d3cff), [`9ef432b`](https://github.com/mastra-ai/mastra/commit/9ef432b6faa534b57b0d182a610e13dd9a7123ff), [`b9cf308`](https://github.com/mastra-ai/mastra/commit/b9cf30846f97f99ac1906ee8a68f4f2d117b0378)]:
|
|
8
|
+
- @mastra/core@1.60.0-alpha.2
|
|
9
|
+
|
|
10
|
+
## 1.60.0-alpha.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Fixed `GET /agent-controller/:controllerId/sessions/:resourceId/threads` and `GET /agent-controller/:controllerId/sessions/:resourceId/threads/:threadId/messages` provisioning a workspace/sandbox on every request. Both endpoints previously routed through session creation as a side effect, stalling read-only page visits 5–17s and consuming a sandbox slot per visit. They now read from storage directly. Session creation and workspace/sandbox provisioning continue to happen on the write path as before. ([#21474](https://github.com/mastra-ai/mastra/pull/21474))
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`15101bb`](https://github.com/mastra-ai/mastra/commit/15101bb53c0d934f31af6b8813b88191e382a5e5), [`c2c3deb`](https://github.com/mastra-ai/mastra/commit/c2c3debcf670c7082d0a5e553aa99818a864698c), [`33374ba`](https://github.com/mastra-ai/mastra/commit/33374ba359e4fb13eaa918ae925fe167a3c55414), [`c5f964d`](https://github.com/mastra-ai/mastra/commit/c5f964d3f77064e978f8066ec506eed77ba5c63c), [`f8f653f`](https://github.com/mastra-ai/mastra/commit/f8f653f10980d01a73706cc3c8689ca5e40ce808)]:
|
|
17
|
+
- @mastra/core@1.60.0-alpha.1
|
|
18
|
+
|
|
3
19
|
## 1.59.1-alpha.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts
CHANGED
|
@@ -60,20 +60,54 @@ declare class RequestContext<Values extends Record<string, any> | unknown = unkn
|
|
|
60
60
|
constructor(iterable?: Values extends Record<string, any> ? RecordToTuple<Partial<Values>> : Iterable<readonly [string, unknown]>);
|
|
61
61
|
/**
|
|
62
62
|
* set a value with strict typing if `Values` is a Record and the key exists in it.
|
|
63
|
+
*
|
|
64
|
+
* Declared schema keys stay strictly typed. For runtime-only keys that are not part of
|
|
65
|
+
* `Values` (for example reserved middleware keys), use {@link setRaw}.
|
|
63
66
|
*/
|
|
64
67
|
set<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K, value: Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown): void;
|
|
68
|
+
/**
|
|
69
|
+
* Set a runtime-only key that is not part of the declared `Values` schema.
|
|
70
|
+
*
|
|
71
|
+
* The runtime store is an open map: schema validation checks declared keys and
|
|
72
|
+
* passes undeclared keys through. Use this when writing infrastructure keys
|
|
73
|
+
* (for example `mastra__resourceId`) or other values that intentionally omit
|
|
74
|
+
* from `requestContextSchema`.
|
|
75
|
+
*/
|
|
76
|
+
setRaw(key: string, value: unknown): void;
|
|
65
77
|
/**
|
|
66
78
|
* Get a value with its type
|
|
79
|
+
*
|
|
80
|
+
* Declared schema keys stay strictly typed. For runtime-only keys that are not part of
|
|
81
|
+
* `Values` (for example reserved middleware keys), use {@link getRaw}.
|
|
67
82
|
*/
|
|
68
83
|
get<K extends (Values extends Record<string, any> ? keyof Values : string), R = Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown>(key: K): R;
|
|
84
|
+
/**
|
|
85
|
+
* Get a runtime-only key that is not part of the declared `Values` schema.
|
|
86
|
+
*
|
|
87
|
+
* Returns `unknown` because the schema does not describe these keys — narrow
|
|
88
|
+
* the result at the call site.
|
|
89
|
+
*/
|
|
90
|
+
getRaw(key: string): unknown;
|
|
69
91
|
/**
|
|
70
92
|
* Check if a key exists in the container
|
|
93
|
+
*
|
|
94
|
+
* Declared schema keys stay strictly typed. For runtime-only keys, use {@link hasRaw}.
|
|
71
95
|
*/
|
|
72
96
|
has<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Check whether a runtime-only key exists in the open map.
|
|
99
|
+
*/
|
|
100
|
+
hasRaw(key: string): boolean;
|
|
73
101
|
/**
|
|
74
102
|
* Delete a value by key
|
|
103
|
+
*
|
|
104
|
+
* Declared schema keys stay strictly typed. For runtime-only keys, use {@link deleteRaw}.
|
|
75
105
|
*/
|
|
76
106
|
delete<K extends (Values extends Record<string, any> ? keyof Values : string)>(key: K): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Delete a runtime-only key from the open map.
|
|
109
|
+
*/
|
|
110
|
+
deleteRaw(key: string): boolean;
|
|
77
111
|
/**
|
|
78
112
|
* Clear all values from the container
|
|
79
113
|
*/
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -810,11 +810,10 @@ const LIST_AGENT_CONTROLLER_THREADS_ROUTE = require_route_builder.createRoute({
|
|
|
810
810
|
tags: ["AgentController"],
|
|
811
811
|
requiresAuth: true,
|
|
812
812
|
requiresPermission: "agent-controller:read",
|
|
813
|
-
handler: async ({ mastra, controllerId, resourceId,
|
|
813
|
+
handler: async ({ mastra, controllerId, resourceId, limit, tags }) => {
|
|
814
814
|
try {
|
|
815
815
|
const controller = getAgentControllerOrThrow(mastra, controllerId);
|
|
816
|
-
const
|
|
817
|
-
const threads = await session.thread.list();
|
|
816
|
+
const threads = await controller.queryThreads({ resourceId });
|
|
818
817
|
const getTags = (t) => {
|
|
819
818
|
const metadata = t.metadata ?? {};
|
|
820
819
|
const result = {};
|
|
@@ -830,7 +829,7 @@ const LIST_AGENT_CONTROLLER_THREADS_ROUTE = require_route_builder.createRoute({
|
|
|
830
829
|
const sorted = [...scoped].sort((a, b) => toTime(b) - toTime(a));
|
|
831
830
|
const max = Number(limit);
|
|
832
831
|
const limited = Number.isFinite(max) && max > 0 ? sorted.slice(0, max) : sorted;
|
|
833
|
-
const
|
|
832
|
+
const activeThreadIds = new Set(controller.listActiveThreadRuns().filter((r) => r.resourceId === resourceId).map((r) => r.threadId));
|
|
834
833
|
return { threads: limited.map((t) => {
|
|
835
834
|
const threadTags = getTags(t);
|
|
836
835
|
return {
|
|
@@ -838,10 +837,7 @@ const LIST_AGENT_CONTROLLER_THREADS_ROUTE = require_route_builder.createRoute({
|
|
|
838
837
|
title: t.title,
|
|
839
838
|
tags: Object.keys(threadTags).length > 0 ? threadTags : void 0,
|
|
840
839
|
updatedAt: t.updatedAt instanceof Date ? t.updatedAt.toISOString() : void 0,
|
|
841
|
-
state:
|
|
842
|
-
resourceId,
|
|
843
|
-
threadId: t.id
|
|
844
|
-
}) ? "active" : "idle"
|
|
840
|
+
state: activeThreadIds.has(t.id) ? "active" : "idle"
|
|
845
841
|
};
|
|
846
842
|
}) };
|
|
847
843
|
} catch (error) {
|
|
@@ -1008,9 +1004,12 @@ const LIST_AGENT_CONTROLLER_THREAD_MESSAGES_ROUTE = require_route_builder.create
|
|
|
1008
1004
|
tags: ["AgentController", "Threads"],
|
|
1009
1005
|
requiresAuth: true,
|
|
1010
1006
|
requiresPermission: "agent-controller:read",
|
|
1011
|
-
handler: async ({ mastra, controllerId, resourceId,
|
|
1007
|
+
handler: async ({ mastra, controllerId, resourceId, threadId, limit }) => {
|
|
1012
1008
|
try {
|
|
1013
|
-
|
|
1009
|
+
const controller = getAgentControllerOrThrow(mastra, controllerId);
|
|
1010
|
+
const thread = await controller.queryThreadById({ threadId });
|
|
1011
|
+
if (!thread || thread.resourceId !== resourceId) throw new Error(`Thread not found: ${threadId}`);
|
|
1012
|
+
return { messages: (await controller.queryThreadMessages({
|
|
1014
1013
|
threadId,
|
|
1015
1014
|
limit
|
|
1016
1015
|
})).map((m) => ({
|