@thinkhive/sdk 3.1.1 → 4.0.0

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
@@ -11,13 +11,35 @@
11
11
  * @license MIT
12
12
  */
13
13
  import { isInitialized, SDK_VERSION, DEFAULT_ENDPOINT } from './core/config';
14
- import { ThinkHiveApiError, ThinkHiveValidationError } from './core/client';
14
+ import { ThinkHiveError, ThinkHiveApiError, ThinkHiveValidationError, PermissionDeniedError, AgentScopeError, RateLimitError, IpWhitelistError } from './core/client';
15
15
  import { runs, createRunWithContext, toOpenAIMessages, fromOpenAIMessages } from './api/runs';
16
16
  import { claims, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory } from './api/claims';
17
17
  import { calibration, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality } from './api/calibration';
18
+ import { humanReview } from './api/human-review';
19
+ import { nondeterminism, calculatePassAtK, calculatePassToK, requiredPassRateForPassAtK, isReliableEvaluation, getReliabilityRecommendation } from './api/nondeterminism';
20
+ import { evalHealth, hasHealthIssue, getSeverityLevel as getHealthSeverityLevel, isSaturated, getSaturationRecommendation } from './api/eval-health';
21
+ import { deterministicGraders, createRegexRule, createContainsRule, createLengthRule, createJsonSchemaRule, allRulesPassed, getFailedRules, calculateAverageScore } from './api/deterministic-graders';
22
+ import { conversationEval, aggregateWorst, aggregateAverage, aggregateWeighted, aggregateFinalTurn, aggregateMajority, getAggregator, getProblematicTurns, analyzeConversationTrend } from './api/conversation-eval';
23
+ import { transcriptPatterns, isHighRisk, getMatchesByCategory, getCriticalInsights, hasPiiExposure, hasFrustrationSignals, hasEscalationRequest, getCategoryDistribution, getRecommendations, needsAttention, sortMatchesBySeverity } from './api/transcript-patterns';
24
+ import { agents } from './api/agents';
25
+ import { apiKeys, hasPermission, isExpired as isApiKeyExpired, isValid as isApiKeyValid, getTimeUntilExpiry, canAccessAgent } from './api/apiKeys';
26
+ import { roiAnalytics, calculateRevenueAtRisk, calculateAutomationSavings, formatCurrency, getROIQuality } from './api/roi-analytics';
27
+ import { businessMetrics, isMetricReady, needsMoreTraces, awaitingExternalData, isMetricStale, getStatusMessage, getTraceProgress, formatMetricValue, getTrendEmoji } from './api/business-metrics';
28
+ import { qualityMetrics, passesQualityThreshold, isHallucinationRiskAcceptable, getQualityRecommendations, formatQualityScore, getGradeColor } from './api/quality-metrics';
18
29
  import { linking, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE } from './integrations/ticket-linking';
19
30
  import { customerContext, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend } from './integrations/customer-context';
20
- export type { InitOptions, Framework, RunOptions, RunOutcome, ConversationMessage, CustomerContextSnapshot, TicketLinkingOptions, LinkMethod, TraceOptions, SpanData, BusinessContext, Claim, ClaimType, ClaimCategory, ConfidenceCalibration, EvidenceReference, AnalysisResult, CalibrationStatus, CalibrationBucket, PredictionType, RoiConfig, RoiSummary, ExplainabilityResult, ApiResponse, PaginatedResponse, RunResponse, } from './core/types';
31
+ export type { InitOptions, Framework, RunOptions, RunOutcome, ConversationMessage, CustomerContextSnapshot, TicketLinkingOptions, LinkMethod, TraceOptions, TraceCustomFlag, SpanData, BusinessContext, Claim, ClaimType, ClaimCategory, ConfidenceCalibration, EvidenceReference, AnalysisResult, CalibrationStatus, CalibrationBucket, PredictionType, RoiConfig, RoiSummary, ExplainabilityResult, ApiResponse, PaginatedResponse, RunResponse, } from './core/types';
32
+ export type { HumanReviewStatus, HumanReviewType, HumanReviewQueueItem, CalibrationSet, ReviewerCalibration, QueueStats, } from './api/human-review';
33
+ export type { NondeterminismRunType, NondeterminismRunStatus, NondeterminismRun, NondeterminismSample, TraceAnalysis, CriterionAnalysis, RunSummary, } from './api/nondeterminism';
34
+ export type { SaturationType, HealthStatus, RegressionSeverity, EvalHealthSnapshot, EvalRegression, HealthReport, } from './api/eval-health';
35
+ export type { RuleType, DeterministicEvalResult, RuleResult, RuleTypeInfo, RuleTemplate, } from './api/deterministic-graders';
36
+ export type { AggregateMethod, SessionTrace, TurnEvaluation, ConversationEvalResult, AggregationMethodInfo, } from './api/conversation-eval';
37
+ export type { PatternCategory, PatternOutcome, PatternSeverity, PatternMatch, PatternInsight, AnalysisResult as PatternAnalysisResult, PatternCategoryInfo, BuiltInPattern, } from './api/transcript-patterns';
38
+ export type { ApiKeyPermissions, ScopeType, Environment, CreateApiKeyOptions, ApiKey, CreateApiKeyResult, } from './api/apiKeys';
39
+ export type { IndustryConfig, CustomIndustryConfig, ROIMetrics, BusinessImpact, ROISummary, TrendDataPoint, Correlation, PatternCluster, CorrelationAnalysis, } from './api/roi-analytics';
40
+ export type { RetrievedContext, GroundTruthContext, GroundedSpan, UngroundedSpan, CitationMap, RAGEvaluation, RAGEvidence, HallucinationInstance, HallucinationReport, GroundednessResult, BatchEvaluationResult, BatchEvaluationSummary, } from './api/quality-metrics';
41
+ export type { MetricTrend, MetricStatus, CurrentMetricResponse, MetricHistoryPoint, MetricHistorySummary, MetricHistoryResponse, RecordMetricOptions, RecordMetricResponse, } from './api/business-metrics';
42
+ export type { Agent, CreateAgentOptions, UpdateAgentOptions, AgentConfig, UpdateAgentConfigOptions, DeleteAgentOptions, CascadeImpact, } from './api/agents';
21
43
  /**
22
44
  * Initialize ThinkHive SDK v3
23
45
  *
@@ -75,52 +97,128 @@ export declare function traceChain<T>(options: {
75
97
  input?: unknown;
76
98
  }, fn: () => Promise<T>): Promise<T>;
77
99
  /**
78
- * Explainer API client (v2 compatibility)
79
- * @deprecated Use runs and claims APIs instead
100
+ * Issues API client
101
+ * This is the recommended API for managing clustered failure patterns
102
+ *
103
+ * @since 3.1.0
80
104
  */
81
- export declare const explainer: {
105
+ export declare const issues: {
106
+ /**
107
+ * List issues for an agent
108
+ */
109
+ list(agentId: string, options?: {
110
+ status?: string;
111
+ startDate?: Date;
112
+ endDate?: Date;
113
+ limit?: number;
114
+ offset?: number;
115
+ }): Promise<any[]>;
116
+ /**
117
+ * Get a single issue by ID
118
+ */
119
+ get(id: string): Promise<any>;
82
120
  /**
83
- * Analyze a trace (v2 format)
84
- * @deprecated Use runs.create() + claims.getRunAnalysis() instead
121
+ * Create a new issue
85
122
  */
86
- analyze(traceData: import("./core/types").TraceOptions, options?: {
87
- tier?: string;
88
- includeRagEvaluation?: boolean;
89
- includeHallucinationCheck?: boolean;
90
- waitForResult?: boolean;
91
- webhookUrl?: string;
92
- }): Promise<import("./core/types").ExplainabilityResult>;
123
+ create(data: {
124
+ agentId: string;
125
+ title: string;
126
+ description?: string;
127
+ type: string;
128
+ severity?: string;
129
+ pattern?: string;
130
+ exampleTraceIds?: string[];
131
+ }): Promise<any>;
132
+ /**
133
+ * Update an issue
134
+ */
135
+ update(id: string, data: {
136
+ title?: string;
137
+ description?: string;
138
+ status?: string;
139
+ severity?: string;
140
+ assignedTo?: string;
141
+ resolutionNotes?: string;
142
+ }): Promise<any>;
143
+ /**
144
+ * Get fixes for an issue
145
+ */
146
+ getFixes(issueId: string): Promise<any[]>;
147
+ };
148
+ /**
149
+ * Analyzer API client
150
+ * User-selected trace analysis with cost estimation and smart sampling
151
+ *
152
+ * Key improvements over v1 Explainer:
153
+ * - User-selected trace analysis (not automatic)
154
+ * - Cost estimation before execution
155
+ * - Smart sampling strategies
156
+ * - Root cause analysis by layer
157
+ * - Pattern aggregation across traces
158
+ *
159
+ * @since 3.1.0
160
+ */
161
+ export declare const analyzer: {
93
162
  /**
94
- * Get a previously analyzed trace
95
- * @deprecated
163
+ * Analyze specific traces (user-selected)
96
164
  */
97
- get(traceId: string): Promise<import("./core/types").ExplainabilityResult>;
165
+ analyze(options: {
166
+ traceIds: string[];
167
+ tier?: "fast" | "standard" | "deep";
168
+ includeRootCause?: boolean;
169
+ includeLayers?: boolean;
170
+ }): Promise<any>;
98
171
  /**
99
- * Search traces semantically
100
- * @deprecated
172
+ * Analyze traces by time window
101
173
  */
102
- search(params: {
103
- query: string;
174
+ analyzeWindow(options: {
175
+ agentId: string;
176
+ startDate: Date;
177
+ endDate: Date;
104
178
  filters?: {
105
- outcome?: string;
106
- minImpactScore?: number;
107
- dateRange?: {
108
- from: Date;
109
- to: Date;
110
- };
179
+ outcomes?: ("failure" | "error" | "success")[];
180
+ minSeverity?: "low" | "medium" | "high" | "critical";
111
181
  };
112
- limit?: number;
182
+ sampling?: {
183
+ strategy: "all" | "failures_only" | "smart" | "random";
184
+ samplePercent?: number;
185
+ };
186
+ }): Promise<any>;
187
+ /**
188
+ * Estimate cost before running analysis
189
+ */
190
+ estimateCost(options: {
191
+ traceIds?: string[];
192
+ agentId?: string;
193
+ startDate?: Date;
194
+ endDate?: Date;
195
+ tier: "fast" | "standard" | "deep";
113
196
  }): Promise<{
114
- results: Array<import("./core/types").ExplainabilityResult & {
115
- similarity: number;
116
- }>;
117
- total: number;
197
+ estimatedTraces: number;
198
+ estimatedTokens: number;
199
+ estimatedCost: number;
200
+ estimatedCredits: number;
201
+ tier: string;
202
+ note: string;
118
203
  }>;
204
+ /**
205
+ * Get analysis results for a specific trace
206
+ */
207
+ get(traceId: string): Promise<any>;
208
+ /**
209
+ * Aggregate insights across multiple analyzed traces
210
+ */
211
+ summarize(options: {
212
+ analysisIds?: string[];
213
+ agentId?: string;
214
+ startDate?: Date;
215
+ endDate?: Date;
216
+ }): Promise<any>;
119
217
  };
120
218
  export { isInitialized, SDK_VERSION, DEFAULT_ENDPOINT };
121
- export { runs, claims, calibration, linking, customerContext, };
122
- export { createRunWithContext, toOpenAIMessages, fromOpenAIMessages, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend, };
123
- export { ThinkHiveApiError, ThinkHiveValidationError };
219
+ export { runs, claims, calibration, linking, customerContext, humanReview, nondeterminism, evalHealth, deterministicGraders, conversationEval, transcriptPatterns, apiKeys, agents, roiAnalytics, qualityMetrics, businessMetrics, };
220
+ export { createRunWithContext, toOpenAIMessages, fromOpenAIMessages, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend, calculatePassAtK, calculatePassToK, requiredPassRateForPassAtK, isReliableEvaluation, getReliabilityRecommendation, hasHealthIssue, getHealthSeverityLevel, isSaturated, getSaturationRecommendation, createRegexRule, createContainsRule, createLengthRule, createJsonSchemaRule, allRulesPassed, getFailedRules, calculateAverageScore, aggregateWorst, aggregateAverage, aggregateWeighted, aggregateFinalTurn, aggregateMajority, getAggregator, getProblematicTurns, analyzeConversationTrend, isHighRisk, getMatchesByCategory, getCriticalInsights, hasPiiExposure, hasFrustrationSignals, hasEscalationRequest, getCategoryDistribution, getRecommendations, needsAttention, sortMatchesBySeverity, hasPermission, isApiKeyExpired, isApiKeyValid, getTimeUntilExpiry, canAccessAgent, calculateRevenueAtRisk, calculateAutomationSavings, formatCurrency, getROIQuality, passesQualityThreshold, isHallucinationRiskAcceptable, getQualityRecommendations, formatQualityScore, getGradeColor, isMetricReady, needsMoreTraces, awaitingExternalData, isMetricStale, getStatusMessage, getTraceProgress, formatMetricValue, getTrendEmoji, };
221
+ export { ThinkHiveError, ThinkHiveApiError, ThinkHiveValidationError, PermissionDeniedError, AgentScopeError, RateLimitError, IpWhitelistError, };
124
222
  declare const _default: {
125
223
  init: typeof init;
126
224
  getTracer: typeof getTracer;
@@ -209,11 +307,6 @@ declare const _default: {
209
307
  calibration: {
210
308
  status(agentId: string, predictionType: import("./core/types").PredictionType): Promise<import("./core/types").CalibrationStatus>;
211
309
  allMetrics(agentId: string): Promise<import("./api/calibration").CalibrationMetrics[]>;
212
- recordOutcome(input: import("./api/calibration").RecordOutcomeInput): Promise<{
213
- recorded: boolean;
214
- brierContribution: number;
215
- message: string;
216
- }>;
217
310
  retrain(agentId: string, options?: {
218
311
  predictionTypes?: import("./core/types").PredictionType[];
219
312
  minSamples?: number;
@@ -226,15 +319,6 @@ declare const _default: {
226
319
  }>;
227
320
  newMetrics: import("./api/calibration").CalibrationMetrics[];
228
321
  }>;
229
- reliabilityDiagram(agentId: string, predictionType: import("./core/types").PredictionType): Promise<{
230
- agentId: string;
231
- predictionType: import("./core/types").PredictionType;
232
- buckets: import("./core/types").CalibrationBucket[];
233
- perfectCalibrationLine: Array<{
234
- x: number;
235
- y: number;
236
- }>;
237
- }>;
238
322
  };
239
323
  linking: {
240
324
  create(input: import("./integrations/ticket-linking").CreateLinkInput): Promise<import("./integrations/ticket-linking").LinkResponse>;
@@ -288,44 +372,302 @@ declare const _default: {
288
372
  getLatestSnapshot(customerId: string): Promise<import("./integrations/customer-context").CustomerMetricsSnapshot | null>;
289
373
  getSnapshotAsOf(customerId: string, timestamp: string | Date): Promise<import("./integrations/customer-context").CustomerMetricsSnapshot | null>;
290
374
  };
291
- explainer: {
375
+ humanReview: {
376
+ getQueue(options?: import("./api/human-review").ListQueueOptions): Promise<import("./api/human-review").HumanReviewQueueItem[]>;
377
+ addToQueue(options: import("./api/human-review").AddToQueueOptions): Promise<import("./api/human-review").HumanReviewQueueItem>;
378
+ getItem(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
379
+ claim(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
380
+ release(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
381
+ skip(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
382
+ submit(itemId: string, review: import("./api/human-review").SubmitReviewOptions): Promise<import("./api/human-review").HumanReviewQueueItem>;
383
+ getStats(agentId?: string): Promise<import("./api/human-review").QueueStats>;
384
+ getNextItem(agentId?: string): Promise<import("./api/human-review").HumanReviewQueueItem | null>;
385
+ getReviewTypes(): Promise<Array<{
386
+ id: string;
387
+ name: string;
388
+ description: string;
389
+ autoTrigger: boolean;
390
+ }>>;
391
+ getCalibrationSets(agentId?: string): Promise<import("./api/human-review").CalibrationSet[]>;
392
+ createCalibrationSet(options: import("./api/human-review").CreateCalibrationSetOptions): Promise<import("./api/human-review").CalibrationSet>;
393
+ getCalibrationSet(setId: string): Promise<import("./api/human-review").CalibrationSet>;
394
+ getCertifiedReviewers(calibrationSetId: string): Promise<import("./api/human-review").ReviewerCalibration[]>;
395
+ getReviewerCalibrations(userId: string): Promise<import("./api/human-review").ReviewerCalibration[]>;
396
+ };
397
+ nondeterminism: {
398
+ createRun(options: import("./api/nondeterminism").CreateRunOptions): Promise<import("./api/nondeterminism").NondeterminismRun>;
399
+ getRuns(options?: import("./api/nondeterminism").ListRunsOptions): Promise<import("./api/nondeterminism").NondeterminismRun[]>;
400
+ getRun(runId: string): Promise<import("./api/nondeterminism").NondeterminismRun>;
401
+ startRun(runId: string): Promise<void>;
402
+ completeRun(runId: string): Promise<void>;
403
+ recordSample(options: import("./api/nondeterminism").RecordSampleOptions): Promise<import("./api/nondeterminism").NondeterminismSample>;
404
+ getSamples(runId: string): Promise<import("./api/nondeterminism").NondeterminismSample[]>;
405
+ getRunSummary(runId: string): Promise<import("./api/nondeterminism").RunSummary>;
406
+ analyzeRun(runId: string): Promise<import("./api/nondeterminism").RunSummary>;
407
+ getInfo(): Promise<import("./api/nondeterminism").PassAtKInfo>;
408
+ };
409
+ evalHealth: {
410
+ getReport(agentId: string): Promise<import("./api/eval-health").HealthReport>;
411
+ getSnapshots(options: import("./api/eval-health").GetSnapshotsOptions): Promise<import("./api/eval-health").EvalHealthSnapshot[]>;
412
+ getLatestSnapshot(agentId: string, criterionId?: string): Promise<import("./api/eval-health").EvalHealthSnapshot | null>;
413
+ recordSnapshot(options: import("./api/eval-health").CreateSnapshotOptions): Promise<import("./api/eval-health").EvalHealthSnapshot>;
414
+ getRegressions(agentId: string): Promise<import("./api/eval-health").EvalRegression[]>;
415
+ recordRegression(options: import("./api/eval-health").CreateRegressionOptions): Promise<import("./api/eval-health").EvalRegression>;
416
+ resolveRegression(regressionId: string, options: import("./api/eval-health").ResolveRegressionOptions): Promise<void>;
417
+ acknowledgeRegression(regressionId: string): Promise<void>;
418
+ };
419
+ deterministicGraders: {
420
+ evaluate(options: import("./api/deterministic-graders").EvaluateOptions): Promise<import("./api/deterministic-graders").DeterministicEvalResult>;
421
+ bulkEvaluate(options: import("./api/deterministic-graders").BulkEvaluateOptions): Promise<import("./api/deterministic-graders").BulkEvaluateResult>;
422
+ getRuleTypes(): Promise<import("./api/deterministic-graders").RuleTypeInfo[]>;
423
+ getTemplates(): Promise<import("./api/deterministic-graders").RuleTemplate[]>;
424
+ };
425
+ conversationEval: {
426
+ getSessionTraces(sessionId: string): Promise<import("./api/conversation-eval").SessionTrace[]>;
427
+ evaluate(options: import("./api/conversation-eval").EvaluateConversationOptions): Promise<import("./api/conversation-eval").ConversationEvalResult>;
428
+ getAggregationMethods(): Promise<import("./api/conversation-eval").AggregationMethodInfo[]>;
429
+ };
430
+ transcriptPatterns: {
431
+ analyze(traceId: string): Promise<import("./api/transcript-patterns").AnalysisResult>;
432
+ bulkAnalyze(traceIds: string[]): Promise<import("./api/transcript-patterns").BulkAnalysisResult>;
433
+ getCategories(): Promise<import("./api/transcript-patterns").PatternCategoryInfo[]>;
434
+ getBuiltInPatterns(): Promise<import("./api/transcript-patterns").BuiltInPattern[]>;
435
+ };
436
+ apiKeys: {
437
+ create: typeof import("./api/apiKeys").create;
438
+ list: typeof import("./api/apiKeys").list;
439
+ revoke: typeof import("./api/apiKeys").revoke;
440
+ rotate: typeof import("./api/apiKeys").rotate;
441
+ test: typeof import("./api/apiKeys").test;
442
+ hasPermission: typeof hasPermission;
443
+ isExpired: typeof isApiKeyExpired;
444
+ isValid: typeof isApiKeyValid;
445
+ getTimeUntilExpiry: typeof getTimeUntilExpiry;
446
+ canAccessAgent: typeof canAccessAgent;
447
+ };
448
+ agents: {
449
+ list(options?: {
450
+ companyId?: string;
451
+ departmentId?: string;
452
+ }): Promise<import("./api/agents").Agent[]>;
453
+ get(id: string): Promise<import("./api/agents").Agent>;
454
+ create(options: import("./api/agents").CreateAgentOptions): Promise<import("./api/agents").Agent>;
455
+ update(id: string, options: import("./api/agents").UpdateAgentOptions): Promise<import("./api/agents").Agent>;
456
+ delete(id: string, options?: import("./api/agents").DeleteAgentOptions): Promise<void | import("./api/agents").CascadeImpact>;
457
+ getConfig(agentId: string): Promise<import("./api/agents").AgentConfig | null>;
458
+ updateConfig(agentId: string, config: import("./api/agents").UpdateAgentConfigOptions): Promise<import("./api/agents").AgentConfig>;
459
+ };
460
+ issues: {
292
461
  /**
293
- * Analyze a trace (v2 format)
294
- * @deprecated Use runs.create() + claims.getRunAnalysis() instead
462
+ * List issues for an agent
295
463
  */
296
- analyze(traceData: import("./core/types").TraceOptions, options?: {
297
- tier?: string;
298
- includeRagEvaluation?: boolean;
299
- includeHallucinationCheck?: boolean;
300
- waitForResult?: boolean;
301
- webhookUrl?: string;
302
- }): Promise<import("./core/types").ExplainabilityResult>;
464
+ list(agentId: string, options?: {
465
+ status?: string;
466
+ startDate?: Date;
467
+ endDate?: Date;
468
+ limit?: number;
469
+ offset?: number;
470
+ }): Promise<any[]>;
303
471
  /**
304
- * Get a previously analyzed trace
305
- * @deprecated
472
+ * Get a single issue by ID
306
473
  */
307
- get(traceId: string): Promise<import("./core/types").ExplainabilityResult>;
474
+ get(id: string): Promise<any>;
308
475
  /**
309
- * Search traces semantically
310
- * @deprecated
476
+ * Create a new issue
311
477
  */
312
- search(params: {
313
- query: string;
478
+ create(data: {
479
+ agentId: string;
480
+ title: string;
481
+ description?: string;
482
+ type: string;
483
+ severity?: string;
484
+ pattern?: string;
485
+ exampleTraceIds?: string[];
486
+ }): Promise<any>;
487
+ /**
488
+ * Update an issue
489
+ */
490
+ update(id: string, data: {
491
+ title?: string;
492
+ description?: string;
493
+ status?: string;
494
+ severity?: string;
495
+ assignedTo?: string;
496
+ resolutionNotes?: string;
497
+ }): Promise<any>;
498
+ /**
499
+ * Get fixes for an issue
500
+ */
501
+ getFixes(issueId: string): Promise<any[]>;
502
+ };
503
+ analyzer: {
504
+ /**
505
+ * Analyze specific traces (user-selected)
506
+ */
507
+ analyze(options: {
508
+ traceIds: string[];
509
+ tier?: "fast" | "standard" | "deep";
510
+ includeRootCause?: boolean;
511
+ includeLayers?: boolean;
512
+ }): Promise<any>;
513
+ /**
514
+ * Analyze traces by time window
515
+ */
516
+ analyzeWindow(options: {
517
+ agentId: string;
518
+ startDate: Date;
519
+ endDate: Date;
314
520
  filters?: {
315
- outcome?: string;
316
- minImpactScore?: number;
317
- dateRange?: {
318
- from: Date;
319
- to: Date;
320
- };
521
+ outcomes?: ("failure" | "error" | "success")[];
522
+ minSeverity?: "low" | "medium" | "high" | "critical";
321
523
  };
322
- limit?: number;
524
+ sampling?: {
525
+ strategy: "all" | "failures_only" | "smart" | "random";
526
+ samplePercent?: number;
527
+ };
528
+ }): Promise<any>;
529
+ /**
530
+ * Estimate cost before running analysis
531
+ */
532
+ estimateCost(options: {
533
+ traceIds?: string[];
534
+ agentId?: string;
535
+ startDate?: Date;
536
+ endDate?: Date;
537
+ tier: "fast" | "standard" | "deep";
538
+ }): Promise<{
539
+ estimatedTraces: number;
540
+ estimatedTokens: number;
541
+ estimatedCost: number;
542
+ estimatedCredits: number;
543
+ tier: string;
544
+ note: string;
545
+ }>;
546
+ /**
547
+ * Get analysis results for a specific trace
548
+ */
549
+ get(traceId: string): Promise<any>;
550
+ /**
551
+ * Aggregate insights across multiple analyzed traces
552
+ */
553
+ summarize(options: {
554
+ analysisIds?: string[];
555
+ agentId?: string;
556
+ startDate?: Date;
557
+ endDate?: Date;
558
+ }): Promise<any>;
559
+ };
560
+ roiAnalytics: {
561
+ summary(options?: {
562
+ startDate?: string | Date;
563
+ endDate?: string | Date;
564
+ agentId?: string;
565
+ }): Promise<import("./api/roi-analytics").ROISummary>;
566
+ byAgent(agentId: string, options?: {
567
+ startDate?: string | Date;
568
+ endDate?: string | Date;
323
569
  }): Promise<{
324
- results: Array<import("./core/types").ExplainabilityResult & {
325
- similarity: number;
570
+ agent: {
571
+ id: string;
572
+ name: string;
573
+ industry: string;
574
+ };
575
+ industryConfig: Partial<import("./api/roi-analytics").IndustryConfig>;
576
+ roi: import("./api/roi-analytics").ROIMetrics;
577
+ recentImpacts: Array<{
578
+ impactScore: number;
579
+ revenueRisk: number;
580
+ roiCategory: string;
581
+ totalFinancialImpact: number;
326
582
  }>;
327
- total: number;
328
583
  }>;
584
+ trends(options?: {
585
+ startDate?: string | Date;
586
+ endDate?: string | Date;
587
+ agentId?: string;
588
+ }): Promise<import("./api/roi-analytics").TrendDataPoint[]>;
589
+ calculate(options: {
590
+ traceId?: string;
591
+ userMessage?: string;
592
+ agentResponse?: string;
593
+ industryConfig?: import("./api/roi-analytics").CustomIndustryConfig;
594
+ }): Promise<import("./api/roi-analytics").BusinessImpact>;
595
+ industries(): Promise<import("./api/roi-analytics").IndustryConfig[]>;
596
+ correlations(options?: {
597
+ startDate?: string | Date;
598
+ endDate?: string | Date;
599
+ agentId?: string;
600
+ }): Promise<import("./api/roi-analytics").CorrelationAnalysis>;
601
+ };
602
+ qualityMetrics: {
603
+ getRagScores(traceId: string): Promise<{
604
+ traceId: string;
605
+ evaluation: import("./api/quality-metrics").RAGEvaluation;
606
+ evidence: import("./api/quality-metrics").RAGEvidence;
607
+ }>;
608
+ getHallucinationReport(traceId: string): Promise<{
609
+ traceId: string;
610
+ report: import("./api/quality-metrics").HallucinationReport;
611
+ }>;
612
+ evaluateRag(input: {
613
+ query: string;
614
+ response: string;
615
+ retrievedContexts: import("./api/quality-metrics").RetrievedContext[];
616
+ groundTruthContexts?: import("./api/quality-metrics").GroundTruthContext[];
617
+ citations?: string[];
618
+ }): Promise<{
619
+ evaluation: import("./api/quality-metrics").RAGEvaluation;
620
+ evidence: import("./api/quality-metrics").RAGEvidence;
621
+ }>;
622
+ detectHallucinations(input: {
623
+ response: string;
624
+ contexts: Array<{
625
+ content: string;
626
+ metadata?: Record<string, unknown>;
627
+ }>;
628
+ query?: string;
629
+ previousResponses?: string[];
630
+ }): Promise<{
631
+ report: import("./api/quality-metrics").HallucinationReport;
632
+ }>;
633
+ getGroundedness(traceId: string): Promise<{
634
+ traceId: string;
635
+ groundedness: import("./api/quality-metrics").GroundednessResult;
636
+ spans: {
637
+ grounded: Array<{
638
+ text: string;
639
+ confidence: number;
640
+ sourceIndex: number;
641
+ }>;
642
+ ungrounded: Array<{
643
+ text: string;
644
+ confidence: number;
645
+ }>;
646
+ };
647
+ summary: {
648
+ totalSpans: number;
649
+ groundedSpans: number;
650
+ ungroundedSpans: number;
651
+ groundednessRatio: number;
652
+ };
653
+ }>;
654
+ evaluateBatch(options: {
655
+ traceIds: string[];
656
+ includeDetails?: boolean;
657
+ }): Promise<{
658
+ summary: import("./api/quality-metrics").BatchEvaluationSummary;
659
+ results: import("./api/quality-metrics").BatchEvaluationResult[];
660
+ }>;
661
+ };
662
+ businessMetrics: {
663
+ current(agentId: string, metricName?: string): Promise<import("./api/business-metrics").CurrentMetricResponse>;
664
+ history(agentId: string, metricName: string, options?: {
665
+ startDate?: string | Date;
666
+ endDate?: string | Date;
667
+ granularity?: "hourly" | "daily" | "weekly" | "monthly";
668
+ }): Promise<import("./api/business-metrics").MetricHistoryResponse>;
669
+ record(agentId: string, options: import("./api/business-metrics").RecordMetricOptions): Promise<import("./api/business-metrics").RecordMetricResponse>;
670
+ recordBatch(agentId: string, metrics: import("./api/business-metrics").RecordMetricOptions[]): Promise<import("./api/business-metrics").RecordMetricResponse[]>;
329
671
  };
330
672
  generateZendeskMarker: typeof generateZendeskMarker;
331
673
  parseZendeskMarker: typeof parseZendeskMarker;
@@ -335,5 +677,16 @@ declare const _default: {
335
677
  isInference: typeof isInference;
336
678
  calculateBrierScore: typeof calculateBrierScore;
337
679
  isWellCalibrated: typeof isWellCalibrated;
680
+ calculatePassAtK: typeof calculatePassAtK;
681
+ isReliableEvaluation: typeof isReliableEvaluation;
682
+ isHighRisk: typeof isHighRisk;
683
+ needsAttention: typeof needsAttention;
684
+ calculateRevenueAtRisk: typeof calculateRevenueAtRisk;
685
+ formatCurrency: typeof formatCurrency;
686
+ passesQualityThreshold: typeof passesQualityThreshold;
687
+ isHallucinationRiskAcceptable: typeof isHallucinationRiskAcceptable;
688
+ isMetricReady: typeof isMetricReady;
689
+ needsMoreTraces: typeof needsMoreTraces;
690
+ getStatusMessage: typeof getStatusMessage;
338
691
  };
339
692
  export default _default;