@company-semantics/contracts 0.63.0 → 0.64.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -414,3 +414,15 @@ export type {
414
414
  } from './impersonation'
415
415
 
416
416
  export { RESTRICTED_IMPERSONATION_ACTIONS } from './impersonation'
417
+
418
+ // Usage tracking types (internal admin)
419
+ // @see PRD-00166 for design rationale
420
+ export type {
421
+ AiFeature,
422
+ UsageSummary,
423
+ DailyUsage,
424
+ UsageByModel,
425
+ UsageByFeature,
426
+ UsageByUser,
427
+ OrgUsageResponse,
428
+ } from './usage/types'
@@ -0,0 +1,55 @@
1
+ /**
2
+ * AI Usage Tracking Types (v1)
3
+ * Internal admin usage visibility. Not org-facing in v1.
4
+ * See PRD-00166 for design rationale and invariants.
5
+ */
6
+
7
+ export type AiFeature = 'chat' | 'chat_title' | 'ingest_summarize' | 'ingest_embedding';
8
+
9
+ export interface UsageSummary {
10
+ totalTokens: number;
11
+ totalInputTokens: number;
12
+ totalOutputTokens: number;
13
+ estimatedCostUsd: string;
14
+ requestCount: number;
15
+ periodStart: string; // UTC ISO8601
16
+ periodEnd: string; // UTC ISO8601
17
+ }
18
+
19
+ export interface DailyUsage {
20
+ date: string; // YYYY-MM-DD
21
+ totalTokens: number;
22
+ estimatedCostUsd: string;
23
+ requestCount: number;
24
+ }
25
+
26
+ export interface UsageByModel {
27
+ model: string;
28
+ provider: string;
29
+ totalTokens: number;
30
+ estimatedCostUsd: string;
31
+ requestCount: number;
32
+ }
33
+
34
+ export interface UsageByFeature {
35
+ feature: AiFeature;
36
+ totalTokens: number;
37
+ estimatedCostUsd: string;
38
+ requestCount: number;
39
+ }
40
+
41
+ export interface UsageByUser {
42
+ userId: string;
43
+ email: string;
44
+ totalTokens: number;
45
+ estimatedCostUsd: string;
46
+ requestCount: number;
47
+ }
48
+
49
+ export interface OrgUsageResponse {
50
+ summary: UsageSummary;
51
+ daily: DailyUsage[];
52
+ byModel: UsageByModel[];
53
+ byFeature: UsageByFeature[];
54
+ topUsers: UsageByUser[];
55
+ }