@rustrak/client 0.14.2 → 0.14.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/dist/index.d.cts CHANGED
@@ -121,24 +121,61 @@ declare const agentTraceSummarySchema: z.ZodObject<{
121
121
  duration_ms: z.ZodNullable<z.ZodNumber>;
122
122
  total_tokens: z.ZodNumber;
123
123
  tool_call_count: z.ZodNumber;
124
+ llm_call_count: z.ZodNumber;
125
+ error_count: z.ZodNumber;
124
126
  started_at: z.ZodString;
125
127
  }, z.core.$strip>;
128
+ declare const agentSummarySchema: z.ZodObject<{
129
+ agent_runs: z.ZodNumber;
130
+ llm_calls: z.ZodNumber;
131
+ tool_calls: z.ZodNumber;
132
+ error_count: z.ZodNumber;
133
+ total_tokens: z.ZodNumber;
134
+ avg_duration_ms: z.ZodNumber;
135
+ p95_duration_ms: z.ZodNumber;
136
+ }, z.core.$strip>;
137
+ declare const agentModelRowSchema: z.ZodObject<{
138
+ model: z.ZodString;
139
+ requests: z.ZodNumber;
140
+ errors: z.ZodNumber;
141
+ avg_ms: z.ZodNumber;
142
+ p95_ms: z.ZodNumber;
143
+ input_tokens: z.ZodNumber;
144
+ cached_input_tokens: z.ZodNumber;
145
+ output_tokens: z.ZodNumber;
146
+ reasoning_output_tokens: z.ZodNumber;
147
+ total_tokens: z.ZodNumber;
148
+ }, z.core.$strip>;
149
+ declare const agentToolRowSchema: z.ZodObject<{
150
+ tool: z.ZodString;
151
+ calls: z.ZodNumber;
152
+ errors: z.ZodNumber;
153
+ avg_ms: z.ZodNumber;
154
+ p95_ms: z.ZodNumber;
155
+ }, z.core.$strip>;
126
156
 
127
157
  type AgentTimeseriesPoint = z.infer<typeof agentTimeseriesPointSchema>;
128
158
  type AgentDurationPoint = z.infer<typeof agentDurationPointSchema>;
129
159
  type GenAiBreakdownRow = z.infer<typeof genAiBreakdownRowSchema>;
130
160
  type AgentTraceSummary = z.infer<typeof agentTraceSummarySchema>;
161
+ type AgentSummary = z.infer<typeof agentSummarySchema>;
162
+ type AgentModelRow = z.infer<typeof agentModelRowSchema>;
163
+ type AgentToolRow = z.infer<typeof agentToolRowSchema>;
131
164
  interface AgentTimeseriesOptions {
132
165
  period_hours?: number;
133
166
  interval_hours?: number;
167
+ environment?: string;
134
168
  }
135
169
  interface AgentBreakdownOptions {
136
170
  period_hours?: number;
137
171
  limit?: number;
172
+ environment?: string;
138
173
  }
139
174
  interface AgentTracesOptions {
140
175
  page?: number;
141
176
  per_page?: number;
177
+ period_hours?: number;
178
+ environment?: string;
142
179
  }
143
180
 
144
181
  declare const providerTypeSchema: z.ZodEnum<{
@@ -979,6 +1016,36 @@ declare const spanSchema: z.ZodObject<{
979
1016
  gen_ai_usage_output_tokens: z.ZodNullable<z.ZodNumber>;
980
1017
  gen_ai_usage_total_tokens: z.ZodNullable<z.ZodNumber>;
981
1018
  }, z.core.$strip>;
1019
+ declare const spanDetailSchema: z.ZodObject<{
1020
+ id: z.ZodString;
1021
+ transaction_id: z.ZodNullable<z.ZodString>;
1022
+ span_id: z.ZodNullable<z.ZodString>;
1023
+ trace_id: z.ZodNullable<z.ZodString>;
1024
+ parent_span_id: z.ZodNullable<z.ZodString>;
1025
+ op: z.ZodNullable<z.ZodString>;
1026
+ description: z.ZodNullable<z.ZodString>;
1027
+ status: z.ZodNullable<z.ZodString>;
1028
+ start_timestamp: z.ZodNullable<z.ZodString>;
1029
+ timestamp: z.ZodNullable<z.ZodString>;
1030
+ duration_ms: z.ZodNullable<z.ZodNumber>;
1031
+ exclusive_time_ms: z.ZodNullable<z.ZodNumber>;
1032
+ is_segment: z.ZodBoolean;
1033
+ segment_id: z.ZodNullable<z.ZodString>;
1034
+ platform: z.ZodNullable<z.ZodString>;
1035
+ release: z.ZodNullable<z.ZodString>;
1036
+ environment: z.ZodNullable<z.ZodString>;
1037
+ gen_ai_operation_type: z.ZodNullable<z.ZodString>;
1038
+ gen_ai_agent_name: z.ZodNullable<z.ZodString>;
1039
+ gen_ai_request_model: z.ZodNullable<z.ZodString>;
1040
+ gen_ai_response_model: z.ZodNullable<z.ZodString>;
1041
+ gen_ai_tool_name: z.ZodNullable<z.ZodString>;
1042
+ gen_ai_conversation_id: z.ZodNullable<z.ZodString>;
1043
+ gen_ai_usage_input_tokens: z.ZodNullable<z.ZodNumber>;
1044
+ gen_ai_usage_output_tokens: z.ZodNullable<z.ZodNumber>;
1045
+ gen_ai_usage_total_tokens: z.ZodNullable<z.ZodNumber>;
1046
+ attributes: z.ZodRecord<z.ZodString, z.ZodAny>;
1047
+ tags: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
1048
+ }, z.core.$strip>;
982
1049
  declare const transactionStatsSchema: z.ZodObject<{
983
1050
  transaction_name: z.ZodString;
984
1051
  op: z.ZodNullable<z.ZodString>;
@@ -992,6 +1059,7 @@ declare const transactionStatsSchema: z.ZodObject<{
992
1059
  type Transaction = z.infer<typeof transactionSchema>;
993
1060
  type TransactionDetail = z.infer<typeof transactionDetailSchema>;
994
1061
  type Span = z.infer<typeof spanSchema>;
1062
+ type SpanDetail = z.infer<typeof spanDetailSchema>;
995
1063
  type TransactionStats = z.infer<typeof transactionStatsSchema>;
996
1064
  interface ListSpansOptions {
997
1065
  page?: number;
@@ -1010,6 +1078,12 @@ declare const userSchema: z.ZodObject<{
1010
1078
  member: "member";
1011
1079
  }>;
1012
1080
  is_admin: z.ZodBoolean;
1081
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1082
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1083
+ }, z.core.$strip>;
1084
+ declare const updatePreferencesRequestSchema: z.ZodObject<{
1085
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1086
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
1087
  }, z.core.$strip>;
1014
1088
  declare const authResponseSchema: z.ZodObject<{
1015
1089
  user: z.ZodObject<{
@@ -1020,6 +1094,8 @@ declare const authResponseSchema: z.ZodObject<{
1020
1094
  member: "member";
1021
1095
  }>;
1022
1096
  is_admin: z.ZodBoolean;
1097
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1098
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1023
1099
  }, z.core.$strip>;
1024
1100
  }, z.core.$strip>;
1025
1101
  declare const loginResultSchema: z.ZodObject<{
@@ -1031,6 +1107,8 @@ declare const loginResultSchema: z.ZodObject<{
1031
1107
  member: "member";
1032
1108
  }>;
1033
1109
  is_admin: z.ZodBoolean;
1110
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1111
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1034
1112
  }, z.core.$strip>;
1035
1113
  cookies: z.ZodArray<z.ZodString>;
1036
1114
  }, z.core.$strip>;
@@ -1044,6 +1122,7 @@ declare const registerRequestSchema: z.ZodObject<{
1044
1122
  }, z.core.$strip>;
1045
1123
 
1046
1124
  type User = z.infer<typeof userSchema>;
1125
+ type UpdatePreferencesRequest = z.infer<typeof updatePreferencesRequestSchema>;
1047
1126
  type AuthResponse = z.infer<typeof authResponseSchema>;
1048
1127
  type LoginResult = z.infer<typeof loginResultSchema>;
1049
1128
  type LoginRequest = z.infer<typeof loginRequestSchema>;
@@ -1067,6 +1146,10 @@ declare class AgentsResource extends BaseResource {
1067
1146
  getModelsByTokens(projectId: number, options?: AgentBreakdownOptions): Promise<Result<GenAiBreakdownRow[], RustrakError>>;
1068
1147
  getTools(projectId: number, options?: AgentBreakdownOptions): Promise<Result<GenAiBreakdownRow[], RustrakError>>;
1069
1148
  getTraces(projectId: number, options?: AgentTracesOptions): Promise<Result<OffsetPaginatedResponse<AgentTraceSummary>, RustrakError>>;
1149
+ getSummary(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentSummary, RustrakError>>;
1150
+ getModelsTable(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentModelRow[], RustrakError>>;
1151
+ getToolsTable(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentToolRow[], RustrakError>>;
1152
+ getEnvironments(projectId: number): Promise<Result<string[], RustrakError>>;
1070
1153
  }
1071
1154
 
1072
1155
  declare class AlertIntegrationsResource extends BaseResource {
@@ -1092,6 +1175,7 @@ declare class AuthResource extends BaseResource {
1092
1175
  login(credentials: LoginRequest): Promise<Result<LoginResult, RustrakError>>;
1093
1176
  logout(): Promise<Result<string[], RustrakError>>;
1094
1177
  getCurrentUser(): Promise<Result<User, RustrakError>>;
1178
+ updatePreferences(preferences: UpdatePreferencesRequest): Promise<Result<User, RustrakError>>;
1095
1179
  getInvitation(token: string): Promise<Result<InvitationInfo, RustrakError>>;
1096
1180
  acceptInvitation(input: AcceptInvitation): Promise<Result<LoginResult, RustrakError>>;
1097
1181
  private readLoginResult;
@@ -1183,6 +1267,7 @@ declare class SourceMapsResource extends BaseResource {
1183
1267
 
1184
1268
  declare class SpansResource extends BaseResource {
1185
1269
  list(projectId: number, options?: ListSpansOptions): Promise<Result<OffsetPaginatedResponse<Span>, RustrakError>>;
1270
+ get(projectId: number, spanId: string): Promise<Result<SpanDetail, RustrakError>>;
1186
1271
  }
1187
1272
 
1188
1273
  declare class StatsResource extends BaseResource {
@@ -1248,4 +1333,4 @@ declare class RustrakClient {
1248
1333
  constructor(config: ClientConfig);
1249
1334
  }
1250
1335
 
1251
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
1336
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
package/dist/index.d.ts CHANGED
@@ -121,24 +121,61 @@ declare const agentTraceSummarySchema: z.ZodObject<{
121
121
  duration_ms: z.ZodNullable<z.ZodNumber>;
122
122
  total_tokens: z.ZodNumber;
123
123
  tool_call_count: z.ZodNumber;
124
+ llm_call_count: z.ZodNumber;
125
+ error_count: z.ZodNumber;
124
126
  started_at: z.ZodString;
125
127
  }, z.core.$strip>;
128
+ declare const agentSummarySchema: z.ZodObject<{
129
+ agent_runs: z.ZodNumber;
130
+ llm_calls: z.ZodNumber;
131
+ tool_calls: z.ZodNumber;
132
+ error_count: z.ZodNumber;
133
+ total_tokens: z.ZodNumber;
134
+ avg_duration_ms: z.ZodNumber;
135
+ p95_duration_ms: z.ZodNumber;
136
+ }, z.core.$strip>;
137
+ declare const agentModelRowSchema: z.ZodObject<{
138
+ model: z.ZodString;
139
+ requests: z.ZodNumber;
140
+ errors: z.ZodNumber;
141
+ avg_ms: z.ZodNumber;
142
+ p95_ms: z.ZodNumber;
143
+ input_tokens: z.ZodNumber;
144
+ cached_input_tokens: z.ZodNumber;
145
+ output_tokens: z.ZodNumber;
146
+ reasoning_output_tokens: z.ZodNumber;
147
+ total_tokens: z.ZodNumber;
148
+ }, z.core.$strip>;
149
+ declare const agentToolRowSchema: z.ZodObject<{
150
+ tool: z.ZodString;
151
+ calls: z.ZodNumber;
152
+ errors: z.ZodNumber;
153
+ avg_ms: z.ZodNumber;
154
+ p95_ms: z.ZodNumber;
155
+ }, z.core.$strip>;
126
156
 
127
157
  type AgentTimeseriesPoint = z.infer<typeof agentTimeseriesPointSchema>;
128
158
  type AgentDurationPoint = z.infer<typeof agentDurationPointSchema>;
129
159
  type GenAiBreakdownRow = z.infer<typeof genAiBreakdownRowSchema>;
130
160
  type AgentTraceSummary = z.infer<typeof agentTraceSummarySchema>;
161
+ type AgentSummary = z.infer<typeof agentSummarySchema>;
162
+ type AgentModelRow = z.infer<typeof agentModelRowSchema>;
163
+ type AgentToolRow = z.infer<typeof agentToolRowSchema>;
131
164
  interface AgentTimeseriesOptions {
132
165
  period_hours?: number;
133
166
  interval_hours?: number;
167
+ environment?: string;
134
168
  }
135
169
  interface AgentBreakdownOptions {
136
170
  period_hours?: number;
137
171
  limit?: number;
172
+ environment?: string;
138
173
  }
139
174
  interface AgentTracesOptions {
140
175
  page?: number;
141
176
  per_page?: number;
177
+ period_hours?: number;
178
+ environment?: string;
142
179
  }
143
180
 
144
181
  declare const providerTypeSchema: z.ZodEnum<{
@@ -979,6 +1016,36 @@ declare const spanSchema: z.ZodObject<{
979
1016
  gen_ai_usage_output_tokens: z.ZodNullable<z.ZodNumber>;
980
1017
  gen_ai_usage_total_tokens: z.ZodNullable<z.ZodNumber>;
981
1018
  }, z.core.$strip>;
1019
+ declare const spanDetailSchema: z.ZodObject<{
1020
+ id: z.ZodString;
1021
+ transaction_id: z.ZodNullable<z.ZodString>;
1022
+ span_id: z.ZodNullable<z.ZodString>;
1023
+ trace_id: z.ZodNullable<z.ZodString>;
1024
+ parent_span_id: z.ZodNullable<z.ZodString>;
1025
+ op: z.ZodNullable<z.ZodString>;
1026
+ description: z.ZodNullable<z.ZodString>;
1027
+ status: z.ZodNullable<z.ZodString>;
1028
+ start_timestamp: z.ZodNullable<z.ZodString>;
1029
+ timestamp: z.ZodNullable<z.ZodString>;
1030
+ duration_ms: z.ZodNullable<z.ZodNumber>;
1031
+ exclusive_time_ms: z.ZodNullable<z.ZodNumber>;
1032
+ is_segment: z.ZodBoolean;
1033
+ segment_id: z.ZodNullable<z.ZodString>;
1034
+ platform: z.ZodNullable<z.ZodString>;
1035
+ release: z.ZodNullable<z.ZodString>;
1036
+ environment: z.ZodNullable<z.ZodString>;
1037
+ gen_ai_operation_type: z.ZodNullable<z.ZodString>;
1038
+ gen_ai_agent_name: z.ZodNullable<z.ZodString>;
1039
+ gen_ai_request_model: z.ZodNullable<z.ZodString>;
1040
+ gen_ai_response_model: z.ZodNullable<z.ZodString>;
1041
+ gen_ai_tool_name: z.ZodNullable<z.ZodString>;
1042
+ gen_ai_conversation_id: z.ZodNullable<z.ZodString>;
1043
+ gen_ai_usage_input_tokens: z.ZodNullable<z.ZodNumber>;
1044
+ gen_ai_usage_output_tokens: z.ZodNullable<z.ZodNumber>;
1045
+ gen_ai_usage_total_tokens: z.ZodNullable<z.ZodNumber>;
1046
+ attributes: z.ZodRecord<z.ZodString, z.ZodAny>;
1047
+ tags: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
1048
+ }, z.core.$strip>;
982
1049
  declare const transactionStatsSchema: z.ZodObject<{
983
1050
  transaction_name: z.ZodString;
984
1051
  op: z.ZodNullable<z.ZodString>;
@@ -992,6 +1059,7 @@ declare const transactionStatsSchema: z.ZodObject<{
992
1059
  type Transaction = z.infer<typeof transactionSchema>;
993
1060
  type TransactionDetail = z.infer<typeof transactionDetailSchema>;
994
1061
  type Span = z.infer<typeof spanSchema>;
1062
+ type SpanDetail = z.infer<typeof spanDetailSchema>;
995
1063
  type TransactionStats = z.infer<typeof transactionStatsSchema>;
996
1064
  interface ListSpansOptions {
997
1065
  page?: number;
@@ -1010,6 +1078,12 @@ declare const userSchema: z.ZodObject<{
1010
1078
  member: "member";
1011
1079
  }>;
1012
1080
  is_admin: z.ZodBoolean;
1081
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1082
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1083
+ }, z.core.$strip>;
1084
+ declare const updatePreferencesRequestSchema: z.ZodObject<{
1085
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1086
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1013
1087
  }, z.core.$strip>;
1014
1088
  declare const authResponseSchema: z.ZodObject<{
1015
1089
  user: z.ZodObject<{
@@ -1020,6 +1094,8 @@ declare const authResponseSchema: z.ZodObject<{
1020
1094
  member: "member";
1021
1095
  }>;
1022
1096
  is_admin: z.ZodBoolean;
1097
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1098
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1023
1099
  }, z.core.$strip>;
1024
1100
  }, z.core.$strip>;
1025
1101
  declare const loginResultSchema: z.ZodObject<{
@@ -1031,6 +1107,8 @@ declare const loginResultSchema: z.ZodObject<{
1031
1107
  member: "member";
1032
1108
  }>;
1033
1109
  is_admin: z.ZodBoolean;
1110
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1111
+ timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1034
1112
  }, z.core.$strip>;
1035
1113
  cookies: z.ZodArray<z.ZodString>;
1036
1114
  }, z.core.$strip>;
@@ -1044,6 +1122,7 @@ declare const registerRequestSchema: z.ZodObject<{
1044
1122
  }, z.core.$strip>;
1045
1123
 
1046
1124
  type User = z.infer<typeof userSchema>;
1125
+ type UpdatePreferencesRequest = z.infer<typeof updatePreferencesRequestSchema>;
1047
1126
  type AuthResponse = z.infer<typeof authResponseSchema>;
1048
1127
  type LoginResult = z.infer<typeof loginResultSchema>;
1049
1128
  type LoginRequest = z.infer<typeof loginRequestSchema>;
@@ -1067,6 +1146,10 @@ declare class AgentsResource extends BaseResource {
1067
1146
  getModelsByTokens(projectId: number, options?: AgentBreakdownOptions): Promise<Result<GenAiBreakdownRow[], RustrakError>>;
1068
1147
  getTools(projectId: number, options?: AgentBreakdownOptions): Promise<Result<GenAiBreakdownRow[], RustrakError>>;
1069
1148
  getTraces(projectId: number, options?: AgentTracesOptions): Promise<Result<OffsetPaginatedResponse<AgentTraceSummary>, RustrakError>>;
1149
+ getSummary(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentSummary, RustrakError>>;
1150
+ getModelsTable(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentModelRow[], RustrakError>>;
1151
+ getToolsTable(projectId: number, options?: AgentBreakdownOptions): Promise<Result<AgentToolRow[], RustrakError>>;
1152
+ getEnvironments(projectId: number): Promise<Result<string[], RustrakError>>;
1070
1153
  }
1071
1154
 
1072
1155
  declare class AlertIntegrationsResource extends BaseResource {
@@ -1092,6 +1175,7 @@ declare class AuthResource extends BaseResource {
1092
1175
  login(credentials: LoginRequest): Promise<Result<LoginResult, RustrakError>>;
1093
1176
  logout(): Promise<Result<string[], RustrakError>>;
1094
1177
  getCurrentUser(): Promise<Result<User, RustrakError>>;
1178
+ updatePreferences(preferences: UpdatePreferencesRequest): Promise<Result<User, RustrakError>>;
1095
1179
  getInvitation(token: string): Promise<Result<InvitationInfo, RustrakError>>;
1096
1180
  acceptInvitation(input: AcceptInvitation): Promise<Result<LoginResult, RustrakError>>;
1097
1181
  private readLoginResult;
@@ -1183,6 +1267,7 @@ declare class SourceMapsResource extends BaseResource {
1183
1267
 
1184
1268
  declare class SpansResource extends BaseResource {
1185
1269
  list(projectId: number, options?: ListSpansOptions): Promise<Result<OffsetPaginatedResponse<Span>, RustrakError>>;
1270
+ get(projectId: number, spanId: string): Promise<Result<SpanDetail, RustrakError>>;
1186
1271
  }
1187
1272
 
1188
1273
  declare class StatsResource extends BaseResource {
@@ -1248,4 +1333,4 @@ declare class RustrakClient {
1248
1333
  constructor(config: ClientConfig);
1249
1334
  }
1250
1335
 
1251
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
1336
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
package/dist/index.js CHANGED
@@ -53,8 +53,40 @@ var agentTraceSummarySchema = z.object({
53
53
  duration_ms: z.number().nullable(),
54
54
  total_tokens: z.number(),
55
55
  tool_call_count: z.number().int(),
56
+ /** `ai_client` spans: how many times a model was actually called. */
57
+ llm_call_count: z.number().int(),
58
+ /** AI spans in this trace whose status is set and not `ok`. */
59
+ error_count: z.number().int(),
56
60
  started_at: dateTimeSchema
57
61
  });
62
+ var agentSummarySchema = z.object({
63
+ agent_runs: z.number().int(),
64
+ llm_calls: z.number().int(),
65
+ tool_calls: z.number().int(),
66
+ error_count: z.number().int(),
67
+ total_tokens: z.number(),
68
+ avg_duration_ms: z.number(),
69
+ p95_duration_ms: z.number()
70
+ });
71
+ var agentModelRowSchema = z.object({
72
+ model: z.string(),
73
+ requests: z.number().int(),
74
+ errors: z.number().int(),
75
+ avg_ms: z.number(),
76
+ p95_ms: z.number(),
77
+ input_tokens: z.number(),
78
+ cached_input_tokens: z.number(),
79
+ output_tokens: z.number(),
80
+ reasoning_output_tokens: z.number(),
81
+ total_tokens: z.number()
82
+ });
83
+ var agentToolRowSchema = z.object({
84
+ tool: z.string(),
85
+ calls: z.number().int(),
86
+ errors: z.number().int(),
87
+ avg_ms: z.number(),
88
+ p95_ms: z.number()
89
+ });
58
90
  var providerTypeSchema = z.enum(["webhook", "email", "slack"]);
59
91
  var alertTypeSchema = z.enum(["new_issue", "regression", "unmute"]);
60
92
  var alertStatusSchema = z.enum([
@@ -592,7 +624,7 @@ var spanSchema = z.object({
592
624
  exclusive_time_ms: z.number().nullable(),
593
625
  is_segment: z.boolean(),
594
626
  segment_id: z.string().nullable(),
595
- /** Only ever set for standalone spans — a transaction-embedded span has no parent row to inherit these from. */
627
+ /** Reported by the span itself, or stamped from its parent transaction. Null only for rows ingested before that stamping existed. */
596
628
  platform: z.string().nullable(),
597
629
  release: z.string().nullable(),
598
630
  environment: z.string().nullable(),
@@ -607,6 +639,11 @@ var spanSchema = z.object({
607
639
  gen_ai_usage_output_tokens: z.number().nullable(),
608
640
  gen_ai_usage_total_tokens: z.number().nullable()
609
641
  });
642
+ var spanDetailSchema = spanSchema.extend({
643
+ attributes: z.record(z.string(), z.any()),
644
+ /** Always absent for a Spans Protocol v2 span: v2 has no tags concept. */
645
+ tags: z.record(z.string(), z.any()).nullish()
646
+ });
610
647
  var transactionStatsSchema = z.object({
611
648
  transaction_name: z.string(),
612
649
  op: z.string().nullable(),
@@ -620,7 +657,21 @@ var userSchema = z.object({
620
657
  id: z.number().int().positive(),
621
658
  email: z.string().email(),
622
659
  role: globalRoleSchema,
623
- is_admin: z.boolean()
660
+ is_admin: z.boolean(),
661
+ /**
662
+ * The dashboard language this user chose.
663
+ *
664
+ * `null` means they never chose one, which a consumer should treat as
665
+ * "infer it" rather than as English. Optional as well as nullable so a
666
+ * client stays compatible with a server predating the column.
667
+ */
668
+ language: z.string().nullable().optional(),
669
+ /** The IANA timezone this user chose, `null` when they never chose one. */
670
+ timezone: z.string().nullable().optional()
671
+ });
672
+ var updatePreferencesRequestSchema = z.object({
673
+ language: z.string().nullable().optional(),
674
+ timezone: z.string().nullable().optional()
624
675
  });
625
676
  var authResponseSchema = z.object({
626
677
  user: userSchema
@@ -985,6 +1036,9 @@ function timeseriesSearchParams(options) {
985
1036
  if (options?.interval_hours) {
986
1037
  searchParams.interval_hours = String(options.interval_hours);
987
1038
  }
1039
+ if (options?.environment) {
1040
+ searchParams.environment = options.environment;
1041
+ }
988
1042
  return searchParams;
989
1043
  }
990
1044
  function breakdownSearchParams(options) {
@@ -995,6 +1049,9 @@ function breakdownSearchParams(options) {
995
1049
  if (options?.limit) {
996
1050
  searchParams.limit = String(options.limit);
997
1051
  }
1052
+ if (options?.environment) {
1053
+ searchParams.environment = options.environment;
1054
+ }
998
1055
  return searchParams;
999
1056
  }
1000
1057
  var AgentsResource = class extends BaseResource {
@@ -1065,6 +1122,12 @@ var AgentsResource = class extends BaseResource {
1065
1122
  if (options?.per_page) {
1066
1123
  searchParams.per_page = String(options.per_page);
1067
1124
  }
1125
+ if (options?.period_hours) {
1126
+ searchParams.period_hours = String(options.period_hours);
1127
+ }
1128
+ if (options?.environment) {
1129
+ searchParams.environment = options.environment;
1130
+ }
1068
1131
  return this.request(
1069
1132
  () => this.http.get(`api/projects/${projectId}/agents/traces`, {
1070
1133
  searchParams
@@ -1072,6 +1135,50 @@ var AgentsResource = class extends BaseResource {
1072
1135
  offsetPaginatedResponseSchema(agentTraceSummarySchema)
1073
1136
  );
1074
1137
  }
1138
+ /**
1139
+ * Headline totals over the selected window — the numbers the charts show
1140
+ * the shape of but cannot state.
1141
+ */
1142
+ async getSummary(projectId, options) {
1143
+ return this.request(
1144
+ () => this.http.get(`api/projects/${projectId}/agents/summary`, {
1145
+ searchParams: breakdownSearchParams(options)
1146
+ }),
1147
+ agentSummarySchema
1148
+ );
1149
+ }
1150
+ /**
1151
+ * Per-model table: volume, failures, latency and the full token split.
1152
+ */
1153
+ async getModelsTable(projectId, options) {
1154
+ return this.request(
1155
+ () => this.http.get(`api/projects/${projectId}/agents/models`, {
1156
+ searchParams: breakdownSearchParams(options)
1157
+ }),
1158
+ z.array(agentModelRowSchema)
1159
+ );
1160
+ }
1161
+ /**
1162
+ * Per-tool table: call volume, failures and latency.
1163
+ */
1164
+ async getToolsTable(projectId, options) {
1165
+ return this.request(
1166
+ () => this.http.get(`api/projects/${projectId}/agents/tools/stats`, {
1167
+ searchParams: breakdownSearchParams(options)
1168
+ }),
1169
+ z.array(agentToolRowSchema)
1170
+ );
1171
+ }
1172
+ /**
1173
+ * Environments present in this project's AI spans — the options the filter
1174
+ * offers, read from the data rather than hardcoded.
1175
+ */
1176
+ async getEnvironments(projectId) {
1177
+ return this.request(
1178
+ () => this.http.get(`api/projects/${projectId}/agents/environments`),
1179
+ z.array(z.string())
1180
+ );
1181
+ }
1075
1182
  };
1076
1183
  var AlertIntegrationsResource = class extends BaseResource {
1077
1184
  /**
@@ -1301,6 +1408,24 @@ var AuthResource = class extends BaseResource {
1301
1408
  async getCurrentUser() {
1302
1409
  return this.request(() => this.http.get("auth/me"), userSchema);
1303
1410
  }
1411
+ /**
1412
+ * Stores how this reader wants the dashboard presented to them.
1413
+ *
1414
+ * A key left out is left alone; a key sent as `null` is cleared. That is why
1415
+ * the request type is optional *and* nullable rather than one or the other:
1416
+ * "do not touch" and "forget my choice" are different instructions.
1417
+ */
1418
+ async updatePreferences(preferences) {
1419
+ const validatedInput = this.validateInput(
1420
+ preferences,
1421
+ updatePreferencesRequestSchema
1422
+ );
1423
+ if (!validatedInput.success) return validatedInput;
1424
+ return this.request(
1425
+ () => this.http.patch("auth/me", { json: validatedInput.data }),
1426
+ userSchema
1427
+ );
1428
+ }
1304
1429
  /**
1305
1430
  * Get the details of a pending invitation by its token (public endpoint)
1306
1431
  * Used by the accept-invitation page before the user has an account
@@ -1986,6 +2111,20 @@ var SpansResource = class extends BaseResource {
1986
2111
  offsetPaginatedResponseSchema(spanSchema)
1987
2112
  );
1988
2113
  }
2114
+ /**
2115
+ * Fetch one span together with its raw attribute bag — the `gen_ai.*`
2116
+ * payload (prompts, responses, tool arguments and results) that `list()`
2117
+ * omits so a trace's worth of spans stays cheap to load.
2118
+ *
2119
+ * `spanId` is the row id from a list item's `id`, not the SDK's 16-hex
2120
+ * `span_id`.
2121
+ */
2122
+ async get(projectId, spanId) {
2123
+ return this.request(
2124
+ () => this.http.get(`api/projects/${projectId}/spans/${spanId}`),
2125
+ spanDetailSchema
2126
+ );
2127
+ }
1989
2128
  };
1990
2129
 
1991
2130
  // src/resources/stats.ts