@mastra/client-js 1.21.2-alpha.2 → 1.22.0-alpha.4
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 +139 -0
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-signals.md +132 -71
- package/dist/index.cjs +144 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +144 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/run.d.ts +25 -0
- package/dist/resources/run.d.ts.map +1 -1
- package/dist/resources/tool-provider.d.ts +57 -10
- package/dist/resources/tool-provider.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +1490 -76
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -3185,6 +3185,35 @@ var Run = class extends BaseResource {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
}).then(deserializeWorkflowError);
|
|
3187
3187
|
}
|
|
3188
|
+
/**
|
|
3189
|
+
* Resumes a suspended workflow step without waiting for the workflow to complete (fire-and-forget)
|
|
3190
|
+
* and returns immediately with the runId. The workflow continues executing in the background.
|
|
3191
|
+
*
|
|
3192
|
+
* Use this when you want to dispatch a resume and return immediately (e.g. an HTTP handler that
|
|
3193
|
+
* never needs the resolved result inline). For Inngest-backed workflows this also avoids the
|
|
3194
|
+
* `getRunOutput()` polling race that `resumeAsync()` can hit.
|
|
3195
|
+
*
|
|
3196
|
+
* TODO(v2): in Mastra v2 this fire-and-forget behavior should become the behavior of
|
|
3197
|
+
* `resumeAsync()` (to mirror `start`/`resume` fire-and-forget semantics), and this method
|
|
3198
|
+
* should be removed. Kept as a separate method in v1 to avoid a breaking contract change.
|
|
3199
|
+
*
|
|
3200
|
+
* @param params - Object containing the step, resumeData and requestContext
|
|
3201
|
+
* @returns Promise containing the runId of the resumed workflow run
|
|
3202
|
+
*/
|
|
3203
|
+
resumeNoWait(params) {
|
|
3204
|
+
const requestContext = parseClientRequestContext(params.requestContext);
|
|
3205
|
+
return this.request(`/workflows/${this.workflowId}/resume-no-wait?runId=${this.runId}`, {
|
|
3206
|
+
method: "POST",
|
|
3207
|
+
body: {
|
|
3208
|
+
step: params.step,
|
|
3209
|
+
resumeData: params.resumeData,
|
|
3210
|
+
requestContext,
|
|
3211
|
+
tracingOptions: params.tracingOptions,
|
|
3212
|
+
perStep: params.perStep,
|
|
3213
|
+
forEachIndex: params.forEachIndex
|
|
3214
|
+
}
|
|
3215
|
+
});
|
|
3216
|
+
}
|
|
3188
3217
|
/**
|
|
3189
3218
|
* Resumes a suspended workflow step that uses stream asynchronously and returns a promise that resolves when the workflow is complete
|
|
3190
3219
|
* @param params - Object containing the step, resumeData and requestContext
|
|
@@ -5214,16 +5243,13 @@ var ToolProvider = class extends BaseResource {
|
|
|
5214
5243
|
}
|
|
5215
5244
|
providerId;
|
|
5216
5245
|
/**
|
|
5217
|
-
* Lists available toolkits from this provider
|
|
5218
|
-
* @returns Promise containing list of toolkits
|
|
5246
|
+
* Lists available toolkits from this provider.
|
|
5219
5247
|
*/
|
|
5220
5248
|
listToolkits() {
|
|
5221
5249
|
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/toolkits`);
|
|
5222
5250
|
}
|
|
5223
5251
|
/**
|
|
5224
|
-
* Lists available tools from this provider, with optional filtering
|
|
5225
|
-
* @param params - Optional filtering and pagination parameters
|
|
5226
|
-
* @returns Promise containing list of tools
|
|
5252
|
+
* Lists available tools from this provider, with optional filtering.
|
|
5227
5253
|
*/
|
|
5228
5254
|
listTools(params) {
|
|
5229
5255
|
const searchParams = new URLSearchParams();
|
|
@@ -5245,15 +5271,125 @@ var ToolProvider = class extends BaseResource {
|
|
|
5245
5271
|
);
|
|
5246
5272
|
}
|
|
5247
5273
|
/**
|
|
5248
|
-
* Gets the input schema for a specific tool
|
|
5249
|
-
* @param toolSlug - The slug of the tool
|
|
5250
|
-
* @returns Promise containing the tool's JSON schema
|
|
5274
|
+
* Gets the input schema for a specific tool.
|
|
5251
5275
|
*/
|
|
5252
5276
|
getToolSchema(toolSlug) {
|
|
5253
5277
|
return this.request(
|
|
5254
5278
|
`/tool-providers/${encodeURIComponent(this.providerId)}/tools/${encodeURIComponent(toolSlug)}/schema`
|
|
5255
5279
|
);
|
|
5256
5280
|
}
|
|
5281
|
+
/**
|
|
5282
|
+
* Starts an OAuth flow for a (toolkit, connectionId) pair. Returns a
|
|
5283
|
+
* redirect URL and an opaque auth handle to poll with `getAuthStatus`.
|
|
5284
|
+
*/
|
|
5285
|
+
authorize(params) {
|
|
5286
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/authorize`, {
|
|
5287
|
+
method: "POST",
|
|
5288
|
+
body: params
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5291
|
+
/**
|
|
5292
|
+
* Polls the OAuth flow status for an outstanding authorize call.
|
|
5293
|
+
*/
|
|
5294
|
+
getAuthStatus(authId) {
|
|
5295
|
+
return this.request(
|
|
5296
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/auth-status/${encodeURIComponent(authId)}`
|
|
5297
|
+
);
|
|
5298
|
+
}
|
|
5299
|
+
/**
|
|
5300
|
+
* Batch-checks whether a set of (connectionId, toolkit) tuples are
|
|
5301
|
+
* currently connected.
|
|
5302
|
+
*/
|
|
5303
|
+
getConnectionStatus(params) {
|
|
5304
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/connection-status`, {
|
|
5305
|
+
method: "POST",
|
|
5306
|
+
body: params
|
|
5307
|
+
});
|
|
5308
|
+
}
|
|
5309
|
+
/**
|
|
5310
|
+
* Lists existing provider connections, scoped to a toolkit.
|
|
5311
|
+
*
|
|
5312
|
+
* Default: the connection owner is resolved server-side from the request's
|
|
5313
|
+
* auth context. Admin callers (with `tool-providers:admin` permission) may
|
|
5314
|
+
* pass `authorId` to target a specific author, or omit it to receive
|
|
5315
|
+
* connections across all authors known to `tool_provider_connections` for
|
|
5316
|
+
* this provider/toolkit. Pagination is page-based via `page` (1-indexed)
|
|
5317
|
+
* and `perPage` (default 50, max 200).
|
|
5318
|
+
*/
|
|
5319
|
+
listConnections(params) {
|
|
5320
|
+
const searchParams = new URLSearchParams();
|
|
5321
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5322
|
+
if (params.authorId) {
|
|
5323
|
+
searchParams.set("authorId", params.authorId);
|
|
5324
|
+
}
|
|
5325
|
+
if (params.page !== void 0 && params.page !== null) {
|
|
5326
|
+
searchParams.set("page", String(params.page));
|
|
5327
|
+
}
|
|
5328
|
+
if (params.perPage !== void 0 && params.perPage !== null) {
|
|
5329
|
+
searchParams.set("perPage", String(params.perPage));
|
|
5330
|
+
}
|
|
5331
|
+
if (params.scope) {
|
|
5332
|
+
searchParams.set("scope", params.scope);
|
|
5333
|
+
}
|
|
5334
|
+
return this.request(
|
|
5335
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections?${searchParams.toString()}`
|
|
5336
|
+
);
|
|
5337
|
+
}
|
|
5338
|
+
/**
|
|
5339
|
+
* Lists provider-specific fields the picker should collect before
|
|
5340
|
+
* initiating a new connection (e.g. Confluence subdomain). Most toolkits
|
|
5341
|
+
* return an empty array.
|
|
5342
|
+
*/
|
|
5343
|
+
listConnectionFields(params) {
|
|
5344
|
+
const searchParams = new URLSearchParams();
|
|
5345
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5346
|
+
return this.request(
|
|
5347
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connection-fields?${searchParams.toString()}`
|
|
5348
|
+
);
|
|
5349
|
+
}
|
|
5350
|
+
/**
|
|
5351
|
+
* Disconnects (revokes + deletes) a persisted connection.
|
|
5352
|
+
*
|
|
5353
|
+
* Without `force: true` the server refuses if any agent still pins the
|
|
5354
|
+
* connection. With `force: true` the provider-side revoke is best-effort
|
|
5355
|
+
* (errors are tolerated) and the local row is always removed.
|
|
5356
|
+
*/
|
|
5357
|
+
disconnectConnection(connectionId, params) {
|
|
5358
|
+
const searchParams = new URLSearchParams();
|
|
5359
|
+
if (params?.toolkit) {
|
|
5360
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5361
|
+
}
|
|
5362
|
+
if (params?.force) {
|
|
5363
|
+
searchParams.set("force", "true");
|
|
5364
|
+
}
|
|
5365
|
+
const queryString = searchParams.toString();
|
|
5366
|
+
return this.request(
|
|
5367
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}${queryString ? `?${queryString}` : ""}`,
|
|
5368
|
+
{
|
|
5369
|
+
method: "DELETE"
|
|
5370
|
+
}
|
|
5371
|
+
);
|
|
5372
|
+
}
|
|
5373
|
+
/**
|
|
5374
|
+
* Lists the agents that currently pin a given connection. Used by the
|
|
5375
|
+
* picker to warn the user before disconnecting a shared account.
|
|
5376
|
+
*/
|
|
5377
|
+
getConnectionUsage(connectionId, params) {
|
|
5378
|
+
const searchParams = new URLSearchParams();
|
|
5379
|
+
if (params?.toolkit) {
|
|
5380
|
+
searchParams.set("toolkit", params.toolkit);
|
|
5381
|
+
}
|
|
5382
|
+
const queryString = searchParams.toString();
|
|
5383
|
+
return this.request(
|
|
5384
|
+
`/tool-providers/${encodeURIComponent(this.providerId)}/connections/${encodeURIComponent(connectionId)}/usage${queryString ? `?${queryString}` : ""}`
|
|
5385
|
+
);
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* Returns provider-level health (config, reachability, etc.).
|
|
5389
|
+
*/
|
|
5390
|
+
getHealth() {
|
|
5391
|
+
return this.request(`/tool-providers/${encodeURIComponent(this.providerId)}/health`);
|
|
5392
|
+
}
|
|
5257
5393
|
};
|
|
5258
5394
|
|
|
5259
5395
|
// src/resources/processor-provider.ts
|