@dbx-tools/appkit-mastra-shared 0.1.12 → 0.1.18
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/README.md +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/src/genie.d.ts +635 -0
- package/dist/src/genie.js +349 -0
- package/dist/src/mastra.d.ts +31 -0
- package/dist/src/mastra.js +44 -0
- package/dist/src/protocol.d.ts +148 -105
- package/dist/src/protocol.js +132 -36
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/index.ts +2 -0
- package/package.json +13 -3
- package/src/genie.ts +407 -0
- package/src/mastra.ts +53 -0
- package/src/protocol.ts +137 -125
package/dist/src/protocol.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shape of the data published by {@link MastraPlugin.clientConfig}
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shape of the data published by {@link MastraPlugin.clientConfig}.
|
|
3
|
+
* Kept dependency-free (no `pg`, no `fastembed`, no Mastra runtime)
|
|
4
|
+
* so the React client can import these schemas without dragging in
|
|
5
|
+
* server-only dependencies.
|
|
5
6
|
*
|
|
6
|
-
* Server-side, `MastraPlugin` derives every path from the plugin
|
|
7
|
-
* (AppKit conventionally serves plugin `foo` at `/api/foo`).
|
|
8
|
-
* the resolved paths lets the client compute URLs
|
|
9
|
-
* `/api/mastra` anywhere - rename the plugin
|
|
10
|
-
* keeps working.
|
|
7
|
+
* Server-side, `MastraPlugin` derives every path from the plugin
|
|
8
|
+
* mount (AppKit conventionally serves plugin `foo` at `/api/foo`).
|
|
9
|
+
* Publishing the resolved paths lets the client compute URLs
|
|
10
|
+
* without hard-coding `/api/mastra` anywhere - rename the plugin
|
|
11
|
+
* and the React client keeps working.
|
|
12
|
+
*
|
|
13
|
+
* URL helpers ({@link chatUrl}, {@link historyUrl}) live in the
|
|
14
|
+
* sibling `mastra.ts` module so this file stays purely declarative
|
|
15
|
+
* (schemas + inferred types only).
|
|
11
16
|
*
|
|
12
17
|
* @example
|
|
13
18
|
* ```tsx
|
|
@@ -20,109 +25,147 @@
|
|
|
20
25
|
* });
|
|
21
26
|
* ```
|
|
22
27
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
agents:
|
|
58
|
-
}
|
|
28
|
+
import { z } from "zod";
|
|
29
|
+
/**
|
|
30
|
+
* JSON-safe descriptor published by the Mastra plugin's
|
|
31
|
+
* `clientConfig()`.
|
|
32
|
+
*
|
|
33
|
+
* Fields:
|
|
34
|
+
* - `basePath`: plugin mount path. Always `/api/<pluginName>`.
|
|
35
|
+
* - `chatPath`: chat endpoint for the **default** agent, i.e.
|
|
36
|
+
* `${basePath}/route/chat`. Equivalent to `chatUrl(config)`.
|
|
37
|
+
* - `chatPathTemplate`: template form used by the route handler:
|
|
38
|
+
* `${basePath}/route/chat/:agentId`. Provided for documentation
|
|
39
|
+
* / tools that want the OpenAPI-style placeholder; clients
|
|
40
|
+
* should normally call {@link chatUrl} instead.
|
|
41
|
+
* - `modelsPath`: models catalogue endpoint: `${basePath}/models`.
|
|
42
|
+
* - `historyPath`: thread history endpoint for the **default**
|
|
43
|
+
* agent: `${basePath}/route/history`. Returns AI SDK V5
|
|
44
|
+
* `UIMessage`s for the current session's thread; takes `page`
|
|
45
|
+
* and `perPage` query params. See {@link historyUrl}.
|
|
46
|
+
* - `historyPathTemplate`: templated form of `historyPath`:
|
|
47
|
+
* `${basePath}/route/history/:agentId`. Use this to reach a
|
|
48
|
+
* non-default agent's history; clients should normally call
|
|
49
|
+
* {@link historyUrl} instead.
|
|
50
|
+
* - `defaultAgent`: agent id `chatRoute` binds to when the client
|
|
51
|
+
* doesn't name one.
|
|
52
|
+
* - `agents`: every registered agent id in registration order.
|
|
53
|
+
*/
|
|
54
|
+
export declare const MastraClientConfigSchema: z.ZodObject<{
|
|
55
|
+
basePath: z.ZodString;
|
|
56
|
+
chatPath: z.ZodString;
|
|
57
|
+
chatPathTemplate: z.ZodString;
|
|
58
|
+
modelsPath: z.ZodString;
|
|
59
|
+
historyPath: z.ZodString;
|
|
60
|
+
historyPathTemplate: z.ZodString;
|
|
61
|
+
defaultAgent: z.ZodString;
|
|
62
|
+
agents: z.ZodArray<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type MastraClientConfig = z.infer<typeof MastraClientConfigSchema>;
|
|
59
65
|
/**
|
|
60
|
-
* Minimal descriptor for a Databricks Model Serving endpoint.
|
|
61
|
-
* the server-side `ServingEndpointSummary` from `serving.ts`
|
|
62
|
-
* kept here so the React client can type the `/models`
|
|
63
|
-
* without importing the full plugin (which would pull in
|
|
64
|
-
* `fastembed`, and Mastra itself).
|
|
66
|
+
* Minimal descriptor for a Databricks Model Serving endpoint.
|
|
67
|
+
* Mirrors the server-side `ServingEndpointSummary` from `serving.ts`
|
|
68
|
+
* and is kept here so the React client can type the `/models`
|
|
69
|
+
* response without importing the full plugin (which would pull in
|
|
70
|
+
* `pg`, `fastembed`, and Mastra itself).
|
|
71
|
+
*
|
|
72
|
+
* Fields:
|
|
73
|
+
* - `name`: endpoint name as listed by the Model Serving REST API.
|
|
74
|
+
* - `task`: task hint (e.g. `"llm/v1/chat"`). Useful for filtering.
|
|
75
|
+
* - `state`: ready / updating / failed state.
|
|
76
|
+
* - `description`: free-form description; mostly informational.
|
|
65
77
|
*/
|
|
66
|
-
export
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/** Free-form description; mostly informational. */
|
|
74
|
-
description?: string;
|
|
75
|
-
}
|
|
78
|
+
export declare const ServingEndpointSummarySchema: z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
task: z.ZodOptional<z.ZodString>;
|
|
81
|
+
state: z.ZodOptional<z.ZodString>;
|
|
82
|
+
description: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export type ServingEndpointSummary = z.infer<typeof ServingEndpointSummarySchema>;
|
|
76
85
|
/** JSON payload returned by `GET ${basePath}/models`. */
|
|
77
|
-
export
|
|
78
|
-
endpoints:
|
|
79
|
-
|
|
86
|
+
export declare const ServingEndpointsResponseSchema: z.ZodObject<{
|
|
87
|
+
endpoints: z.ZodArray<z.ZodObject<{
|
|
88
|
+
name: z.ZodString;
|
|
89
|
+
task: z.ZodOptional<z.ZodString>;
|
|
90
|
+
state: z.ZodOptional<z.ZodString>;
|
|
91
|
+
description: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type ServingEndpointsResponse = z.infer<typeof ServingEndpointsResponseSchema>;
|
|
80
95
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
96
|
+
* Structural shape for an AI SDK V5 `UIMessage`. Defined locally
|
|
97
|
+
* so the shared types package stays dependency-free (no `ai`
|
|
98
|
+
* import). The runtime values returned by the `/history` endpoint
|
|
99
|
+
* are produced by `toAISdkV5Messages` and are 1:1 compatible with
|
|
100
|
+
* `UIMessage` from the `ai` package; clients can safely cast when
|
|
101
|
+
* needed.
|
|
85
102
|
*/
|
|
86
|
-
export declare
|
|
103
|
+
export declare const MastraHistoryUIMessageSchema: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
role: z.ZodEnum<{
|
|
106
|
+
system: "system";
|
|
107
|
+
user: "user";
|
|
108
|
+
assistant: "assistant";
|
|
109
|
+
}>;
|
|
110
|
+
parts: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
|
|
111
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export type MastraHistoryUIMessage = z.infer<typeof MastraHistoryUIMessageSchema>;
|
|
87
114
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
115
|
+
* JSON payload returned by `GET ${basePath}/history`.
|
|
116
|
+
*
|
|
117
|
+
* Fields:
|
|
118
|
+
* - `uiMessages`: page of UI-formatted messages, oldest -> newest.
|
|
119
|
+
* Always chronological regardless of the underlying pagination
|
|
120
|
+
* order so the client can prepend the array to the live
|
|
121
|
+
* transcript without sorting.
|
|
122
|
+
* - `page`: zero-indexed page that produced this response.
|
|
123
|
+
* - `perPage`: number of items requested per page.
|
|
124
|
+
* - `total`: total number of messages in the thread.
|
|
125
|
+
* - `hasMore`: true when at least one older page is still
|
|
126
|
+
* available.
|
|
93
127
|
*/
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/** Number of items requested per page. */
|
|
112
|
-
perPage: number;
|
|
113
|
-
/** Total number of messages in the thread. */
|
|
114
|
-
total: number;
|
|
115
|
-
/** True when at least one older page is still available. */
|
|
116
|
-
hasMore: boolean;
|
|
117
|
-
}
|
|
128
|
+
export declare const MastraHistoryResponseSchema: z.ZodObject<{
|
|
129
|
+
uiMessages: z.ZodArray<z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
role: z.ZodEnum<{
|
|
132
|
+
system: "system";
|
|
133
|
+
user: "user";
|
|
134
|
+
assistant: "assistant";
|
|
135
|
+
}>;
|
|
136
|
+
parts: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
|
|
137
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
page: z.ZodNumber;
|
|
140
|
+
perPage: z.ZodNumber;
|
|
141
|
+
total: z.ZodNumber;
|
|
142
|
+
hasMore: z.ZodBoolean;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
export type MastraHistoryResponse = z.infer<typeof MastraHistoryResponseSchema>;
|
|
118
145
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
146
|
+
* JSON payload returned by `DELETE ${basePath}/history`. Deletes
|
|
147
|
+
* every persisted message + workflow snapshot tied to the caller's
|
|
148
|
+
* thread, so the next chat turn starts from a clean slate. The
|
|
149
|
+
* session cookie that anchors the thread id is preserved so the
|
|
150
|
+
* caller doesn't lose its identity - only the contents go away.
|
|
151
|
+
*
|
|
152
|
+
* `ok` is always `true` on success; the response object is kept
|
|
153
|
+
* as a struct (vs a bare 204) so future fields (e.g. `deletedAt`,
|
|
154
|
+
* `messages`) can be added without bumping the contract.
|
|
155
|
+
*
|
|
156
|
+
* Fields:
|
|
157
|
+
* - `ok`: literal `true` on success.
|
|
158
|
+
* - `agentId`: agent whose history was cleared.
|
|
159
|
+
* - `threadId`: thread id that was wiped.
|
|
160
|
+
* - `cleared`: number of messages the thread held before
|
|
161
|
+
* deletion. Useful for client-side "cleared 12 messages"
|
|
162
|
+
* toasts; `0` is reported when the thread was already empty
|
|
163
|
+
* (call is idempotent).
|
|
123
164
|
*/
|
|
124
|
-
export declare
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
165
|
+
export declare const MastraClearHistoryResponseSchema: z.ZodObject<{
|
|
166
|
+
ok: z.ZodLiteral<true>;
|
|
167
|
+
agentId: z.ZodString;
|
|
168
|
+
threadId: z.ZodString;
|
|
169
|
+
cleared: z.ZodNumber;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export type MastraClearHistoryResponse = z.infer<typeof MastraClearHistoryResponseSchema>;
|
package/dist/src/protocol.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shape of the data published by {@link MastraPlugin.clientConfig}
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Shape of the data published by {@link MastraPlugin.clientConfig}.
|
|
3
|
+
* Kept dependency-free (no `pg`, no `fastembed`, no Mastra runtime)
|
|
4
|
+
* so the React client can import these schemas without dragging in
|
|
5
|
+
* server-only dependencies.
|
|
5
6
|
*
|
|
6
|
-
* Server-side, `MastraPlugin` derives every path from the plugin
|
|
7
|
-
* (AppKit conventionally serves plugin `foo` at `/api/foo`).
|
|
8
|
-
* the resolved paths lets the client compute URLs
|
|
9
|
-
* `/api/mastra` anywhere - rename the plugin
|
|
10
|
-
* keeps working.
|
|
7
|
+
* Server-side, `MastraPlugin` derives every path from the plugin
|
|
8
|
+
* mount (AppKit conventionally serves plugin `foo` at `/api/foo`).
|
|
9
|
+
* Publishing the resolved paths lets the client compute URLs
|
|
10
|
+
* without hard-coding `/api/mastra` anywhere - rename the plugin
|
|
11
|
+
* and the React client keeps working.
|
|
12
|
+
*
|
|
13
|
+
* URL helpers ({@link chatUrl}, {@link historyUrl}) live in the
|
|
14
|
+
* sibling `mastra.ts` module so this file stays purely declarative
|
|
15
|
+
* (schemas + inferred types only).
|
|
11
16
|
*
|
|
12
17
|
* @example
|
|
13
18
|
* ```tsx
|
|
@@ -20,35 +25,126 @@
|
|
|
20
25
|
* });
|
|
21
26
|
* ```
|
|
22
27
|
*/
|
|
28
|
+
import { z } from "zod";
|
|
29
|
+
/* ---------------------------- client config ---------------------------- */
|
|
30
|
+
/**
|
|
31
|
+
* JSON-safe descriptor published by the Mastra plugin's
|
|
32
|
+
* `clientConfig()`.
|
|
33
|
+
*
|
|
34
|
+
* Fields:
|
|
35
|
+
* - `basePath`: plugin mount path. Always `/api/<pluginName>`.
|
|
36
|
+
* - `chatPath`: chat endpoint for the **default** agent, i.e.
|
|
37
|
+
* `${basePath}/route/chat`. Equivalent to `chatUrl(config)`.
|
|
38
|
+
* - `chatPathTemplate`: template form used by the route handler:
|
|
39
|
+
* `${basePath}/route/chat/:agentId`. Provided for documentation
|
|
40
|
+
* / tools that want the OpenAPI-style placeholder; clients
|
|
41
|
+
* should normally call {@link chatUrl} instead.
|
|
42
|
+
* - `modelsPath`: models catalogue endpoint: `${basePath}/models`.
|
|
43
|
+
* - `historyPath`: thread history endpoint for the **default**
|
|
44
|
+
* agent: `${basePath}/route/history`. Returns AI SDK V5
|
|
45
|
+
* `UIMessage`s for the current session's thread; takes `page`
|
|
46
|
+
* and `perPage` query params. See {@link historyUrl}.
|
|
47
|
+
* - `historyPathTemplate`: templated form of `historyPath`:
|
|
48
|
+
* `${basePath}/route/history/:agentId`. Use this to reach a
|
|
49
|
+
* non-default agent's history; clients should normally call
|
|
50
|
+
* {@link historyUrl} instead.
|
|
51
|
+
* - `defaultAgent`: agent id `chatRoute` binds to when the client
|
|
52
|
+
* doesn't name one.
|
|
53
|
+
* - `agents`: every registered agent id in registration order.
|
|
54
|
+
*/
|
|
55
|
+
export const MastraClientConfigSchema = z.object({
|
|
56
|
+
basePath: z.string(),
|
|
57
|
+
chatPath: z.string(),
|
|
58
|
+
chatPathTemplate: z.string(),
|
|
59
|
+
modelsPath: z.string(),
|
|
60
|
+
historyPath: z.string(),
|
|
61
|
+
historyPathTemplate: z.string(),
|
|
62
|
+
defaultAgent: z.string(),
|
|
63
|
+
agents: z.array(z.string()),
|
|
64
|
+
});
|
|
65
|
+
/* ---------------------------- model catalogue ---------------------------- */
|
|
66
|
+
/**
|
|
67
|
+
* Minimal descriptor for a Databricks Model Serving endpoint.
|
|
68
|
+
* Mirrors the server-side `ServingEndpointSummary` from `serving.ts`
|
|
69
|
+
* and is kept here so the React client can type the `/models`
|
|
70
|
+
* response without importing the full plugin (which would pull in
|
|
71
|
+
* `pg`, `fastembed`, and Mastra itself).
|
|
72
|
+
*
|
|
73
|
+
* Fields:
|
|
74
|
+
* - `name`: endpoint name as listed by the Model Serving REST API.
|
|
75
|
+
* - `task`: task hint (e.g. `"llm/v1/chat"`). Useful for filtering.
|
|
76
|
+
* - `state`: ready / updating / failed state.
|
|
77
|
+
* - `description`: free-form description; mostly informational.
|
|
78
|
+
*/
|
|
79
|
+
export const ServingEndpointSummarySchema = z.object({
|
|
80
|
+
name: z.string(),
|
|
81
|
+
task: z.string().optional(),
|
|
82
|
+
state: z.string().optional(),
|
|
83
|
+
description: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
/** JSON payload returned by `GET ${basePath}/models`. */
|
|
86
|
+
export const ServingEndpointsResponseSchema = z.object({
|
|
87
|
+
endpoints: z.array(ServingEndpointSummarySchema),
|
|
88
|
+
});
|
|
89
|
+
/* ----------------------------- chat history ----------------------------- */
|
|
90
|
+
/**
|
|
91
|
+
* Structural shape for an AI SDK V5 `UIMessage`. Defined locally
|
|
92
|
+
* so the shared types package stays dependency-free (no `ai`
|
|
93
|
+
* import). The runtime values returned by the `/history` endpoint
|
|
94
|
+
* are produced by `toAISdkV5Messages` and are 1:1 compatible with
|
|
95
|
+
* `UIMessage` from the `ai` package; clients can safely cast when
|
|
96
|
+
* needed.
|
|
97
|
+
*/
|
|
98
|
+
export const MastraHistoryUIMessageSchema = z.object({
|
|
99
|
+
id: z.string(),
|
|
100
|
+
role: z.enum(["system", "user", "assistant"]),
|
|
101
|
+
parts: z.array(z.unknown()).readonly(),
|
|
102
|
+
metadata: z.unknown().optional(),
|
|
103
|
+
});
|
|
23
104
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `:
|
|
105
|
+
* JSON payload returned by `GET ${basePath}/history`.
|
|
106
|
+
*
|
|
107
|
+
* Fields:
|
|
108
|
+
* - `uiMessages`: page of UI-formatted messages, oldest -> newest.
|
|
109
|
+
* Always chronological regardless of the underlying pagination
|
|
110
|
+
* order so the client can prepend the array to the live
|
|
111
|
+
* transcript without sorting.
|
|
112
|
+
* - `page`: zero-indexed page that produced this response.
|
|
113
|
+
* - `perPage`: number of items requested per page.
|
|
114
|
+
* - `total`: total number of messages in the thread.
|
|
115
|
+
* - `hasMore`: true when at least one older page is still
|
|
116
|
+
* available.
|
|
28
117
|
*/
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
118
|
+
export const MastraHistoryResponseSchema = z.object({
|
|
119
|
+
uiMessages: z.array(MastraHistoryUIMessageSchema),
|
|
120
|
+
page: z.number(),
|
|
121
|
+
perPage: z.number(),
|
|
122
|
+
total: z.number(),
|
|
123
|
+
hasMore: z.boolean(),
|
|
124
|
+
});
|
|
35
125
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
126
|
+
* JSON payload returned by `DELETE ${basePath}/history`. Deletes
|
|
127
|
+
* every persisted message + workflow snapshot tied to the caller's
|
|
128
|
+
* thread, so the next chat turn starts from a clean slate. The
|
|
129
|
+
* session cookie that anchors the thread id is preserved so the
|
|
130
|
+
* caller doesn't lose its identity - only the contents go away.
|
|
131
|
+
*
|
|
132
|
+
* `ok` is always `true` on success; the response object is kept
|
|
133
|
+
* as a struct (vs a bare 204) so future fields (e.g. `deletedAt`,
|
|
134
|
+
* `messages`) can be added without bumping the contract.
|
|
135
|
+
*
|
|
136
|
+
* Fields:
|
|
137
|
+
* - `ok`: literal `true` on success.
|
|
138
|
+
* - `agentId`: agent whose history was cleared.
|
|
139
|
+
* - `threadId`: thread id that was wiped.
|
|
140
|
+
* - `cleared`: number of messages the thread held before
|
|
141
|
+
* deletion. Useful for client-side "cleared 12 messages"
|
|
142
|
+
* toasts; `0` is reported when the thread was already empty
|
|
143
|
+
* (call is idempotent).
|
|
40
144
|
*/
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (options.page !== undefined)
|
|
48
|
-
params.set("page", String(options.page));
|
|
49
|
-
if (options.perPage !== undefined) {
|
|
50
|
-
params.set("perPage", String(options.perPage));
|
|
51
|
-
}
|
|
52
|
-
const qs = params.toString();
|
|
53
|
-
return qs ? `${base}?${qs}` : base;
|
|
54
|
-
}
|
|
145
|
+
export const MastraClearHistoryResponseSchema = z.object({
|
|
146
|
+
ok: z.literal(true),
|
|
147
|
+
agentId: z.string(),
|
|
148
|
+
threadId: z.string(),
|
|
149
|
+
cleared: z.number(),
|
|
150
|
+
});
|