@miradorlabs/web-grpc 4.34.0 → 4.35.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.
@@ -3282,6 +3282,97 @@ export interface ScoredSession {
3282
3282
  sessionScoreRubric: AISessionScoreRubric;
3283
3283
  }
3284
3284
 
3285
+ export interface GetSessionPeriodTotalsRequest {
3286
+ organizationId: string;
3287
+ projectId: string;
3288
+ /**
3289
+ * The window's start, which is scope: the sessions last active at or after it, as ListSessions' filter.active_after
3290
+ * keeps them. At most 35 days before the server's clock, else INVALID_ARGUMENT; a window that starts in the future
3291
+ * has no sessions.
3292
+ */
3293
+ activeAfter:
3294
+ | Date
3295
+ | undefined;
3296
+ /**
3297
+ * The prior window's start: prior_totals covers the sessions last active at or after it and before active_after.
3298
+ * Before active_after and at most 35 days before it, else INVALID_ARGUMENT.
3299
+ */
3300
+ priorActiveAfter: Date | undefined;
3301
+ }
3302
+
3303
+ export interface GetSessionPeriodTotalsResponse {
3304
+ status:
3305
+ | ResponseStatus
3306
+ | undefined;
3307
+ /** The sessions last active at or after active_after. */
3308
+ totals:
3309
+ | SessionPeriodTotals
3310
+ | undefined;
3311
+ /** The sessions last active at or after prior_active_after and before active_after. */
3312
+ priorTotals:
3313
+ | SessionPeriodTotals
3314
+ | undefined;
3315
+ /**
3316
+ * The window's sessions per actor, one row per actor with a session, ordered by source_system, user_id, then
3317
+ * api_key_id.
3318
+ */
3319
+ actors: SessionActorUsage[];
3320
+ /** The window's sessions per work type key of their latest label, as GetSessionAnalysisOverview counts them. */
3321
+ workTypeCounts: SessionWorkTypeCount[];
3322
+ /**
3323
+ * The window's sessions per work size key of their latest label, ordered by key, whatever their work type. A
3324
+ * session with no label, or whose label names no work size (""), is in no row.
3325
+ */
3326
+ workSizeCounts: SessionWorkSizeCount[];
3327
+ }
3328
+
3329
+ /**
3330
+ * SessionPeriodTotals sums whole-session figures over a window's sessions, one per (source_system, session_id) as
3331
+ * ListSessions lists them. input_tokens is cache-inclusive. A source that reports no usage has zero tokens here
3332
+ * (unknown, not none), as for SessionTotalsBucket.
3333
+ */
3334
+ export interface SessionPeriodTotals {
3335
+ /** For totals, ListSessions' pagination.total_count for the same active_after. */
3336
+ sessions: number;
3337
+ /** The sessions with at least one commit. */
3338
+ sessionsWithCommits: number;
3339
+ commits: number;
3340
+ gitPushes: number;
3341
+ pullRequestsCreated: number;
3342
+ /**
3343
+ * AISessionSummary.pull_requests_merged summed over the sessions: a pull request counts once in every session that
3344
+ * links to it, so this is not a count of distinct pull requests.
3345
+ */
3346
+ pullRequestsMerged: number;
3347
+ inputTokens: number;
3348
+ outputTokens: number;
3349
+ /** input_tokens + output_tokens of the sessions that have tokens and no provider cost. */
3350
+ unpricedTokens: number;
3351
+ }
3352
+
3353
+ /**
3354
+ * SessionActorUsage is one actor's sessions in the window, with their whole-session usage. The actor is the session's
3355
+ * user id, else its api key id, on its source system, as SessionFilter.principals matches it: api_key_id is set only
3356
+ * when user_id is empty, and both are empty for a session that carries neither. input_tokens is cache-inclusive.
3357
+ */
3358
+ export interface SessionActorUsage {
3359
+ sourceSystem: string;
3360
+ userId: string;
3361
+ apiKeyId: string;
3362
+ inputTokens: number;
3363
+ outputTokens: number;
3364
+ /** AITokenUsage.provider_cost_usd, summed. */
3365
+ providerCostUsd: number;
3366
+ /** AIFacilityCostBreakdown.subscription_facility_usd, summed: a facility lens, never reconciled billing. */
3367
+ subscriptionFacilityUsd: number;
3368
+ }
3369
+
3370
+ /** SessionWorkSizeCount is how many sessions carry one work size (AISessionSummary.work_size) as their latest label. */
3371
+ export interface SessionWorkSizeCount {
3372
+ workSize: string;
3373
+ sessions: number;
3374
+ }
3375
+
3285
3376
  export interface GetSessionAnalysisRequest {
3286
3377
  organizationId: string;
3287
3378
  projectId: string;
@@ -24714,28 +24805,28 @@ export const ScoredSession: MessageFns<ScoredSession> = {
24714
24805
  },
24715
24806
  };
24716
24807
 
24717
- function createBaseGetSessionAnalysisRequest(): GetSessionAnalysisRequest {
24718
- return { organizationId: "", projectId: "", sourceSystem: "", sessionId: "" };
24808
+ function createBaseGetSessionPeriodTotalsRequest(): GetSessionPeriodTotalsRequest {
24809
+ return { organizationId: "", projectId: "", activeAfter: undefined, priorActiveAfter: undefined };
24719
24810
  }
24720
24811
 
24721
- export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> = {
24722
- encode(message: GetSessionAnalysisRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24812
+ export const GetSessionPeriodTotalsRequest: MessageFns<GetSessionPeriodTotalsRequest> = {
24813
+ encode(message: GetSessionPeriodTotalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24723
24814
  if (message.organizationId !== "") {
24724
24815
  writer.uint32(10).string(message.organizationId);
24725
24816
  }
24726
24817
  if (message.projectId !== "") {
24727
24818
  writer.uint32(18).string(message.projectId);
24728
24819
  }
24729
- if (message.sourceSystem !== "") {
24730
- writer.uint32(26).string(message.sourceSystem);
24820
+ if (message.activeAfter !== undefined) {
24821
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(26).fork()).join();
24731
24822
  }
24732
- if (message.sessionId !== "") {
24733
- writer.uint32(34).string(message.sessionId);
24823
+ if (message.priorActiveAfter !== undefined) {
24824
+ Timestamp.encode(toTimestamp(message.priorActiveAfter), writer.uint32(34).fork()).join();
24734
24825
  }
24735
24826
  return writer;
24736
24827
  },
24737
24828
 
24738
- decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisRequest {
24829
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionPeriodTotalsRequest {
24739
24830
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24740
24831
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24741
24832
  if (previousRecursionDepth >= 100) {
@@ -24744,7 +24835,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24744
24835
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24745
24836
  try {
24746
24837
  const end = length === undefined ? reader.len : reader.pos + length;
24747
- const message = createBaseGetSessionAnalysisRequest();
24838
+ const message = createBaseGetSessionPeriodTotalsRequest();
24748
24839
  while (reader.pos < end) {
24749
24840
  const tag = reader.uint32();
24750
24841
  switch (tag >>> 3) {
@@ -24769,7 +24860,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24769
24860
  break;
24770
24861
  }
24771
24862
 
24772
- message.sourceSystem = reader.string();
24863
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24773
24864
  continue;
24774
24865
  }
24775
24866
  case 4: {
@@ -24777,7 +24868,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24777
24868
  break;
24778
24869
  }
24779
24870
 
24780
- message.sessionId = reader.string();
24871
+ message.priorActiveAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24781
24872
  continue;
24782
24873
  }
24783
24874
  }
@@ -24792,7 +24883,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24792
24883
  }
24793
24884
  },
24794
24885
 
24795
- fromJSON(object: any): GetSessionAnalysisRequest {
24886
+ fromJSON(object: any): GetSessionPeriodTotalsRequest {
24796
24887
  return {
24797
24888
  organizationId: isSet(object.organizationId)
24798
24889
  ? globalThis.String(object.organizationId)
@@ -24804,20 +24895,20 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24804
24895
  : isSet(object.project_id)
24805
24896
  ? globalThis.String(object.project_id)
24806
24897
  : "",
24807
- sourceSystem: isSet(object.sourceSystem)
24808
- ? globalThis.String(object.sourceSystem)
24809
- : isSet(object.source_system)
24810
- ? globalThis.String(object.source_system)
24811
- : "",
24812
- sessionId: isSet(object.sessionId)
24813
- ? globalThis.String(object.sessionId)
24814
- : isSet(object.session_id)
24815
- ? globalThis.String(object.session_id)
24816
- : "",
24898
+ activeAfter: isSet(object.activeAfter)
24899
+ ? fromJsonTimestamp(object.activeAfter)
24900
+ : isSet(object.active_after)
24901
+ ? fromJsonTimestamp(object.active_after)
24902
+ : undefined,
24903
+ priorActiveAfter: isSet(object.priorActiveAfter)
24904
+ ? fromJsonTimestamp(object.priorActiveAfter)
24905
+ : isSet(object.prior_active_after)
24906
+ ? fromJsonTimestamp(object.prior_active_after)
24907
+ : undefined,
24817
24908
  };
24818
24909
  },
24819
24910
 
24820
- toJSON(message: GetSessionAnalysisRequest): unknown {
24911
+ toJSON(message: GetSessionPeriodTotalsRequest): unknown {
24821
24912
  const obj: any = {};
24822
24913
  if (message.organizationId !== "") {
24823
24914
  obj.organizationId = message.organizationId;
@@ -24825,50 +24916,65 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
24825
24916
  if (message.projectId !== "") {
24826
24917
  obj.projectId = message.projectId;
24827
24918
  }
24828
- if (message.sourceSystem !== "") {
24829
- obj.sourceSystem = message.sourceSystem;
24919
+ if (message.activeAfter !== undefined) {
24920
+ obj.activeAfter = message.activeAfter.toISOString();
24830
24921
  }
24831
- if (message.sessionId !== "") {
24832
- obj.sessionId = message.sessionId;
24922
+ if (message.priorActiveAfter !== undefined) {
24923
+ obj.priorActiveAfter = message.priorActiveAfter.toISOString();
24833
24924
  }
24834
24925
  return obj;
24835
24926
  },
24836
24927
 
24837
- create<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(base?: I): GetSessionAnalysisRequest {
24838
- return GetSessionAnalysisRequest.fromPartial(base ?? ({} as any));
24928
+ create<I extends Exact<DeepPartial<GetSessionPeriodTotalsRequest>, I>>(base?: I): GetSessionPeriodTotalsRequest {
24929
+ return GetSessionPeriodTotalsRequest.fromPartial(base ?? ({} as any));
24839
24930
  },
24840
- fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(object: I): GetSessionAnalysisRequest {
24841
- const message = createBaseGetSessionAnalysisRequest();
24931
+ fromPartial<I extends Exact<DeepPartial<GetSessionPeriodTotalsRequest>, I>>(
24932
+ object: I,
24933
+ ): GetSessionPeriodTotalsRequest {
24934
+ const message = createBaseGetSessionPeriodTotalsRequest();
24842
24935
  message.organizationId = object.organizationId ?? "";
24843
24936
  message.projectId = object.projectId ?? "";
24844
- message.sourceSystem = object.sourceSystem ?? "";
24845
- message.sessionId = object.sessionId ?? "";
24937
+ message.activeAfter = object.activeAfter ?? undefined;
24938
+ message.priorActiveAfter = object.priorActiveAfter ?? undefined;
24846
24939
  return message;
24847
24940
  },
24848
24941
  };
24849
24942
 
24850
- function createBaseGetSessionAnalysisResponse(): GetSessionAnalysisResponse {
24851
- return { status: undefined, score: undefined, insights: undefined, sessionVersion: undefined };
24943
+ function createBaseGetSessionPeriodTotalsResponse(): GetSessionPeriodTotalsResponse {
24944
+ return {
24945
+ status: undefined,
24946
+ totals: undefined,
24947
+ priorTotals: undefined,
24948
+ actors: [],
24949
+ workTypeCounts: [],
24950
+ workSizeCounts: [],
24951
+ };
24852
24952
  }
24853
24953
 
24854
- export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse> = {
24855
- encode(message: GetSessionAnalysisResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24954
+ export const GetSessionPeriodTotalsResponse: MessageFns<GetSessionPeriodTotalsResponse> = {
24955
+ encode(message: GetSessionPeriodTotalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24856
24956
  if (message.status !== undefined) {
24857
24957
  ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
24858
24958
  }
24859
- if (message.score !== undefined) {
24860
- AISessionScore.encode(message.score, writer.uint32(18).fork()).join();
24959
+ if (message.totals !== undefined) {
24960
+ SessionPeriodTotals.encode(message.totals, writer.uint32(18).fork()).join();
24861
24961
  }
24862
- if (message.insights !== undefined) {
24863
- AISessionInsights.encode(message.insights, writer.uint32(26).fork()).join();
24962
+ if (message.priorTotals !== undefined) {
24963
+ SessionPeriodTotals.encode(message.priorTotals, writer.uint32(26).fork()).join();
24864
24964
  }
24865
- if (message.sessionVersion !== undefined) {
24866
- writer.uint32(32).uint64(message.sessionVersion);
24965
+ for (const v of message.actors) {
24966
+ SessionActorUsage.encode(v!, writer.uint32(34).fork()).join();
24967
+ }
24968
+ for (const v of message.workTypeCounts) {
24969
+ SessionWorkTypeCount.encode(v!, writer.uint32(42).fork()).join();
24970
+ }
24971
+ for (const v of message.workSizeCounts) {
24972
+ SessionWorkSizeCount.encode(v!, writer.uint32(50).fork()).join();
24867
24973
  }
24868
24974
  return writer;
24869
24975
  },
24870
24976
 
24871
- decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisResponse {
24977
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionPeriodTotalsResponse {
24872
24978
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24873
24979
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24874
24980
  if (previousRecursionDepth >= 100) {
@@ -24877,7 +24983,7 @@ export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse>
24877
24983
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24878
24984
  try {
24879
24985
  const end = length === undefined ? reader.len : reader.pos + length;
24880
- const message = createBaseGetSessionAnalysisResponse();
24986
+ const message = createBaseGetSessionPeriodTotalsResponse();
24881
24987
  while (reader.pos < end) {
24882
24988
  const tag = reader.uint32();
24883
24989
  switch (tag >>> 3) {
@@ -24894,7 +25000,7 @@ export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse>
24894
25000
  break;
24895
25001
  }
24896
25002
 
24897
- message.score = AISessionScore.decode(reader, reader.uint32());
25003
+ message.totals = SessionPeriodTotals.decode(reader, reader.uint32());
24898
25004
  continue;
24899
25005
  }
24900
25006
  case 3: {
@@ -24902,15 +25008,31 @@ export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse>
24902
25008
  break;
24903
25009
  }
24904
25010
 
24905
- message.insights = AISessionInsights.decode(reader, reader.uint32());
25011
+ message.priorTotals = SessionPeriodTotals.decode(reader, reader.uint32());
24906
25012
  continue;
24907
25013
  }
24908
25014
  case 4: {
24909
- if (tag !== 32) {
25015
+ if (tag !== 34) {
24910
25016
  break;
24911
25017
  }
24912
25018
 
24913
- message.sessionVersion = longToNumber(reader.uint64());
25019
+ message.actors.push(SessionActorUsage.decode(reader, reader.uint32()));
25020
+ continue;
25021
+ }
25022
+ case 5: {
25023
+ if (tag !== 42) {
25024
+ break;
25025
+ }
25026
+
25027
+ message.workTypeCounts.push(SessionWorkTypeCount.decode(reader, reader.uint32()));
25028
+ continue;
25029
+ }
25030
+ case 6: {
25031
+ if (tag !== 50) {
25032
+ break;
25033
+ }
25034
+
25035
+ message.workSizeCounts.push(SessionWorkSizeCount.decode(reader, reader.uint32()));
24914
25036
  continue;
24915
25037
  }
24916
25038
  }
@@ -24925,83 +25047,124 @@ export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse>
24925
25047
  }
24926
25048
  },
24927
25049
 
24928
- fromJSON(object: any): GetSessionAnalysisResponse {
25050
+ fromJSON(object: any): GetSessionPeriodTotalsResponse {
24929
25051
  return {
24930
25052
  status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
24931
- score: isSet(object.score) ? AISessionScore.fromJSON(object.score) : undefined,
24932
- insights: isSet(object.insights) ? AISessionInsights.fromJSON(object.insights) : undefined,
24933
- sessionVersion: isSet(object.sessionVersion)
24934
- ? globalThis.Number(object.sessionVersion)
24935
- : isSet(object.session_version)
24936
- ? globalThis.Number(object.session_version)
25053
+ totals: isSet(object.totals) ? SessionPeriodTotals.fromJSON(object.totals) : undefined,
25054
+ priorTotals: isSet(object.priorTotals)
25055
+ ? SessionPeriodTotals.fromJSON(object.priorTotals)
25056
+ : isSet(object.prior_totals)
25057
+ ? SessionPeriodTotals.fromJSON(object.prior_totals)
24937
25058
  : undefined,
25059
+ actors: globalThis.Array.isArray(object?.actors)
25060
+ ? object.actors.map((e: any) => SessionActorUsage.fromJSON(e))
25061
+ : [],
25062
+ workTypeCounts: globalThis.Array.isArray(object?.workTypeCounts)
25063
+ ? object.workTypeCounts.map((e: any) => SessionWorkTypeCount.fromJSON(e))
25064
+ : globalThis.Array.isArray(object?.work_type_counts)
25065
+ ? object.work_type_counts.map((e: any) => SessionWorkTypeCount.fromJSON(e))
25066
+ : [],
25067
+ workSizeCounts: globalThis.Array.isArray(object?.workSizeCounts)
25068
+ ? object.workSizeCounts.map((e: any) => SessionWorkSizeCount.fromJSON(e))
25069
+ : globalThis.Array.isArray(object?.work_size_counts)
25070
+ ? object.work_size_counts.map((e: any) => SessionWorkSizeCount.fromJSON(e))
25071
+ : [],
24938
25072
  };
24939
25073
  },
24940
25074
 
24941
- toJSON(message: GetSessionAnalysisResponse): unknown {
25075
+ toJSON(message: GetSessionPeriodTotalsResponse): unknown {
24942
25076
  const obj: any = {};
24943
25077
  if (message.status !== undefined) {
24944
25078
  obj.status = ResponseStatus.toJSON(message.status);
24945
25079
  }
24946
- if (message.score !== undefined) {
24947
- obj.score = AISessionScore.toJSON(message.score);
25080
+ if (message.totals !== undefined) {
25081
+ obj.totals = SessionPeriodTotals.toJSON(message.totals);
24948
25082
  }
24949
- if (message.insights !== undefined) {
24950
- obj.insights = AISessionInsights.toJSON(message.insights);
25083
+ if (message.priorTotals !== undefined) {
25084
+ obj.priorTotals = SessionPeriodTotals.toJSON(message.priorTotals);
24951
25085
  }
24952
- if (message.sessionVersion !== undefined) {
24953
- obj.sessionVersion = Math.round(message.sessionVersion);
25086
+ if (message.actors?.length) {
25087
+ obj.actors = message.actors.map((e) => SessionActorUsage.toJSON(e));
25088
+ }
25089
+ if (message.workTypeCounts?.length) {
25090
+ obj.workTypeCounts = message.workTypeCounts.map((e) => SessionWorkTypeCount.toJSON(e));
25091
+ }
25092
+ if (message.workSizeCounts?.length) {
25093
+ obj.workSizeCounts = message.workSizeCounts.map((e) => SessionWorkSizeCount.toJSON(e));
24954
25094
  }
24955
25095
  return obj;
24956
25096
  },
24957
25097
 
24958
- create<I extends Exact<DeepPartial<GetSessionAnalysisResponse>, I>>(base?: I): GetSessionAnalysisResponse {
24959
- return GetSessionAnalysisResponse.fromPartial(base ?? ({} as any));
25098
+ create<I extends Exact<DeepPartial<GetSessionPeriodTotalsResponse>, I>>(base?: I): GetSessionPeriodTotalsResponse {
25099
+ return GetSessionPeriodTotalsResponse.fromPartial(base ?? ({} as any));
24960
25100
  },
24961
- fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisResponse>, I>>(object: I): GetSessionAnalysisResponse {
24962
- const message = createBaseGetSessionAnalysisResponse();
25101
+ fromPartial<I extends Exact<DeepPartial<GetSessionPeriodTotalsResponse>, I>>(
25102
+ object: I,
25103
+ ): GetSessionPeriodTotalsResponse {
25104
+ const message = createBaseGetSessionPeriodTotalsResponse();
24963
25105
  message.status = (object.status !== undefined && object.status !== null)
24964
25106
  ? ResponseStatus.fromPartial(object.status)
24965
25107
  : undefined;
24966
- message.score = (object.score !== undefined && object.score !== null)
24967
- ? AISessionScore.fromPartial(object.score)
25108
+ message.totals = (object.totals !== undefined && object.totals !== null)
25109
+ ? SessionPeriodTotals.fromPartial(object.totals)
24968
25110
  : undefined;
24969
- message.insights = (object.insights !== undefined && object.insights !== null)
24970
- ? AISessionInsights.fromPartial(object.insights)
25111
+ message.priorTotals = (object.priorTotals !== undefined && object.priorTotals !== null)
25112
+ ? SessionPeriodTotals.fromPartial(object.priorTotals)
24971
25113
  : undefined;
24972
- message.sessionVersion = object.sessionVersion ?? undefined;
25114
+ message.actors = object.actors?.map((e) => SessionActorUsage.fromPartial(e)) || [];
25115
+ message.workTypeCounts = object.workTypeCounts?.map((e) => SessionWorkTypeCount.fromPartial(e)) || [];
25116
+ message.workSizeCounts = object.workSizeCounts?.map((e) => SessionWorkSizeCount.fromPartial(e)) || [];
24973
25117
  return message;
24974
25118
  },
24975
25119
  };
24976
25120
 
24977
- function createBaseAISessionInsights(): AISessionInsights {
24978
- return { insights: [], model: "", version: "", inputSessionVersion: 0, analyzedAt: undefined, topicsVersion: "" };
25121
+ function createBaseSessionPeriodTotals(): SessionPeriodTotals {
25122
+ return {
25123
+ sessions: 0,
25124
+ sessionsWithCommits: 0,
25125
+ commits: 0,
25126
+ gitPushes: 0,
25127
+ pullRequestsCreated: 0,
25128
+ pullRequestsMerged: 0,
25129
+ inputTokens: 0,
25130
+ outputTokens: 0,
25131
+ unpricedTokens: 0,
25132
+ };
24979
25133
  }
24980
25134
 
24981
- export const AISessionInsights: MessageFns<AISessionInsights> = {
24982
- encode(message: AISessionInsights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24983
- for (const v of message.insights) {
24984
- AISessionInsight.encode(v!, writer.uint32(10).fork()).join();
25135
+ export const SessionPeriodTotals: MessageFns<SessionPeriodTotals> = {
25136
+ encode(message: SessionPeriodTotals, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25137
+ if (message.sessions !== 0) {
25138
+ writer.uint32(8).uint64(message.sessions);
24985
25139
  }
24986
- if (message.model !== "") {
24987
- writer.uint32(18).string(message.model);
25140
+ if (message.sessionsWithCommits !== 0) {
25141
+ writer.uint32(16).uint64(message.sessionsWithCommits);
24988
25142
  }
24989
- if (message.version !== "") {
24990
- writer.uint32(26).string(message.version);
25143
+ if (message.commits !== 0) {
25144
+ writer.uint32(24).uint64(message.commits);
24991
25145
  }
24992
- if (message.inputSessionVersion !== 0) {
24993
- writer.uint32(32).uint64(message.inputSessionVersion);
25146
+ if (message.gitPushes !== 0) {
25147
+ writer.uint32(32).uint64(message.gitPushes);
24994
25148
  }
24995
- if (message.analyzedAt !== undefined) {
24996
- Timestamp.encode(toTimestamp(message.analyzedAt), writer.uint32(42).fork()).join();
25149
+ if (message.pullRequestsCreated !== 0) {
25150
+ writer.uint32(40).uint64(message.pullRequestsCreated);
24997
25151
  }
24998
- if (message.topicsVersion !== "") {
24999
- writer.uint32(50).string(message.topicsVersion);
25152
+ if (message.pullRequestsMerged !== 0) {
25153
+ writer.uint32(48).uint64(message.pullRequestsMerged);
25154
+ }
25155
+ if (message.inputTokens !== 0) {
25156
+ writer.uint32(56).uint64(message.inputTokens);
25157
+ }
25158
+ if (message.outputTokens !== 0) {
25159
+ writer.uint32(64).uint64(message.outputTokens);
25160
+ }
25161
+ if (message.unpricedTokens !== 0) {
25162
+ writer.uint32(72).uint64(message.unpricedTokens);
25000
25163
  }
25001
25164
  return writer;
25002
25165
  },
25003
25166
 
25004
- decode(input: BinaryReader | Uint8Array, length?: number): AISessionInsights {
25167
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionPeriodTotals {
25005
25168
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25006
25169
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25007
25170
  if (previousRecursionDepth >= 100) {
@@ -25010,32 +25173,32 @@ export const AISessionInsights: MessageFns<AISessionInsights> = {
25010
25173
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25011
25174
  try {
25012
25175
  const end = length === undefined ? reader.len : reader.pos + length;
25013
- const message = createBaseAISessionInsights();
25176
+ const message = createBaseSessionPeriodTotals();
25014
25177
  while (reader.pos < end) {
25015
25178
  const tag = reader.uint32();
25016
25179
  switch (tag >>> 3) {
25017
25180
  case 1: {
25018
- if (tag !== 10) {
25181
+ if (tag !== 8) {
25019
25182
  break;
25020
25183
  }
25021
25184
 
25022
- message.insights.push(AISessionInsight.decode(reader, reader.uint32()));
25185
+ message.sessions = longToNumber(reader.uint64());
25023
25186
  continue;
25024
25187
  }
25025
25188
  case 2: {
25026
- if (tag !== 18) {
25189
+ if (tag !== 16) {
25027
25190
  break;
25028
25191
  }
25029
25192
 
25030
- message.model = reader.string();
25193
+ message.sessionsWithCommits = longToNumber(reader.uint64());
25031
25194
  continue;
25032
25195
  }
25033
25196
  case 3: {
25034
- if (tag !== 26) {
25197
+ if (tag !== 24) {
25035
25198
  break;
25036
25199
  }
25037
25200
 
25038
- message.version = reader.string();
25201
+ message.commits = longToNumber(reader.uint64());
25039
25202
  continue;
25040
25203
  }
25041
25204
  case 4: {
@@ -25043,31 +25206,797 @@ export const AISessionInsights: MessageFns<AISessionInsights> = {
25043
25206
  break;
25044
25207
  }
25045
25208
 
25046
- message.inputSessionVersion = longToNumber(reader.uint64());
25209
+ message.gitPushes = longToNumber(reader.uint64());
25047
25210
  continue;
25048
25211
  }
25049
25212
  case 5: {
25050
- if (tag !== 42) {
25213
+ if (tag !== 40) {
25051
25214
  break;
25052
25215
  }
25053
25216
 
25054
- message.analyzedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
25217
+ message.pullRequestsCreated = longToNumber(reader.uint64());
25055
25218
  continue;
25056
25219
  }
25057
25220
  case 6: {
25058
- if (tag !== 50) {
25221
+ if (tag !== 48) {
25059
25222
  break;
25060
25223
  }
25061
25224
 
25062
- message.topicsVersion = reader.string();
25225
+ message.pullRequestsMerged = longToNumber(reader.uint64());
25063
25226
  continue;
25064
25227
  }
25065
- }
25066
- if ((tag & 7) === 4 || tag === 0) {
25067
- break;
25068
- }
25069
- reader.skip(tag & 7);
25070
- }
25228
+ case 7: {
25229
+ if (tag !== 56) {
25230
+ break;
25231
+ }
25232
+
25233
+ message.inputTokens = longToNumber(reader.uint64());
25234
+ continue;
25235
+ }
25236
+ case 8: {
25237
+ if (tag !== 64) {
25238
+ break;
25239
+ }
25240
+
25241
+ message.outputTokens = longToNumber(reader.uint64());
25242
+ continue;
25243
+ }
25244
+ case 9: {
25245
+ if (tag !== 72) {
25246
+ break;
25247
+ }
25248
+
25249
+ message.unpricedTokens = longToNumber(reader.uint64());
25250
+ continue;
25251
+ }
25252
+ }
25253
+ if ((tag & 7) === 4 || tag === 0) {
25254
+ break;
25255
+ }
25256
+ reader.skip(tag & 7);
25257
+ }
25258
+ return message;
25259
+ } finally {
25260
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25261
+ }
25262
+ },
25263
+
25264
+ fromJSON(object: any): SessionPeriodTotals {
25265
+ return {
25266
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
25267
+ sessionsWithCommits: isSet(object.sessionsWithCommits)
25268
+ ? globalThis.Number(object.sessionsWithCommits)
25269
+ : isSet(object.sessions_with_commits)
25270
+ ? globalThis.Number(object.sessions_with_commits)
25271
+ : 0,
25272
+ commits: isSet(object.commits) ? globalThis.Number(object.commits) : 0,
25273
+ gitPushes: isSet(object.gitPushes)
25274
+ ? globalThis.Number(object.gitPushes)
25275
+ : isSet(object.git_pushes)
25276
+ ? globalThis.Number(object.git_pushes)
25277
+ : 0,
25278
+ pullRequestsCreated: isSet(object.pullRequestsCreated)
25279
+ ? globalThis.Number(object.pullRequestsCreated)
25280
+ : isSet(object.pull_requests_created)
25281
+ ? globalThis.Number(object.pull_requests_created)
25282
+ : 0,
25283
+ pullRequestsMerged: isSet(object.pullRequestsMerged)
25284
+ ? globalThis.Number(object.pullRequestsMerged)
25285
+ : isSet(object.pull_requests_merged)
25286
+ ? globalThis.Number(object.pull_requests_merged)
25287
+ : 0,
25288
+ inputTokens: isSet(object.inputTokens)
25289
+ ? globalThis.Number(object.inputTokens)
25290
+ : isSet(object.input_tokens)
25291
+ ? globalThis.Number(object.input_tokens)
25292
+ : 0,
25293
+ outputTokens: isSet(object.outputTokens)
25294
+ ? globalThis.Number(object.outputTokens)
25295
+ : isSet(object.output_tokens)
25296
+ ? globalThis.Number(object.output_tokens)
25297
+ : 0,
25298
+ unpricedTokens: isSet(object.unpricedTokens)
25299
+ ? globalThis.Number(object.unpricedTokens)
25300
+ : isSet(object.unpriced_tokens)
25301
+ ? globalThis.Number(object.unpriced_tokens)
25302
+ : 0,
25303
+ };
25304
+ },
25305
+
25306
+ toJSON(message: SessionPeriodTotals): unknown {
25307
+ const obj: any = {};
25308
+ if (message.sessions !== 0) {
25309
+ obj.sessions = Math.round(message.sessions);
25310
+ }
25311
+ if (message.sessionsWithCommits !== 0) {
25312
+ obj.sessionsWithCommits = Math.round(message.sessionsWithCommits);
25313
+ }
25314
+ if (message.commits !== 0) {
25315
+ obj.commits = Math.round(message.commits);
25316
+ }
25317
+ if (message.gitPushes !== 0) {
25318
+ obj.gitPushes = Math.round(message.gitPushes);
25319
+ }
25320
+ if (message.pullRequestsCreated !== 0) {
25321
+ obj.pullRequestsCreated = Math.round(message.pullRequestsCreated);
25322
+ }
25323
+ if (message.pullRequestsMerged !== 0) {
25324
+ obj.pullRequestsMerged = Math.round(message.pullRequestsMerged);
25325
+ }
25326
+ if (message.inputTokens !== 0) {
25327
+ obj.inputTokens = Math.round(message.inputTokens);
25328
+ }
25329
+ if (message.outputTokens !== 0) {
25330
+ obj.outputTokens = Math.round(message.outputTokens);
25331
+ }
25332
+ if (message.unpricedTokens !== 0) {
25333
+ obj.unpricedTokens = Math.round(message.unpricedTokens);
25334
+ }
25335
+ return obj;
25336
+ },
25337
+
25338
+ create<I extends Exact<DeepPartial<SessionPeriodTotals>, I>>(base?: I): SessionPeriodTotals {
25339
+ return SessionPeriodTotals.fromPartial(base ?? ({} as any));
25340
+ },
25341
+ fromPartial<I extends Exact<DeepPartial<SessionPeriodTotals>, I>>(object: I): SessionPeriodTotals {
25342
+ const message = createBaseSessionPeriodTotals();
25343
+ message.sessions = object.sessions ?? 0;
25344
+ message.sessionsWithCommits = object.sessionsWithCommits ?? 0;
25345
+ message.commits = object.commits ?? 0;
25346
+ message.gitPushes = object.gitPushes ?? 0;
25347
+ message.pullRequestsCreated = object.pullRequestsCreated ?? 0;
25348
+ message.pullRequestsMerged = object.pullRequestsMerged ?? 0;
25349
+ message.inputTokens = object.inputTokens ?? 0;
25350
+ message.outputTokens = object.outputTokens ?? 0;
25351
+ message.unpricedTokens = object.unpricedTokens ?? 0;
25352
+ return message;
25353
+ },
25354
+ };
25355
+
25356
+ function createBaseSessionActorUsage(): SessionActorUsage {
25357
+ return {
25358
+ sourceSystem: "",
25359
+ userId: "",
25360
+ apiKeyId: "",
25361
+ inputTokens: 0,
25362
+ outputTokens: 0,
25363
+ providerCostUsd: 0,
25364
+ subscriptionFacilityUsd: 0,
25365
+ };
25366
+ }
25367
+
25368
+ export const SessionActorUsage: MessageFns<SessionActorUsage> = {
25369
+ encode(message: SessionActorUsage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25370
+ if (message.sourceSystem !== "") {
25371
+ writer.uint32(10).string(message.sourceSystem);
25372
+ }
25373
+ if (message.userId !== "") {
25374
+ writer.uint32(18).string(message.userId);
25375
+ }
25376
+ if (message.apiKeyId !== "") {
25377
+ writer.uint32(26).string(message.apiKeyId);
25378
+ }
25379
+ if (message.inputTokens !== 0) {
25380
+ writer.uint32(32).uint64(message.inputTokens);
25381
+ }
25382
+ if (message.outputTokens !== 0) {
25383
+ writer.uint32(40).uint64(message.outputTokens);
25384
+ }
25385
+ if (message.providerCostUsd !== 0) {
25386
+ writer.uint32(49).double(message.providerCostUsd);
25387
+ }
25388
+ if (message.subscriptionFacilityUsd !== 0) {
25389
+ writer.uint32(57).double(message.subscriptionFacilityUsd);
25390
+ }
25391
+ return writer;
25392
+ },
25393
+
25394
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionActorUsage {
25395
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25396
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25397
+ if (previousRecursionDepth >= 100) {
25398
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25399
+ }
25400
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25401
+ try {
25402
+ const end = length === undefined ? reader.len : reader.pos + length;
25403
+ const message = createBaseSessionActorUsage();
25404
+ while (reader.pos < end) {
25405
+ const tag = reader.uint32();
25406
+ switch (tag >>> 3) {
25407
+ case 1: {
25408
+ if (tag !== 10) {
25409
+ break;
25410
+ }
25411
+
25412
+ message.sourceSystem = reader.string();
25413
+ continue;
25414
+ }
25415
+ case 2: {
25416
+ if (tag !== 18) {
25417
+ break;
25418
+ }
25419
+
25420
+ message.userId = reader.string();
25421
+ continue;
25422
+ }
25423
+ case 3: {
25424
+ if (tag !== 26) {
25425
+ break;
25426
+ }
25427
+
25428
+ message.apiKeyId = reader.string();
25429
+ continue;
25430
+ }
25431
+ case 4: {
25432
+ if (tag !== 32) {
25433
+ break;
25434
+ }
25435
+
25436
+ message.inputTokens = longToNumber(reader.uint64());
25437
+ continue;
25438
+ }
25439
+ case 5: {
25440
+ if (tag !== 40) {
25441
+ break;
25442
+ }
25443
+
25444
+ message.outputTokens = longToNumber(reader.uint64());
25445
+ continue;
25446
+ }
25447
+ case 6: {
25448
+ if (tag !== 49) {
25449
+ break;
25450
+ }
25451
+
25452
+ message.providerCostUsd = reader.double();
25453
+ continue;
25454
+ }
25455
+ case 7: {
25456
+ if (tag !== 57) {
25457
+ break;
25458
+ }
25459
+
25460
+ message.subscriptionFacilityUsd = reader.double();
25461
+ continue;
25462
+ }
25463
+ }
25464
+ if ((tag & 7) === 4 || tag === 0) {
25465
+ break;
25466
+ }
25467
+ reader.skip(tag & 7);
25468
+ }
25469
+ return message;
25470
+ } finally {
25471
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25472
+ }
25473
+ },
25474
+
25475
+ fromJSON(object: any): SessionActorUsage {
25476
+ return {
25477
+ sourceSystem: isSet(object.sourceSystem)
25478
+ ? globalThis.String(object.sourceSystem)
25479
+ : isSet(object.source_system)
25480
+ ? globalThis.String(object.source_system)
25481
+ : "",
25482
+ userId: isSet(object.userId)
25483
+ ? globalThis.String(object.userId)
25484
+ : isSet(object.user_id)
25485
+ ? globalThis.String(object.user_id)
25486
+ : "",
25487
+ apiKeyId: isSet(object.apiKeyId)
25488
+ ? globalThis.String(object.apiKeyId)
25489
+ : isSet(object.api_key_id)
25490
+ ? globalThis.String(object.api_key_id)
25491
+ : "",
25492
+ inputTokens: isSet(object.inputTokens)
25493
+ ? globalThis.Number(object.inputTokens)
25494
+ : isSet(object.input_tokens)
25495
+ ? globalThis.Number(object.input_tokens)
25496
+ : 0,
25497
+ outputTokens: isSet(object.outputTokens)
25498
+ ? globalThis.Number(object.outputTokens)
25499
+ : isSet(object.output_tokens)
25500
+ ? globalThis.Number(object.output_tokens)
25501
+ : 0,
25502
+ providerCostUsd: isSet(object.providerCostUsd)
25503
+ ? globalThis.Number(object.providerCostUsd)
25504
+ : isSet(object.provider_cost_usd)
25505
+ ? globalThis.Number(object.provider_cost_usd)
25506
+ : 0,
25507
+ subscriptionFacilityUsd: isSet(object.subscriptionFacilityUsd)
25508
+ ? globalThis.Number(object.subscriptionFacilityUsd)
25509
+ : isSet(object.subscription_facility_usd)
25510
+ ? globalThis.Number(object.subscription_facility_usd)
25511
+ : 0,
25512
+ };
25513
+ },
25514
+
25515
+ toJSON(message: SessionActorUsage): unknown {
25516
+ const obj: any = {};
25517
+ if (message.sourceSystem !== "") {
25518
+ obj.sourceSystem = message.sourceSystem;
25519
+ }
25520
+ if (message.userId !== "") {
25521
+ obj.userId = message.userId;
25522
+ }
25523
+ if (message.apiKeyId !== "") {
25524
+ obj.apiKeyId = message.apiKeyId;
25525
+ }
25526
+ if (message.inputTokens !== 0) {
25527
+ obj.inputTokens = Math.round(message.inputTokens);
25528
+ }
25529
+ if (message.outputTokens !== 0) {
25530
+ obj.outputTokens = Math.round(message.outputTokens);
25531
+ }
25532
+ if (message.providerCostUsd !== 0) {
25533
+ obj.providerCostUsd = floatToJson(message.providerCostUsd);
25534
+ }
25535
+ if (message.subscriptionFacilityUsd !== 0) {
25536
+ obj.subscriptionFacilityUsd = floatToJson(message.subscriptionFacilityUsd);
25537
+ }
25538
+ return obj;
25539
+ },
25540
+
25541
+ create<I extends Exact<DeepPartial<SessionActorUsage>, I>>(base?: I): SessionActorUsage {
25542
+ return SessionActorUsage.fromPartial(base ?? ({} as any));
25543
+ },
25544
+ fromPartial<I extends Exact<DeepPartial<SessionActorUsage>, I>>(object: I): SessionActorUsage {
25545
+ const message = createBaseSessionActorUsage();
25546
+ message.sourceSystem = object.sourceSystem ?? "";
25547
+ message.userId = object.userId ?? "";
25548
+ message.apiKeyId = object.apiKeyId ?? "";
25549
+ message.inputTokens = object.inputTokens ?? 0;
25550
+ message.outputTokens = object.outputTokens ?? 0;
25551
+ message.providerCostUsd = object.providerCostUsd ?? 0;
25552
+ message.subscriptionFacilityUsd = object.subscriptionFacilityUsd ?? 0;
25553
+ return message;
25554
+ },
25555
+ };
25556
+
25557
+ function createBaseSessionWorkSizeCount(): SessionWorkSizeCount {
25558
+ return { workSize: "", sessions: 0 };
25559
+ }
25560
+
25561
+ export const SessionWorkSizeCount: MessageFns<SessionWorkSizeCount> = {
25562
+ encode(message: SessionWorkSizeCount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25563
+ if (message.workSize !== "") {
25564
+ writer.uint32(10).string(message.workSize);
25565
+ }
25566
+ if (message.sessions !== 0) {
25567
+ writer.uint32(16).uint64(message.sessions);
25568
+ }
25569
+ return writer;
25570
+ },
25571
+
25572
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionWorkSizeCount {
25573
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25574
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25575
+ if (previousRecursionDepth >= 100) {
25576
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25577
+ }
25578
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25579
+ try {
25580
+ const end = length === undefined ? reader.len : reader.pos + length;
25581
+ const message = createBaseSessionWorkSizeCount();
25582
+ while (reader.pos < end) {
25583
+ const tag = reader.uint32();
25584
+ switch (tag >>> 3) {
25585
+ case 1: {
25586
+ if (tag !== 10) {
25587
+ break;
25588
+ }
25589
+
25590
+ message.workSize = reader.string();
25591
+ continue;
25592
+ }
25593
+ case 2: {
25594
+ if (tag !== 16) {
25595
+ break;
25596
+ }
25597
+
25598
+ message.sessions = longToNumber(reader.uint64());
25599
+ continue;
25600
+ }
25601
+ }
25602
+ if ((tag & 7) === 4 || tag === 0) {
25603
+ break;
25604
+ }
25605
+ reader.skip(tag & 7);
25606
+ }
25607
+ return message;
25608
+ } finally {
25609
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25610
+ }
25611
+ },
25612
+
25613
+ fromJSON(object: any): SessionWorkSizeCount {
25614
+ return {
25615
+ workSize: isSet(object.workSize)
25616
+ ? globalThis.String(object.workSize)
25617
+ : isSet(object.work_size)
25618
+ ? globalThis.String(object.work_size)
25619
+ : "",
25620
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
25621
+ };
25622
+ },
25623
+
25624
+ toJSON(message: SessionWorkSizeCount): unknown {
25625
+ const obj: any = {};
25626
+ if (message.workSize !== "") {
25627
+ obj.workSize = message.workSize;
25628
+ }
25629
+ if (message.sessions !== 0) {
25630
+ obj.sessions = Math.round(message.sessions);
25631
+ }
25632
+ return obj;
25633
+ },
25634
+
25635
+ create<I extends Exact<DeepPartial<SessionWorkSizeCount>, I>>(base?: I): SessionWorkSizeCount {
25636
+ return SessionWorkSizeCount.fromPartial(base ?? ({} as any));
25637
+ },
25638
+ fromPartial<I extends Exact<DeepPartial<SessionWorkSizeCount>, I>>(object: I): SessionWorkSizeCount {
25639
+ const message = createBaseSessionWorkSizeCount();
25640
+ message.workSize = object.workSize ?? "";
25641
+ message.sessions = object.sessions ?? 0;
25642
+ return message;
25643
+ },
25644
+ };
25645
+
25646
+ function createBaseGetSessionAnalysisRequest(): GetSessionAnalysisRequest {
25647
+ return { organizationId: "", projectId: "", sourceSystem: "", sessionId: "" };
25648
+ }
25649
+
25650
+ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> = {
25651
+ encode(message: GetSessionAnalysisRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25652
+ if (message.organizationId !== "") {
25653
+ writer.uint32(10).string(message.organizationId);
25654
+ }
25655
+ if (message.projectId !== "") {
25656
+ writer.uint32(18).string(message.projectId);
25657
+ }
25658
+ if (message.sourceSystem !== "") {
25659
+ writer.uint32(26).string(message.sourceSystem);
25660
+ }
25661
+ if (message.sessionId !== "") {
25662
+ writer.uint32(34).string(message.sessionId);
25663
+ }
25664
+ return writer;
25665
+ },
25666
+
25667
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisRequest {
25668
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25669
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25670
+ if (previousRecursionDepth >= 100) {
25671
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25672
+ }
25673
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25674
+ try {
25675
+ const end = length === undefined ? reader.len : reader.pos + length;
25676
+ const message = createBaseGetSessionAnalysisRequest();
25677
+ while (reader.pos < end) {
25678
+ const tag = reader.uint32();
25679
+ switch (tag >>> 3) {
25680
+ case 1: {
25681
+ if (tag !== 10) {
25682
+ break;
25683
+ }
25684
+
25685
+ message.organizationId = reader.string();
25686
+ continue;
25687
+ }
25688
+ case 2: {
25689
+ if (tag !== 18) {
25690
+ break;
25691
+ }
25692
+
25693
+ message.projectId = reader.string();
25694
+ continue;
25695
+ }
25696
+ case 3: {
25697
+ if (tag !== 26) {
25698
+ break;
25699
+ }
25700
+
25701
+ message.sourceSystem = reader.string();
25702
+ continue;
25703
+ }
25704
+ case 4: {
25705
+ if (tag !== 34) {
25706
+ break;
25707
+ }
25708
+
25709
+ message.sessionId = reader.string();
25710
+ continue;
25711
+ }
25712
+ }
25713
+ if ((tag & 7) === 4 || tag === 0) {
25714
+ break;
25715
+ }
25716
+ reader.skip(tag & 7);
25717
+ }
25718
+ return message;
25719
+ } finally {
25720
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25721
+ }
25722
+ },
25723
+
25724
+ fromJSON(object: any): GetSessionAnalysisRequest {
25725
+ return {
25726
+ organizationId: isSet(object.organizationId)
25727
+ ? globalThis.String(object.organizationId)
25728
+ : isSet(object.organization_id)
25729
+ ? globalThis.String(object.organization_id)
25730
+ : "",
25731
+ projectId: isSet(object.projectId)
25732
+ ? globalThis.String(object.projectId)
25733
+ : isSet(object.project_id)
25734
+ ? globalThis.String(object.project_id)
25735
+ : "",
25736
+ sourceSystem: isSet(object.sourceSystem)
25737
+ ? globalThis.String(object.sourceSystem)
25738
+ : isSet(object.source_system)
25739
+ ? globalThis.String(object.source_system)
25740
+ : "",
25741
+ sessionId: isSet(object.sessionId)
25742
+ ? globalThis.String(object.sessionId)
25743
+ : isSet(object.session_id)
25744
+ ? globalThis.String(object.session_id)
25745
+ : "",
25746
+ };
25747
+ },
25748
+
25749
+ toJSON(message: GetSessionAnalysisRequest): unknown {
25750
+ const obj: any = {};
25751
+ if (message.organizationId !== "") {
25752
+ obj.organizationId = message.organizationId;
25753
+ }
25754
+ if (message.projectId !== "") {
25755
+ obj.projectId = message.projectId;
25756
+ }
25757
+ if (message.sourceSystem !== "") {
25758
+ obj.sourceSystem = message.sourceSystem;
25759
+ }
25760
+ if (message.sessionId !== "") {
25761
+ obj.sessionId = message.sessionId;
25762
+ }
25763
+ return obj;
25764
+ },
25765
+
25766
+ create<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(base?: I): GetSessionAnalysisRequest {
25767
+ return GetSessionAnalysisRequest.fromPartial(base ?? ({} as any));
25768
+ },
25769
+ fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(object: I): GetSessionAnalysisRequest {
25770
+ const message = createBaseGetSessionAnalysisRequest();
25771
+ message.organizationId = object.organizationId ?? "";
25772
+ message.projectId = object.projectId ?? "";
25773
+ message.sourceSystem = object.sourceSystem ?? "";
25774
+ message.sessionId = object.sessionId ?? "";
25775
+ return message;
25776
+ },
25777
+ };
25778
+
25779
+ function createBaseGetSessionAnalysisResponse(): GetSessionAnalysisResponse {
25780
+ return { status: undefined, score: undefined, insights: undefined, sessionVersion: undefined };
25781
+ }
25782
+
25783
+ export const GetSessionAnalysisResponse: MessageFns<GetSessionAnalysisResponse> = {
25784
+ encode(message: GetSessionAnalysisResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25785
+ if (message.status !== undefined) {
25786
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
25787
+ }
25788
+ if (message.score !== undefined) {
25789
+ AISessionScore.encode(message.score, writer.uint32(18).fork()).join();
25790
+ }
25791
+ if (message.insights !== undefined) {
25792
+ AISessionInsights.encode(message.insights, writer.uint32(26).fork()).join();
25793
+ }
25794
+ if (message.sessionVersion !== undefined) {
25795
+ writer.uint32(32).uint64(message.sessionVersion);
25796
+ }
25797
+ return writer;
25798
+ },
25799
+
25800
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisResponse {
25801
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25802
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25803
+ if (previousRecursionDepth >= 100) {
25804
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25805
+ }
25806
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25807
+ try {
25808
+ const end = length === undefined ? reader.len : reader.pos + length;
25809
+ const message = createBaseGetSessionAnalysisResponse();
25810
+ while (reader.pos < end) {
25811
+ const tag = reader.uint32();
25812
+ switch (tag >>> 3) {
25813
+ case 1: {
25814
+ if (tag !== 10) {
25815
+ break;
25816
+ }
25817
+
25818
+ message.status = ResponseStatus.decode(reader, reader.uint32());
25819
+ continue;
25820
+ }
25821
+ case 2: {
25822
+ if (tag !== 18) {
25823
+ break;
25824
+ }
25825
+
25826
+ message.score = AISessionScore.decode(reader, reader.uint32());
25827
+ continue;
25828
+ }
25829
+ case 3: {
25830
+ if (tag !== 26) {
25831
+ break;
25832
+ }
25833
+
25834
+ message.insights = AISessionInsights.decode(reader, reader.uint32());
25835
+ continue;
25836
+ }
25837
+ case 4: {
25838
+ if (tag !== 32) {
25839
+ break;
25840
+ }
25841
+
25842
+ message.sessionVersion = longToNumber(reader.uint64());
25843
+ continue;
25844
+ }
25845
+ }
25846
+ if ((tag & 7) === 4 || tag === 0) {
25847
+ break;
25848
+ }
25849
+ reader.skip(tag & 7);
25850
+ }
25851
+ return message;
25852
+ } finally {
25853
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25854
+ }
25855
+ },
25856
+
25857
+ fromJSON(object: any): GetSessionAnalysisResponse {
25858
+ return {
25859
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
25860
+ score: isSet(object.score) ? AISessionScore.fromJSON(object.score) : undefined,
25861
+ insights: isSet(object.insights) ? AISessionInsights.fromJSON(object.insights) : undefined,
25862
+ sessionVersion: isSet(object.sessionVersion)
25863
+ ? globalThis.Number(object.sessionVersion)
25864
+ : isSet(object.session_version)
25865
+ ? globalThis.Number(object.session_version)
25866
+ : undefined,
25867
+ };
25868
+ },
25869
+
25870
+ toJSON(message: GetSessionAnalysisResponse): unknown {
25871
+ const obj: any = {};
25872
+ if (message.status !== undefined) {
25873
+ obj.status = ResponseStatus.toJSON(message.status);
25874
+ }
25875
+ if (message.score !== undefined) {
25876
+ obj.score = AISessionScore.toJSON(message.score);
25877
+ }
25878
+ if (message.insights !== undefined) {
25879
+ obj.insights = AISessionInsights.toJSON(message.insights);
25880
+ }
25881
+ if (message.sessionVersion !== undefined) {
25882
+ obj.sessionVersion = Math.round(message.sessionVersion);
25883
+ }
25884
+ return obj;
25885
+ },
25886
+
25887
+ create<I extends Exact<DeepPartial<GetSessionAnalysisResponse>, I>>(base?: I): GetSessionAnalysisResponse {
25888
+ return GetSessionAnalysisResponse.fromPartial(base ?? ({} as any));
25889
+ },
25890
+ fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisResponse>, I>>(object: I): GetSessionAnalysisResponse {
25891
+ const message = createBaseGetSessionAnalysisResponse();
25892
+ message.status = (object.status !== undefined && object.status !== null)
25893
+ ? ResponseStatus.fromPartial(object.status)
25894
+ : undefined;
25895
+ message.score = (object.score !== undefined && object.score !== null)
25896
+ ? AISessionScore.fromPartial(object.score)
25897
+ : undefined;
25898
+ message.insights = (object.insights !== undefined && object.insights !== null)
25899
+ ? AISessionInsights.fromPartial(object.insights)
25900
+ : undefined;
25901
+ message.sessionVersion = object.sessionVersion ?? undefined;
25902
+ return message;
25903
+ },
25904
+ };
25905
+
25906
+ function createBaseAISessionInsights(): AISessionInsights {
25907
+ return { insights: [], model: "", version: "", inputSessionVersion: 0, analyzedAt: undefined, topicsVersion: "" };
25908
+ }
25909
+
25910
+ export const AISessionInsights: MessageFns<AISessionInsights> = {
25911
+ encode(message: AISessionInsights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25912
+ for (const v of message.insights) {
25913
+ AISessionInsight.encode(v!, writer.uint32(10).fork()).join();
25914
+ }
25915
+ if (message.model !== "") {
25916
+ writer.uint32(18).string(message.model);
25917
+ }
25918
+ if (message.version !== "") {
25919
+ writer.uint32(26).string(message.version);
25920
+ }
25921
+ if (message.inputSessionVersion !== 0) {
25922
+ writer.uint32(32).uint64(message.inputSessionVersion);
25923
+ }
25924
+ if (message.analyzedAt !== undefined) {
25925
+ Timestamp.encode(toTimestamp(message.analyzedAt), writer.uint32(42).fork()).join();
25926
+ }
25927
+ if (message.topicsVersion !== "") {
25928
+ writer.uint32(50).string(message.topicsVersion);
25929
+ }
25930
+ return writer;
25931
+ },
25932
+
25933
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionInsights {
25934
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25935
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25936
+ if (previousRecursionDepth >= 100) {
25937
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25938
+ }
25939
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25940
+ try {
25941
+ const end = length === undefined ? reader.len : reader.pos + length;
25942
+ const message = createBaseAISessionInsights();
25943
+ while (reader.pos < end) {
25944
+ const tag = reader.uint32();
25945
+ switch (tag >>> 3) {
25946
+ case 1: {
25947
+ if (tag !== 10) {
25948
+ break;
25949
+ }
25950
+
25951
+ message.insights.push(AISessionInsight.decode(reader, reader.uint32()));
25952
+ continue;
25953
+ }
25954
+ case 2: {
25955
+ if (tag !== 18) {
25956
+ break;
25957
+ }
25958
+
25959
+ message.model = reader.string();
25960
+ continue;
25961
+ }
25962
+ case 3: {
25963
+ if (tag !== 26) {
25964
+ break;
25965
+ }
25966
+
25967
+ message.version = reader.string();
25968
+ continue;
25969
+ }
25970
+ case 4: {
25971
+ if (tag !== 32) {
25972
+ break;
25973
+ }
25974
+
25975
+ message.inputSessionVersion = longToNumber(reader.uint64());
25976
+ continue;
25977
+ }
25978
+ case 5: {
25979
+ if (tag !== 42) {
25980
+ break;
25981
+ }
25982
+
25983
+ message.analyzedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
25984
+ continue;
25985
+ }
25986
+ case 6: {
25987
+ if (tag !== 50) {
25988
+ break;
25989
+ }
25990
+
25991
+ message.topicsVersion = reader.string();
25992
+ continue;
25993
+ }
25994
+ }
25995
+ if ((tag & 7) === 4 || tag === 0) {
25996
+ break;
25997
+ }
25998
+ reader.skip(tag & 7);
25999
+ }
25071
26000
  return message;
25072
26001
  } finally {
25073
26002
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
@@ -35309,6 +36238,15 @@ export interface AIGatewayService {
35309
36238
  request: GetSessionAnalysisOverviewRequest,
35310
36239
  metadata?: Metadata,
35311
36240
  ): Promise<GetSessionAnalysisOverviewResponse>;
36241
+ /**
36242
+ * The sessions ListSessions lists with filter.active_after, and those of the window before it, rolled up from their
36243
+ * whole-session figures: git and pull request counts and tokens per window, and for the window itself each actor's
36244
+ * usage and the work type and size counts. Mirrors ai.api.v1.
36245
+ */
36246
+ GetSessionPeriodTotals(
36247
+ request: GetSessionPeriodTotalsRequest,
36248
+ metadata?: Metadata,
36249
+ ): Promise<GetSessionPeriodTotalsResponse>;
35312
36250
  /**
35313
36251
  * One session's latest score against the scorer's rubric, with each criterion's assessment and improvement, and
35314
36252
  * its latest insights with their cause and action; each part absent until its job has run. Mirrors ai.api.v1.
@@ -35436,6 +36374,7 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
35436
36374
  this.GetSessionUsageTrend = this.GetSessionUsageTrend.bind(this);
35437
36375
  this.GetSessionTotalsTrend = this.GetSessionTotalsTrend.bind(this);
35438
36376
  this.GetSessionAnalysisOverview = this.GetSessionAnalysisOverview.bind(this);
36377
+ this.GetSessionPeriodTotals = this.GetSessionPeriodTotals.bind(this);
35439
36378
  this.GetSessionAnalysis = this.GetSessionAnalysis.bind(this);
35440
36379
  this.GetSessionScoreTrend = this.GetSessionScoreTrend.bind(this);
35441
36380
  this.GetPromptLabelTrend = this.GetPromptLabelTrend.bind(this);
@@ -35659,6 +36598,15 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
35659
36598
  return promise.then((data) => GetSessionAnalysisOverviewResponse.decode(new BinaryReader(data)));
35660
36599
  }
35661
36600
 
36601
+ GetSessionPeriodTotals(
36602
+ request: GetSessionPeriodTotalsRequest,
36603
+ metadata?: Metadata,
36604
+ ): Promise<GetSessionPeriodTotalsResponse> {
36605
+ const data = GetSessionPeriodTotalsRequest.encode(request).finish();
36606
+ const promise = this.rpc.request(this.service, "GetSessionPeriodTotals", data, metadata);
36607
+ return promise.then((data) => GetSessionPeriodTotalsResponse.decode(new BinaryReader(data)));
36608
+ }
36609
+
35662
36610
  GetSessionAnalysis(request: GetSessionAnalysisRequest, metadata?: Metadata): Promise<GetSessionAnalysisResponse> {
35663
36611
  const data = GetSessionAnalysisRequest.encode(request).finish();
35664
36612
  const promise = this.rpc.request(this.service, "GetSessionAnalysis", data, metadata);