@mastra/client-js 1.17.0-alpha.1 → 1.17.0-alpha.3

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.d.ts CHANGED
@@ -4,4 +4,5 @@ export * from './tools.js';
4
4
  export type { ChannelPlatformInfo, ChannelInstallationInfo, ChannelConnectOAuth, ChannelConnectDeepLink, ChannelConnectImmediate, ChannelConnectResult, } from './resources/channels.js';
5
5
  export { RequestContext } from '@mastra/core/request-context';
6
6
  export type { UIMessageWithMetadata } from '@mastra/core/agent';
7
+ export type { Body, Client, ClientMethod, ClientPath, ClientRequest, ClientResponse, ClientResponseKind, ClientRoute, PathParams, QueryParams, RouteKey, RouteRequest, RouteResponse, RouteResponseType, RouteTypes, } from './route-types.generated.js';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,UAAU,GACX,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1187,15 +1187,15 @@ var Agent = class extends BaseResource {
1187
1187
  }
1188
1188
  case "step-finish": {
1189
1189
  step += 1;
1190
- currentTextPart = chunk.payload.stepResult.isContinued ? currentTextPart : void 0;
1190
+ currentTextPart = chunk.payload?.stepResult?.isContinued ? currentTextPart : void 0;
1191
1191
  currentReasoningPart = void 0;
1192
1192
  currentReasoningTextDetail = void 0;
1193
1193
  execUpdate();
1194
1194
  break;
1195
1195
  }
1196
1196
  case "finish": {
1197
- finishReason = chunk.payload.stepResult.reason;
1198
- if (chunk.payload.usage != null) {
1197
+ finishReason = chunk.payload?.stepResult?.reason ?? finishReason;
1198
+ if (chunk.payload?.usage != null) {
1199
1199
  usage = chunk.payload.usage;
1200
1200
  }
1201
1201
  break;
@@ -3505,6 +3505,37 @@ var Observability = class extends BaseResource {
3505
3505
  const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
3506
3506
  return this.request(`/observability/traces${queryString ? `?${queryString}` : ""}`);
3507
3507
  }
3508
+ /**
3509
+ * Retrieves a paginated list of trace branches with optional filtering and sorting.
3510
+ *
3511
+ * Each row is a single branch-anchor span (e.g., AGENT_RUN, WORKFLOW_RUN, TOOL_CALL),
3512
+ * including ones nested under a different root entity. Use this to list every run of
3513
+ * a given agent/workflow/tool regardless of how it was triggered. Pairs with
3514
+ * {@link getBranch} to expand a single branch into its subtree.
3515
+ *
3516
+ * @param params - Parameters for pagination, filtering, and ordering
3517
+ * @returns Promise containing paginated branch-anchor spans and pagination info
3518
+ */
3519
+ listBranches(params = {}) {
3520
+ const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
3521
+ return this.request(`/observability/branches${queryString ? `?${queryString}` : ""}`);
3522
+ }
3523
+ /**
3524
+ * Retrieves the subtree of spans rooted at a given span.
3525
+ *
3526
+ * @param params - Parameters containing trace ID, span ID, and optional depth.
3527
+ * When `depth` is omitted the full descendant subtree is returned; with a finite
3528
+ * `depth` only that many levels below the anchor are returned (depth: 0 → only the
3529
+ * anchor span; depth: 1 → anchor plus immediate children; etc).
3530
+ * @returns Promise containing the branch (anchor span plus descendants)
3531
+ */
3532
+ getBranch(params) {
3533
+ const { traceId, spanId, depth } = params;
3534
+ const queryString = depth !== void 0 ? `?depth=${depth}` : "";
3535
+ return this.request(
3536
+ `/observability/traces/${encodeURIComponent(traceId)}/branches/${encodeURIComponent(spanId)}${queryString}`
3537
+ );
3538
+ }
3508
3539
  /**
3509
3540
  * Retrieves scores by trace ID and span ID
3510
3541
  * @param params - Parameters containing trace ID, span ID, and pagination options
@@ -5410,6 +5441,22 @@ var MastraClient = class extends BaseResource {
5410
5441
  listTraces(params = {}) {
5411
5442
  return this.observability.listTraces(params);
5412
5443
  }
5444
+ /**
5445
+ * Retrieves a paginated list of trace branches with optional filtering and sorting.
5446
+ * Each row is a branch-anchor span (AGENT_RUN, WORKFLOW_RUN, TOOL_CALL, etc.) including
5447
+ * ones nested under a different root entity. Pairs with {@link getBranch} to expand
5448
+ * a single branch into its subtree.
5449
+ */
5450
+ listBranches(params = {}) {
5451
+ return this.observability.listBranches(params);
5452
+ }
5453
+ /**
5454
+ * Retrieves the subtree of spans rooted at a given span. The optional `depth` field
5455
+ * bounds descendant levels below the anchor (0 = anchor only; omitted = full subtree).
5456
+ */
5457
+ getBranch(params) {
5458
+ return this.observability.getBranch(params);
5459
+ }
5413
5460
  listScoresBySpan(params) {
5414
5461
  return this.observability.listScoresBySpan(params);
5415
5462
  }