@miradorlabs/web-grpc 3.1.0 → 3.3.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,
@@ -92,6 +93,16 @@ export enum AISessionEventKind {
92
93
  AI_SESSION_EVENT_KIND_ERROR = 10,
93
94
  /** AI_SESSION_EVENT_KIND_SUBAGENT_RUN - One subagent run: what launched it, its parent and type, how it ended. Carries no usage. */
94
95
  AI_SESSION_EVENT_KIND_SUBAGENT_RUN = 11,
96
+ /**
97
+ * AI_SESSION_EVENT_KIND_AUTH - The harness's ambient records: no usage, and none of them makes a session on its own. Presence,
98
+ * status and duration only; what they report stays in the stored event's attributes.
99
+ */
100
+ AI_SESSION_EVENT_KIND_AUTH = 12,
101
+ AI_SESSION_EVENT_KIND_MCP_CONNECTION = 13,
102
+ AI_SESSION_EVENT_KIND_SKILL_ACTIVATION = 14,
103
+ AI_SESSION_EVENT_KIND_PERMISSION_CHANGE = 15,
104
+ AI_SESSION_EVENT_KIND_CONTEXT_MENTION = 16,
105
+ AI_SESSION_EVENT_KIND_USER_FEEDBACK = 17,
95
106
  UNRECOGNIZED = -1,
96
107
  }
97
108
 
@@ -133,6 +144,24 @@ export function aISessionEventKindFromJSON(object: any): AISessionEventKind {
133
144
  case 11:
134
145
  case "AI_SESSION_EVENT_KIND_SUBAGENT_RUN":
135
146
  return AISessionEventKind.AI_SESSION_EVENT_KIND_SUBAGENT_RUN;
147
+ case 12:
148
+ case "AI_SESSION_EVENT_KIND_AUTH":
149
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_AUTH;
150
+ case 13:
151
+ case "AI_SESSION_EVENT_KIND_MCP_CONNECTION":
152
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_MCP_CONNECTION;
153
+ case 14:
154
+ case "AI_SESSION_EVENT_KIND_SKILL_ACTIVATION":
155
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_SKILL_ACTIVATION;
156
+ case 15:
157
+ case "AI_SESSION_EVENT_KIND_PERMISSION_CHANGE":
158
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_PERMISSION_CHANGE;
159
+ case 16:
160
+ case "AI_SESSION_EVENT_KIND_CONTEXT_MENTION":
161
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_CONTEXT_MENTION;
162
+ case 17:
163
+ case "AI_SESSION_EVENT_KIND_USER_FEEDBACK":
164
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_USER_FEEDBACK;
136
165
  case -1:
137
166
  case "UNRECOGNIZED":
138
167
  default:
@@ -166,6 +195,18 @@ export function aISessionEventKindToJSON(object: AISessionEventKind): string {
166
195
  return "AI_SESSION_EVENT_KIND_ERROR";
167
196
  case AISessionEventKind.AI_SESSION_EVENT_KIND_SUBAGENT_RUN:
168
197
  return "AI_SESSION_EVENT_KIND_SUBAGENT_RUN";
198
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_AUTH:
199
+ return "AI_SESSION_EVENT_KIND_AUTH";
200
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_MCP_CONNECTION:
201
+ return "AI_SESSION_EVENT_KIND_MCP_CONNECTION";
202
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_SKILL_ACTIVATION:
203
+ return "AI_SESSION_EVENT_KIND_SKILL_ACTIVATION";
204
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_PERMISSION_CHANGE:
205
+ return "AI_SESSION_EVENT_KIND_PERMISSION_CHANGE";
206
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_CONTEXT_MENTION:
207
+ return "AI_SESSION_EVENT_KIND_CONTEXT_MENTION";
208
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_USER_FEEDBACK:
209
+ return "AI_SESSION_EVENT_KIND_USER_FEEDBACK";
169
210
  case AISessionEventKind.UNRECOGNIZED:
170
211
  default:
171
212
  return "UNRECOGNIZED";
@@ -1084,13 +1125,13 @@ export interface SessionTimelinePoint {
1084
1125
  }
1085
1126
 
1086
1127
  /**
1087
- * AIGitActivityFilter mirrors telemetry.api.v1.AIGitActivityFilter. session_id is the
1088
- * session identity (from a session-list row); fields AND, repeated values OR
1089
- * (any-of); empty = unconstrained. event_time bounds are REQUIRED when session_id is empty.
1128
+ * AIGitActivityFilter mirrors telemetry.api.v1.AIGitActivityFilter. session is the
1129
+ * session identity (from a session-list row); fields AND, sessions OR (any-of);
1130
+ * empty = unconstrained. event_time bounds are REQUIRED when session is empty.
1090
1131
  */
1091
1132
  export interface AIGitActivityFilter {
1092
- sessionId: string[];
1093
- sourceSystem: string[];
1133
+ /** both halves required */
1134
+ session: AISessionRef[];
1094
1135
  eventTimeAfter?: Date | undefined;
1095
1136
  eventTimeBefore?: Date | undefined;
1096
1137
  }
@@ -1168,8 +1209,8 @@ export interface GitActivitySummaryRequest {
1168
1209
  organizationId: string;
1169
1210
  projectId: string;
1170
1211
  /**
1171
- * filter's session_id / source_system apply; its event-time bounds are ignored
1172
- * (time_window is the range).
1212
+ * filter's session applies; its event-time bounds are ignored (time_window is the
1213
+ * range).
1173
1214
  */
1174
1215
  filter:
1175
1216
  | AIGitActivityFilter
@@ -1521,12 +1562,71 @@ export interface ResourceRanking {
1521
1562
  sessionCount: number;
1522
1563
  }
1523
1564
 
1565
+ export interface ModelActivityRequest {
1566
+ organizationId: string;
1567
+ projectId: string;
1568
+ groups: ModelActivityGroup[];
1569
+ startTime: Date | undefined;
1570
+ endTime: Date | undefined;
1571
+ }
1572
+
1573
+ export interface ModelActivityGroup {
1574
+ key: string;
1575
+ modelNames: string[];
1576
+ }
1577
+
1578
+ export interface ModelActivityResponse {
1579
+ status: ResponseStatus | undefined;
1580
+ models: ModelActivity[];
1581
+ windowStart: Date | undefined;
1582
+ windowEnd: Date | undefined;
1583
+ }
1584
+
1585
+ export interface ModelActivity {
1586
+ key: string;
1587
+ modelCalls: number;
1588
+ failedCalls: number;
1589
+ inputTokens: number;
1590
+ outputTokens: number;
1591
+ cacheReadTokens: number;
1592
+ cacheWriteTokens: number;
1593
+ costUsd: number;
1594
+ subscriptionCostUsd: number;
1595
+ sessions: number;
1596
+ toolCalls: number;
1597
+ compactions: number;
1598
+ subagentRuns: number;
1599
+ ttftMsSum: number;
1600
+ ttftCalls: number;
1601
+ providers: string[];
1602
+ /** busiest first, at most 200; user id, else api key */
1603
+ principals: ModelActivityPrincipal[];
1604
+ }
1605
+
1606
+ export interface ModelActivityPrincipal {
1607
+ kind: AIPrincipalKind;
1608
+ id: string;
1609
+ sourceSystem: string;
1610
+ modelCalls: number;
1611
+ sessions: number;
1612
+ inputTokens: number;
1613
+ outputTokens: number;
1614
+ costUsd: number;
1615
+ }
1616
+
1617
+ /** AISessionRef is a session's identity: two sources can issue the same session_id. */
1618
+ export interface AISessionRef {
1619
+ sourceSystem: string;
1620
+ sessionId: string;
1621
+ }
1622
+
1524
1623
  export interface AIFileFilter {
1525
1624
  repositoryKey: string[];
1526
1625
  ref: string[];
1527
1626
  state: AIFileLifecycle[];
1528
1627
  tier: AIFileTier[];
1529
- sessionId: string[];
1628
+ /** both halves required */
1629
+ session: AISessionRef[];
1530
1630
  minAge?: Duration | undefined;
1531
1631
  activeAfter?: Date | undefined;
1532
1632
  activeBefore?: Date | undefined;
@@ -1564,8 +1664,8 @@ export interface AIFileRow {
1564
1664
  discardedAt: Date | undefined;
1565
1665
  discardReason: string;
1566
1666
  editCount: number;
1567
- /** internal session ids that touched this file */
1568
- sessionId: string[];
1667
+ /** unique, sorted by (source_system, session_id) */
1668
+ sessions: AISessionRef[];
1569
1669
  unlandedCostUsd: number;
1570
1670
  unlandedOutputTokens: number;
1571
1671
  /**
@@ -6011,22 +6111,19 @@ export const SessionTimelinePoint: MessageFns<SessionTimelinePoint> = {
6011
6111
  };
6012
6112
 
6013
6113
  function createBaseAIGitActivityFilter(): AIGitActivityFilter {
6014
- return { sessionId: [], sourceSystem: [], eventTimeAfter: undefined, eventTimeBefore: undefined };
6114
+ return { session: [], eventTimeAfter: undefined, eventTimeBefore: undefined };
6015
6115
  }
6016
6116
 
6017
6117
  export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6018
6118
  encode(message: AIGitActivityFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6019
- for (const v of message.sessionId) {
6020
- writer.uint32(10).string(v!);
6021
- }
6022
- for (const v of message.sourceSystem) {
6023
- writer.uint32(18).string(v!);
6119
+ for (const v of message.session) {
6120
+ AISessionRef.encode(v!, writer.uint32(10).fork()).join();
6024
6121
  }
6025
6122
  if (message.eventTimeAfter !== undefined) {
6026
- Timestamp.encode(toTimestamp(message.eventTimeAfter), writer.uint32(26).fork()).join();
6123
+ Timestamp.encode(toTimestamp(message.eventTimeAfter), writer.uint32(18).fork()).join();
6027
6124
  }
6028
6125
  if (message.eventTimeBefore !== undefined) {
6029
- Timestamp.encode(toTimestamp(message.eventTimeBefore), writer.uint32(34).fork()).join();
6126
+ Timestamp.encode(toTimestamp(message.eventTimeBefore), writer.uint32(26).fork()).join();
6030
6127
  }
6031
6128
  return writer;
6032
6129
  },
@@ -6049,7 +6146,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6049
6146
  break;
6050
6147
  }
6051
6148
 
6052
- message.sessionId.push(reader.string());
6149
+ message.session.push(AISessionRef.decode(reader, reader.uint32()));
6053
6150
  continue;
6054
6151
  }
6055
6152
  case 2: {
@@ -6057,7 +6154,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6057
6154
  break;
6058
6155
  }
6059
6156
 
6060
- message.sourceSystem.push(reader.string());
6157
+ message.eventTimeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6061
6158
  continue;
6062
6159
  }
6063
6160
  case 3: {
@@ -6065,14 +6162,6 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6065
6162
  break;
6066
6163
  }
6067
6164
 
6068
- message.eventTimeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6069
- continue;
6070
- }
6071
- case 4: {
6072
- if (tag !== 34) {
6073
- break;
6074
- }
6075
-
6076
6165
  message.eventTimeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6077
6166
  continue;
6078
6167
  }
@@ -6090,15 +6179,8 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6090
6179
 
6091
6180
  fromJSON(object: any): AIGitActivityFilter {
6092
6181
  return {
6093
- sessionId: globalThis.Array.isArray(object?.sessionId)
6094
- ? object.sessionId.map((e: any) => globalThis.String(e))
6095
- : globalThis.Array.isArray(object?.session_id)
6096
- ? object.session_id.map((e: any) => globalThis.String(e))
6097
- : [],
6098
- sourceSystem: globalThis.Array.isArray(object?.sourceSystem)
6099
- ? object.sourceSystem.map((e: any) => globalThis.String(e))
6100
- : globalThis.Array.isArray(object?.source_system)
6101
- ? object.source_system.map((e: any) => globalThis.String(e))
6182
+ session: globalThis.Array.isArray(object?.session)
6183
+ ? object.session.map((e: any) => AISessionRef.fromJSON(e))
6102
6184
  : [],
6103
6185
  eventTimeAfter: isSet(object.eventTimeAfter)
6104
6186
  ? fromJsonTimestamp(object.eventTimeAfter)
@@ -6115,11 +6197,8 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6115
6197
 
6116
6198
  toJSON(message: AIGitActivityFilter): unknown {
6117
6199
  const obj: any = {};
6118
- if (message.sessionId?.length) {
6119
- obj.sessionId = message.sessionId;
6120
- }
6121
- if (message.sourceSystem?.length) {
6122
- obj.sourceSystem = message.sourceSystem;
6200
+ if (message.session?.length) {
6201
+ obj.session = message.session.map((e) => AISessionRef.toJSON(e));
6123
6202
  }
6124
6203
  if (message.eventTimeAfter !== undefined) {
6125
6204
  obj.eventTimeAfter = message.eventTimeAfter.toISOString();
@@ -6135,8 +6214,7 @@ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
6135
6214
  },
6136
6215
  fromPartial<I extends Exact<DeepPartial<AIGitActivityFilter>, I>>(object: I): AIGitActivityFilter {
6137
6216
  const message = createBaseAIGitActivityFilter();
6138
- message.sessionId = object.sessionId?.map((e) => e) || [];
6139
- message.sourceSystem = object.sourceSystem?.map((e) => e) || [];
6217
+ message.session = object.session?.map((e) => AISessionRef.fromPartial(e)) || [];
6140
6218
  message.eventTimeAfter = object.eventTimeAfter ?? undefined;
6141
6219
  message.eventTimeBefore = object.eventTimeBefore ?? undefined;
6142
6220
  return message;
@@ -12468,57 +12546,31 @@ export const ResourceRanking: MessageFns<ResourceRanking> = {
12468
12546
  },
12469
12547
  };
12470
12548
 
12471
- function createBaseAIFileFilter(): AIFileFilter {
12472
- return {
12473
- repositoryKey: [],
12474
- ref: [],
12475
- state: [],
12476
- tier: [],
12477
- sessionId: [],
12478
- minAge: undefined,
12479
- activeAfter: undefined,
12480
- activeBefore: undefined,
12481
- abandonedHorizon: undefined,
12482
- };
12549
+ function createBaseModelActivityRequest(): ModelActivityRequest {
12550
+ return { organizationId: "", projectId: "", groups: [], startTime: undefined, endTime: undefined };
12483
12551
  }
12484
12552
 
12485
- export const AIFileFilter: MessageFns<AIFileFilter> = {
12486
- encode(message: AIFileFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12487
- for (const v of message.repositoryKey) {
12488
- writer.uint32(10).string(v!);
12489
- }
12490
- for (const v of message.ref) {
12491
- writer.uint32(18).string(v!);
12492
- }
12493
- writer.uint32(26).fork();
12494
- for (const v of message.state) {
12495
- writer.int32(v);
12496
- }
12497
- writer.join();
12498
- writer.uint32(34).fork();
12499
- for (const v of message.tier) {
12500
- writer.int32(v);
12501
- }
12502
- writer.join();
12503
- for (const v of message.sessionId) {
12504
- writer.uint32(42).string(v!);
12553
+ export const ModelActivityRequest: MessageFns<ModelActivityRequest> = {
12554
+ encode(message: ModelActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12555
+ if (message.organizationId !== "") {
12556
+ writer.uint32(10).string(message.organizationId);
12505
12557
  }
12506
- if (message.minAge !== undefined) {
12507
- Duration.encode(message.minAge, writer.uint32(50).fork()).join();
12558
+ if (message.projectId !== "") {
12559
+ writer.uint32(18).string(message.projectId);
12508
12560
  }
12509
- if (message.activeAfter !== undefined) {
12510
- Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(58).fork()).join();
12561
+ for (const v of message.groups) {
12562
+ ModelActivityGroup.encode(v!, writer.uint32(26).fork()).join();
12511
12563
  }
12512
- if (message.activeBefore !== undefined) {
12513
- Timestamp.encode(toTimestamp(message.activeBefore), writer.uint32(66).fork()).join();
12564
+ if (message.startTime !== undefined) {
12565
+ Timestamp.encode(toTimestamp(message.startTime), writer.uint32(34).fork()).join();
12514
12566
  }
12515
- if (message.abandonedHorizon !== undefined) {
12516
- Duration.encode(message.abandonedHorizon, writer.uint32(74).fork()).join();
12567
+ if (message.endTime !== undefined) {
12568
+ Timestamp.encode(toTimestamp(message.endTime), writer.uint32(42).fork()).join();
12517
12569
  }
12518
12570
  return writer;
12519
12571
  },
12520
12572
 
12521
- decode(input: BinaryReader | Uint8Array, length?: number): AIFileFilter {
12573
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityRequest {
12522
12574
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12523
12575
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12524
12576
  if (previousRecursionDepth >= 100) {
@@ -12527,7 +12579,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12527
12579
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12528
12580
  try {
12529
12581
  const end = length === undefined ? reader.len : reader.pos + length;
12530
- const message = createBaseAIFileFilter();
12582
+ const message = createBaseModelActivityRequest();
12531
12583
  while (reader.pos < end) {
12532
12584
  const tag = reader.uint32();
12533
12585
  switch (tag >>> 3) {
@@ -12536,7 +12588,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12536
12588
  break;
12537
12589
  }
12538
12590
 
12539
- message.repositoryKey.push(reader.string());
12591
+ message.organizationId = reader.string();
12540
12592
  continue;
12541
12593
  }
12542
12594
  case 2: {
@@ -12544,83 +12596,31 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12544
12596
  break;
12545
12597
  }
12546
12598
 
12547
- message.ref.push(reader.string());
12599
+ message.projectId = reader.string();
12548
12600
  continue;
12549
12601
  }
12550
12602
  case 3: {
12551
- if (tag === 24) {
12552
- message.state.push(reader.int32() as any);
12553
-
12554
- continue;
12555
- }
12556
-
12557
- if (tag === 26) {
12558
- const end2 = reader.uint32() + reader.pos;
12559
- while (reader.pos < end2) {
12560
- message.state.push(reader.int32() as any);
12561
- }
12562
-
12563
- continue;
12564
- }
12565
-
12566
- break;
12567
- }
12568
- case 4: {
12569
- if (tag === 32) {
12570
- message.tier.push(reader.int32() as any);
12571
-
12572
- continue;
12573
- }
12574
-
12575
- if (tag === 34) {
12576
- const end2 = reader.uint32() + reader.pos;
12577
- while (reader.pos < end2) {
12578
- message.tier.push(reader.int32() as any);
12579
- }
12580
-
12581
- continue;
12582
- }
12583
-
12584
- break;
12585
- }
12586
- case 5: {
12587
- if (tag !== 42) {
12588
- break;
12589
- }
12590
-
12591
- message.sessionId.push(reader.string());
12592
- continue;
12593
- }
12594
- case 6: {
12595
- if (tag !== 50) {
12596
- break;
12597
- }
12598
-
12599
- message.minAge = Duration.decode(reader, reader.uint32());
12600
- continue;
12601
- }
12602
- case 7: {
12603
- if (tag !== 58) {
12603
+ if (tag !== 26) {
12604
12604
  break;
12605
12605
  }
12606
12606
 
12607
- message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12607
+ message.groups.push(ModelActivityGroup.decode(reader, reader.uint32()));
12608
12608
  continue;
12609
12609
  }
12610
- case 8: {
12611
- if (tag !== 66) {
12610
+ case 4: {
12611
+ if (tag !== 34) {
12612
12612
  break;
12613
12613
  }
12614
12614
 
12615
- message.activeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12615
+ message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12616
12616
  continue;
12617
12617
  }
12618
- case 9: {
12619
- if (tag !== 74) {
12618
+ case 5: {
12619
+ if (tag !== 42) {
12620
12620
  break;
12621
12621
  }
12622
12622
 
12623
- message.abandonedHorizon = Duration.decode(reader, reader.uint32());
12623
+ message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12624
12624
  continue;
12625
12625
  }
12626
12626
  }
@@ -12635,66 +12635,1198 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12635
12635
  }
12636
12636
  },
12637
12637
 
12638
- fromJSON(object: any): AIFileFilter {
12638
+ fromJSON(object: any): ModelActivityRequest {
12639
12639
  return {
12640
- repositoryKey: globalThis.Array.isArray(object?.repositoryKey)
12641
- ? object.repositoryKey.map((e: any) => globalThis.String(e))
12642
- : globalThis.Array.isArray(object?.repository_key)
12643
- ? object.repository_key.map((e: any) => globalThis.String(e))
12644
- : [],
12645
- ref: globalThis.Array.isArray(object?.ref) ? object.ref.map((e: any) => globalThis.String(e)) : [],
12646
- state: globalThis.Array.isArray(object?.state) ? object.state.map((e: any) => aIFileLifecycleFromJSON(e)) : [],
12647
- tier: globalThis.Array.isArray(object?.tier) ? object.tier.map((e: any) => aIFileTierFromJSON(e)) : [],
12648
- sessionId: globalThis.Array.isArray(object?.sessionId)
12649
- ? object.sessionId.map((e: any) => globalThis.String(e))
12650
- : globalThis.Array.isArray(object?.session_id)
12651
- ? object.session_id.map((e: any) => globalThis.String(e))
12640
+ organizationId: isSet(object.organizationId)
12641
+ ? globalThis.String(object.organizationId)
12642
+ : isSet(object.organization_id)
12643
+ ? globalThis.String(object.organization_id)
12644
+ : "",
12645
+ projectId: isSet(object.projectId)
12646
+ ? globalThis.String(object.projectId)
12647
+ : isSet(object.project_id)
12648
+ ? globalThis.String(object.project_id)
12649
+ : "",
12650
+ groups: globalThis.Array.isArray(object?.groups)
12651
+ ? object.groups.map((e: any) => ModelActivityGroup.fromJSON(e))
12652
12652
  : [],
12653
- minAge: isSet(object.minAge)
12654
- ? Duration.fromJSON(object.minAge)
12655
- : isSet(object.min_age)
12656
- ? Duration.fromJSON(object.min_age)
12657
- : undefined,
12658
- activeAfter: isSet(object.activeAfter)
12659
- ? fromJsonTimestamp(object.activeAfter)
12660
- : isSet(object.active_after)
12661
- ? fromJsonTimestamp(object.active_after)
12662
- : undefined,
12663
- activeBefore: isSet(object.activeBefore)
12664
- ? fromJsonTimestamp(object.activeBefore)
12665
- : isSet(object.active_before)
12666
- ? fromJsonTimestamp(object.active_before)
12653
+ startTime: isSet(object.startTime)
12654
+ ? fromJsonTimestamp(object.startTime)
12655
+ : isSet(object.start_time)
12656
+ ? fromJsonTimestamp(object.start_time)
12667
12657
  : undefined,
12668
- abandonedHorizon: isSet(object.abandonedHorizon)
12669
- ? Duration.fromJSON(object.abandonedHorizon)
12670
- : isSet(object.abandoned_horizon)
12671
- ? Duration.fromJSON(object.abandoned_horizon)
12658
+ endTime: isSet(object.endTime)
12659
+ ? fromJsonTimestamp(object.endTime)
12660
+ : isSet(object.end_time)
12661
+ ? fromJsonTimestamp(object.end_time)
12672
12662
  : undefined,
12673
12663
  };
12674
12664
  },
12675
12665
 
12676
- toJSON(message: AIFileFilter): unknown {
12666
+ toJSON(message: ModelActivityRequest): unknown {
12677
12667
  const obj: any = {};
12678
- if (message.repositoryKey?.length) {
12679
- obj.repositoryKey = message.repositoryKey;
12680
- }
12681
- if (message.ref?.length) {
12682
- obj.ref = message.ref;
12668
+ if (message.organizationId !== "") {
12669
+ obj.organizationId = message.organizationId;
12683
12670
  }
12684
- if (message.state?.length) {
12685
- obj.state = message.state.map((e) => aIFileLifecycleToJSON(e));
12671
+ if (message.projectId !== "") {
12672
+ obj.projectId = message.projectId;
12686
12673
  }
12687
- if (message.tier?.length) {
12688
- obj.tier = message.tier.map((e) => aIFileTierToJSON(e));
12674
+ if (message.groups?.length) {
12675
+ obj.groups = message.groups.map((e) => ModelActivityGroup.toJSON(e));
12689
12676
  }
12690
- if (message.sessionId?.length) {
12691
- obj.sessionId = message.sessionId;
12677
+ if (message.startTime !== undefined) {
12678
+ obj.startTime = message.startTime.toISOString();
12692
12679
  }
12693
- if (message.minAge !== undefined) {
12694
- obj.minAge = Duration.toJSON(message.minAge);
12680
+ if (message.endTime !== undefined) {
12681
+ obj.endTime = message.endTime.toISOString();
12695
12682
  }
12696
- if (message.activeAfter !== undefined) {
12697
- obj.activeAfter = message.activeAfter.toISOString();
12683
+ return obj;
12684
+ },
12685
+
12686
+ create<I extends Exact<DeepPartial<ModelActivityRequest>, I>>(base?: I): ModelActivityRequest {
12687
+ return ModelActivityRequest.fromPartial(base ?? ({} as any));
12688
+ },
12689
+ fromPartial<I extends Exact<DeepPartial<ModelActivityRequest>, I>>(object: I): ModelActivityRequest {
12690
+ const message = createBaseModelActivityRequest();
12691
+ message.organizationId = object.organizationId ?? "";
12692
+ message.projectId = object.projectId ?? "";
12693
+ message.groups = object.groups?.map((e) => ModelActivityGroup.fromPartial(e)) || [];
12694
+ message.startTime = object.startTime ?? undefined;
12695
+ message.endTime = object.endTime ?? undefined;
12696
+ return message;
12697
+ },
12698
+ };
12699
+
12700
+ function createBaseModelActivityGroup(): ModelActivityGroup {
12701
+ return { key: "", modelNames: [] };
12702
+ }
12703
+
12704
+ export const ModelActivityGroup: MessageFns<ModelActivityGroup> = {
12705
+ encode(message: ModelActivityGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12706
+ if (message.key !== "") {
12707
+ writer.uint32(10).string(message.key);
12708
+ }
12709
+ for (const v of message.modelNames) {
12710
+ writer.uint32(18).string(v!);
12711
+ }
12712
+ return writer;
12713
+ },
12714
+
12715
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityGroup {
12716
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12717
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12718
+ if (previousRecursionDepth >= 100) {
12719
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12720
+ }
12721
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12722
+ try {
12723
+ const end = length === undefined ? reader.len : reader.pos + length;
12724
+ const message = createBaseModelActivityGroup();
12725
+ while (reader.pos < end) {
12726
+ const tag = reader.uint32();
12727
+ switch (tag >>> 3) {
12728
+ case 1: {
12729
+ if (tag !== 10) {
12730
+ break;
12731
+ }
12732
+
12733
+ message.key = reader.string();
12734
+ continue;
12735
+ }
12736
+ case 2: {
12737
+ if (tag !== 18) {
12738
+ break;
12739
+ }
12740
+
12741
+ message.modelNames.push(reader.string());
12742
+ continue;
12743
+ }
12744
+ }
12745
+ if ((tag & 7) === 4 || tag === 0) {
12746
+ break;
12747
+ }
12748
+ reader.skip(tag & 7);
12749
+ }
12750
+ return message;
12751
+ } finally {
12752
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
12753
+ }
12754
+ },
12755
+
12756
+ fromJSON(object: any): ModelActivityGroup {
12757
+ return {
12758
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
12759
+ modelNames: globalThis.Array.isArray(object?.modelNames)
12760
+ ? object.modelNames.map((e: any) => globalThis.String(e))
12761
+ : globalThis.Array.isArray(object?.model_names)
12762
+ ? object.model_names.map((e: any) => globalThis.String(e))
12763
+ : [],
12764
+ };
12765
+ },
12766
+
12767
+ toJSON(message: ModelActivityGroup): unknown {
12768
+ const obj: any = {};
12769
+ if (message.key !== "") {
12770
+ obj.key = message.key;
12771
+ }
12772
+ if (message.modelNames?.length) {
12773
+ obj.modelNames = message.modelNames;
12774
+ }
12775
+ return obj;
12776
+ },
12777
+
12778
+ create<I extends Exact<DeepPartial<ModelActivityGroup>, I>>(base?: I): ModelActivityGroup {
12779
+ return ModelActivityGroup.fromPartial(base ?? ({} as any));
12780
+ },
12781
+ fromPartial<I extends Exact<DeepPartial<ModelActivityGroup>, I>>(object: I): ModelActivityGroup {
12782
+ const message = createBaseModelActivityGroup();
12783
+ message.key = object.key ?? "";
12784
+ message.modelNames = object.modelNames?.map((e) => e) || [];
12785
+ return message;
12786
+ },
12787
+ };
12788
+
12789
+ function createBaseModelActivityResponse(): ModelActivityResponse {
12790
+ return { status: undefined, models: [], windowStart: undefined, windowEnd: undefined };
12791
+ }
12792
+
12793
+ export const ModelActivityResponse: MessageFns<ModelActivityResponse> = {
12794
+ encode(message: ModelActivityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12795
+ if (message.status !== undefined) {
12796
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
12797
+ }
12798
+ for (const v of message.models) {
12799
+ ModelActivity.encode(v!, writer.uint32(18).fork()).join();
12800
+ }
12801
+ if (message.windowStart !== undefined) {
12802
+ Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(26).fork()).join();
12803
+ }
12804
+ if (message.windowEnd !== undefined) {
12805
+ Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(34).fork()).join();
12806
+ }
12807
+ return writer;
12808
+ },
12809
+
12810
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityResponse {
12811
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12812
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12813
+ if (previousRecursionDepth >= 100) {
12814
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12815
+ }
12816
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12817
+ try {
12818
+ const end = length === undefined ? reader.len : reader.pos + length;
12819
+ const message = createBaseModelActivityResponse();
12820
+ while (reader.pos < end) {
12821
+ const tag = reader.uint32();
12822
+ switch (tag >>> 3) {
12823
+ case 1: {
12824
+ if (tag !== 10) {
12825
+ break;
12826
+ }
12827
+
12828
+ message.status = ResponseStatus.decode(reader, reader.uint32());
12829
+ continue;
12830
+ }
12831
+ case 2: {
12832
+ if (tag !== 18) {
12833
+ break;
12834
+ }
12835
+
12836
+ message.models.push(ModelActivity.decode(reader, reader.uint32()));
12837
+ continue;
12838
+ }
12839
+ case 3: {
12840
+ if (tag !== 26) {
12841
+ break;
12842
+ }
12843
+
12844
+ message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12845
+ continue;
12846
+ }
12847
+ case 4: {
12848
+ if (tag !== 34) {
12849
+ break;
12850
+ }
12851
+
12852
+ message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12853
+ continue;
12854
+ }
12855
+ }
12856
+ if ((tag & 7) === 4 || tag === 0) {
12857
+ break;
12858
+ }
12859
+ reader.skip(tag & 7);
12860
+ }
12861
+ return message;
12862
+ } finally {
12863
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
12864
+ }
12865
+ },
12866
+
12867
+ fromJSON(object: any): ModelActivityResponse {
12868
+ return {
12869
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
12870
+ models: globalThis.Array.isArray(object?.models) ? object.models.map((e: any) => ModelActivity.fromJSON(e)) : [],
12871
+ windowStart: isSet(object.windowStart)
12872
+ ? fromJsonTimestamp(object.windowStart)
12873
+ : isSet(object.window_start)
12874
+ ? fromJsonTimestamp(object.window_start)
12875
+ : undefined,
12876
+ windowEnd: isSet(object.windowEnd)
12877
+ ? fromJsonTimestamp(object.windowEnd)
12878
+ : isSet(object.window_end)
12879
+ ? fromJsonTimestamp(object.window_end)
12880
+ : undefined,
12881
+ };
12882
+ },
12883
+
12884
+ toJSON(message: ModelActivityResponse): unknown {
12885
+ const obj: any = {};
12886
+ if (message.status !== undefined) {
12887
+ obj.status = ResponseStatus.toJSON(message.status);
12888
+ }
12889
+ if (message.models?.length) {
12890
+ obj.models = message.models.map((e) => ModelActivity.toJSON(e));
12891
+ }
12892
+ if (message.windowStart !== undefined) {
12893
+ obj.windowStart = message.windowStart.toISOString();
12894
+ }
12895
+ if (message.windowEnd !== undefined) {
12896
+ obj.windowEnd = message.windowEnd.toISOString();
12897
+ }
12898
+ return obj;
12899
+ },
12900
+
12901
+ create<I extends Exact<DeepPartial<ModelActivityResponse>, I>>(base?: I): ModelActivityResponse {
12902
+ return ModelActivityResponse.fromPartial(base ?? ({} as any));
12903
+ },
12904
+ fromPartial<I extends Exact<DeepPartial<ModelActivityResponse>, I>>(object: I): ModelActivityResponse {
12905
+ const message = createBaseModelActivityResponse();
12906
+ message.status = (object.status !== undefined && object.status !== null)
12907
+ ? ResponseStatus.fromPartial(object.status)
12908
+ : undefined;
12909
+ message.models = object.models?.map((e) => ModelActivity.fromPartial(e)) || [];
12910
+ message.windowStart = object.windowStart ?? undefined;
12911
+ message.windowEnd = object.windowEnd ?? undefined;
12912
+ return message;
12913
+ },
12914
+ };
12915
+
12916
+ function createBaseModelActivity(): ModelActivity {
12917
+ return {
12918
+ key: "",
12919
+ modelCalls: 0,
12920
+ failedCalls: 0,
12921
+ inputTokens: 0,
12922
+ outputTokens: 0,
12923
+ cacheReadTokens: 0,
12924
+ cacheWriteTokens: 0,
12925
+ costUsd: 0,
12926
+ subscriptionCostUsd: 0,
12927
+ sessions: 0,
12928
+ toolCalls: 0,
12929
+ compactions: 0,
12930
+ subagentRuns: 0,
12931
+ ttftMsSum: 0,
12932
+ ttftCalls: 0,
12933
+ providers: [],
12934
+ principals: [],
12935
+ };
12936
+ }
12937
+
12938
+ export const ModelActivity: MessageFns<ModelActivity> = {
12939
+ encode(message: ModelActivity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12940
+ if (message.key !== "") {
12941
+ writer.uint32(10).string(message.key);
12942
+ }
12943
+ if (message.modelCalls !== 0) {
12944
+ writer.uint32(16).uint64(message.modelCalls);
12945
+ }
12946
+ if (message.failedCalls !== 0) {
12947
+ writer.uint32(24).uint64(message.failedCalls);
12948
+ }
12949
+ if (message.inputTokens !== 0) {
12950
+ writer.uint32(32).uint64(message.inputTokens);
12951
+ }
12952
+ if (message.outputTokens !== 0) {
12953
+ writer.uint32(40).uint64(message.outputTokens);
12954
+ }
12955
+ if (message.cacheReadTokens !== 0) {
12956
+ writer.uint32(48).uint64(message.cacheReadTokens);
12957
+ }
12958
+ if (message.cacheWriteTokens !== 0) {
12959
+ writer.uint32(56).uint64(message.cacheWriteTokens);
12960
+ }
12961
+ if (message.costUsd !== 0) {
12962
+ writer.uint32(65).double(message.costUsd);
12963
+ }
12964
+ if (message.subscriptionCostUsd !== 0) {
12965
+ writer.uint32(73).double(message.subscriptionCostUsd);
12966
+ }
12967
+ if (message.sessions !== 0) {
12968
+ writer.uint32(80).uint64(message.sessions);
12969
+ }
12970
+ if (message.toolCalls !== 0) {
12971
+ writer.uint32(88).uint64(message.toolCalls);
12972
+ }
12973
+ if (message.compactions !== 0) {
12974
+ writer.uint32(96).uint64(message.compactions);
12975
+ }
12976
+ if (message.subagentRuns !== 0) {
12977
+ writer.uint32(104).uint64(message.subagentRuns);
12978
+ }
12979
+ if (message.ttftMsSum !== 0) {
12980
+ writer.uint32(112).uint64(message.ttftMsSum);
12981
+ }
12982
+ if (message.ttftCalls !== 0) {
12983
+ writer.uint32(120).uint64(message.ttftCalls);
12984
+ }
12985
+ for (const v of message.providers) {
12986
+ writer.uint32(130).string(v!);
12987
+ }
12988
+ for (const v of message.principals) {
12989
+ ModelActivityPrincipal.encode(v!, writer.uint32(138).fork()).join();
12990
+ }
12991
+ return writer;
12992
+ },
12993
+
12994
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivity {
12995
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12996
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12997
+ if (previousRecursionDepth >= 100) {
12998
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12999
+ }
13000
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13001
+ try {
13002
+ const end = length === undefined ? reader.len : reader.pos + length;
13003
+ const message = createBaseModelActivity();
13004
+ while (reader.pos < end) {
13005
+ const tag = reader.uint32();
13006
+ switch (tag >>> 3) {
13007
+ case 1: {
13008
+ if (tag !== 10) {
13009
+ break;
13010
+ }
13011
+
13012
+ message.key = reader.string();
13013
+ continue;
13014
+ }
13015
+ case 2: {
13016
+ if (tag !== 16) {
13017
+ break;
13018
+ }
13019
+
13020
+ message.modelCalls = longToNumber(reader.uint64());
13021
+ continue;
13022
+ }
13023
+ case 3: {
13024
+ if (tag !== 24) {
13025
+ break;
13026
+ }
13027
+
13028
+ message.failedCalls = longToNumber(reader.uint64());
13029
+ continue;
13030
+ }
13031
+ case 4: {
13032
+ if (tag !== 32) {
13033
+ break;
13034
+ }
13035
+
13036
+ message.inputTokens = longToNumber(reader.uint64());
13037
+ continue;
13038
+ }
13039
+ case 5: {
13040
+ if (tag !== 40) {
13041
+ break;
13042
+ }
13043
+
13044
+ message.outputTokens = longToNumber(reader.uint64());
13045
+ continue;
13046
+ }
13047
+ case 6: {
13048
+ if (tag !== 48) {
13049
+ break;
13050
+ }
13051
+
13052
+ message.cacheReadTokens = longToNumber(reader.uint64());
13053
+ continue;
13054
+ }
13055
+ case 7: {
13056
+ if (tag !== 56) {
13057
+ break;
13058
+ }
13059
+
13060
+ message.cacheWriteTokens = longToNumber(reader.uint64());
13061
+ continue;
13062
+ }
13063
+ case 8: {
13064
+ if (tag !== 65) {
13065
+ break;
13066
+ }
13067
+
13068
+ message.costUsd = reader.double();
13069
+ continue;
13070
+ }
13071
+ case 9: {
13072
+ if (tag !== 73) {
13073
+ break;
13074
+ }
13075
+
13076
+ message.subscriptionCostUsd = reader.double();
13077
+ continue;
13078
+ }
13079
+ case 10: {
13080
+ if (tag !== 80) {
13081
+ break;
13082
+ }
13083
+
13084
+ message.sessions = longToNumber(reader.uint64());
13085
+ continue;
13086
+ }
13087
+ case 11: {
13088
+ if (tag !== 88) {
13089
+ break;
13090
+ }
13091
+
13092
+ message.toolCalls = longToNumber(reader.uint64());
13093
+ continue;
13094
+ }
13095
+ case 12: {
13096
+ if (tag !== 96) {
13097
+ break;
13098
+ }
13099
+
13100
+ message.compactions = longToNumber(reader.uint64());
13101
+ continue;
13102
+ }
13103
+ case 13: {
13104
+ if (tag !== 104) {
13105
+ break;
13106
+ }
13107
+
13108
+ message.subagentRuns = longToNumber(reader.uint64());
13109
+ continue;
13110
+ }
13111
+ case 14: {
13112
+ if (tag !== 112) {
13113
+ break;
13114
+ }
13115
+
13116
+ message.ttftMsSum = longToNumber(reader.uint64());
13117
+ continue;
13118
+ }
13119
+ case 15: {
13120
+ if (tag !== 120) {
13121
+ break;
13122
+ }
13123
+
13124
+ message.ttftCalls = longToNumber(reader.uint64());
13125
+ continue;
13126
+ }
13127
+ case 16: {
13128
+ if (tag !== 130) {
13129
+ break;
13130
+ }
13131
+
13132
+ message.providers.push(reader.string());
13133
+ continue;
13134
+ }
13135
+ case 17: {
13136
+ if (tag !== 138) {
13137
+ break;
13138
+ }
13139
+
13140
+ message.principals.push(ModelActivityPrincipal.decode(reader, reader.uint32()));
13141
+ continue;
13142
+ }
13143
+ }
13144
+ if ((tag & 7) === 4 || tag === 0) {
13145
+ break;
13146
+ }
13147
+ reader.skip(tag & 7);
13148
+ }
13149
+ return message;
13150
+ } finally {
13151
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13152
+ }
13153
+ },
13154
+
13155
+ fromJSON(object: any): ModelActivity {
13156
+ return {
13157
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
13158
+ modelCalls: isSet(object.modelCalls)
13159
+ ? globalThis.Number(object.modelCalls)
13160
+ : isSet(object.model_calls)
13161
+ ? globalThis.Number(object.model_calls)
13162
+ : 0,
13163
+ failedCalls: isSet(object.failedCalls)
13164
+ ? globalThis.Number(object.failedCalls)
13165
+ : isSet(object.failed_calls)
13166
+ ? globalThis.Number(object.failed_calls)
13167
+ : 0,
13168
+ inputTokens: isSet(object.inputTokens)
13169
+ ? globalThis.Number(object.inputTokens)
13170
+ : isSet(object.input_tokens)
13171
+ ? globalThis.Number(object.input_tokens)
13172
+ : 0,
13173
+ outputTokens: isSet(object.outputTokens)
13174
+ ? globalThis.Number(object.outputTokens)
13175
+ : isSet(object.output_tokens)
13176
+ ? globalThis.Number(object.output_tokens)
13177
+ : 0,
13178
+ cacheReadTokens: isSet(object.cacheReadTokens)
13179
+ ? globalThis.Number(object.cacheReadTokens)
13180
+ : isSet(object.cache_read_tokens)
13181
+ ? globalThis.Number(object.cache_read_tokens)
13182
+ : 0,
13183
+ cacheWriteTokens: isSet(object.cacheWriteTokens)
13184
+ ? globalThis.Number(object.cacheWriteTokens)
13185
+ : isSet(object.cache_write_tokens)
13186
+ ? globalThis.Number(object.cache_write_tokens)
13187
+ : 0,
13188
+ costUsd: isSet(object.costUsd)
13189
+ ? globalThis.Number(object.costUsd)
13190
+ : isSet(object.cost_usd)
13191
+ ? globalThis.Number(object.cost_usd)
13192
+ : 0,
13193
+ subscriptionCostUsd: isSet(object.subscriptionCostUsd)
13194
+ ? globalThis.Number(object.subscriptionCostUsd)
13195
+ : isSet(object.subscription_cost_usd)
13196
+ ? globalThis.Number(object.subscription_cost_usd)
13197
+ : 0,
13198
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
13199
+ toolCalls: isSet(object.toolCalls)
13200
+ ? globalThis.Number(object.toolCalls)
13201
+ : isSet(object.tool_calls)
13202
+ ? globalThis.Number(object.tool_calls)
13203
+ : 0,
13204
+ compactions: isSet(object.compactions) ? globalThis.Number(object.compactions) : 0,
13205
+ subagentRuns: isSet(object.subagentRuns)
13206
+ ? globalThis.Number(object.subagentRuns)
13207
+ : isSet(object.subagent_runs)
13208
+ ? globalThis.Number(object.subagent_runs)
13209
+ : 0,
13210
+ ttftMsSum: isSet(object.ttftMsSum)
13211
+ ? globalThis.Number(object.ttftMsSum)
13212
+ : isSet(object.ttft_ms_sum)
13213
+ ? globalThis.Number(object.ttft_ms_sum)
13214
+ : 0,
13215
+ ttftCalls: isSet(object.ttftCalls)
13216
+ ? globalThis.Number(object.ttftCalls)
13217
+ : isSet(object.ttft_calls)
13218
+ ? globalThis.Number(object.ttft_calls)
13219
+ : 0,
13220
+ providers: globalThis.Array.isArray(object?.providers)
13221
+ ? object.providers.map((e: any) => globalThis.String(e))
13222
+ : [],
13223
+ principals: globalThis.Array.isArray(object?.principals)
13224
+ ? object.principals.map((e: any) => ModelActivityPrincipal.fromJSON(e))
13225
+ : [],
13226
+ };
13227
+ },
13228
+
13229
+ toJSON(message: ModelActivity): unknown {
13230
+ const obj: any = {};
13231
+ if (message.key !== "") {
13232
+ obj.key = message.key;
13233
+ }
13234
+ if (message.modelCalls !== 0) {
13235
+ obj.modelCalls = Math.round(message.modelCalls);
13236
+ }
13237
+ if (message.failedCalls !== 0) {
13238
+ obj.failedCalls = Math.round(message.failedCalls);
13239
+ }
13240
+ if (message.inputTokens !== 0) {
13241
+ obj.inputTokens = Math.round(message.inputTokens);
13242
+ }
13243
+ if (message.outputTokens !== 0) {
13244
+ obj.outputTokens = Math.round(message.outputTokens);
13245
+ }
13246
+ if (message.cacheReadTokens !== 0) {
13247
+ obj.cacheReadTokens = Math.round(message.cacheReadTokens);
13248
+ }
13249
+ if (message.cacheWriteTokens !== 0) {
13250
+ obj.cacheWriteTokens = Math.round(message.cacheWriteTokens);
13251
+ }
13252
+ if (message.costUsd !== 0) {
13253
+ obj.costUsd = message.costUsd;
13254
+ }
13255
+ if (message.subscriptionCostUsd !== 0) {
13256
+ obj.subscriptionCostUsd = message.subscriptionCostUsd;
13257
+ }
13258
+ if (message.sessions !== 0) {
13259
+ obj.sessions = Math.round(message.sessions);
13260
+ }
13261
+ if (message.toolCalls !== 0) {
13262
+ obj.toolCalls = Math.round(message.toolCalls);
13263
+ }
13264
+ if (message.compactions !== 0) {
13265
+ obj.compactions = Math.round(message.compactions);
13266
+ }
13267
+ if (message.subagentRuns !== 0) {
13268
+ obj.subagentRuns = Math.round(message.subagentRuns);
13269
+ }
13270
+ if (message.ttftMsSum !== 0) {
13271
+ obj.ttftMsSum = Math.round(message.ttftMsSum);
13272
+ }
13273
+ if (message.ttftCalls !== 0) {
13274
+ obj.ttftCalls = Math.round(message.ttftCalls);
13275
+ }
13276
+ if (message.providers?.length) {
13277
+ obj.providers = message.providers;
13278
+ }
13279
+ if (message.principals?.length) {
13280
+ obj.principals = message.principals.map((e) => ModelActivityPrincipal.toJSON(e));
13281
+ }
13282
+ return obj;
13283
+ },
13284
+
13285
+ create<I extends Exact<DeepPartial<ModelActivity>, I>>(base?: I): ModelActivity {
13286
+ return ModelActivity.fromPartial(base ?? ({} as any));
13287
+ },
13288
+ fromPartial<I extends Exact<DeepPartial<ModelActivity>, I>>(object: I): ModelActivity {
13289
+ const message = createBaseModelActivity();
13290
+ message.key = object.key ?? "";
13291
+ message.modelCalls = object.modelCalls ?? 0;
13292
+ message.failedCalls = object.failedCalls ?? 0;
13293
+ message.inputTokens = object.inputTokens ?? 0;
13294
+ message.outputTokens = object.outputTokens ?? 0;
13295
+ message.cacheReadTokens = object.cacheReadTokens ?? 0;
13296
+ message.cacheWriteTokens = object.cacheWriteTokens ?? 0;
13297
+ message.costUsd = object.costUsd ?? 0;
13298
+ message.subscriptionCostUsd = object.subscriptionCostUsd ?? 0;
13299
+ message.sessions = object.sessions ?? 0;
13300
+ message.toolCalls = object.toolCalls ?? 0;
13301
+ message.compactions = object.compactions ?? 0;
13302
+ message.subagentRuns = object.subagentRuns ?? 0;
13303
+ message.ttftMsSum = object.ttftMsSum ?? 0;
13304
+ message.ttftCalls = object.ttftCalls ?? 0;
13305
+ message.providers = object.providers?.map((e) => e) || [];
13306
+ message.principals = object.principals?.map((e) => ModelActivityPrincipal.fromPartial(e)) || [];
13307
+ return message;
13308
+ },
13309
+ };
13310
+
13311
+ function createBaseModelActivityPrincipal(): ModelActivityPrincipal {
13312
+ return { kind: 0, id: "", sourceSystem: "", modelCalls: 0, sessions: 0, inputTokens: 0, outputTokens: 0, costUsd: 0 };
13313
+ }
13314
+
13315
+ export const ModelActivityPrincipal: MessageFns<ModelActivityPrincipal> = {
13316
+ encode(message: ModelActivityPrincipal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13317
+ if (message.kind !== 0) {
13318
+ writer.uint32(8).int32(message.kind);
13319
+ }
13320
+ if (message.id !== "") {
13321
+ writer.uint32(18).string(message.id);
13322
+ }
13323
+ if (message.sourceSystem !== "") {
13324
+ writer.uint32(26).string(message.sourceSystem);
13325
+ }
13326
+ if (message.modelCalls !== 0) {
13327
+ writer.uint32(32).uint64(message.modelCalls);
13328
+ }
13329
+ if (message.sessions !== 0) {
13330
+ writer.uint32(40).uint64(message.sessions);
13331
+ }
13332
+ if (message.inputTokens !== 0) {
13333
+ writer.uint32(48).uint64(message.inputTokens);
13334
+ }
13335
+ if (message.outputTokens !== 0) {
13336
+ writer.uint32(56).uint64(message.outputTokens);
13337
+ }
13338
+ if (message.costUsd !== 0) {
13339
+ writer.uint32(65).double(message.costUsd);
13340
+ }
13341
+ return writer;
13342
+ },
13343
+
13344
+ decode(input: BinaryReader | Uint8Array, length?: number): ModelActivityPrincipal {
13345
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13346
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13347
+ if (previousRecursionDepth >= 100) {
13348
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13349
+ }
13350
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13351
+ try {
13352
+ const end = length === undefined ? reader.len : reader.pos + length;
13353
+ const message = createBaseModelActivityPrincipal();
13354
+ while (reader.pos < end) {
13355
+ const tag = reader.uint32();
13356
+ switch (tag >>> 3) {
13357
+ case 1: {
13358
+ if (tag !== 8) {
13359
+ break;
13360
+ }
13361
+
13362
+ message.kind = reader.int32() as any;
13363
+ continue;
13364
+ }
13365
+ case 2: {
13366
+ if (tag !== 18) {
13367
+ break;
13368
+ }
13369
+
13370
+ message.id = reader.string();
13371
+ continue;
13372
+ }
13373
+ case 3: {
13374
+ if (tag !== 26) {
13375
+ break;
13376
+ }
13377
+
13378
+ message.sourceSystem = reader.string();
13379
+ continue;
13380
+ }
13381
+ case 4: {
13382
+ if (tag !== 32) {
13383
+ break;
13384
+ }
13385
+
13386
+ message.modelCalls = longToNumber(reader.uint64());
13387
+ continue;
13388
+ }
13389
+ case 5: {
13390
+ if (tag !== 40) {
13391
+ break;
13392
+ }
13393
+
13394
+ message.sessions = longToNumber(reader.uint64());
13395
+ continue;
13396
+ }
13397
+ case 6: {
13398
+ if (tag !== 48) {
13399
+ break;
13400
+ }
13401
+
13402
+ message.inputTokens = longToNumber(reader.uint64());
13403
+ continue;
13404
+ }
13405
+ case 7: {
13406
+ if (tag !== 56) {
13407
+ break;
13408
+ }
13409
+
13410
+ message.outputTokens = longToNumber(reader.uint64());
13411
+ continue;
13412
+ }
13413
+ case 8: {
13414
+ if (tag !== 65) {
13415
+ break;
13416
+ }
13417
+
13418
+ message.costUsd = reader.double();
13419
+ continue;
13420
+ }
13421
+ }
13422
+ if ((tag & 7) === 4 || tag === 0) {
13423
+ break;
13424
+ }
13425
+ reader.skip(tag & 7);
13426
+ }
13427
+ return message;
13428
+ } finally {
13429
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13430
+ }
13431
+ },
13432
+
13433
+ fromJSON(object: any): ModelActivityPrincipal {
13434
+ return {
13435
+ kind: isSet(object.kind) ? aIPrincipalKindFromJSON(object.kind) : 0,
13436
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
13437
+ sourceSystem: isSet(object.sourceSystem)
13438
+ ? globalThis.String(object.sourceSystem)
13439
+ : isSet(object.source_system)
13440
+ ? globalThis.String(object.source_system)
13441
+ : "",
13442
+ modelCalls: isSet(object.modelCalls)
13443
+ ? globalThis.Number(object.modelCalls)
13444
+ : isSet(object.model_calls)
13445
+ ? globalThis.Number(object.model_calls)
13446
+ : 0,
13447
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
13448
+ inputTokens: isSet(object.inputTokens)
13449
+ ? globalThis.Number(object.inputTokens)
13450
+ : isSet(object.input_tokens)
13451
+ ? globalThis.Number(object.input_tokens)
13452
+ : 0,
13453
+ outputTokens: isSet(object.outputTokens)
13454
+ ? globalThis.Number(object.outputTokens)
13455
+ : isSet(object.output_tokens)
13456
+ ? globalThis.Number(object.output_tokens)
13457
+ : 0,
13458
+ costUsd: isSet(object.costUsd)
13459
+ ? globalThis.Number(object.costUsd)
13460
+ : isSet(object.cost_usd)
13461
+ ? globalThis.Number(object.cost_usd)
13462
+ : 0,
13463
+ };
13464
+ },
13465
+
13466
+ toJSON(message: ModelActivityPrincipal): unknown {
13467
+ const obj: any = {};
13468
+ if (message.kind !== 0) {
13469
+ obj.kind = aIPrincipalKindToJSON(message.kind);
13470
+ }
13471
+ if (message.id !== "") {
13472
+ obj.id = message.id;
13473
+ }
13474
+ if (message.sourceSystem !== "") {
13475
+ obj.sourceSystem = message.sourceSystem;
13476
+ }
13477
+ if (message.modelCalls !== 0) {
13478
+ obj.modelCalls = Math.round(message.modelCalls);
13479
+ }
13480
+ if (message.sessions !== 0) {
13481
+ obj.sessions = Math.round(message.sessions);
13482
+ }
13483
+ if (message.inputTokens !== 0) {
13484
+ obj.inputTokens = Math.round(message.inputTokens);
13485
+ }
13486
+ if (message.outputTokens !== 0) {
13487
+ obj.outputTokens = Math.round(message.outputTokens);
13488
+ }
13489
+ if (message.costUsd !== 0) {
13490
+ obj.costUsd = message.costUsd;
13491
+ }
13492
+ return obj;
13493
+ },
13494
+
13495
+ create<I extends Exact<DeepPartial<ModelActivityPrincipal>, I>>(base?: I): ModelActivityPrincipal {
13496
+ return ModelActivityPrincipal.fromPartial(base ?? ({} as any));
13497
+ },
13498
+ fromPartial<I extends Exact<DeepPartial<ModelActivityPrincipal>, I>>(object: I): ModelActivityPrincipal {
13499
+ const message = createBaseModelActivityPrincipal();
13500
+ message.kind = object.kind ?? 0;
13501
+ message.id = object.id ?? "";
13502
+ message.sourceSystem = object.sourceSystem ?? "";
13503
+ message.modelCalls = object.modelCalls ?? 0;
13504
+ message.sessions = object.sessions ?? 0;
13505
+ message.inputTokens = object.inputTokens ?? 0;
13506
+ message.outputTokens = object.outputTokens ?? 0;
13507
+ message.costUsd = object.costUsd ?? 0;
13508
+ return message;
13509
+ },
13510
+ };
13511
+
13512
+ function createBaseAISessionRef(): AISessionRef {
13513
+ return { sourceSystem: "", sessionId: "" };
13514
+ }
13515
+
13516
+ export const AISessionRef: MessageFns<AISessionRef> = {
13517
+ encode(message: AISessionRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13518
+ if (message.sourceSystem !== "") {
13519
+ writer.uint32(10).string(message.sourceSystem);
13520
+ }
13521
+ if (message.sessionId !== "") {
13522
+ writer.uint32(18).string(message.sessionId);
13523
+ }
13524
+ return writer;
13525
+ },
13526
+
13527
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionRef {
13528
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13529
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13530
+ if (previousRecursionDepth >= 100) {
13531
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13532
+ }
13533
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13534
+ try {
13535
+ const end = length === undefined ? reader.len : reader.pos + length;
13536
+ const message = createBaseAISessionRef();
13537
+ while (reader.pos < end) {
13538
+ const tag = reader.uint32();
13539
+ switch (tag >>> 3) {
13540
+ case 1: {
13541
+ if (tag !== 10) {
13542
+ break;
13543
+ }
13544
+
13545
+ message.sourceSystem = reader.string();
13546
+ continue;
13547
+ }
13548
+ case 2: {
13549
+ if (tag !== 18) {
13550
+ break;
13551
+ }
13552
+
13553
+ message.sessionId = reader.string();
13554
+ continue;
13555
+ }
13556
+ }
13557
+ if ((tag & 7) === 4 || tag === 0) {
13558
+ break;
13559
+ }
13560
+ reader.skip(tag & 7);
13561
+ }
13562
+ return message;
13563
+ } finally {
13564
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13565
+ }
13566
+ },
13567
+
13568
+ fromJSON(object: any): AISessionRef {
13569
+ return {
13570
+ sourceSystem: isSet(object.sourceSystem)
13571
+ ? globalThis.String(object.sourceSystem)
13572
+ : isSet(object.source_system)
13573
+ ? globalThis.String(object.source_system)
13574
+ : "",
13575
+ sessionId: isSet(object.sessionId)
13576
+ ? globalThis.String(object.sessionId)
13577
+ : isSet(object.session_id)
13578
+ ? globalThis.String(object.session_id)
13579
+ : "",
13580
+ };
13581
+ },
13582
+
13583
+ toJSON(message: AISessionRef): unknown {
13584
+ const obj: any = {};
13585
+ if (message.sourceSystem !== "") {
13586
+ obj.sourceSystem = message.sourceSystem;
13587
+ }
13588
+ if (message.sessionId !== "") {
13589
+ obj.sessionId = message.sessionId;
13590
+ }
13591
+ return obj;
13592
+ },
13593
+
13594
+ create<I extends Exact<DeepPartial<AISessionRef>, I>>(base?: I): AISessionRef {
13595
+ return AISessionRef.fromPartial(base ?? ({} as any));
13596
+ },
13597
+ fromPartial<I extends Exact<DeepPartial<AISessionRef>, I>>(object: I): AISessionRef {
13598
+ const message = createBaseAISessionRef();
13599
+ message.sourceSystem = object.sourceSystem ?? "";
13600
+ message.sessionId = object.sessionId ?? "";
13601
+ return message;
13602
+ },
13603
+ };
13604
+
13605
+ function createBaseAIFileFilter(): AIFileFilter {
13606
+ return {
13607
+ repositoryKey: [],
13608
+ ref: [],
13609
+ state: [],
13610
+ tier: [],
13611
+ session: [],
13612
+ minAge: undefined,
13613
+ activeAfter: undefined,
13614
+ activeBefore: undefined,
13615
+ abandonedHorizon: undefined,
13616
+ };
13617
+ }
13618
+
13619
+ export const AIFileFilter: MessageFns<AIFileFilter> = {
13620
+ encode(message: AIFileFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
13621
+ for (const v of message.repositoryKey) {
13622
+ writer.uint32(10).string(v!);
13623
+ }
13624
+ for (const v of message.ref) {
13625
+ writer.uint32(18).string(v!);
13626
+ }
13627
+ writer.uint32(26).fork();
13628
+ for (const v of message.state) {
13629
+ writer.int32(v);
13630
+ }
13631
+ writer.join();
13632
+ writer.uint32(34).fork();
13633
+ for (const v of message.tier) {
13634
+ writer.int32(v);
13635
+ }
13636
+ writer.join();
13637
+ for (const v of message.session) {
13638
+ AISessionRef.encode(v!, writer.uint32(42).fork()).join();
13639
+ }
13640
+ if (message.minAge !== undefined) {
13641
+ Duration.encode(message.minAge, writer.uint32(50).fork()).join();
13642
+ }
13643
+ if (message.activeAfter !== undefined) {
13644
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(58).fork()).join();
13645
+ }
13646
+ if (message.activeBefore !== undefined) {
13647
+ Timestamp.encode(toTimestamp(message.activeBefore), writer.uint32(66).fork()).join();
13648
+ }
13649
+ if (message.abandonedHorizon !== undefined) {
13650
+ Duration.encode(message.abandonedHorizon, writer.uint32(74).fork()).join();
13651
+ }
13652
+ return writer;
13653
+ },
13654
+
13655
+ decode(input: BinaryReader | Uint8Array, length?: number): AIFileFilter {
13656
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
13657
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
13658
+ if (previousRecursionDepth >= 100) {
13659
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
13660
+ }
13661
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
13662
+ try {
13663
+ const end = length === undefined ? reader.len : reader.pos + length;
13664
+ const message = createBaseAIFileFilter();
13665
+ while (reader.pos < end) {
13666
+ const tag = reader.uint32();
13667
+ switch (tag >>> 3) {
13668
+ case 1: {
13669
+ if (tag !== 10) {
13670
+ break;
13671
+ }
13672
+
13673
+ message.repositoryKey.push(reader.string());
13674
+ continue;
13675
+ }
13676
+ case 2: {
13677
+ if (tag !== 18) {
13678
+ break;
13679
+ }
13680
+
13681
+ message.ref.push(reader.string());
13682
+ continue;
13683
+ }
13684
+ case 3: {
13685
+ if (tag === 24) {
13686
+ message.state.push(reader.int32() as any);
13687
+
13688
+ continue;
13689
+ }
13690
+
13691
+ if (tag === 26) {
13692
+ const end2 = reader.uint32() + reader.pos;
13693
+ while (reader.pos < end2) {
13694
+ message.state.push(reader.int32() as any);
13695
+ }
13696
+
13697
+ continue;
13698
+ }
13699
+
13700
+ break;
13701
+ }
13702
+ case 4: {
13703
+ if (tag === 32) {
13704
+ message.tier.push(reader.int32() as any);
13705
+
13706
+ continue;
13707
+ }
13708
+
13709
+ if (tag === 34) {
13710
+ const end2 = reader.uint32() + reader.pos;
13711
+ while (reader.pos < end2) {
13712
+ message.tier.push(reader.int32() as any);
13713
+ }
13714
+
13715
+ continue;
13716
+ }
13717
+
13718
+ break;
13719
+ }
13720
+ case 5: {
13721
+ if (tag !== 42) {
13722
+ break;
13723
+ }
13724
+
13725
+ message.session.push(AISessionRef.decode(reader, reader.uint32()));
13726
+ continue;
13727
+ }
13728
+ case 6: {
13729
+ if (tag !== 50) {
13730
+ break;
13731
+ }
13732
+
13733
+ message.minAge = Duration.decode(reader, reader.uint32());
13734
+ continue;
13735
+ }
13736
+ case 7: {
13737
+ if (tag !== 58) {
13738
+ break;
13739
+ }
13740
+
13741
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
13742
+ continue;
13743
+ }
13744
+ case 8: {
13745
+ if (tag !== 66) {
13746
+ break;
13747
+ }
13748
+
13749
+ message.activeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
13750
+ continue;
13751
+ }
13752
+ case 9: {
13753
+ if (tag !== 74) {
13754
+ break;
13755
+ }
13756
+
13757
+ message.abandonedHorizon = Duration.decode(reader, reader.uint32());
13758
+ continue;
13759
+ }
13760
+ }
13761
+ if ((tag & 7) === 4 || tag === 0) {
13762
+ break;
13763
+ }
13764
+ reader.skip(tag & 7);
13765
+ }
13766
+ return message;
13767
+ } finally {
13768
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
13769
+ }
13770
+ },
13771
+
13772
+ fromJSON(object: any): AIFileFilter {
13773
+ return {
13774
+ repositoryKey: globalThis.Array.isArray(object?.repositoryKey)
13775
+ ? object.repositoryKey.map((e: any) => globalThis.String(e))
13776
+ : globalThis.Array.isArray(object?.repository_key)
13777
+ ? object.repository_key.map((e: any) => globalThis.String(e))
13778
+ : [],
13779
+ ref: globalThis.Array.isArray(object?.ref) ? object.ref.map((e: any) => globalThis.String(e)) : [],
13780
+ state: globalThis.Array.isArray(object?.state) ? object.state.map((e: any) => aIFileLifecycleFromJSON(e)) : [],
13781
+ tier: globalThis.Array.isArray(object?.tier) ? object.tier.map((e: any) => aIFileTierFromJSON(e)) : [],
13782
+ session: globalThis.Array.isArray(object?.session)
13783
+ ? object.session.map((e: any) => AISessionRef.fromJSON(e))
13784
+ : [],
13785
+ minAge: isSet(object.minAge)
13786
+ ? Duration.fromJSON(object.minAge)
13787
+ : isSet(object.min_age)
13788
+ ? Duration.fromJSON(object.min_age)
13789
+ : undefined,
13790
+ activeAfter: isSet(object.activeAfter)
13791
+ ? fromJsonTimestamp(object.activeAfter)
13792
+ : isSet(object.active_after)
13793
+ ? fromJsonTimestamp(object.active_after)
13794
+ : undefined,
13795
+ activeBefore: isSet(object.activeBefore)
13796
+ ? fromJsonTimestamp(object.activeBefore)
13797
+ : isSet(object.active_before)
13798
+ ? fromJsonTimestamp(object.active_before)
13799
+ : undefined,
13800
+ abandonedHorizon: isSet(object.abandonedHorizon)
13801
+ ? Duration.fromJSON(object.abandonedHorizon)
13802
+ : isSet(object.abandoned_horizon)
13803
+ ? Duration.fromJSON(object.abandoned_horizon)
13804
+ : undefined,
13805
+ };
13806
+ },
13807
+
13808
+ toJSON(message: AIFileFilter): unknown {
13809
+ const obj: any = {};
13810
+ if (message.repositoryKey?.length) {
13811
+ obj.repositoryKey = message.repositoryKey;
13812
+ }
13813
+ if (message.ref?.length) {
13814
+ obj.ref = message.ref;
13815
+ }
13816
+ if (message.state?.length) {
13817
+ obj.state = message.state.map((e) => aIFileLifecycleToJSON(e));
13818
+ }
13819
+ if (message.tier?.length) {
13820
+ obj.tier = message.tier.map((e) => aIFileTierToJSON(e));
13821
+ }
13822
+ if (message.session?.length) {
13823
+ obj.session = message.session.map((e) => AISessionRef.toJSON(e));
13824
+ }
13825
+ if (message.minAge !== undefined) {
13826
+ obj.minAge = Duration.toJSON(message.minAge);
13827
+ }
13828
+ if (message.activeAfter !== undefined) {
13829
+ obj.activeAfter = message.activeAfter.toISOString();
12698
13830
  }
12699
13831
  if (message.activeBefore !== undefined) {
12700
13832
  obj.activeBefore = message.activeBefore.toISOString();
@@ -12714,7 +13846,7 @@ export const AIFileFilter: MessageFns<AIFileFilter> = {
12714
13846
  message.ref = object.ref?.map((e) => e) || [];
12715
13847
  message.state = object.state?.map((e) => e) || [];
12716
13848
  message.tier = object.tier?.map((e) => e) || [];
12717
- message.sessionId = object.sessionId?.map((e) => e) || [];
13849
+ message.session = object.session?.map((e) => AISessionRef.fromPartial(e)) || [];
12718
13850
  message.minAge = (object.minAge !== undefined && object.minAge !== null)
12719
13851
  ? Duration.fromPartial(object.minAge)
12720
13852
  : undefined;
@@ -13003,7 +14135,7 @@ function createBaseAIFileRow(): AIFileRow {
13003
14135
  discardedAt: undefined,
13004
14136
  discardReason: "",
13005
14137
  editCount: 0,
13006
- sessionId: [],
14138
+ sessions: [],
13007
14139
  unlandedCostUsd: 0,
13008
14140
  unlandedOutputTokens: 0,
13009
14141
  totalCostUsd: 0,
@@ -13062,8 +14194,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13062
14194
  if (message.editCount !== 0) {
13063
14195
  writer.uint32(128).uint32(message.editCount);
13064
14196
  }
13065
- for (const v of message.sessionId) {
13066
- writer.uint32(138).string(v!);
14197
+ for (const v of message.sessions) {
14198
+ AISessionRef.encode(v!, writer.uint32(138).fork()).join();
13067
14199
  }
13068
14200
  if (message.unlandedCostUsd !== 0) {
13069
14201
  writer.uint32(145).double(message.unlandedCostUsd);
@@ -13229,7 +14361,7 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13229
14361
  break;
13230
14362
  }
13231
14363
 
13232
- message.sessionId.push(reader.string());
14364
+ message.sessions.push(AISessionRef.decode(reader, reader.uint32()));
13233
14365
  continue;
13234
14366
  }
13235
14367
  case 18: {
@@ -13346,10 +14478,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13346
14478
  : isSet(object.edit_count)
13347
14479
  ? globalThis.Number(object.edit_count)
13348
14480
  : 0,
13349
- sessionId: globalThis.Array.isArray(object?.sessionId)
13350
- ? object.sessionId.map((e: any) => globalThis.String(e))
13351
- : globalThis.Array.isArray(object?.session_id)
13352
- ? object.session_id.map((e: any) => globalThis.String(e))
14481
+ sessions: globalThis.Array.isArray(object?.sessions)
14482
+ ? object.sessions.map((e: any) => AISessionRef.fromJSON(e))
13353
14483
  : [],
13354
14484
  unlandedCostUsd: isSet(object.unlandedCostUsd)
13355
14485
  ? globalThis.Number(object.unlandedCostUsd)
@@ -13429,8 +14559,8 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13429
14559
  if (message.editCount !== 0) {
13430
14560
  obj.editCount = Math.round(message.editCount);
13431
14561
  }
13432
- if (message.sessionId?.length) {
13433
- obj.sessionId = message.sessionId;
14562
+ if (message.sessions?.length) {
14563
+ obj.sessions = message.sessions.map((e) => AISessionRef.toJSON(e));
13434
14564
  }
13435
14565
  if (message.unlandedCostUsd !== 0) {
13436
14566
  obj.unlandedCostUsd = message.unlandedCostUsd;
@@ -13471,7 +14601,7 @@ export const AIFileRow: MessageFns<AIFileRow> = {
13471
14601
  message.discardedAt = object.discardedAt ?? undefined;
13472
14602
  message.discardReason = object.discardReason ?? "";
13473
14603
  message.editCount = object.editCount ?? 0;
13474
- message.sessionId = object.sessionId?.map((e) => e) || [];
14604
+ message.sessions = object.sessions?.map((e) => AISessionRef.fromPartial(e)) || [];
13475
14605
  message.unlandedCostUsd = object.unlandedCostUsd ?? 0;
13476
14606
  message.unlandedOutputTokens = object.unlandedOutputTokens ?? 0;
13477
14607
  message.totalCostUsd = object.totalCostUsd ?? 0;
@@ -16314,6 +17444,12 @@ export interface AIGatewayService {
16314
17444
  * sessions. Mirrors telemetry.api.v1.
16315
17445
  */
16316
17446
  ListResourceRankings(request: ResourceRankingsRequest, metadata?: Metadata): Promise<ResourceRankingsResponse>;
17447
+ /**
17448
+ * Every model of a project over a time range: usage, the tool calls, compactions and subagent runs
17449
+ * attributed to each, and who called it. Groups fold stored spellings; an ungrouped name is its own row,
17450
+ * costliest first. Mirrors telemetry.api.v1.
17451
+ */
17452
+ ListModelActivity(request: ModelActivityRequest, metadata?: Metadata): Promise<ModelActivityResponse>;
16317
17453
  /**
16318
17454
  * Per-seat entitlement usage board: every entitlement owner's latest observed funding facility and
16319
17455
  * per-harness usage % windows. Stream-first (first frame = full snapshot), seat-scoped. Mirrors
@@ -16349,6 +17485,7 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
16349
17485
  this.ListModelPrices = this.ListModelPrices.bind(this);
16350
17486
  this.ListModelPriceHistory = this.ListModelPriceHistory.bind(this);
16351
17487
  this.ListResourceRankings = this.ListResourceRankings.bind(this);
17488
+ this.ListModelActivity = this.ListModelActivity.bind(this);
16352
17489
  this.StreamEntitlements = this.StreamEntitlements.bind(this);
16353
17490
  }
16354
17491
  ListSessions(request: ListSessionsRequest, metadata?: Metadata): Promise<ListSessionsResponse> {
@@ -16480,6 +17617,12 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
16480
17617
  return promise.then((data) => ResourceRankingsResponse.decode(new BinaryReader(data)));
16481
17618
  }
16482
17619
 
17620
+ ListModelActivity(request: ModelActivityRequest, metadata?: Metadata): Promise<ModelActivityResponse> {
17621
+ const data = ModelActivityRequest.encode(request).finish();
17622
+ const promise = this.rpc.request(this.service, "ListModelActivity", data, metadata);
17623
+ return promise.then((data) => ModelActivityResponse.decode(new BinaryReader(data)));
17624
+ }
17625
+
16483
17626
  StreamEntitlements(request: StreamEntitlementsRequest, metadata?: Metadata): Observable<EntitlementsSnapshot> {
16484
17627
  const data = StreamEntitlementsRequest.encode(request).finish();
16485
17628
  const result = this.rpc.serverStreamingRequest(this.service, "StreamEntitlements", data, metadata);