@mastra/client-js 1.20.0-alpha.1 → 1.20.0-alpha.10

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/dist/index.js CHANGED
@@ -444,6 +444,34 @@ var Agent = class extends BaseResource {
444
444
  details(requestContext) {
445
445
  return this.request(`/agents/${this.agentId}${this.getQueryString(requestContext)}`);
446
446
  }
447
+ /**
448
+ * Probe the agent's browser session state before opening a screencast WebSocket.
449
+ *
450
+ * Returns `{ hasSession, screencastAvailable }`. Use this to avoid opening a WS
451
+ * that would either fail (screencast packages not installed) or sit idle (no
452
+ * active browser session yet). See {@link GetAgentBrowserSessionResponse}.
453
+ *
454
+ * @param threadId - Optional thread ID for thread-scoped browser sessions
455
+ */
456
+ browserSession(threadId) {
457
+ const query = threadId ? `?threadId=${encodeURIComponent(threadId)}` : "";
458
+ return this.request(`/agents/${this.agentId}/browser/session${query}`);
459
+ }
460
+ /**
461
+ * Close the agent's browser session.
462
+ *
463
+ * For thread-scoped browsers, pass `threadId` to close only that thread's
464
+ * session. Omit it to close the shared session (or all sessions for the agent
465
+ * depending on the toolset's scope).
466
+ *
467
+ * @param threadId - Optional thread ID for thread-scoped browser sessions
468
+ */
469
+ closeBrowser(threadId) {
470
+ return this.request(`/agents/${this.agentId}/browser/close`, {
471
+ method: "POST",
472
+ body: { threadId }
473
+ });
474
+ }
447
475
  enhanceInstructions(instructions, comment) {
448
476
  return this.request(`/agents/${this.agentId}/instructions/enhance`, {
449
477
  method: "POST",
@@ -4041,6 +4069,37 @@ var StoredAgent = class extends BaseResource {
4041
4069
  );
4042
4070
  }
4043
4071
  // ==========================================================================
4072
+ // Favorite Methods (EE feature)
4073
+ // ==========================================================================
4074
+ /**
4075
+ * Favorites this agent for the calling user. Idempotent.
4076
+ * Requires the `agent.favorites` builder feature flag to be enabled on the server.
4077
+ * @param requestContext - Optional request context to pass as query parameter
4078
+ * @returns Promise containing the new favorited state and updated favorite count
4079
+ */
4080
+ favorite(requestContext) {
4081
+ return this.request(
4082
+ `/stored/agents/${encodeURIComponent(this.storedAgentId)}/favorite${requestContextQueryString(requestContext)}`,
4083
+ {
4084
+ method: "PUT"
4085
+ }
4086
+ );
4087
+ }
4088
+ /**
4089
+ * Unfavorites this agent for the calling user. Idempotent.
4090
+ * Requires the `agent.favorites` builder feature flag to be enabled on the server.
4091
+ * @param requestContext - Optional request context to pass as query parameter
4092
+ * @returns Promise containing the new favorited state and updated favorite count
4093
+ */
4094
+ unfavorite(requestContext) {
4095
+ return this.request(
4096
+ `/stored/agents/${encodeURIComponent(this.storedAgentId)}/favorite${requestContextQueryString(requestContext)}`,
4097
+ {
4098
+ method: "DELETE"
4099
+ }
4100
+ );
4101
+ }
4102
+ // ==========================================================================
4044
4103
  // Version Methods
4045
4104
  // ==========================================================================
4046
4105
  /**
@@ -4858,6 +4917,30 @@ var StoredSkill = class extends BaseResource {
4858
4917
  }
4859
4918
  );
4860
4919
  }
4920
+ /**
4921
+ * Favorites this skill for the calling user. Idempotent.
4922
+ * Requires the `skill.favorites` builder feature flag to be enabled on the server.
4923
+ */
4924
+ favorite(requestContext) {
4925
+ return this.request(
4926
+ `/stored/skills/${encodeURIComponent(this.storedSkillId)}/favorite${requestContextQueryString(requestContext)}`,
4927
+ {
4928
+ method: "PUT"
4929
+ }
4930
+ );
4931
+ }
4932
+ /**
4933
+ * Unfavorites this skill for the calling user. Idempotent.
4934
+ * Requires the `skill.favorites` builder feature flag to be enabled on the server.
4935
+ */
4936
+ unfavorite(requestContext) {
4937
+ return this.request(
4938
+ `/stored/skills/${encodeURIComponent(this.storedSkillId)}/favorite${requestContextQueryString(requestContext)}`,
4939
+ {
4940
+ method: "DELETE"
4941
+ }
4942
+ );
4943
+ }
4861
4944
  };
4862
4945
 
4863
4946
  // src/resources/responses.ts
@@ -5863,12 +5946,24 @@ var MastraClient = class extends BaseResource {
5863
5946
  searchParams.set("orderBy[direction]", params.orderBy.direction);
5864
5947
  }
5865
5948
  }
5949
+ if (params?.status) {
5950
+ searchParams.set("status", params.status);
5951
+ }
5866
5952
  if (params?.authorId) {
5867
5953
  searchParams.set("authorId", params.authorId);
5868
5954
  }
5955
+ if (params?.visibility) {
5956
+ searchParams.set("visibility", params.visibility);
5957
+ }
5869
5958
  if (params?.metadata) {
5870
5959
  searchParams.set("metadata", JSON.stringify(params.metadata));
5871
5960
  }
5961
+ if (params?.favoritedOnly) {
5962
+ searchParams.set("favoritedOnly", "true");
5963
+ }
5964
+ if (params?.pinFavoritedFor) {
5965
+ searchParams.set("pinFavoritedFor", params.pinFavoritedFor);
5966
+ }
5872
5967
  const queryString = searchParams.toString();
5873
5968
  return this.request(`/stored/agents${queryString ? `?${queryString}` : ""}`);
5874
5969
  }
@@ -6077,9 +6172,18 @@ var MastraClient = class extends BaseResource {
6077
6172
  if (params?.authorId) {
6078
6173
  searchParams.set("authorId", params.authorId);
6079
6174
  }
6175
+ if (params?.visibility) {
6176
+ searchParams.set("visibility", params.visibility);
6177
+ }
6080
6178
  if (params?.metadata) {
6081
6179
  searchParams.set("metadata", JSON.stringify(params.metadata));
6082
6180
  }
6181
+ if (params?.favoritedOnly) {
6182
+ searchParams.set("favoritedOnly", "true");
6183
+ }
6184
+ if (params?.pinFavoritedFor) {
6185
+ searchParams.set("pinFavoritedFor", params.pinFavoritedFor);
6186
+ }
6083
6187
  const queryString = searchParams.toString();
6084
6188
  return this.request(`/stored/skills${queryString ? `?${queryString}` : ""}`);
6085
6189
  }
@@ -6149,6 +6253,80 @@ var MastraClient = class extends BaseResource {
6149
6253
  return this.request("/system/packages");
6150
6254
  }
6151
6255
  // ============================================================================
6256
+ // Editor / Builder
6257
+ // ============================================================================
6258
+ /**
6259
+ * Retrieves agent builder settings for UI gating.
6260
+ * Returns feature flags and configuration set by admin.
6261
+ * @returns Promise containing builder settings
6262
+ */
6263
+ getBuilderSettings() {
6264
+ return this.request("/editor/builder/settings");
6265
+ }
6266
+ /**
6267
+ * Retrieves Agent Builder infrastructure configuration and resolution status.
6268
+ * Requires `infrastructure:read` permission.
6269
+ * @returns Promise containing infrastructure status
6270
+ */
6271
+ getInfrastructureStatus() {
6272
+ return this.request("/editor/builder/infrastructure");
6273
+ }
6274
+ /**
6275
+ * Lists known skill registries surfaced by the Agent Builder config.
6276
+ * Each entry reports whether the registry is enabled. Disabled or unknown
6277
+ * registries return 404 from registry-scoped routes.
6278
+ * Requires `stored-skills:read` permission.
6279
+ */
6280
+ listBuilderRegistries() {
6281
+ return this.request("/editor/builder/registries");
6282
+ }
6283
+ /**
6284
+ * Search a builder skill registry. The registry must be enabled or the
6285
+ * server returns 404.
6286
+ * Requires `stored-skills:read` permission.
6287
+ */
6288
+ searchBuilderRegistry(registryId, params) {
6289
+ const search = new URLSearchParams({ q: params.q });
6290
+ if (params.limit !== void 0) search.set("limit", String(params.limit));
6291
+ return this.request(`/editor/builder/registries/${encodeURIComponent(registryId)}/search?${search.toString()}`);
6292
+ }
6293
+ /**
6294
+ * Fetch the popular skills feed from a builder skill registry.
6295
+ * Requires `stored-skills:read` permission.
6296
+ */
6297
+ getBuilderRegistryPopular(registryId, params) {
6298
+ const search = new URLSearchParams();
6299
+ if (params?.limit !== void 0) search.set("limit", String(params.limit));
6300
+ if (params?.offset !== void 0) search.set("offset", String(params.offset));
6301
+ const query = search.toString();
6302
+ return this.request(
6303
+ `/editor/builder/registries/${encodeURIComponent(registryId)}/popular${query ? `?${query}` : ""}`
6304
+ );
6305
+ }
6306
+ /**
6307
+ * Fetch the rendered preview content for a single registry skill.
6308
+ * Requires `stored-skills:read` permission.
6309
+ */
6310
+ getBuilderRegistryPreview(registryId, params) {
6311
+ const search = new URLSearchParams({
6312
+ owner: params.owner,
6313
+ repo: params.repo,
6314
+ path: params.path
6315
+ });
6316
+ return this.request(`/editor/builder/registries/${encodeURIComponent(registryId)}/preview?${search.toString()}`);
6317
+ }
6318
+ /**
6319
+ * Install a registry skill into the builder's stored-skills DB.
6320
+ * Returns 409 when a stored skill with the derived id already exists.
6321
+ * Requires `stored-skills:write` permission.
6322
+ */
6323
+ installBuilderRegistrySkill(registryId, body) {
6324
+ return this.request(`/editor/builder/registries/${encodeURIComponent(registryId)}/install`, {
6325
+ method: "POST",
6326
+ body
6327
+ });
6328
+ }
6329
+ // ============================================================================
6152
6330
  // Workspace
6153
6331
  // ============================================================================
6154
6332
  /**
@@ -6167,6 +6345,32 @@ var MastraClient = class extends BaseResource {
6167
6345
  return new Workspace(this.options, workspaceId);
6168
6346
  }
6169
6347
  // ============================================================================
6348
+ // Stored Workspaces
6349
+ // ============================================================================
6350
+ /**
6351
+ * Lists stored workspace configurations from the database
6352
+ * @param params - Optional filter and pagination parameters
6353
+ * @returns Promise containing paginated list of stored workspaces
6354
+ */
6355
+ listStoredWorkspaces(params) {
6356
+ const searchParams = new URLSearchParams();
6357
+ if (params?.page !== void 0) searchParams.set("page", String(params.page));
6358
+ if (params?.perPage !== void 0) searchParams.set("perPage", String(params.perPage));
6359
+ if (params?.authorId) searchParams.set("authorId", params.authorId);
6360
+ if (params?.orderBy?.field) searchParams.set("orderBy[field]", params.orderBy.field);
6361
+ if (params?.orderBy?.direction) searchParams.set("orderBy[direction]", params.orderBy.direction);
6362
+ const qs = searchParams.toString();
6363
+ return this.request(`/stored/workspaces${qs ? `?${qs}` : ""}`);
6364
+ }
6365
+ /**
6366
+ * Gets a specific stored workspace by ID
6367
+ * @param id - The workspace ID
6368
+ * @returns Promise containing the stored workspace
6369
+ */
6370
+ getStoredWorkspace(id) {
6371
+ return this.request(`/stored/workspaces/${encodeURIComponent(id)}`);
6372
+ }
6373
+ // ============================================================================
6170
6374
  // Vectors & Embedders
6171
6375
  // ============================================================================
6172
6376
  /**