@company-semantics/contracts 0.79.0 → 0.81.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/package.json +1 -1
- package/src/index.ts +9 -0
- package/src/usage/execution-types.ts +71 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -483,4 +483,13 @@ export type {
|
|
|
483
483
|
export type {
|
|
484
484
|
ExecutionFailureReason,
|
|
485
485
|
RuntimeExecutionTelemetry,
|
|
486
|
+
// Aggregation response types (PRD-00201)
|
|
487
|
+
ProfileStats,
|
|
488
|
+
OrgExecutionSummary,
|
|
489
|
+
DailyExecutionStats,
|
|
490
|
+
ExecutionByUser,
|
|
491
|
+
ExecutionDetail,
|
|
492
|
+
// Budget governance types (PRD-00232)
|
|
493
|
+
BudgetCheck,
|
|
494
|
+
OrgBudgetSettings,
|
|
486
495
|
} from './usage/execution-types'
|
|
@@ -14,6 +14,7 @@ export type ExecutionFailureReason =
|
|
|
14
14
|
| 'client_disconnect'
|
|
15
15
|
| 'unknown'
|
|
16
16
|
|
|
17
|
+
// @vocabulary-exempt reason: telemetry row is a single DB-aligned record; splitting risks consumer breakage
|
|
17
18
|
export interface RuntimeExecutionTelemetry {
|
|
18
19
|
executionId: string
|
|
19
20
|
orgId: string
|
|
@@ -35,3 +36,73 @@ export interface RuntimeExecutionTelemetry {
|
|
|
35
36
|
failureReason?: ExecutionFailureReason
|
|
36
37
|
createdAt: string // ISO 8601
|
|
37
38
|
}
|
|
39
|
+
|
|
40
|
+
// --- Aggregation response types (PRD-00201) ---
|
|
41
|
+
|
|
42
|
+
export interface ProfileStats {
|
|
43
|
+
executions: number
|
|
44
|
+
percentOfTotal: number
|
|
45
|
+
avgDurationMs: number
|
|
46
|
+
totalCostUsd: string
|
|
47
|
+
avgCostPerExecution: string
|
|
48
|
+
failureRate: number
|
|
49
|
+
avgStepCount: number
|
|
50
|
+
avgToolCallCount: number
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface OrgExecutionSummary {
|
|
54
|
+
dateRange: { start: string; end: string }
|
|
55
|
+
totals: {
|
|
56
|
+
executions: number
|
|
57
|
+
tokens: number
|
|
58
|
+
costUsd: string
|
|
59
|
+
avgDurationMs: number
|
|
60
|
+
}
|
|
61
|
+
byProfile: Record<ChatRuntimeProfile, ProfileStats>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface DailyExecutionStats {
|
|
65
|
+
date: string // YYYY-MM-DD
|
|
66
|
+
executions: number
|
|
67
|
+
totalCostUsd: string
|
|
68
|
+
byProfile: Record<ChatRuntimeProfile, number>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ExecutionByUser {
|
|
72
|
+
userId: string
|
|
73
|
+
email: string
|
|
74
|
+
executions: number
|
|
75
|
+
totalCostUsd: string
|
|
76
|
+
favoriteProfile: ChatRuntimeProfile
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ExecutionDetail {
|
|
80
|
+
execution: RuntimeExecutionTelemetry
|
|
81
|
+
llmCalls: Array<{
|
|
82
|
+
callId: string
|
|
83
|
+
model: string
|
|
84
|
+
provider: string
|
|
85
|
+
tokensInput: number
|
|
86
|
+
tokensOutput: number
|
|
87
|
+
costUsd: string
|
|
88
|
+
durationMs: number
|
|
89
|
+
toolCalls: number
|
|
90
|
+
}>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// --- Budget governance types (PRD-00232) ---
|
|
94
|
+
|
|
95
|
+
export interface BudgetCheck {
|
|
96
|
+
allowed: boolean
|
|
97
|
+
reason?: 'monthly_budget_exceeded' | 'approaching_limit'
|
|
98
|
+
remainingBudgetUsd?: string
|
|
99
|
+
usedThisMonthUsd?: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface OrgBudgetSettings {
|
|
103
|
+
monthlyBudgetUsd: string | null
|
|
104
|
+
maxCostPerExecution: string | null
|
|
105
|
+
agenticMaxSteps: number | null
|
|
106
|
+
alertThresholdPct: number
|
|
107
|
+
enabled: boolean
|
|
108
|
+
}
|