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