@miradorlabs/web-grpc 3.0.0 → 3.2.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.
@@ -12,6 +12,7 @@ import { map } from "rxjs/operators";
12
12
  import { Duration } from "../../../../google/protobuf/duration";
13
13
  import { Timestamp } from "../../../../google/protobuf/timestamp";
14
14
  import { ResponseStatus } from "../../common/v1/status";
15
+ import { AIPrincipalKind, aIPrincipalKindFromJSON, aIPrincipalKindToJSON } from "./reference_gateway";
15
16
  import {
16
17
  AnalyticsTimeInterval,
17
18
  analyticsTimeIntervalFromJSON,
@@ -844,6 +845,10 @@ export interface AISessionSummary {
844
845
  accountIds: string[];
845
846
  /** Who reported the session: 'harness' or 'gateway'. */
846
847
  observer: string;
848
+ /** The apps the session ran in ('claude-code', 'codex-exec', ...); a session can be resumed in another app. */
849
+ clients: string[];
850
+ /** The versions those apps reported, verbatim. */
851
+ clientVersions: string[];
847
852
  }
848
853
 
849
854
  export interface StreamSessionsRequest {
@@ -1080,13 +1085,13 @@ export interface SessionTimelinePoint {
1080
1085
  }
1081
1086
 
1082
1087
  /**
1083
- * AIGitActivityFilter mirrors telemetry.api.v1.AIGitActivityFilter. session_id is the
1084
- * session identity (from a session-list row); fields AND, repeated values OR
1085
- * (any-of); empty = unconstrained. event_time bounds are REQUIRED when session_id is empty.
1088
+ * AIGitActivityFilter mirrors telemetry.api.v1.AIGitActivityFilter. session is the
1089
+ * session identity (from a session-list row); fields AND, sessions OR (any-of);
1090
+ * empty = unconstrained. event_time bounds are REQUIRED when session is empty.
1086
1091
  */
1087
1092
  export interface AIGitActivityFilter {
1088
- sessionId: string[];
1089
- sourceSystem: string[];
1093
+ /** both halves required */
1094
+ session: AISessionRef[];
1090
1095
  eventTimeAfter?: Date | undefined;
1091
1096
  eventTimeBefore?: Date | undefined;
1092
1097
  }
@@ -1164,8 +1169,8 @@ export interface GitActivitySummaryRequest {
1164
1169
  organizationId: string;
1165
1170
  projectId: string;
1166
1171
  /**
1167
- * filter's session_id / source_system apply; its event-time bounds are ignored
1168
- * (time_window is the range).
1172
+ * filter's session applies; its event-time bounds are ignored (time_window is the
1173
+ * range).
1169
1174
  */
1170
1175
  filter:
1171
1176
  | AIGitActivityFilter
@@ -1517,12 +1522,71 @@ export interface ResourceRanking {
1517
1522
  sessionCount: number;
1518
1523
  }
1519
1524
 
1525
+ export interface ModelActivityRequest {
1526
+ organizationId: string;
1527
+ projectId: string;
1528
+ groups: ModelActivityGroup[];
1529
+ startTime: Date | undefined;
1530
+ endTime: Date | undefined;
1531
+ }
1532
+
1533
+ export interface ModelActivityGroup {
1534
+ key: string;
1535
+ modelNames: string[];
1536
+ }
1537
+
1538
+ export interface ModelActivityResponse {
1539
+ status: ResponseStatus | undefined;
1540
+ models: ModelActivity[];
1541
+ windowStart: Date | undefined;
1542
+ windowEnd: Date | undefined;
1543
+ }
1544
+
1545
+ export interface ModelActivity {
1546
+ key: string;
1547
+ modelCalls: number;
1548
+ failedCalls: number;
1549
+ inputTokens: number;
1550
+ outputTokens: number;
1551
+ cacheReadTokens: number;
1552
+ cacheWriteTokens: number;
1553
+ costUsd: number;
1554
+ subscriptionCostUsd: number;
1555
+ sessions: number;
1556
+ toolCalls: number;
1557
+ compactions: number;
1558
+ subagentRuns: number;
1559
+ ttftMsSum: number;
1560
+ ttftCalls: number;
1561
+ providers: string[];
1562
+ /** busiest first, at most 200; user id, else api key */
1563
+ principals: ModelActivityPrincipal[];
1564
+ }
1565
+
1566
+ export interface ModelActivityPrincipal {
1567
+ kind: AIPrincipalKind;
1568
+ id: string;
1569
+ sourceSystem: string;
1570
+ modelCalls: number;
1571
+ sessions: number;
1572
+ inputTokens: number;
1573
+ outputTokens: number;
1574
+ costUsd: number;
1575
+ }
1576
+
1577
+ /** AISessionRef is a session's identity: two sources can issue the same session_id. */
1578
+ export interface AISessionRef {
1579
+ sourceSystem: string;
1580
+ sessionId: string;
1581
+ }
1582
+
1520
1583
  export interface AIFileFilter {
1521
1584
  repositoryKey: string[];
1522
1585
  ref: string[];
1523
1586
  state: AIFileLifecycle[];
1524
1587
  tier: AIFileTier[];
1525
- sessionId: string[];
1588
+ /** both halves required */
1589
+ session: AISessionRef[];
1526
1590
  minAge?: Duration | undefined;
1527
1591
  activeAfter?: Date | undefined;
1528
1592
  activeBefore?: Date | undefined;
@@ -1560,8 +1624,8 @@ export interface AIFileRow {
1560
1624
  discardedAt: Date | undefined;
1561
1625
  discardReason: string;
1562
1626
  editCount: number;
1563
- /** internal session ids that touched this file */
1564
- sessionId: string[];
1627
+ /** unique, sorted by (source_system, session_id) */
1628
+ sessions: AISessionRef[];
1565
1629
  unlandedCostUsd: number;
1566
1630
  unlandedOutputTokens: number;
1567
1631
  /**
@@ -2373,6 +2437,8 @@ function createBaseAISessionSummary(): AISessionSummary {
2373
2437
  costSources: [],
2374
2438
  accountIds: [],
2375
2439
  observer: "",
2440
+ clients: [],
2441
+ clientVersions: [],
2376
2442
  };
2377
2443
  }
2378
2444
 
@@ -2468,6 +2534,12 @@ export const AISessionSummary: MessageFns<AISessionSummary> = {
2468
2534
  if (message.observer !== "") {
2469
2535
  writer.uint32(242).string(message.observer);
2470
2536
  }
2537
+ for (const v of message.clients) {
2538
+ writer.uint32(250).string(v!);
2539
+ }
2540
+ for (const v of message.clientVersions) {
2541
+ writer.uint32(258).string(v!);
2542
+ }
2471
2543
  return writer;
2472
2544
  },
2473
2545
 
@@ -2724,6 +2796,22 @@ export const AISessionSummary: MessageFns<AISessionSummary> = {
2724
2796
  message.observer = reader.string();
2725
2797
  continue;
2726
2798
  }
2799
+ case 31: {
2800
+ if (tag !== 250) {
2801
+ break;
2802
+ }
2803
+
2804
+ message.clients.push(reader.string());
2805
+ continue;
2806
+ }
2807
+ case 32: {
2808
+ if (tag !== 258) {
2809
+ break;
2810
+ }
2811
+
2812
+ message.clientVersions.push(reader.string());
2813
+ continue;
2814
+ }
2727
2815
  }
2728
2816
  if ((tag & 7) === 4 || tag === 0) {
2729
2817
  break;
@@ -2860,6 +2948,14 @@ export const AISessionSummary: MessageFns<AISessionSummary> = {
2860
2948
  ? object.account_ids.map((e: any) => globalThis.String(e))
2861
2949
  : [],
2862
2950
  observer: isSet(object.observer) ? globalThis.String(object.observer) : "",
2951
+ clients: globalThis.Array.isArray(object?.clients)
2952
+ ? object.clients.map((e: any) => globalThis.String(e))
2953
+ : [],
2954
+ clientVersions: globalThis.Array.isArray(object?.clientVersions)
2955
+ ? object.clientVersions.map((e: any) => globalThis.String(e))
2956
+ : globalThis.Array.isArray(object?.client_versions)
2957
+ ? object.client_versions.map((e: any) => globalThis.String(e))
2958
+ : [],
2863
2959
  };
2864
2960
  },
2865
2961
 
@@ -2955,6 +3051,12 @@ export const AISessionSummary: MessageFns<AISessionSummary> = {
2955
3051
  if (message.observer !== "") {
2956
3052
  obj.observer = message.observer;
2957
3053
  }
3054
+ if (message.clients?.length) {
3055
+ obj.clients = message.clients;
3056
+ }
3057
+ if (message.clientVersions?.length) {
3058
+ obj.clientVersions = message.clientVersions;
3059
+ }
2958
3060
  return obj;
2959
3061
  },
2960
3062
 
@@ -2995,6 +3097,8 @@ export const AISessionSummary: MessageFns<AISessionSummary> = {
2995
3097
  message.costSources = object.costSources?.map((e) => e) || [];
2996
3098
  message.accountIds = object.accountIds?.map((e) => e) || [];
2997
3099
  message.observer = object.observer ?? "";
3100
+ message.clients = object.clients?.map((e) => e) || [];
3101
+ message.clientVersions = object.clientVersions?.map((e) => e) || [];
2998
3102
  return message;
2999
3103
  },
3000
3104
  };
@@ -5967,22 +6071,19 @@ export const SessionTimelinePoint: MessageFns<SessionTimelinePoint> = {
5967
6071
  };
5968
6072
 
5969
6073
  function createBaseAIGitActivityFilter(): AIGitActivityFilter {
5970
- return { sessionId: [], sourceSystem: [], eventTimeAfter: undefined, eventTimeBefore: undefined };
6074
+ return { session: [], eventTimeAfter: undefined, eventTimeBefore: undefined };
5971
6075
  }
5972
6076
 
5973
6077
  export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
5974
6078
  encode(message: AIGitActivityFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5975
- for (const v of message.sessionId) {
5976
- writer.uint32(10).string(v!);
5977
- }
5978
- for (const v of message.sourceSystem) {
5979
- writer.uint32(18).string(v!);
6079
+ for (const v of message.session) {
6080
+ AISessionRef.encode(v!, writer.uint32(10).fork()).join();
5980
6081
  }
5981
6082
  if (message.eventTimeAfter !== undefined) {
5982
- Timestamp.encode(toTimestamp(message.eventTimeAfter), writer.uint32(26).fork()).join();
6083
+ Timestamp.encode(toTimestamp(message.eventTimeAfter), writer.uint32(18).fork()).join();
5983
6084
  }
5984
6085
  if (message.eventTimeBefore !== undefined) {
5985
- Timestamp.encode(toTimestamp(message.eventTimeBefore), writer.uint32(34).fork()).join();
6086
+ Timestamp.encode(toTimestamp(message.eventTimeBefore), writer.uint32(26).fork()).join();
5986
6087
  }
5987
6088
  return writer;
5988
6089
  },
@@ -6005,7 +6106,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6005
6106
  break;
6006
6107
  }
6007
6108
 
6008
- message.sessionId.push(reader.string());
6109
+ message.session.push(AISessionRef.decode(reader, reader.uint32()));
6009
6110
  continue;
6010
6111
  }
6011
6112
  case 2: {
@@ -6013,7 +6114,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6013
6114
  break;
6014
6115
  }
6015
6116
 
6016
- message.sourceSystem.push(reader.string());
6117
+ message.eventTimeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6017
6118
  continue;
6018
6119
  }
6019
6120
  case 3: {
@@ -6021,14 +6122,6 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6021
6122
  break;
6022
6123
  }
6023
6124
 
6024
- message.eventTimeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6025
- continue;
6026
- }
6027
- case 4: {
6028
- if (tag !== 34) {
6029
- break;
6030
- }
6031
-
6032
6125
  message.eventTimeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6033
6126
  continue;
6034
6127
  }
@@ -6046,15 +6139,8 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6046
6139
 
6047
6140
  fromJSON(object: any): AIGitActivityFilter {
6048
6141
  return {
6049
- sessionId: globalThis.Array.isArray(object?.sessionId)
6050
- ? object.sessionId.map((e: any) => globalThis.String(e))
6051
- : globalThis.Array.isArray(object?.session_id)
6052
- ? object.session_id.map((e: any) => globalThis.String(e))
6053
- : [],
6054
- sourceSystem: globalThis.Array.isArray(object?.sourceSystem)
6055
- ? object.sourceSystem.map((e: any) => globalThis.String(e))
6056
- : globalThis.Array.isArray(object?.source_system)
6057
- ? object.source_system.map((e: any) => globalThis.String(e))
6142
+ session: globalThis.Array.isArray(object?.session)
6143
+ ? object.session.map((e: any) => AISessionRef.fromJSON(e))
6058
6144
  : [],
6059
6145
  eventTimeAfter: isSet(object.eventTimeAfter)
6060
6146
  ? fromJsonTimestamp(object.eventTimeAfter)
@@ -6071,11 +6157,8 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6071
6157
 
6072
6158
  toJSON(message: AIGitActivityFilter): unknown {
6073
6159
  const obj: any = {};
6074
- if (message.sessionId?.length) {
6075
- obj.sessionId = message.sessionId;
6076
- }
6077
- if (message.sourceSystem?.length) {
6078
- obj.sourceSystem = message.sourceSystem;
6160
+ if (message.session?.length) {
6161
+ obj.session = message.session.map((e) => AISessionRef.toJSON(e));
6079
6162
  }
6080
6163
  if (message.eventTimeAfter !== undefined) {
6081
6164
  obj.eventTimeAfter = message.eventTimeAfter.toISOString();
@@ -6091,8 +6174,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6091
6174
  },
6092
6175
  fromPartial<I extends Exact<DeepPartial<AIGitActivityFilter>, I>>(object: I): AIGitActivityFilter {
6093
6176
  const message = createBaseAIGitActivityFilter();
6094
- message.sessionId = object.sessionId?.map((e) => e) || [];
6095
- message.sourceSystem = object.sourceSystem?.map((e) => e) || [];
6177
+ message.session = object.session?.map((e) => AISessionRef.fromPartial(e)) || [];
6096
6178
  message.eventTimeAfter = object.eventTimeAfter ?? undefined;
6097
6179
  message.eventTimeBefore = object.eventTimeBefore ?? undefined;
6098
6180
  return message;
@@ -12424,57 +12506,31 @@ export const ResourceRanking: MessageFns<ResourceRanking> = {
12424
12506
  },
12425
12507
  };
12426
12508
 
12427
- function createBaseAIFileFilter(): AIFileFilter {
12428
- return {
12429
- repositoryKey: [],
12430
- ref: [],
12431
- state: [],
12432
- tier: [],
12433
- sessionId: [],
12434
- minAge: undefined,
12435
- activeAfter: undefined,
12436
- activeBefore: undefined,
12437
- abandonedHorizon: undefined,
12438
- };
12509
+ function createBaseModelActivityRequest(): ModelActivityRequest {
12510
+ return { organizationId: "", projectId: "", groups: [], startTime: undefined, endTime: undefined };
12439
12511
  }
12440
12512
 
12441
- export const AIFileFilter: MessageFns<AIFileFilter> = {
12442
- encode(message: AIFileFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12443
- for (const v of message.repositoryKey) {
12444
- writer.uint32(10).string(v!);
12445
- }
12446
- for (const v of message.ref) {
12447
- writer.uint32(18).string(v!);
12448
- }
12449
- writer.uint32(26).fork();
12450
- for (const v of message.state) {
12451
- writer.int32(v);
12452
- }
12453
- writer.join();
12454
- writer.uint32(34).fork();
12455
- for (const v of message.tier) {
12456
- writer.int32(v);
12457
- }
12458
- writer.join();
12459
- for (const v of message.sessionId) {
12460
- writer.uint32(42).string(v!);
12513
+ export const ModelActivityRequest: MessageFns<ModelActivityRequest> = {
12514
+ encode(message: ModelActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12515
+ if (message.organizationId !== "") {
12516
+ writer.uint32(10).string(message.organizationId);
12461
12517
  }
12462
- if (message.minAge !== undefined) {
12463
- Duration.encode(message.minAge, writer.uint32(50).fork()).join();
12518
+ if (message.projectId !== "") {
12519
+ writer.uint32(18).string(message.projectId);
12464
12520
  }
12465
- if (message.activeAfter !== undefined) {
12466
- Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(58).fork()).join();
12521
+ for (const v of message.groups) {
12522
+ ModelActivityGroup.encode(v!, writer.uint32(26).fork()).join();
12467
12523
  }
12468
- if (message.activeBefore !== undefined) {
12469
- Timestamp.encode(toTimestamp(message.activeBefore), writer.uint32(66).fork()).join();
12524
+ if (message.startTime !== undefined) {
12525
+ Timestamp.encode(toTimestamp(message.startTime), writer.uint32(34).fork()).join();
12470
12526
  }
12471
- if (message.abandonedHorizon !== undefined) {
12472
- Duration.encode(message.abandonedHorizon, writer.uint32(74).fork()).join();
12527
+ if (message.endTime !== undefined) {
12528
+ Timestamp.encode(toTimestamp(message.endTime), writer.uint32(42).fork()).join();
12473
12529
  }
12474
12530
  return writer;
12475
12531
  },
12476
12532
 
12477
- decode(input: BinaryReader | Uint8Array, length?: number): AIFileFilter {
12533
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityRequest {
12478
12534
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12479
12535
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12480
12536
  if (previousRecursionDepth >= 100) {
@@ -12483,7 +12539,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12483
12539
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12484
12540
  try {
12485
12541
  const end = length === undefined ? reader.len : reader.pos + length;
12486
- const message = createBaseAIFileFilter();
12542
+ const message = createBaseModelActivityRequest();
12487
12543
  while (reader.pos < end) {
12488
12544
  const tag = reader.uint32();
12489
12545
  switch (tag >>> 3) {
@@ -12492,7 +12548,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12492
12548
  break;
12493
12549
  }
12494
12550
 
12495
- message.repositoryKey.push(reader.string());
12551
+ message.organizationId = reader.string();
12496
12552
  continue;
12497
12553
  }
12498
12554
  case 2: {
@@ -12500,83 +12556,31 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12500
12556
  break;
12501
12557
  }
12502
12558
 
12503
- message.ref.push(reader.string());
12559
+ message.projectId = reader.string();
12504
12560
  continue;
12505
12561
  }
12506
12562
  case 3: {
12507
- if (tag === 24) {
12508
- message.state.push(reader.int32() as any);
12509
-
12510
- continue;
12511
- }
12512
-
12513
- if (tag === 26) {
12514
- const end2 = reader.uint32() + reader.pos;
12515
- while (reader.pos < end2) {
12516
- message.state.push(reader.int32() as any);
12517
- }
12518
-
12519
- continue;
12520
- }
12521
-
12522
- break;
12523
- }
12524
- case 4: {
12525
- if (tag === 32) {
12526
- message.tier.push(reader.int32() as any);
12527
-
12528
- continue;
12529
- }
12530
-
12531
- if (tag === 34) {
12532
- const end2 = reader.uint32() + reader.pos;
12533
- while (reader.pos < end2) {
12534
- message.tier.push(reader.int32() as any);
12535
- }
12536
-
12537
- continue;
12538
- }
12539
-
12540
- break;
12541
- }
12542
- case 5: {
12543
- if (tag !== 42) {
12544
- break;
12545
- }
12546
-
12547
- message.sessionId.push(reader.string());
12548
- continue;
12549
- }
12550
- case 6: {
12551
- if (tag !== 50) {
12552
- break;
12553
- }
12554
-
12555
- message.minAge = Duration.decode(reader, reader.uint32());
12556
- continue;
12557
- }
12558
- case 7: {
12559
- if (tag !== 58) {
12563
+ if (tag !== 26) {
12560
12564
  break;
12561
12565
  }
12562
12566
 
12563
- message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12567
+ message.groups.push(ModelActivityGroup.decode(reader, reader.uint32()));
12564
12568
  continue;
12565
12569
  }
12566
- case 8: {
12567
- if (tag !== 66) {
12570
+ case 4: {
12571
+ if (tag !== 34) {
12568
12572
  break;
12569
12573
  }
12570
12574
 
12571
- message.activeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12575
+ message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12572
12576
  continue;
12573
12577
  }
12574
- case 9: {
12575
- if (tag !== 74) {
12578
+ case 5: {
12579
+ if (tag !== 42) {
12576
12580
  break;
12577
12581
  }
12578
12582
 
12579
- message.abandonedHorizon = Duration.decode(reader, reader.uint32());
12583
+ message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12580
12584
  continue;
12581
12585
  }
12582
12586
  }
@@ -12591,60 +12595,1192 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12591
12595
  }
12592
12596
  },
12593
12597
 
12594
- fromJSON(object: any): AIFileFilter {
12598
+ fromJSON(object: any): ModelActivityRequest {
12595
12599
  return {
12596
- repositoryKey: globalThis.Array.isArray(object?.repositoryKey)
12597
- ? object.repositoryKey.map((e: any) => globalThis.String(e))
12598
- : globalThis.Array.isArray(object?.repository_key)
12599
- ? object.repository_key.map((e: any) => globalThis.String(e))
12600
- : [],
12601
- ref: globalThis.Array.isArray(object?.ref) ? object.ref.map((e: any) => globalThis.String(e)) : [],
12602
- state: globalThis.Array.isArray(object?.state) ? object.state.map((e: any) => aIFileLifecycleFromJSON(e)) : [],
12603
- tier: globalThis.Array.isArray(object?.tier) ? object.tier.map((e: any) => aIFileTierFromJSON(e)) : [],
12604
- sessionId: globalThis.Array.isArray(object?.sessionId)
12605
- ? object.sessionId.map((e: any) => globalThis.String(e))
12606
- : globalThis.Array.isArray(object?.session_id)
12607
- ? object.session_id.map((e: any) => globalThis.String(e))
12600
+ organizationId: isSet(object.organizationId)
12601
+ ? globalThis.String(object.organizationId)
12602
+ : isSet(object.organization_id)
12603
+ ? globalThis.String(object.organization_id)
12604
+ : "",
12605
+ projectId: isSet(object.projectId)
12606
+ ? globalThis.String(object.projectId)
12607
+ : isSet(object.project_id)
12608
+ ? globalThis.String(object.project_id)
12609
+ : "",
12610
+ groups: globalThis.Array.isArray(object?.groups)
12611
+ ? object.groups.map((e: any) => ModelActivityGroup.fromJSON(e))
12608
12612
  : [],
12609
- minAge: isSet(object.minAge)
12610
- ? Duration.fromJSON(object.minAge)
12611
- : isSet(object.min_age)
12612
- ? Duration.fromJSON(object.min_age)
12613
- : undefined,
12614
- activeAfter: isSet(object.activeAfter)
12615
- ? fromJsonTimestamp(object.activeAfter)
12616
- : isSet(object.active_after)
12617
- ? fromJsonTimestamp(object.active_after)
12618
- : undefined,
12619
- activeBefore: isSet(object.activeBefore)
12620
- ? fromJsonTimestamp(object.activeBefore)
12621
- : isSet(object.active_before)
12622
- ? fromJsonTimestamp(object.active_before)
12613
+ startTime: isSet(object.startTime)
12614
+ ? fromJsonTimestamp(object.startTime)
12615
+ : isSet(object.start_time)
12616
+ ? fromJsonTimestamp(object.start_time)
12623
12617
  : undefined,
12624
- abandonedHorizon: isSet(object.abandonedHorizon)
12625
- ? Duration.fromJSON(object.abandonedHorizon)
12626
- : isSet(object.abandoned_horizon)
12627
- ? Duration.fromJSON(object.abandoned_horizon)
12618
+ endTime: isSet(object.endTime)
12619
+ ? fromJsonTimestamp(object.endTime)
12620
+ : isSet(object.end_time)
12621
+ ? fromJsonTimestamp(object.end_time)
12628
12622
  : undefined,
12629
12623
  };
12630
12624
  },
12631
12625
 
12632
- toJSON(message: AIFileFilter): unknown {
12626
+ toJSON(message: ModelActivityRequest): unknown {
12633
12627
  const obj: any = {};
12634
- if (message.repositoryKey?.length) {
12635
- obj.repositoryKey = message.repositoryKey;
12628
+ if (message.organizationId !== "") {
12629
+ obj.organizationId = message.organizationId;
12636
12630
  }
12637
- if (message.ref?.length) {
12638
- obj.ref = message.ref;
12631
+ if (message.projectId !== "") {
12632
+ obj.projectId = message.projectId;
12639
12633
  }
12640
- if (message.state?.length) {
12634
+ if (message.groups?.length) {
12635
+ obj.groups = message.groups.map((e) => ModelActivityGroup.toJSON(e));
12636
+ }
12637
+ if (message.startTime !== undefined) {
12638
+ obj.startTime = message.startTime.toISOString();
12639
+ }
12640
+ if (message.endTime !== undefined) {
12641
+ obj.endTime = message.endTime.toISOString();
12642
+ }
12643
+ return obj;
12644
+ },
12645
+
12646
+ create<I extends Exact<DeepPartial<ModelActivityRequest>, I>>(base?: I): ModelActivityRequest {
12647
+ return ModelActivityRequest.fromPartial(base ?? ({} as any));
12648
+ },
12649
+ fromPartial<I extends Exact<DeepPartial<ModelActivityRequest>, I>>(object: I): ModelActivityRequest {
12650
+ const message = createBaseModelActivityRequest();
12651
+ message.organizationId = object.organizationId ?? "";
12652
+ message.projectId = object.projectId ?? "";
12653
+ message.groups = object.groups?.map((e) => ModelActivityGroup.fromPartial(e)) || [];
12654
+ message.startTime = object.startTime ?? undefined;
12655
+ message.endTime = object.endTime ?? undefined;
12656
+ return message;
12657
+ },
12658
+ };
12659
+
12660
+ function createBaseModelActivityGroup(): ModelActivityGroup {
12661
+ return { key: "", modelNames: [] };
12662
+ }
12663
+
12664
+ export const ModelActivityGroup: MessageFns<ModelActivityGroup> = {
12665
+ encode(message: ModelActivityGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12666
+ if (message.key !== "") {
12667
+ writer.uint32(10).string(message.key);
12668
+ }
12669
+ for (const v of message.modelNames) {
12670
+ writer.uint32(18).string(v!);
12671
+ }
12672
+ return writer;
12673
+ },
12674
+
12675
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityGroup {
12676
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12677
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12678
+ if (previousRecursionDepth >= 100) {
12679
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12680
+ }
12681
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12682
+ try {
12683
+ const end = length === undefined ? reader.len : reader.pos + length;
12684
+ const message = createBaseModelActivityGroup();
12685
+ while (reader.pos < end) {
12686
+ const tag = reader.uint32();
12687
+ switch (tag >>> 3) {
12688
+ case 1: {
12689
+ if (tag !== 10) {
12690
+ break;
12691
+ }
12692
+
12693
+ message.key = reader.string();
12694
+ continue;
12695
+ }
12696
+ case 2: {
12697
+ if (tag !== 18) {
12698
+ break;
12699
+ }
12700
+
12701
+ message.modelNames.push(reader.string());
12702
+ continue;
12703
+ }
12704
+ }
12705
+ if ((tag & 7) === 4 || tag === 0) {
12706
+ break;
12707
+ }
12708
+ reader.skip(tag & 7);
12709
+ }
12710
+ return message;
12711
+ } finally {
12712
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
12713
+ }
12714
+ },
12715
+
12716
+ fromJSON(object: any): ModelActivityGroup {
12717
+ return {
12718
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
12719
+ modelNames: globalThis.Array.isArray(object?.modelNames)
12720
+ ? object.modelNames.map((e: any) => globalThis.String(e))
12721
+ : globalThis.Array.isArray(object?.model_names)
12722
+ ? object.model_names.map((e: any) => globalThis.String(e))
12723
+ : [],
12724
+ };
12725
+ },
12726
+
12727
+ toJSON(message: ModelActivityGroup): unknown {
12728
+ const obj: any = {};
12729
+ if (message.key !== "") {
12730
+ obj.key = message.key;
12731
+ }
12732
+ if (message.modelNames?.length) {
12733
+ obj.modelNames = message.modelNames;
12734
+ }
12735
+ return obj;
12736
+ },
12737
+
12738
+ create<I extends Exact<DeepPartial<ModelActivityGroup>, I>>(base?: I): ModelActivityGroup {
12739
+ return ModelActivityGroup.fromPartial(base ?? ({} as any));
12740
+ },
12741
+ fromPartial<I extends Exact<DeepPartial<ModelActivityGroup>, I>>(object: I): ModelActivityGroup {
12742
+ const message = createBaseModelActivityGroup();
12743
+ message.key = object.key ?? "";
12744
+ message.modelNames = object.modelNames?.map((e) => e) || [];
12745
+ return message;
12746
+ },
12747
+ };
12748
+
12749
+ function createBaseModelActivityResponse(): ModelActivityResponse {
12750
+ return { status: undefined, models: [], windowStart: undefined, windowEnd: undefined };
12751
+ }
12752
+
12753
+ export const ModelActivityResponse: MessageFns<ModelActivityResponse> = {
12754
+ encode(message: ModelActivityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12755
+ if (message.status !== undefined) {
12756
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
12757
+ }
12758
+ for (const v of message.models) {
12759
+ ModelActivity.encode(v!, writer.uint32(18).fork()).join();
12760
+ }
12761
+ if (message.windowStart !== undefined) {
12762
+ Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(26).fork()).join();
12763
+ }
12764
+ if (message.windowEnd !== undefined) {
12765
+ Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(34).fork()).join();
12766
+ }
12767
+ return writer;
12768
+ },
12769
+
12770
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityResponse {
12771
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12772
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12773
+ if (previousRecursionDepth >= 100) {
12774
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12775
+ }
12776
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12777
+ try {
12778
+ const end = length === undefined ? reader.len : reader.pos + length;
12779
+ const message = createBaseModelActivityResponse();
12780
+ while (reader.pos < end) {
12781
+ const tag = reader.uint32();
12782
+ switch (tag >>> 3) {
12783
+ case 1: {
12784
+ if (tag !== 10) {
12785
+ break;
12786
+ }
12787
+
12788
+ message.status = ResponseStatus.decode(reader, reader.uint32());
12789
+ continue;
12790
+ }
12791
+ case 2: {
12792
+ if (tag !== 18) {
12793
+ break;
12794
+ }
12795
+
12796
+ message.models.push(ModelActivity.decode(reader, reader.uint32()));
12797
+ continue;
12798
+ }
12799
+ case 3: {
12800
+ if (tag !== 26) {
12801
+ break;
12802
+ }
12803
+
12804
+ message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12805
+ continue;
12806
+ }
12807
+ case 4: {
12808
+ if (tag !== 34) {
12809
+ break;
12810
+ }
12811
+
12812
+ message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12813
+ continue;
12814
+ }
12815
+ }
12816
+ if ((tag & 7) === 4 || tag === 0) {
12817
+ break;
12818
+ }
12819
+ reader.skip(tag & 7);
12820
+ }
12821
+ return message;
12822
+ } finally {
12823
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
12824
+ }
12825
+ },
12826
+
12827
+ fromJSON(object: any): ModelActivityResponse {
12828
+ return {
12829
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
12830
+ models: globalThis.Array.isArray(object?.models) ? object.models.map((e: any) => ModelActivity.fromJSON(e)) : [],
12831
+ windowStart: isSet(object.windowStart)
12832
+ ? fromJsonTimestamp(object.windowStart)
12833
+ : isSet(object.window_start)
12834
+ ? fromJsonTimestamp(object.window_start)
12835
+ : undefined,
12836
+ windowEnd: isSet(object.windowEnd)
12837
+ ? fromJsonTimestamp(object.windowEnd)
12838
+ : isSet(object.window_end)
12839
+ ? fromJsonTimestamp(object.window_end)
12840
+ : undefined,
12841
+ };
12842
+ },
12843
+
12844
+ toJSON(message: ModelActivityResponse): unknown {
12845
+ const obj: any = {};
12846
+ if (message.status !== undefined) {
12847
+ obj.status = ResponseStatus.toJSON(message.status);
12848
+ }
12849
+ if (message.models?.length) {
12850
+ obj.models = message.models.map((e) => ModelActivity.toJSON(e));
12851
+ }
12852
+ if (message.windowStart !== undefined) {
12853
+ obj.windowStart = message.windowStart.toISOString();
12854
+ }
12855
+ if (message.windowEnd !== undefined) {
12856
+ obj.windowEnd = message.windowEnd.toISOString();
12857
+ }
12858
+ return obj;
12859
+ },
12860
+
12861
+ create<I extends Exact<DeepPartial<ModelActivityResponse>, I>>(base?: I): ModelActivityResponse {
12862
+ return ModelActivityResponse.fromPartial(base ?? ({} as any));
12863
+ },
12864
+ fromPartial<I extends Exact<DeepPartial<ModelActivityResponse>, I>>(object: I): ModelActivityResponse {
12865
+ const message = createBaseModelActivityResponse();
12866
+ message.status = (object.status !== undefined && object.status !== null)
12867
+ ? ResponseStatus.fromPartial(object.status)
12868
+ : undefined;
12869
+ message.models = object.models?.map((e) => ModelActivity.fromPartial(e)) || [];
12870
+ message.windowStart = object.windowStart ?? undefined;
12871
+ message.windowEnd = object.windowEnd ?? undefined;
12872
+ return message;
12873
+ },
12874
+ };
12875
+
12876
+ function createBaseModelActivity(): ModelActivity {
12877
+ return {
12878
+ key: "",
12879
+ modelCalls: 0,
12880
+ failedCalls: 0,
12881
+ inputTokens: 0,
12882
+ outputTokens: 0,
12883
+ cacheReadTokens: 0,
12884
+ cacheWriteTokens: 0,
12885
+ costUsd: 0,
12886
+ subscriptionCostUsd: 0,
12887
+ sessions: 0,
12888
+ toolCalls: 0,
12889
+ compactions: 0,
12890
+ subagentRuns: 0,
12891
+ ttftMsSum: 0,
12892
+ ttftCalls: 0,
12893
+ providers: [],
12894
+ principals: [],
12895
+ };
12896
+ }
12897
+
12898
+ export const ModelActivity: MessageFns<ModelActivity> = {
12899
+ encode(message: ModelActivity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12900
+ if (message.key !== "") {
12901
+ writer.uint32(10).string(message.key);
12902
+ }
12903
+ if (message.modelCalls !== 0) {
12904
+ writer.uint32(16).uint64(message.modelCalls);
12905
+ }
12906
+ if (message.failedCalls !== 0) {
12907
+ writer.uint32(24).uint64(message.failedCalls);
12908
+ }
12909
+ if (message.inputTokens !== 0) {
12910
+ writer.uint32(32).uint64(message.inputTokens);
12911
+ }
12912
+ if (message.outputTokens !== 0) {
12913
+ writer.uint32(40).uint64(message.outputTokens);
12914
+ }
12915
+ if (message.cacheReadTokens !== 0) {
12916
+ writer.uint32(48).uint64(message.cacheReadTokens);
12917
+ }
12918
+ if (message.cacheWriteTokens !== 0) {
12919
+ writer.uint32(56).uint64(message.cacheWriteTokens);
12920
+ }
12921
+ if (message.costUsd !== 0) {
12922
+ writer.uint32(65).double(message.costUsd);
12923
+ }
12924
+ if (message.subscriptionCostUsd !== 0) {
12925
+ writer.uint32(73).double(message.subscriptionCostUsd);
12926
+ }
12927
+ if (message.sessions !== 0) {
12928
+ writer.uint32(80).uint64(message.sessions);
12929
+ }
12930
+ if (message.toolCalls !== 0) {
12931
+ writer.uint32(88).uint64(message.toolCalls);
12932
+ }
12933
+ if (message.compactions !== 0) {
12934
+ writer.uint32(96).uint64(message.compactions);
12935
+ }
12936
+ if (message.subagentRuns !== 0) {
12937
+ writer.uint32(104).uint64(message.subagentRuns);
12938
+ }
12939
+ if (message.ttftMsSum !== 0) {
12940
+ writer.uint32(112).uint64(message.ttftMsSum);
12941
+ }
12942
+ if (message.ttftCalls !== 0) {
12943
+ writer.uint32(120).uint64(message.ttftCalls);
12944
+ }
12945
+ for (const v of message.providers) {
12946
+ writer.uint32(130).string(v!);
12947
+ }
12948
+ for (const v of message.principals) {
12949
+ ModelActivityPrincipal.encode(v!, writer.uint32(138).fork()).join();
12950
+ }
12951
+ return writer;
12952
+ },
12953
+
12954
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivity {
12955
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12956
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12957
+ if (previousRecursionDepth >= 100) {
12958
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12959
+ }
12960
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12961
+ try {
12962
+ const end = length === undefined ? reader.len : reader.pos + length;
12963
+ const message = createBaseModelActivity();
12964
+ while (reader.pos < end) {
12965
+ const tag = reader.uint32();
12966
+ switch (tag >>> 3) {
12967
+ case 1: {
12968
+ if (tag !== 10) {
12969
+ break;
12970
+ }
12971
+
12972
+ message.key = reader.string();
12973
+ continue;
12974
+ }
12975
+ case 2: {
12976
+ if (tag !== 16) {
12977
+ break;
12978
+ }
12979
+
12980
+ message.modelCalls = longToNumber(reader.uint64());
12981
+ continue;
12982
+ }
12983
+ case 3: {
12984
+ if (tag !== 24) {
12985
+ break;
12986
+ }
12987
+
12988
+ message.failedCalls = longToNumber(reader.uint64());
12989
+ continue;
12990
+ }
12991
+ case 4: {
12992
+ if (tag !== 32) {
12993
+ break;
12994
+ }
12995
+
12996
+ message.inputTokens = longToNumber(reader.uint64());
12997
+ continue;
12998
+ }
12999
+ case 5: {
13000
+ if (tag !== 40) {
13001
+ break;
13002
+ }
13003
+
13004
+ message.outputTokens = longToNumber(reader.uint64());
13005
+ continue;
13006
+ }
13007
+ case 6: {
13008
+ if (tag !== 48) {
13009
+ break;
13010
+ }
13011
+
13012
+ message.cacheReadTokens = longToNumber(reader.uint64());
13013
+ continue;
13014
+ }
13015
+ case 7: {
13016
+ if (tag !== 56) {
13017
+ break;
13018
+ }
13019
+
13020
+ message.cacheWriteTokens = longToNumber(reader.uint64());
13021
+ continue;
13022
+ }
13023
+ case 8: {
13024
+ if (tag !== 65) {
13025
+ break;
13026
+ }
13027
+
13028
+ message.costUsd = reader.double();
13029
+ continue;
13030
+ }
13031
+ case 9: {
13032
+ if (tag !== 73) {
13033
+ break;
13034
+ }
13035
+
13036
+ message.subscriptionCostUsd = reader.double();
13037
+ continue;
13038
+ }
13039
+ case 10: {
13040
+ if (tag !== 80) {
13041
+ break;
13042
+ }
13043
+
13044
+ message.sessions = longToNumber(reader.uint64());
13045
+ continue;
13046
+ }
13047
+ case 11: {
13048
+ if (tag !== 88) {
13049
+ break;
13050
+ }
13051
+
13052
+ message.toolCalls = longToNumber(reader.uint64());
13053
+ continue;
13054
+ }
13055
+ case 12: {
13056
+ if (tag !== 96) {
13057
+ break;
13058
+ }
13059
+
13060
+ message.compactions = longToNumber(reader.uint64());
13061
+ continue;
13062
+ }
13063
+ case 13: {
13064
+ if (tag !== 104) {
13065
+ break;
13066
+ }
13067
+
13068
+ message.subagentRuns = longToNumber(reader.uint64());
13069
+ continue;
13070
+ }
13071
+ case 14: {
13072
+ if (tag !== 112) {
13073
+ break;
13074
+ }
13075
+
13076
+ message.ttftMsSum = longToNumber(reader.uint64());
13077
+ continue;
13078
+ }
13079
+ case 15: {
13080
+ if (tag !== 120) {
13081
+ break;
13082
+ }
13083
+
13084
+ message.ttftCalls = longToNumber(reader.uint64());
13085
+ continue;
13086
+ }
13087
+ case 16: {
13088
+ if (tag !== 130) {
13089
+ break;
13090
+ }
13091
+
13092
+ message.providers.push(reader.string());
13093
+ continue;
13094
+ }
13095
+ case 17: {
13096
+ if (tag !== 138) {
13097
+ break;
13098
+ }
13099
+
13100
+ message.principals.push(ModelActivityPrincipal.decode(reader, reader.uint32()));
13101
+ continue;
13102
+ }
13103
+ }
13104
+ if ((tag & 7) === 4 || tag === 0) {
13105
+ break;
13106
+ }
13107
+ reader.skip(tag & 7);
13108
+ }
13109
+ return message;
13110
+ } finally {
13111
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13112
+ }
13113
+ },
13114
+
13115
+ fromJSON(object: any): ModelActivity {
13116
+ return {
13117
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
13118
+ modelCalls: isSet(object.modelCalls)
13119
+ ? globalThis.Number(object.modelCalls)
13120
+ : isSet(object.model_calls)
13121
+ ? globalThis.Number(object.model_calls)
13122
+ : 0,
13123
+ failedCalls: isSet(object.failedCalls)
13124
+ ? globalThis.Number(object.failedCalls)
13125
+ : isSet(object.failed_calls)
13126
+ ? globalThis.Number(object.failed_calls)
13127
+ : 0,
13128
+ inputTokens: isSet(object.inputTokens)
13129
+ ? globalThis.Number(object.inputTokens)
13130
+ : isSet(object.input_tokens)
13131
+ ? globalThis.Number(object.input_tokens)
13132
+ : 0,
13133
+ outputTokens: isSet(object.outputTokens)
13134
+ ? globalThis.Number(object.outputTokens)
13135
+ : isSet(object.output_tokens)
13136
+ ? globalThis.Number(object.output_tokens)
13137
+ : 0,
13138
+ cacheReadTokens: isSet(object.cacheReadTokens)
13139
+ ? globalThis.Number(object.cacheReadTokens)
13140
+ : isSet(object.cache_read_tokens)
13141
+ ? globalThis.Number(object.cache_read_tokens)
13142
+ : 0,
13143
+ cacheWriteTokens: isSet(object.cacheWriteTokens)
13144
+ ? globalThis.Number(object.cacheWriteTokens)
13145
+ : isSet(object.cache_write_tokens)
13146
+ ? globalThis.Number(object.cache_write_tokens)
13147
+ : 0,
13148
+ costUsd: isSet(object.costUsd)
13149
+ ? globalThis.Number(object.costUsd)
13150
+ : isSet(object.cost_usd)
13151
+ ? globalThis.Number(object.cost_usd)
13152
+ : 0,
13153
+ subscriptionCostUsd: isSet(object.subscriptionCostUsd)
13154
+ ? globalThis.Number(object.subscriptionCostUsd)
13155
+ : isSet(object.subscription_cost_usd)
13156
+ ? globalThis.Number(object.subscription_cost_usd)
13157
+ : 0,
13158
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
13159
+ toolCalls: isSet(object.toolCalls)
13160
+ ? globalThis.Number(object.toolCalls)
13161
+ : isSet(object.tool_calls)
13162
+ ? globalThis.Number(object.tool_calls)
13163
+ : 0,
13164
+ compactions: isSet(object.compactions) ? globalThis.Number(object.compactions) : 0,
13165
+ subagentRuns: isSet(object.subagentRuns)
13166
+ ? globalThis.Number(object.subagentRuns)
13167
+ : isSet(object.subagent_runs)
13168
+ ? globalThis.Number(object.subagent_runs)
13169
+ : 0,
13170
+ ttftMsSum: isSet(object.ttftMsSum)
13171
+ ? globalThis.Number(object.ttftMsSum)
13172
+ : isSet(object.ttft_ms_sum)
13173
+ ? globalThis.Number(object.ttft_ms_sum)
13174
+ : 0,
13175
+ ttftCalls: isSet(object.ttftCalls)
13176
+ ? globalThis.Number(object.ttftCalls)
13177
+ : isSet(object.ttft_calls)
13178
+ ? globalThis.Number(object.ttft_calls)
13179
+ : 0,
13180
+ providers: globalThis.Array.isArray(object?.providers)
13181
+ ? object.providers.map((e: any) => globalThis.String(e))
13182
+ : [],
13183
+ principals: globalThis.Array.isArray(object?.principals)
13184
+ ? object.principals.map((e: any) => ModelActivityPrincipal.fromJSON(e))
13185
+ : [],
13186
+ };
13187
+ },
13188
+
13189
+ toJSON(message: ModelActivity): unknown {
13190
+ const obj: any = {};
13191
+ if (message.key !== "") {
13192
+ obj.key = message.key;
13193
+ }
13194
+ if (message.modelCalls !== 0) {
13195
+ obj.modelCalls = Math.round(message.modelCalls);
13196
+ }
13197
+ if (message.failedCalls !== 0) {
13198
+ obj.failedCalls = Math.round(message.failedCalls);
13199
+ }
13200
+ if (message.inputTokens !== 0) {
13201
+ obj.inputTokens = Math.round(message.inputTokens);
13202
+ }
13203
+ if (message.outputTokens !== 0) {
13204
+ obj.outputTokens = Math.round(message.outputTokens);
13205
+ }
13206
+ if (message.cacheReadTokens !== 0) {
13207
+ obj.cacheReadTokens = Math.round(message.cacheReadTokens);
13208
+ }
13209
+ if (message.cacheWriteTokens !== 0) {
13210
+ obj.cacheWriteTokens = Math.round(message.cacheWriteTokens);
13211
+ }
13212
+ if (message.costUsd !== 0) {
13213
+ obj.costUsd = message.costUsd;
13214
+ }
13215
+ if (message.subscriptionCostUsd !== 0) {
13216
+ obj.subscriptionCostUsd = message.subscriptionCostUsd;
13217
+ }
13218
+ if (message.sessions !== 0) {
13219
+ obj.sessions = Math.round(message.sessions);
13220
+ }
13221
+ if (message.toolCalls !== 0) {
13222
+ obj.toolCalls = Math.round(message.toolCalls);
13223
+ }
13224
+ if (message.compactions !== 0) {
13225
+ obj.compactions = Math.round(message.compactions);
13226
+ }
13227
+ if (message.subagentRuns !== 0) {
13228
+ obj.subagentRuns = Math.round(message.subagentRuns);
13229
+ }
13230
+ if (message.ttftMsSum !== 0) {
13231
+ obj.ttftMsSum = Math.round(message.ttftMsSum);
13232
+ }
13233
+ if (message.ttftCalls !== 0) {
13234
+ obj.ttftCalls = Math.round(message.ttftCalls);
13235
+ }
13236
+ if (message.providers?.length) {
13237
+ obj.providers = message.providers;
13238
+ }
13239
+ if (message.principals?.length) {
13240
+ obj.principals = message.principals.map((e) => ModelActivityPrincipal.toJSON(e));
13241
+ }
13242
+ return obj;
13243
+ },
13244
+
13245
+ create<I extends Exact<DeepPartial<ModelActivity>, I>>(base?: I): ModelActivity {
13246
+ return ModelActivity.fromPartial(base ?? ({} as any));
13247
+ },
13248
+ fromPartial<I extends Exact<DeepPartial<ModelActivity>, I>>(object: I): ModelActivity {
13249
+ const message = createBaseModelActivity();
13250
+ message.key = object.key ?? "";
13251
+ message.modelCalls = object.modelCalls ?? 0;
13252
+ message.failedCalls = object.failedCalls ?? 0;
13253
+ message.inputTokens = object.inputTokens ?? 0;
13254
+ message.outputTokens = object.outputTokens ?? 0;
13255
+ message.cacheReadTokens = object.cacheReadTokens ?? 0;
13256
+ message.cacheWriteTokens = object.cacheWriteTokens ?? 0;
13257
+ message.costUsd = object.costUsd ?? 0;
13258
+ message.subscriptionCostUsd = object.subscriptionCostUsd ?? 0;
13259
+ message.sessions = object.sessions ?? 0;
13260
+ message.toolCalls = object.toolCalls ?? 0;
13261
+ message.compactions = object.compactions ?? 0;
13262
+ message.subagentRuns = object.subagentRuns ?? 0;
13263
+ message.ttftMsSum = object.ttftMsSum ?? 0;
13264
+ message.ttftCalls = object.ttftCalls ?? 0;
13265
+ message.providers = object.providers?.map((e) => e) || [];
13266
+ message.principals = object.principals?.map((e) => ModelActivityPrincipal.fromPartial(e)) || [];
13267
+ return message;
13268
+ },
13269
+ };
13270
+
13271
+ function createBaseModelActivityPrincipal(): ModelActivityPrincipal {
13272
+ return { kind: 0, id: "", sourceSystem: "", modelCalls: 0, sessions: 0, inputTokens: 0, outputTokens: 0, costUsd: 0 };
13273
+ }
13274
+
13275
+ export const ModelActivityPrincipal: MessageFns<ModelActivityPrincipal> = {
13276
+ encode(message: ModelActivityPrincipal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13277
+ if (message.kind !== 0) {
13278
+ writer.uint32(8).int32(message.kind);
13279
+ }
13280
+ if (message.id !== "") {
13281
+ writer.uint32(18).string(message.id);
13282
+ }
13283
+ if (message.sourceSystem !== "") {
13284
+ writer.uint32(26).string(message.sourceSystem);
13285
+ }
13286
+ if (message.modelCalls !== 0) {
13287
+ writer.uint32(32).uint64(message.modelCalls);
13288
+ }
13289
+ if (message.sessions !== 0) {
13290
+ writer.uint32(40).uint64(message.sessions);
13291
+ }
13292
+ if (message.inputTokens !== 0) {
13293
+ writer.uint32(48).uint64(message.inputTokens);
13294
+ }
13295
+ if (message.outputTokens !== 0) {
13296
+ writer.uint32(56).uint64(message.outputTokens);
13297
+ }
13298
+ if (message.costUsd !== 0) {
13299
+ writer.uint32(65).double(message.costUsd);
13300
+ }
13301
+ return writer;
13302
+ },
13303
+
13304
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityPrincipal {
13305
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13306
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13307
+ if (previousRecursionDepth >= 100) {
13308
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13309
+ }
13310
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13311
+ try {
13312
+ const end = length === undefined ? reader.len : reader.pos + length;
13313
+ const message = createBaseModelActivityPrincipal();
13314
+ while (reader.pos < end) {
13315
+ const tag = reader.uint32();
13316
+ switch (tag >>> 3) {
13317
+ case 1: {
13318
+ if (tag !== 8) {
13319
+ break;
13320
+ }
13321
+
13322
+ message.kind = reader.int32() as any;
13323
+ continue;
13324
+ }
13325
+ case 2: {
13326
+ if (tag !== 18) {
13327
+ break;
13328
+ }
13329
+
13330
+ message.id = reader.string();
13331
+ continue;
13332
+ }
13333
+ case 3: {
13334
+ if (tag !== 26) {
13335
+ break;
13336
+ }
13337
+
13338
+ message.sourceSystem = reader.string();
13339
+ continue;
13340
+ }
13341
+ case 4: {
13342
+ if (tag !== 32) {
13343
+ break;
13344
+ }
13345
+
13346
+ message.modelCalls = longToNumber(reader.uint64());
13347
+ continue;
13348
+ }
13349
+ case 5: {
13350
+ if (tag !== 40) {
13351
+ break;
13352
+ }
13353
+
13354
+ message.sessions = longToNumber(reader.uint64());
13355
+ continue;
13356
+ }
13357
+ case 6: {
13358
+ if (tag !== 48) {
13359
+ break;
13360
+ }
13361
+
13362
+ message.inputTokens = longToNumber(reader.uint64());
13363
+ continue;
13364
+ }
13365
+ case 7: {
13366
+ if (tag !== 56) {
13367
+ break;
13368
+ }
13369
+
13370
+ message.outputTokens = longToNumber(reader.uint64());
13371
+ continue;
13372
+ }
13373
+ case 8: {
13374
+ if (tag !== 65) {
13375
+ break;
13376
+ }
13377
+
13378
+ message.costUsd = reader.double();
13379
+ continue;
13380
+ }
13381
+ }
13382
+ if ((tag & 7) === 4 || tag === 0) {
13383
+ break;
13384
+ }
13385
+ reader.skip(tag & 7);
13386
+ }
13387
+ return message;
13388
+ } finally {
13389
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13390
+ }
13391
+ },
13392
+
13393
+ fromJSON(object: any): ModelActivityPrincipal {
13394
+ return {
13395
+ kind: isSet(object.kind) ? aIPrincipalKindFromJSON(object.kind) : 0,
13396
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
13397
+ sourceSystem: isSet(object.sourceSystem)
13398
+ ? globalThis.String(object.sourceSystem)
13399
+ : isSet(object.source_system)
13400
+ ? globalThis.String(object.source_system)
13401
+ : "",
13402
+ modelCalls: isSet(object.modelCalls)
13403
+ ? globalThis.Number(object.modelCalls)
13404
+ : isSet(object.model_calls)
13405
+ ? globalThis.Number(object.model_calls)
13406
+ : 0,
13407
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
13408
+ inputTokens: isSet(object.inputTokens)
13409
+ ? globalThis.Number(object.inputTokens)
13410
+ : isSet(object.input_tokens)
13411
+ ? globalThis.Number(object.input_tokens)
13412
+ : 0,
13413
+ outputTokens: isSet(object.outputTokens)
13414
+ ? globalThis.Number(object.outputTokens)
13415
+ : isSet(object.output_tokens)
13416
+ ? globalThis.Number(object.output_tokens)
13417
+ : 0,
13418
+ costUsd: isSet(object.costUsd)
13419
+ ? globalThis.Number(object.costUsd)
13420
+ : isSet(object.cost_usd)
13421
+ ? globalThis.Number(object.cost_usd)
13422
+ : 0,
13423
+ };
13424
+ },
13425
+
13426
+ toJSON(message: ModelActivityPrincipal): unknown {
13427
+ const obj: any = {};
13428
+ if (message.kind !== 0) {
13429
+ obj.kind = aIPrincipalKindToJSON(message.kind);
13430
+ }
13431
+ if (message.id !== "") {
13432
+ obj.id = message.id;
13433
+ }
13434
+ if (message.sourceSystem !== "") {
13435
+ obj.sourceSystem = message.sourceSystem;
13436
+ }
13437
+ if (message.modelCalls !== 0) {
13438
+ obj.modelCalls = Math.round(message.modelCalls);
13439
+ }
13440
+ if (message.sessions !== 0) {
13441
+ obj.sessions = Math.round(message.sessions);
13442
+ }
13443
+ if (message.inputTokens !== 0) {
13444
+ obj.inputTokens = Math.round(message.inputTokens);
13445
+ }
13446
+ if (message.outputTokens !== 0) {
13447
+ obj.outputTokens = Math.round(message.outputTokens);
13448
+ }
13449
+ if (message.costUsd !== 0) {
13450
+ obj.costUsd = message.costUsd;
13451
+ }
13452
+ return obj;
13453
+ },
13454
+
13455
+ create<I extends Exact<DeepPartial<ModelActivityPrincipal>, I>>(base?: I): ModelActivityPrincipal {
13456
+ return ModelActivityPrincipal.fromPartial(base ?? ({} as any));
13457
+ },
13458
+ fromPartial<I extends Exact<DeepPartial<ModelActivityPrincipal>, I>>(object: I): ModelActivityPrincipal {
13459
+ const message = createBaseModelActivityPrincipal();
13460
+ message.kind = object.kind ?? 0;
13461
+ message.id = object.id ?? "";
13462
+ message.sourceSystem = object.sourceSystem ?? "";
13463
+ message.modelCalls = object.modelCalls ?? 0;
13464
+ message.sessions = object.sessions ?? 0;
13465
+ message.inputTokens = object.inputTokens ?? 0;
13466
+ message.outputTokens = object.outputTokens ?? 0;
13467
+ message.costUsd = object.costUsd ?? 0;
13468
+ return message;
13469
+ },
13470
+ };
13471
+
13472
+ function createBaseAISessionRef(): AISessionRef {
13473
+ return { sourceSystem: "", sessionId: "" };
13474
+ }
13475
+
13476
+ export const AISessionRef: MessageFns<AISessionRef> = {
13477
+ encode(message: AISessionRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13478
+ if (message.sourceSystem !== "") {
13479
+ writer.uint32(10).string(message.sourceSystem);
13480
+ }
13481
+ if (message.sessionId !== "") {
13482
+ writer.uint32(18).string(message.sessionId);
13483
+ }
13484
+ return writer;
13485
+ },
13486
+
13487
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionRef {
13488
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13489
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13490
+ if (previousRecursionDepth >= 100) {
13491
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13492
+ }
13493
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13494
+ try {
13495
+ const end = length === undefined ? reader.len : reader.pos + length;
13496
+ const message = createBaseAISessionRef();
13497
+ while (reader.pos < end) {
13498
+ const tag = reader.uint32();
13499
+ switch (tag >>> 3) {
13500
+ case 1: {
13501
+ if (tag !== 10) {
13502
+ break;
13503
+ }
13504
+
13505
+ message.sourceSystem = reader.string();
13506
+ continue;
13507
+ }
13508
+ case 2: {
13509
+ if (tag !== 18) {
13510
+ break;
13511
+ }
13512
+
13513
+ message.sessionId = reader.string();
13514
+ continue;
13515
+ }
13516
+ }
13517
+ if ((tag & 7) === 4 || tag === 0) {
13518
+ break;
13519
+ }
13520
+ reader.skip(tag & 7);
13521
+ }
13522
+ return message;
13523
+ } finally {
13524
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13525
+ }
13526
+ },
13527
+
13528
+ fromJSON(object: any): AISessionRef {
13529
+ return {
13530
+ sourceSystem: isSet(object.sourceSystem)
13531
+ ? globalThis.String(object.sourceSystem)
13532
+ : isSet(object.source_system)
13533
+ ? globalThis.String(object.source_system)
13534
+ : "",
13535
+ sessionId: isSet(object.sessionId)
13536
+ ? globalThis.String(object.sessionId)
13537
+ : isSet(object.session_id)
13538
+ ? globalThis.String(object.session_id)
13539
+ : "",
13540
+ };
13541
+ },
13542
+
13543
+ toJSON(message: AISessionRef): unknown {
13544
+ const obj: any = {};
13545
+ if (message.sourceSystem !== "") {
13546
+ obj.sourceSystem = message.sourceSystem;
13547
+ }
13548
+ if (message.sessionId !== "") {
13549
+ obj.sessionId = message.sessionId;
13550
+ }
13551
+ return obj;
13552
+ },
13553
+
13554
+ create<I extends Exact<DeepPartial<AISessionRef>, I>>(base?: I): AISessionRef {
13555
+ return AISessionRef.fromPartial(base ?? ({} as any));
13556
+ },
13557
+ fromPartial<I extends Exact<DeepPartial<AISessionRef>, I>>(object: I): AISessionRef {
13558
+ const message = createBaseAISessionRef();
13559
+ message.sourceSystem = object.sourceSystem ?? "";
13560
+ message.sessionId = object.sessionId ?? "";
13561
+ return message;
13562
+ },
13563
+ };
13564
+
13565
+ function createBaseAIFileFilter(): AIFileFilter {
13566
+ return {
13567
+ repositoryKey: [],
13568
+ ref: [],
13569
+ state: [],
13570
+ tier: [],
13571
+ session: [],
13572
+ minAge: undefined,
13573
+ activeAfter: undefined,
13574
+ activeBefore: undefined,
13575
+ abandonedHorizon: undefined,
13576
+ };
13577
+ }
13578
+
13579
+ export const AIFileFilter: MessageFns<AIFileFilter> = {
13580
+ encode(message: AIFileFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13581
+ for (const v of message.repositoryKey) {
13582
+ writer.uint32(10).string(v!);
13583
+ }
13584
+ for (const v of message.ref) {
13585
+ writer.uint32(18).string(v!);
13586
+ }
13587
+ writer.uint32(26).fork();
13588
+ for (const v of message.state) {
13589
+ writer.int32(v);
13590
+ }
13591
+ writer.join();
13592
+ writer.uint32(34).fork();
13593
+ for (const v of message.tier) {
13594
+ writer.int32(v);
13595
+ }
13596
+ writer.join();
13597
+ for (const v of message.session) {
13598
+ AISessionRef.encode(v!, writer.uint32(42).fork()).join();
13599
+ }
13600
+ if (message.minAge !== undefined) {
13601
+ Duration.encode(message.minAge, writer.uint32(50).fork()).join();
13602
+ }
13603
+ if (message.activeAfter !== undefined) {
13604
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(58).fork()).join();
13605
+ }
13606
+ if (message.activeBefore !== undefined) {
13607
+ Timestamp.encode(toTimestamp(message.activeBefore), writer.uint32(66).fork()).join();
13608
+ }
13609
+ if (message.abandonedHorizon !== undefined) {
13610
+ Duration.encode(message.abandonedHorizon, writer.uint32(74).fork()).join();
13611
+ }
13612
+ return writer;
13613
+ },
13614
+
13615
+ decode(input: BinaryReader | Uint8Array, length?: number): AIFileFilter {
13616
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13617
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13618
+ if (previousRecursionDepth >= 100) {
13619
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13620
+ }
13621
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13622
+ try {
13623
+ const end = length === undefined ? reader.len : reader.pos + length;
13624
+ const message = createBaseAIFileFilter();
13625
+ while (reader.pos < end) {
13626
+ const tag = reader.uint32();
13627
+ switch (tag >>> 3) {
13628
+ case 1: {
13629
+ if (tag !== 10) {
13630
+ break;
13631
+ }
13632
+
13633
+ message.repositoryKey.push(reader.string());
13634
+ continue;
13635
+ }
13636
+ case 2: {
13637
+ if (tag !== 18) {
13638
+ break;
13639
+ }
13640
+
13641
+ message.ref.push(reader.string());
13642
+ continue;
13643
+ }
13644
+ case 3: {
13645
+ if (tag === 24) {
13646
+ message.state.push(reader.int32() as any);
13647
+
13648
+ continue;
13649
+ }
13650
+
13651
+ if (tag === 26) {
13652
+ const end2 = reader.uint32() + reader.pos;
13653
+ while (reader.pos < end2) {
13654
+ message.state.push(reader.int32() as any);
13655
+ }
13656
+
13657
+ continue;
13658
+ }
13659
+
13660
+ break;
13661
+ }
13662
+ case 4: {
13663
+ if (tag === 32) {
13664
+ message.tier.push(reader.int32() as any);
13665
+
13666
+ continue;
13667
+ }
13668
+
13669
+ if (tag === 34) {
13670
+ const end2 = reader.uint32() + reader.pos;
13671
+ while (reader.pos < end2) {
13672
+ message.tier.push(reader.int32() as any);
13673
+ }
13674
+
13675
+ continue;
13676
+ }
13677
+
13678
+ break;
13679
+ }
13680
+ case 5: {
13681
+ if (tag !== 42) {
13682
+ break;
13683
+ }
13684
+
13685
+ message.session.push(AISessionRef.decode(reader, reader.uint32()));
13686
+ continue;
13687
+ }
13688
+ case 6: {
13689
+ if (tag !== 50) {
13690
+ break;
13691
+ }
13692
+
13693
+ message.minAge = Duration.decode(reader, reader.uint32());
13694
+ continue;
13695
+ }
13696
+ case 7: {
13697
+ if (tag !== 58) {
13698
+ break;
13699
+ }
13700
+
13701
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
13702
+ continue;
13703
+ }
13704
+ case 8: {
13705
+ if (tag !== 66) {
13706
+ break;
13707
+ }
13708
+
13709
+ message.activeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
13710
+ continue;
13711
+ }
13712
+ case 9: {
13713
+ if (tag !== 74) {
13714
+ break;
13715
+ }
13716
+
13717
+ message.abandonedHorizon = Duration.decode(reader, reader.uint32());
13718
+ continue;
13719
+ }
13720
+ }
13721
+ if ((tag & 7) === 4 || tag === 0) {
13722
+ break;
13723
+ }
13724
+ reader.skip(tag & 7);
13725
+ }
13726
+ return message;
13727
+ } finally {
13728
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13729
+ }
13730
+ },
13731
+
13732
+ fromJSON(object: any): AIFileFilter {
13733
+ return {
13734
+ repositoryKey: globalThis.Array.isArray(object?.repositoryKey)
13735
+ ? object.repositoryKey.map((e: any) => globalThis.String(e))
13736
+ : globalThis.Array.isArray(object?.repository_key)
13737
+ ? object.repository_key.map((e: any) => globalThis.String(e))
13738
+ : [],
13739
+ ref: globalThis.Array.isArray(object?.ref) ? object.ref.map((e: any) => globalThis.String(e)) : [],
13740
+ state: globalThis.Array.isArray(object?.state) ? object.state.map((e: any) => aIFileLifecycleFromJSON(e)) : [],
13741
+ tier: globalThis.Array.isArray(object?.tier) ? object.tier.map((e: any) => aIFileTierFromJSON(e)) : [],
13742
+ session: globalThis.Array.isArray(object?.session)
13743
+ ? object.session.map((e: any) => AISessionRef.fromJSON(e))
13744
+ : [],
13745
+ minAge: isSet(object.minAge)
13746
+ ? Duration.fromJSON(object.minAge)
13747
+ : isSet(object.min_age)
13748
+ ? Duration.fromJSON(object.min_age)
13749
+ : undefined,
13750
+ activeAfter: isSet(object.activeAfter)
13751
+ ? fromJsonTimestamp(object.activeAfter)
13752
+ : isSet(object.active_after)
13753
+ ? fromJsonTimestamp(object.active_after)
13754
+ : undefined,
13755
+ activeBefore: isSet(object.activeBefore)
13756
+ ? fromJsonTimestamp(object.activeBefore)
13757
+ : isSet(object.active_before)
13758
+ ? fromJsonTimestamp(object.active_before)
13759
+ : undefined,
13760
+ abandonedHorizon: isSet(object.abandonedHorizon)
13761
+ ? Duration.fromJSON(object.abandonedHorizon)
13762
+ : isSet(object.abandoned_horizon)
13763
+ ? Duration.fromJSON(object.abandoned_horizon)
13764
+ : undefined,
13765
+ };
13766
+ },
13767
+
13768
+ toJSON(message: AIFileFilter): unknown {
13769
+ const obj: any = {};
13770
+ if (message.repositoryKey?.length) {
13771
+ obj.repositoryKey = message.repositoryKey;
13772
+ }
13773
+ if (message.ref?.length) {
13774
+ obj.ref = message.ref;
13775
+ }
13776
+ if (message.state?.length) {
12641
13777
  obj.state = message.state.map((e) => aIFileLifecycleToJSON(e));
12642
13778
  }
12643
13779
  if (message.tier?.length) {
12644
13780
  obj.tier = message.tier.map((e) => aIFileTierToJSON(e));
12645
13781
  }
12646
- if (message.sessionId?.length) {
12647
- obj.sessionId = message.sessionId;
13782
+ if (message.session?.length) {
13783
+ obj.session = message.session.map((e) => AISessionRef.toJSON(e));
12648
13784
  }
12649
13785
  if (message.minAge !== undefined) {
12650
13786
  obj.minAge = Duration.toJSON(message.minAge);
@@ -12670,7 +13806,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12670
13806
  message.ref = object.ref?.map((e) => e) || [];
12671
13807
  message.state = object.state?.map((e) => e) || [];
12672
13808
  message.tier = object.tier?.map((e) => e) || [];
12673
- message.sessionId = object.sessionId?.map((e) => e) || [];
13809
+ message.session = object.session?.map((e) => AISessionRef.fromPartial(e)) || [];
12674
13810
  message.minAge = (object.minAge !== undefined && object.minAge !== null)
12675
13811
  ? Duration.fromPartial(object.minAge)
12676
13812
  : undefined;
@@ -12959,7 +14095,7 @@ function createBaseAIFileRow(): AIFileRow {
12959
14095
  discardedAt: undefined,
12960
14096
  discardReason: "",
12961
14097
  editCount: 0,
12962
- sessionId: [],
14098
+ sessions: [],
12963
14099
  unlandedCostUsd: 0,
12964
14100
  unlandedOutputTokens: 0,
12965
14101
  totalCostUsd: 0,
@@ -13018,8 +14154,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13018
14154
  if (message.editCount !== 0) {
13019
14155
  writer.uint32(128).uint32(message.editCount);
13020
14156
  }
13021
- for (const v of message.sessionId) {
13022
- writer.uint32(138).string(v!);
14157
+ for (const v of message.sessions) {
14158
+ AISessionRef.encode(v!, writer.uint32(138).fork()).join();
13023
14159
  }
13024
14160
  if (message.unlandedCostUsd !== 0) {
13025
14161
  writer.uint32(145).double(message.unlandedCostUsd);
@@ -13185,7 +14321,7 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13185
14321
  break;
13186
14322
  }
13187
14323
 
13188
- message.sessionId.push(reader.string());
14324
+ message.sessions.push(AISessionRef.decode(reader, reader.uint32()));
13189
14325
  continue;
13190
14326
  }
13191
14327
  case 18: {
@@ -13302,10 +14438,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13302
14438
  : isSet(object.edit_count)
13303
14439
  ? globalThis.Number(object.edit_count)
13304
14440
  : 0,
13305
- sessionId: globalThis.Array.isArray(object?.sessionId)
13306
- ? object.sessionId.map((e: any) => globalThis.String(e))
13307
- : globalThis.Array.isArray(object?.session_id)
13308
- ? object.session_id.map((e: any) => globalThis.String(e))
14441
+ sessions: globalThis.Array.isArray(object?.sessions)
14442
+ ? object.sessions.map((e: any) => AISessionRef.fromJSON(e))
13309
14443
  : [],
13310
14444
  unlandedCostUsd: isSet(object.unlandedCostUsd)
13311
14445
  ? globalThis.Number(object.unlandedCostUsd)
@@ -13385,8 +14519,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13385
14519
  if (message.editCount !== 0) {
13386
14520
  obj.editCount = Math.round(message.editCount);
13387
14521
  }
13388
- if (message.sessionId?.length) {
13389
- obj.sessionId = message.sessionId;
14522
+ if (message.sessions?.length) {
14523
+ obj.sessions = message.sessions.map((e) => AISessionRef.toJSON(e));
13390
14524
  }
13391
14525
  if (message.unlandedCostUsd !== 0) {
13392
14526
  obj.unlandedCostUsd = message.unlandedCostUsd;
@@ -13427,7 +14561,7 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13427
14561
  message.discardedAt = object.discardedAt ?? undefined;
13428
14562
  message.discardReason = object.discardReason ?? "";
13429
14563
  message.editCount = object.editCount ?? 0;
13430
- message.sessionId = object.sessionId?.map((e) => e) || [];
14564
+ message.sessions = object.sessions?.map((e) => AISessionRef.fromPartial(e)) || [];
13431
14565
  message.unlandedCostUsd = object.unlandedCostUsd ?? 0;
13432
14566
  message.unlandedOutputTokens = object.unlandedOutputTokens ?? 0;
13433
14567
  message.totalCostUsd = object.totalCostUsd ?? 0;
@@ -16270,6 +17404,12 @@ export interface AIGatewayService {
16270
17404
  * sessions. Mirrors telemetry.api.v1.
16271
17405
  */
16272
17406
  ListResourceRankings(request: ResourceRankingsRequest, metadata?: Metadata): Promise<ResourceRankingsResponse>;
17407
+ /**
17408
+ * Every model of a project over a time range: usage, the tool calls, compactions and subagent runs
17409
+ * attributed to each, and who called it. Groups fold stored spellings; an ungrouped name is its own row,
17410
+ * costliest first. Mirrors telemetry.api.v1.
17411
+ */
17412
+ ListModelActivity(request: ModelActivityRequest, metadata?: Metadata): Promise<ModelActivityResponse>;
16273
17413
  /**
16274
17414
  * Per-seat entitlement usage board: every entitlement owner's latest observed funding facility and
16275
17415
  * per-harness usage % windows. Stream-first (first frame = full snapshot), seat-scoped. Mirrors
@@ -16305,6 +17445,7 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
16305
17445
  this.ListModelPrices = this.ListModelPrices.bind(this);
16306
17446
  this.ListModelPriceHistory = this.ListModelPriceHistory.bind(this);
16307
17447
  this.ListResourceRankings = this.ListResourceRankings.bind(this);
17448
+ this.ListModelActivity = this.ListModelActivity.bind(this);
16308
17449
  this.StreamEntitlements = this.StreamEntitlements.bind(this);
16309
17450
  }
16310
17451
  ListSessions(request: ListSessionsRequest, metadata?: Metadata): Promise<ListSessionsResponse> {
@@ -16436,6 +17577,12 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
16436
17577
  return promise.then((data) => ResourceRankingsResponse.decode(new BinaryReader(data)));
16437
17578
  }
16438
17579
 
17580
+ ListModelActivity(request: ModelActivityRequest, metadata?: Metadata): Promise<ModelActivityResponse> {
17581
+ const data = ModelActivityRequest.encode(request).finish();
17582
+ const promise = this.rpc.request(this.service, "ListModelActivity", data, metadata);
17583
+ return promise.then((data) => ModelActivityResponse.decode(new BinaryReader(data)));
17584
+ }
17585
+
16439
17586
  StreamEntitlements(request: StreamEntitlementsRequest, metadata?: Metadata): Observable<EntitlementsSnapshot> {
16440
17587
  const data = StreamEntitlementsRequest.encode(request).finish();
16441
17588
  const result = this.rpc.serverStreamingRequest(this.service, "StreamEntitlements", data, metadata);