@mastra/client-js 1.22.0-alpha.3 → 1.22.0-alpha.5

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
@@ -4705,6 +4705,15 @@ var StoredAgent = class extends BaseResource {
4705
4705
  }
4706
4706
  );
4707
4707
  }
4708
+ /**
4709
+ * Exports deterministic JSON for this agent without mutating storage.
4710
+ */
4711
+ export(params) {
4712
+ return this.request(`/stored/agents/${encodeURIComponent(this.storedAgentId)}/export`, {
4713
+ method: "POST",
4714
+ body: params
4715
+ });
4716
+ }
4708
4717
  /**
4709
4718
  * Deletes the stored agent
4710
4719
  * @param requestContext - Optional request context to pass as query parameter
@@ -5238,16 +5247,13 @@ var ToolProvider = class extends BaseResource {
5238
5247
  }
5239
5248
  providerId;
5240
5249
  /**
5241
- * Lists available toolkits from this provider
5242
- * @returns Promise containing list of toolkits
5250
+ * Lists available toolkits from this provider.
5243
5251
  */
5244
5252
  listToolkits() {
5245
5253
  return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/toolkits`);
5246
5254
  }
5247
5255
  /**
5248
- * Lists available tools from this provider, with optional filtering
5249
- * @param params - Optional filtering and pagination parameters
5250
- * @returns Promise containing list of tools
5256
+ * Lists available tools from this provider, with optional filtering.
5251
5257
  */
5252
5258
  listTools(params) {
5253
5259
  const searchParams = new URLSearchParams();
@@ -5269,15 +5275,139 @@ var ToolProvider = class extends BaseResource {
5269
5275
  );
5270
5276
  }
5271
5277
  /**
5272
- * Gets the input schema for a specific tool
5273
- * @param toolSlug - The slug of the tool
5274
- * @returns Promise containing the tool's JSON schema
5278
+ * Gets the input schema for a specific tool.
5275
5279
  */
5276
5280
  getToolSchema(toolSlug) {
5277
5281
  return this.request(
5278
5282
  `/tool-providers/${encodeURIComponent(this.providerId)}/tools/${encodeURIComponent(toolSlug)}/schema`
5279
5283
  );
5280
5284
  }
5285
+ /**
5286
+ * Starts an OAuth flow for a (toolkit, connectionId) pair. Returns a
5287
+ * redirect URL and an opaque auth handle to poll with `getAuthStatus`.
5288
+ */
5289
+ authorize(params) {
5290
+ return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/authorize`, {
5291
+ method: "POST",
5292
+ body: params
5293
+ });
5294
+ }
5295
+ /**
5296
+ * Polls the OAuth flow status for an outstanding authorize call.
5297
+ */
5298
+ getAuthStatus(authId) {
5299
+ return this.request(
5300
+ `/tool-providers/${encodeURIComponent(this.providerId)}/auth-status/${encodeURIComponent(authId)}`
5301
+ );
5302
+ }
5303
+ /**
5304
+ * Batch-checks whether a set of (connectionId, toolkit) tuples are
5305
+ * currently connected.
5306
+ */
5307
+ getConnectionStatus(params) {
5308
+ return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/connection-status`, {
5309
+ method: "POST",
5310
+ body: params
5311
+ });
5312
+ }
5313
+ /**
5314
+ * Lists existing provider connections, scoped to a toolkit.
5315
+ *
5316
+ * Default: the connection owner is resolved server-side from the request's
5317
+ * auth context. Admin callers (with `tool-providers:admin` permission) may
5318
+ * pass `authorId` to target a specific author, or omit it to receive
5319
+ * connections across all authors known to `tool_provider_connections` for
5320
+ * this provider/toolkit. Pagination is page-based via `page` (1-indexed)
5321
+ * and `perPage` (default 50, max 200).
5322
+ */
5323
+ listConnections(params) {
5324
+ const searchParams = new URLSearchParams();
5325
+ searchParams.set("toolkit", params.toolkit);
5326
+ if (params.authorId) {
5327
+ searchParams.set("authorId", params.authorId);
5328
+ }
5329
+ if (params.page !== void 0 && params.page !== null) {
5330
+ searchParams.set("page", String(params.page));
5331
+ }
5332
+ if (params.perPage !== void 0 && params.perPage !== null) {
5333
+ searchParams.set("perPage", String(params.perPage));
5334
+ }
5335
+ if (params.scope) {
5336
+ searchParams.set("scope", params.scope);
5337
+ }
5338
+ return this.request(
5339
+ `/tool-providers/${encodeURIComponent(this.providerId)}/connections?${searchParams.toString()}`
5340
+ );
5341
+ }
5342
+ /**
5343
+ * Lists provider-specific fields the picker should collect before
5344
+ * initiating a new connection (e.g. Confluence subdomain). Most toolkits
5345
+ * return an empty array.
5346
+ */
5347
+ listConnectionFields(params) {
5348
+ const searchParams = new URLSearchParams();
5349
+ searchParams.set("toolkit", params.toolkit);
5350
+ return this.request(
5351
+ `/tool-providers/${encodeURIComponent(this.providerId)}/connection-fields?${searchParams.toString()}`
5352
+ );
5353
+ }
5354
+ /**
5355
+ * Disconnects (revokes + deletes) a persisted connection.
5356
+ *
5357
+ * Without `force: true` the server refuses if any agent still pins the
5358
+ * connection. With `force: true` the provider-side revoke is best-effort
5359
+ * (errors are tolerated) and the local row is always removed.
5360
+ */
5361
+ disconnectConnection(connectionId, params) {
5362
+ const searchParams = new URLSearchParams();
5363
+ if (params?.toolkit) {
5364
+ searchParams.set("toolkit", params.toolkit);
5365
+ }
5366
+ if (params?.force) {
5367
+ searchParams.set("force", "true");
5368
+ }
5369
+ const queryString = searchParams.toString();
5370
+ return this.request(
5371
+ `/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}${queryString ? `?${queryString}` : ""}`,
5372
+ {
5373
+ method: "DELETE"
5374
+ }
5375
+ );
5376
+ }
5377
+ /**
5378
+ * Updates the persisted display label on a connection row. Pass `label: null`
5379
+ * (or an empty string) to clear the existing label. Only the connection owner
5380
+ * or an admin may rename, unless the row is `scope: 'shared'`.
5381
+ */
5382
+ updateConnection(connectionId, params) {
5383
+ return this.request(
5384
+ `/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}`,
5385
+ {
5386
+ method: "PATCH",
5387
+ body: params
5388
+ }
5389
+ );
5390
+ }
5391
+ /**
5392
+ * Lists the agents that currently pin a given connection. Used by the
5393
+ * picker to warn the user before disconnecting a shared account.
5394
+ */
5395
+ getConnectionUsage(connectionId, params) {
5396
+ const searchParams = new URLSearchParams();
5397
+ if (params?.toolkit) {
5398
+ searchParams.set("toolkit", params.toolkit);
5399
+ }
5400
+ const queryString = searchParams.toString();
5401
+ return this.request(
5402
+ `/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}/usage${queryString ? `?${queryString}` : ""}`
5403
+ );
5404
+ }
5405
+ /**
5406
+ * Returns provider-level health (config, reachability, etc.).
5407
+ */
5408
+ getHealth() {
5409
+ return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/health`);
5410
+ }
5281
5411
  };
5282
5412
 
5283
5413
  // src/resources/processor-provider.ts