@miradorlabs/web-grpc 4.31.0 → 4.33.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.
@@ -3256,6 +3256,149 @@ export interface SessionGitBucket {
3256
3256
  count: number;
3257
3257
  }
3258
3258
 
3259
+ export interface GetSessionTotalsTrendRequest {
3260
+ organizationId: string;
3261
+ projectId: string;
3262
+ /**
3263
+ * The window's start, which is this request's scope (it has no filter): the sessions last active at or after it,
3264
+ * the set ListSessions keeps for the same filter.active_after. At most 35 days before the server's clock, else
3265
+ * INVALID_ARGUMENT; a start in the future answers no buckets.
3266
+ */
3267
+ activeAfter:
3268
+ | Date
3269
+ | undefined;
3270
+ /**
3271
+ * Bucket width: ANALYTICS_TIME_INTERVAL_1_HOUR (a clock hour in time_zone) or ANALYTICS_TIME_INTERVAL_1_DAY (a
3272
+ * calendar day in time_zone). This RPC derives none: unspecified and every other value are INVALID_ARGUMENT.
3273
+ */
3274
+ timeInterval: AnalyticsTimeInterval;
3275
+ /**
3276
+ * IANA zone name the buckets start in (e.g. "America/New_York"); empty is "UTC". Any other name is
3277
+ * INVALID_ARGUMENT. Echoed on the response.
3278
+ */
3279
+ timeZone: string;
3280
+ }
3281
+
3282
+ export interface GetSessionTotalsTrendResponse {
3283
+ status:
3284
+ | ResponseStatus
3285
+ | undefined;
3286
+ /**
3287
+ * One row per (bucket, source system) with at least one session, ordered by bucket_start then source_system. A
3288
+ * bucket or source with no session has no row, so no rows means no session was last active in the window.
3289
+ */
3290
+ buckets: SessionTotalsBucket[];
3291
+ /** The resolved IANA zone the buckets start in ("UTC" when the request named none). */
3292
+ timeZone: string;
3293
+ }
3294
+
3295
+ /**
3296
+ * SessionTotalsBucket is one source system's sessions whose last activity fell in one bucket, with their
3297
+ * whole-session totals. input_tokens is cache-inclusive. A source that reports no usage has zero tokens and cost
3298
+ * here: unknown, not none, which the caller decides by source, as for AISessionSummary.usage.
3299
+ */
3300
+ export interface SessionTotalsBucket {
3301
+ /**
3302
+ * The instant the hour or calendar day holding the sessions' last activity starts in the response's time_zone.
3303
+ * Across a daylight-saving change a day is 23 or 25 hours long.
3304
+ */
3305
+ bucketStart: Date | undefined;
3306
+ sourceSystem: string;
3307
+ /**
3308
+ * Sessions as ListSessions lists them, one per (source_system, session_id): over all rows they add up to
3309
+ * ListSessions' pagination.total_count for the same filter.active_after.
3310
+ */
3311
+ sessions: number;
3312
+ modelCalls: number;
3313
+ inputTokens: number;
3314
+ outputTokens: number;
3315
+ /** AITokenUsage.provider_cost_usd, summed. */
3316
+ providerCostUsd: number;
3317
+ /** AIFacilityCostBreakdown.subscription_facility_usd, summed: a facility lens, never reconciled billing. */
3318
+ subscriptionFacilityUsd: number;
3319
+ }
3320
+
3321
+ export interface GetSessionAnalysisOverviewRequest {
3322
+ organizationId: string;
3323
+ projectId: string;
3324
+ /**
3325
+ * The window's start, which is scope: the sessions last active at or after it. At most 35 days before the
3326
+ * server's clock, else INVALID_ARGUMENT; a start in the future answers an empty overview.
3327
+ */
3328
+ activeAfter:
3329
+ | Date
3330
+ | undefined;
3331
+ /** Which of the window's sessions to roll up; unset rolls up the whole project. */
3332
+ filter: SessionAnalysisOverviewFilter | undefined;
3333
+ }
3334
+
3335
+ /**
3336
+ * SessionAnalysisOverviewFilter narrows the sessions. Fields AND; a repeated field matches any of its values; an
3337
+ * unset or empty field does not filter. Each list holds at most 500 entries, else INVALID_ARGUMENT.
3338
+ */
3339
+ export interface SessionAnalysisOverviewFilter {
3340
+ /**
3341
+ * The session's actor (its user id, else its api key id, as the summary shows it), as SessionFilter.principals
3342
+ * matches it: a user matches its user id, an api key only a session with no user id, an empty id a session with
3343
+ * neither; each on its source system when one is given. A principal of an unspecified kind is INVALID_ARGUMENT.
3344
+ * An empty list reads the whole project, so a caller does not query a person with no principals.
3345
+ */
3346
+ principals: DailyActivityPrincipal[];
3347
+ /** Exact source systems. */
3348
+ sourceSystems: string[];
3349
+ }
3350
+
3351
+ export interface GetSessionAnalysisOverviewResponse {
3352
+ status:
3353
+ | ResponseStatus
3354
+ | undefined;
3355
+ /**
3356
+ * Sessions as ListSessions lists them for the same principals, source systems and active_after: its
3357
+ * pagination.total_count.
3358
+ */
3359
+ sessions: number;
3360
+ /**
3361
+ * One row per work type key with at least one session, ordered by key, read in one statement with `sessions`:
3362
+ * the rows add up to the labelled sessions, at most `sessions`. A session with no label, or whose label names
3363
+ * no work type (""), is in no row.
3364
+ */
3365
+ workTypeCounts: SessionWorkTypeCount[];
3366
+ /**
3367
+ * The sessions that carry a score (AISessionSummary.session_score), ordered by last_activity_at descending, then
3368
+ * source_system and session_id ascending, as ListSessions orders by recency; at most 20.
3369
+ */
3370
+ scoredSessions: ScoredSession[];
3371
+ /** How many of the sessions carry a score; scored_sessions holds the first 20 of them. */
3372
+ scoredSessionCount: number;
3373
+ }
3374
+
3375
+ /** SessionWorkTypeCount is how many sessions carry one work type (AISessionSummary.work_type) as their latest label. */
3376
+ export interface SessionWorkTypeCount {
3377
+ workType: string;
3378
+ sessions: number;
3379
+ /**
3380
+ * The latest last_activity_at among those sessions, so a caller can order work types with equal counts by how
3381
+ * recently each was worked on.
3382
+ */
3383
+ lastActivityAt: Date | undefined;
3384
+ }
3385
+
3386
+ /**
3387
+ * ScoredSession is one session with its score, and what a caller needs to name it and open it. Each field is
3388
+ * AISessionSummary's of the same name.
3389
+ */
3390
+ export interface ScoredSession {
3391
+ sourceSystem: string;
3392
+ sessionId: string;
3393
+ lastActivityAt: Date | undefined;
3394
+ title: string;
3395
+ clients: string[];
3396
+ /** 0-100, from the session's latest grading read from its current session_version. */
3397
+ sessionScore: number;
3398
+ /** UNSPECIFIED when the score predates the scorer recording its template. */
3399
+ sessionScoreRubric: AISessionScoreRubric;
3400
+ }
3401
+
3259
3402
  export interface GetSessionAnalysisRequest {
3260
3403
  organizationId: string;
3261
3404
  projectId: string;
@@ -23656,28 +23799,31 @@ export const SessionGitBucket: MessageFns<SessionGitBucket> = {
23656
23799
  },
23657
23800
  };
23658
23801
 
23659
- function createBaseGetSessionAnalysisRequest(): GetSessionAnalysisRequest {
23660
- return { organizationId: "", projectId: "", sourceSystem: "", sessionId: "" };
23802
+ function createBaseGetSessionTotalsTrendRequest(): GetSessionTotalsTrendRequest {
23803
+ return { organizationId: "", projectId: "", activeAfter: undefined, timeInterval: 0, timeZone: "" };
23661
23804
  }
23662
23805
 
23663
- export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> = {
23664
- encode(message: GetSessionAnalysisRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
23806
+ export const GetSessionTotalsTrendRequest: MessageFns<GetSessionTotalsTrendRequest> = {
23807
+ encode(message: GetSessionTotalsTrendRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
23665
23808
  if (message.organizationId !== "") {
23666
23809
  writer.uint32(10).string(message.organizationId);
23667
23810
  }
23668
23811
  if (message.projectId !== "") {
23669
23812
  writer.uint32(18).string(message.projectId);
23670
23813
  }
23671
- if (message.sourceSystem !== "") {
23672
- writer.uint32(26).string(message.sourceSystem);
23814
+ if (message.activeAfter !== undefined) {
23815
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(26).fork()).join();
23673
23816
  }
23674
- if (message.sessionId !== "") {
23675
- writer.uint32(34).string(message.sessionId);
23817
+ if (message.timeInterval !== 0) {
23818
+ writer.uint32(32).int32(message.timeInterval);
23819
+ }
23820
+ if (message.timeZone !== "") {
23821
+ writer.uint32(42).string(message.timeZone);
23676
23822
  }
23677
23823
  return writer;
23678
23824
  },
23679
23825
 
23680
- decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisRequest {
23826
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionTotalsTrendRequest {
23681
23827
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
23682
23828
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
23683
23829
  if (previousRecursionDepth >= 100) {
@@ -23686,7 +23832,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
23686
23832
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
23687
23833
  try {
23688
23834
  const end = length === undefined ? reader.len : reader.pos + length;
23689
- const message = createBaseGetSessionAnalysisRequest();
23835
+ const message = createBaseGetSessionTotalsTrendRequest();
23690
23836
  while (reader.pos < end) {
23691
23837
  const tag = reader.uint32();
23692
23838
  switch (tag >>> 3) {
@@ -23711,15 +23857,23 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
23711
23857
  break;
23712
23858
  }
23713
23859
 
23714
- message.sourceSystem = reader.string();
23860
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
23715
23861
  continue;
23716
23862
  }
23717
23863
  case 4: {
23718
- if (tag !== 34) {
23864
+ if (tag !== 32) {
23719
23865
  break;
23720
23866
  }
23721
23867
 
23722
- message.sessionId = reader.string();
23868
+ message.timeInterval = reader.int32() as any;
23869
+ continue;
23870
+ }
23871
+ case 5: {
23872
+ if (tag !== 42) {
23873
+ break;
23874
+ }
23875
+
23876
+ message.timeZone = reader.string();
23723
23877
  continue;
23724
23878
  }
23725
23879
  }
@@ -23734,7 +23888,7 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
23734
23888
  }
23735
23889
  },
23736
23890
 
23737
- fromJSON(object: any): GetSessionAnalysisRequest {
23891
+ fromJSON(object: any): GetSessionTotalsTrendRequest {
23738
23892
  return {
23739
23893
  organizationId: isSet(object.organizationId)
23740
23894
  ? globalThis.String(object.organizationId)
@@ -23746,20 +23900,25 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
23746
23900
  : isSet(object.project_id)
23747
23901
  ? globalThis.String(object.project_id)
23748
23902
  : "",
23749
- sourceSystem: isSet(object.sourceSystem)
23750
- ? globalThis.String(object.sourceSystem)
23751
- : isSet(object.source_system)
23752
- ? globalThis.String(object.source_system)
23753
- : "",
23754
- sessionId: isSet(object.sessionId)
23755
- ? globalThis.String(object.sessionId)
23756
- : isSet(object.session_id)
23757
- ? globalThis.String(object.session_id)
23903
+ activeAfter: isSet(object.activeAfter)
23904
+ ? fromJsonTimestamp(object.activeAfter)
23905
+ : isSet(object.active_after)
23906
+ ? fromJsonTimestamp(object.active_after)
23907
+ : undefined,
23908
+ timeInterval: isSet(object.timeInterval)
23909
+ ? analyticsTimeIntervalFromJSON(object.timeInterval)
23910
+ : isSet(object.time_interval)
23911
+ ? analyticsTimeIntervalFromJSON(object.time_interval)
23912
+ : 0,
23913
+ timeZone: isSet(object.timeZone)
23914
+ ? globalThis.String(object.timeZone)
23915
+ : isSet(object.time_zone)
23916
+ ? globalThis.String(object.time_zone)
23758
23917
  : "",
23759
23918
  };
23760
23919
  },
23761
23920
 
23762
- toJSON(message: GetSessionAnalysisRequest): unknown {
23921
+ toJSON(message: GetSessionTotalsTrendRequest): unknown {
23763
23922
  const obj: any = {};
23764
23923
  if (message.organizationId !== "") {
23765
23924
  obj.organizationId = message.organizationId;
@@ -23767,56 +23926,383 @@ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> =
23767
23926
  if (message.projectId !== "") {
23768
23927
  obj.projectId = message.projectId;
23769
23928
  }
23770
- if (message.sourceSystem !== "") {
23771
- obj.sourceSystem = message.sourceSystem;
23929
+ if (message.activeAfter !== undefined) {
23930
+ obj.activeAfter = message.activeAfter.toISOString();
23772
23931
  }
23773
- if (message.sessionId !== "") {
23774
- obj.sessionId = message.sessionId;
23932
+ if (message.timeInterval !== 0) {
23933
+ obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
23934
+ }
23935
+ if (message.timeZone !== "") {
23936
+ obj.timeZone = message.timeZone;
23775
23937
  }
23776
23938
  return obj;
23777
23939
  },
23778
23940
 
23779
- create<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(base?: I): GetSessionAnalysisRequest {
23780
- return GetSessionAnalysisRequest.fromPartial(base ?? ({} as any));
23941
+ create<I extends Exact<DeepPartial<GetSessionTotalsTrendRequest>, I>>(base?: I): GetSessionTotalsTrendRequest {
23942
+ return GetSessionTotalsTrendRequest.fromPartial(base ?? ({} as any));
23781
23943
  },
23782
- fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(object: I): GetSessionAnalysisRequest {
23783
- const message = createBaseGetSessionAnalysisRequest();
23944
+ fromPartial<I extends Exact<DeepPartial<GetSessionTotalsTrendRequest>, I>>(object: I): GetSessionTotalsTrendRequest {
23945
+ const message = createBaseGetSessionTotalsTrendRequest();
23784
23946
  message.organizationId = object.organizationId ?? "";
23785
23947
  message.projectId = object.projectId ?? "";
23948
+ message.activeAfter = object.activeAfter ?? undefined;
23949
+ message.timeInterval = object.timeInterval ?? 0;
23950
+ message.timeZone = object.timeZone ?? "";
23951
+ return message;
23952
+ },
23953
+ };
23954
+
23955
+ function createBaseGetSessionTotalsTrendResponse(): GetSessionTotalsTrendResponse {
23956
+ return { status: undefined, buckets: [], timeZone: "" };
23957
+ }
23958
+
23959
+ export const GetSessionTotalsTrendResponse: MessageFns<GetSessionTotalsTrendResponse> = {
23960
+ encode(message: GetSessionTotalsTrendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
23961
+ if (message.status !== undefined) {
23962
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
23963
+ }
23964
+ for (const v of message.buckets) {
23965
+ SessionTotalsBucket.encode(v!, writer.uint32(18).fork()).join();
23966
+ }
23967
+ if (message.timeZone !== "") {
23968
+ writer.uint32(26).string(message.timeZone);
23969
+ }
23970
+ return writer;
23971
+ },
23972
+
23973
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionTotalsTrendResponse {
23974
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
23975
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
23976
+ if (previousRecursionDepth >= 100) {
23977
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
23978
+ }
23979
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
23980
+ try {
23981
+ const end = length === undefined ? reader.len : reader.pos + length;
23982
+ const message = createBaseGetSessionTotalsTrendResponse();
23983
+ while (reader.pos < end) {
23984
+ const tag = reader.uint32();
23985
+ switch (tag >>> 3) {
23986
+ case 1: {
23987
+ if (tag !== 10) {
23988
+ break;
23989
+ }
23990
+
23991
+ message.status = ResponseStatus.decode(reader, reader.uint32());
23992
+ continue;
23993
+ }
23994
+ case 2: {
23995
+ if (tag !== 18) {
23996
+ break;
23997
+ }
23998
+
23999
+ message.buckets.push(SessionTotalsBucket.decode(reader, reader.uint32()));
24000
+ continue;
24001
+ }
24002
+ case 3: {
24003
+ if (tag !== 26) {
24004
+ break;
24005
+ }
24006
+
24007
+ message.timeZone = reader.string();
24008
+ continue;
24009
+ }
24010
+ }
24011
+ if ((tag & 7) === 4 || tag === 0) {
24012
+ break;
24013
+ }
24014
+ reader.skip(tag & 7);
24015
+ }
24016
+ return message;
24017
+ } finally {
24018
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24019
+ }
24020
+ },
24021
+
24022
+ fromJSON(object: any): GetSessionTotalsTrendResponse {
24023
+ return {
24024
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
24025
+ buckets: globalThis.Array.isArray(object?.buckets)
24026
+ ? object.buckets.map((e: any) => SessionTotalsBucket.fromJSON(e))
24027
+ : [],
24028
+ timeZone: isSet(object.timeZone)
24029
+ ? globalThis.String(object.timeZone)
24030
+ : isSet(object.time_zone)
24031
+ ? globalThis.String(object.time_zone)
24032
+ : "",
24033
+ };
24034
+ },
24035
+
24036
+ toJSON(message: GetSessionTotalsTrendResponse): unknown {
24037
+ const obj: any = {};
24038
+ if (message.status !== undefined) {
24039
+ obj.status = ResponseStatus.toJSON(message.status);
24040
+ }
24041
+ if (message.buckets?.length) {
24042
+ obj.buckets = message.buckets.map((e) => SessionTotalsBucket.toJSON(e));
24043
+ }
24044
+ if (message.timeZone !== "") {
24045
+ obj.timeZone = message.timeZone;
24046
+ }
24047
+ return obj;
24048
+ },
24049
+
24050
+ create<I extends Exact<DeepPartial<GetSessionTotalsTrendResponse>, I>>(base?: I): GetSessionTotalsTrendResponse {
24051
+ return GetSessionTotalsTrendResponse.fromPartial(base ?? ({} as any));
24052
+ },
24053
+ fromPartial<I extends Exact<DeepPartial<GetSessionTotalsTrendResponse>, I>>(
24054
+ object: I,
24055
+ ): GetSessionTotalsTrendResponse {
24056
+ const message = createBaseGetSessionTotalsTrendResponse();
24057
+ message.status = (object.status !== undefined && object.status !== null)
24058
+ ? ResponseStatus.fromPartial(object.status)
24059
+ : undefined;
24060
+ message.buckets = object.buckets?.map((e) => SessionTotalsBucket.fromPartial(e)) || [];
24061
+ message.timeZone = object.timeZone ?? "";
24062
+ return message;
24063
+ },
24064
+ };
24065
+
24066
+ function createBaseSessionTotalsBucket(): SessionTotalsBucket {
24067
+ return {
24068
+ bucketStart: undefined,
24069
+ sourceSystem: "",
24070
+ sessions: 0,
24071
+ modelCalls: 0,
24072
+ inputTokens: 0,
24073
+ outputTokens: 0,
24074
+ providerCostUsd: 0,
24075
+ subscriptionFacilityUsd: 0,
24076
+ };
24077
+ }
24078
+
24079
+ export const SessionTotalsBucket: MessageFns<SessionTotalsBucket> = {
24080
+ encode(message: SessionTotalsBucket, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24081
+ if (message.bucketStart !== undefined) {
24082
+ Timestamp.encode(toTimestamp(message.bucketStart), writer.uint32(10).fork()).join();
24083
+ }
24084
+ if (message.sourceSystem !== "") {
24085
+ writer.uint32(18).string(message.sourceSystem);
24086
+ }
24087
+ if (message.sessions !== 0) {
24088
+ writer.uint32(24).uint64(message.sessions);
24089
+ }
24090
+ if (message.modelCalls !== 0) {
24091
+ writer.uint32(32).uint64(message.modelCalls);
24092
+ }
24093
+ if (message.inputTokens !== 0) {
24094
+ writer.uint32(40).uint64(message.inputTokens);
24095
+ }
24096
+ if (message.outputTokens !== 0) {
24097
+ writer.uint32(48).uint64(message.outputTokens);
24098
+ }
24099
+ if (message.providerCostUsd !== 0) {
24100
+ writer.uint32(57).double(message.providerCostUsd);
24101
+ }
24102
+ if (message.subscriptionFacilityUsd !== 0) {
24103
+ writer.uint32(65).double(message.subscriptionFacilityUsd);
24104
+ }
24105
+ return writer;
24106
+ },
24107
+
24108
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionTotalsBucket {
24109
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24110
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24111
+ if (previousRecursionDepth >= 100) {
24112
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24113
+ }
24114
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24115
+ try {
24116
+ const end = length === undefined ? reader.len : reader.pos + length;
24117
+ const message = createBaseSessionTotalsBucket();
24118
+ while (reader.pos < end) {
24119
+ const tag = reader.uint32();
24120
+ switch (tag >>> 3) {
24121
+ case 1: {
24122
+ if (tag !== 10) {
24123
+ break;
24124
+ }
24125
+
24126
+ message.bucketStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24127
+ continue;
24128
+ }
24129
+ case 2: {
24130
+ if (tag !== 18) {
24131
+ break;
24132
+ }
24133
+
24134
+ message.sourceSystem = reader.string();
24135
+ continue;
24136
+ }
24137
+ case 3: {
24138
+ if (tag !== 24) {
24139
+ break;
24140
+ }
24141
+
24142
+ message.sessions = longToNumber(reader.uint64());
24143
+ continue;
24144
+ }
24145
+ case 4: {
24146
+ if (tag !== 32) {
24147
+ break;
24148
+ }
24149
+
24150
+ message.modelCalls = longToNumber(reader.uint64());
24151
+ continue;
24152
+ }
24153
+ case 5: {
24154
+ if (tag !== 40) {
24155
+ break;
24156
+ }
24157
+
24158
+ message.inputTokens = longToNumber(reader.uint64());
24159
+ continue;
24160
+ }
24161
+ case 6: {
24162
+ if (tag !== 48) {
24163
+ break;
24164
+ }
24165
+
24166
+ message.outputTokens = longToNumber(reader.uint64());
24167
+ continue;
24168
+ }
24169
+ case 7: {
24170
+ if (tag !== 57) {
24171
+ break;
24172
+ }
24173
+
24174
+ message.providerCostUsd = reader.double();
24175
+ continue;
24176
+ }
24177
+ case 8: {
24178
+ if (tag !== 65) {
24179
+ break;
24180
+ }
24181
+
24182
+ message.subscriptionFacilityUsd = reader.double();
24183
+ continue;
24184
+ }
24185
+ }
24186
+ if ((tag & 7) === 4 || tag === 0) {
24187
+ break;
24188
+ }
24189
+ reader.skip(tag & 7);
24190
+ }
24191
+ return message;
24192
+ } finally {
24193
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24194
+ }
24195
+ },
24196
+
24197
+ fromJSON(object: any): SessionTotalsBucket {
24198
+ return {
24199
+ bucketStart: isSet(object.bucketStart)
24200
+ ? fromJsonTimestamp(object.bucketStart)
24201
+ : isSet(object.bucket_start)
24202
+ ? fromJsonTimestamp(object.bucket_start)
24203
+ : undefined,
24204
+ sourceSystem: isSet(object.sourceSystem)
24205
+ ? globalThis.String(object.sourceSystem)
24206
+ : isSet(object.source_system)
24207
+ ? globalThis.String(object.source_system)
24208
+ : "",
24209
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
24210
+ modelCalls: isSet(object.modelCalls)
24211
+ ? globalThis.Number(object.modelCalls)
24212
+ : isSet(object.model_calls)
24213
+ ? globalThis.Number(object.model_calls)
24214
+ : 0,
24215
+ inputTokens: isSet(object.inputTokens)
24216
+ ? globalThis.Number(object.inputTokens)
24217
+ : isSet(object.input_tokens)
24218
+ ? globalThis.Number(object.input_tokens)
24219
+ : 0,
24220
+ outputTokens: isSet(object.outputTokens)
24221
+ ? globalThis.Number(object.outputTokens)
24222
+ : isSet(object.output_tokens)
24223
+ ? globalThis.Number(object.output_tokens)
24224
+ : 0,
24225
+ providerCostUsd: isSet(object.providerCostUsd)
24226
+ ? globalThis.Number(object.providerCostUsd)
24227
+ : isSet(object.provider_cost_usd)
24228
+ ? globalThis.Number(object.provider_cost_usd)
24229
+ : 0,
24230
+ subscriptionFacilityUsd: isSet(object.subscriptionFacilityUsd)
24231
+ ? globalThis.Number(object.subscriptionFacilityUsd)
24232
+ : isSet(object.subscription_facility_usd)
24233
+ ? globalThis.Number(object.subscription_facility_usd)
24234
+ : 0,
24235
+ };
24236
+ },
24237
+
24238
+ toJSON(message: SessionTotalsBucket): unknown {
24239
+ const obj: any = {};
24240
+ if (message.bucketStart !== undefined) {
24241
+ obj.bucketStart = message.bucketStart.toISOString();
24242
+ }
24243
+ if (message.sourceSystem !== "") {
24244
+ obj.sourceSystem = message.sourceSystem;
24245
+ }
24246
+ if (message.sessions !== 0) {
24247
+ obj.sessions = Math.round(message.sessions);
24248
+ }
24249
+ if (message.modelCalls !== 0) {
24250
+ obj.modelCalls = Math.round(message.modelCalls);
24251
+ }
24252
+ if (message.inputTokens !== 0) {
24253
+ obj.inputTokens = Math.round(message.inputTokens);
24254
+ }
24255
+ if (message.outputTokens !== 0) {
24256
+ obj.outputTokens = Math.round(message.outputTokens);
24257
+ }
24258
+ if (message.providerCostUsd !== 0) {
24259
+ obj.providerCostUsd = floatToJson(message.providerCostUsd);
24260
+ }
24261
+ if (message.subscriptionFacilityUsd !== 0) {
24262
+ obj.subscriptionFacilityUsd = floatToJson(message.subscriptionFacilityUsd);
24263
+ }
24264
+ return obj;
24265
+ },
24266
+
24267
+ create<I extends Exact<DeepPartial<SessionTotalsBucket>, I>>(base?: I): SessionTotalsBucket {
24268
+ return SessionTotalsBucket.fromPartial(base ?? ({} as any));
24269
+ },
24270
+ fromPartial<I extends Exact<DeepPartial<SessionTotalsBucket>, I>>(object: I): SessionTotalsBucket {
24271
+ const message = createBaseSessionTotalsBucket();
24272
+ message.bucketStart = object.bucketStart ?? undefined;
23786
24273
  message.sourceSystem = object.sourceSystem ?? "";
23787
- message.sessionId = object.sessionId ?? "";
24274
+ message.sessions = object.sessions ?? 0;
24275
+ message.modelCalls = object.modelCalls ?? 0;
24276
+ message.inputTokens = object.inputTokens ?? 0;
24277
+ message.outputTokens = object.outputTokens ?? 0;
24278
+ message.providerCostUsd = object.providerCostUsd ?? 0;
24279
+ message.subscriptionFacilityUsd = object.subscriptionFacilityUsd ?? 0;
23788
24280
  return message;
23789
24281
  },
23790
24282
  };
23791
24283
 
23792
- function createBaseListSessionInsightsRequest(): ListSessionInsightsRequest {
23793
- return { organizationId: "", projectId: "", filter: undefined, sort: 0, pageSize: 0, pageToken: "" };
24284
+ function createBaseGetSessionAnalysisOverviewRequest(): GetSessionAnalysisOverviewRequest {
24285
+ return { organizationId: "", projectId: "", activeAfter: undefined, filter: undefined };
23794
24286
  }
23795
24287
 
23796
- export const ListSessionInsightsRequest: MessageFns<ListSessionInsightsRequest> = {
23797
- encode(message: ListSessionInsightsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24288
+ export const GetSessionAnalysisOverviewRequest: MessageFns<GetSessionAnalysisOverviewRequest> = {
24289
+ encode(message: GetSessionAnalysisOverviewRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
23798
24290
  if (message.organizationId !== "") {
23799
24291
  writer.uint32(10).string(message.organizationId);
23800
24292
  }
23801
24293
  if (message.projectId !== "") {
23802
24294
  writer.uint32(18).string(message.projectId);
23803
24295
  }
23804
- if (message.filter !== undefined) {
23805
- SessionInsightFilter.encode(message.filter, writer.uint32(26).fork()).join();
23806
- }
23807
- if (message.sort !== 0) {
23808
- writer.uint32(32).int32(message.sort);
23809
- }
23810
- if (message.pageSize !== 0) {
23811
- writer.uint32(40).int32(message.pageSize);
24296
+ if (message.activeAfter !== undefined) {
24297
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(26).fork()).join();
23812
24298
  }
23813
- if (message.pageToken !== "") {
23814
- writer.uint32(50).string(message.pageToken);
24299
+ if (message.filter !== undefined) {
24300
+ SessionAnalysisOverviewFilter.encode(message.filter, writer.uint32(34).fork()).join();
23815
24301
  }
23816
24302
  return writer;
23817
24303
  },
23818
24304
 
23819
- decode(input: BinaryReader | Uint8Array, length?: number): ListSessionInsightsRequest {
24305
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisOverviewRequest {
23820
24306
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
23821
24307
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
23822
24308
  if (previousRecursionDepth >= 100) {
@@ -23825,7 +24311,827 @@ export const ListSessionInsightsRequest: MessageFns<ListSessionInsightsRequest>
23825
24311
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
23826
24312
  try {
23827
24313
  const end = length === undefined ? reader.len : reader.pos + length;
23828
- const message = createBaseListSessionInsightsRequest();
24314
+ const message = createBaseGetSessionAnalysisOverviewRequest();
24315
+ while (reader.pos < end) {
24316
+ const tag = reader.uint32();
24317
+ switch (tag >>> 3) {
24318
+ case 1: {
24319
+ if (tag !== 10) {
24320
+ break;
24321
+ }
24322
+
24323
+ message.organizationId = reader.string();
24324
+ continue;
24325
+ }
24326
+ case 2: {
24327
+ if (tag !== 18) {
24328
+ break;
24329
+ }
24330
+
24331
+ message.projectId = reader.string();
24332
+ continue;
24333
+ }
24334
+ case 3: {
24335
+ if (tag !== 26) {
24336
+ break;
24337
+ }
24338
+
24339
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24340
+ continue;
24341
+ }
24342
+ case 4: {
24343
+ if (tag !== 34) {
24344
+ break;
24345
+ }
24346
+
24347
+ message.filter = SessionAnalysisOverviewFilter.decode(reader, reader.uint32());
24348
+ continue;
24349
+ }
24350
+ }
24351
+ if ((tag & 7) === 4 || tag === 0) {
24352
+ break;
24353
+ }
24354
+ reader.skip(tag & 7);
24355
+ }
24356
+ return message;
24357
+ } finally {
24358
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24359
+ }
24360
+ },
24361
+
24362
+ fromJSON(object: any): GetSessionAnalysisOverviewRequest {
24363
+ return {
24364
+ organizationId: isSet(object.organizationId)
24365
+ ? globalThis.String(object.organizationId)
24366
+ : isSet(object.organization_id)
24367
+ ? globalThis.String(object.organization_id)
24368
+ : "",
24369
+ projectId: isSet(object.projectId)
24370
+ ? globalThis.String(object.projectId)
24371
+ : isSet(object.project_id)
24372
+ ? globalThis.String(object.project_id)
24373
+ : "",
24374
+ activeAfter: isSet(object.activeAfter)
24375
+ ? fromJsonTimestamp(object.activeAfter)
24376
+ : isSet(object.active_after)
24377
+ ? fromJsonTimestamp(object.active_after)
24378
+ : undefined,
24379
+ filter: isSet(object.filter) ? SessionAnalysisOverviewFilter.fromJSON(object.filter) : undefined,
24380
+ };
24381
+ },
24382
+
24383
+ toJSON(message: GetSessionAnalysisOverviewRequest): unknown {
24384
+ const obj: any = {};
24385
+ if (message.organizationId !== "") {
24386
+ obj.organizationId = message.organizationId;
24387
+ }
24388
+ if (message.projectId !== "") {
24389
+ obj.projectId = message.projectId;
24390
+ }
24391
+ if (message.activeAfter !== undefined) {
24392
+ obj.activeAfter = message.activeAfter.toISOString();
24393
+ }
24394
+ if (message.filter !== undefined) {
24395
+ obj.filter = SessionAnalysisOverviewFilter.toJSON(message.filter);
24396
+ }
24397
+ return obj;
24398
+ },
24399
+
24400
+ create<I extends Exact<DeepPartial<GetSessionAnalysisOverviewRequest>, I>>(
24401
+ base?: I,
24402
+ ): GetSessionAnalysisOverviewRequest {
24403
+ return GetSessionAnalysisOverviewRequest.fromPartial(base ?? ({} as any));
24404
+ },
24405
+ fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisOverviewRequest>, I>>(
24406
+ object: I,
24407
+ ): GetSessionAnalysisOverviewRequest {
24408
+ const message = createBaseGetSessionAnalysisOverviewRequest();
24409
+ message.organizationId = object.organizationId ?? "";
24410
+ message.projectId = object.projectId ?? "";
24411
+ message.activeAfter = object.activeAfter ?? undefined;
24412
+ message.filter = (object.filter !== undefined && object.filter !== null)
24413
+ ? SessionAnalysisOverviewFilter.fromPartial(object.filter)
24414
+ : undefined;
24415
+ return message;
24416
+ },
24417
+ };
24418
+
24419
+ function createBaseSessionAnalysisOverviewFilter(): SessionAnalysisOverviewFilter {
24420
+ return { principals: [], sourceSystems: [] };
24421
+ }
24422
+
24423
+ export const SessionAnalysisOverviewFilter: MessageFns<SessionAnalysisOverviewFilter> = {
24424
+ encode(message: SessionAnalysisOverviewFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24425
+ for (const v of message.principals) {
24426
+ DailyActivityPrincipal.encode(v!, writer.uint32(10).fork()).join();
24427
+ }
24428
+ for (const v of message.sourceSystems) {
24429
+ writer.uint32(18).string(v!);
24430
+ }
24431
+ return writer;
24432
+ },
24433
+
24434
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionAnalysisOverviewFilter {
24435
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24436
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24437
+ if (previousRecursionDepth >= 100) {
24438
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24439
+ }
24440
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24441
+ try {
24442
+ const end = length === undefined ? reader.len : reader.pos + length;
24443
+ const message = createBaseSessionAnalysisOverviewFilter();
24444
+ while (reader.pos < end) {
24445
+ const tag = reader.uint32();
24446
+ switch (tag >>> 3) {
24447
+ case 1: {
24448
+ if (tag !== 10) {
24449
+ break;
24450
+ }
24451
+
24452
+ message.principals.push(DailyActivityPrincipal.decode(reader, reader.uint32()));
24453
+ continue;
24454
+ }
24455
+ case 2: {
24456
+ if (tag !== 18) {
24457
+ break;
24458
+ }
24459
+
24460
+ message.sourceSystems.push(reader.string());
24461
+ continue;
24462
+ }
24463
+ }
24464
+ if ((tag & 7) === 4 || tag === 0) {
24465
+ break;
24466
+ }
24467
+ reader.skip(tag & 7);
24468
+ }
24469
+ return message;
24470
+ } finally {
24471
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24472
+ }
24473
+ },
24474
+
24475
+ fromJSON(object: any): SessionAnalysisOverviewFilter {
24476
+ return {
24477
+ principals: globalThis.Array.isArray(object?.principals)
24478
+ ? object.principals.map((e: any) => DailyActivityPrincipal.fromJSON(e))
24479
+ : [],
24480
+ sourceSystems: globalThis.Array.isArray(object?.sourceSystems)
24481
+ ? object.sourceSystems.map((e: any) => globalThis.String(e))
24482
+ : globalThis.Array.isArray(object?.source_systems)
24483
+ ? object.source_systems.map((e: any) => globalThis.String(e))
24484
+ : [],
24485
+ };
24486
+ },
24487
+
24488
+ toJSON(message: SessionAnalysisOverviewFilter): unknown {
24489
+ const obj: any = {};
24490
+ if (message.principals?.length) {
24491
+ obj.principals = message.principals.map((e) => DailyActivityPrincipal.toJSON(e));
24492
+ }
24493
+ if (message.sourceSystems?.length) {
24494
+ obj.sourceSystems = message.sourceSystems;
24495
+ }
24496
+ return obj;
24497
+ },
24498
+
24499
+ create<I extends Exact<DeepPartial<SessionAnalysisOverviewFilter>, I>>(base?: I): SessionAnalysisOverviewFilter {
24500
+ return SessionAnalysisOverviewFilter.fromPartial(base ?? ({} as any));
24501
+ },
24502
+ fromPartial<I extends Exact<DeepPartial<SessionAnalysisOverviewFilter>, I>>(
24503
+ object: I,
24504
+ ): SessionAnalysisOverviewFilter {
24505
+ const message = createBaseSessionAnalysisOverviewFilter();
24506
+ message.principals = object.principals?.map((e) => DailyActivityPrincipal.fromPartial(e)) || [];
24507
+ message.sourceSystems = object.sourceSystems?.map((e) => e) || [];
24508
+ return message;
24509
+ },
24510
+ };
24511
+
24512
+ function createBaseGetSessionAnalysisOverviewResponse(): GetSessionAnalysisOverviewResponse {
24513
+ return { status: undefined, sessions: 0, workTypeCounts: [], scoredSessions: [], scoredSessionCount: 0 };
24514
+ }
24515
+
24516
+ export const GetSessionAnalysisOverviewResponse: MessageFns<GetSessionAnalysisOverviewResponse> = {
24517
+ encode(message: GetSessionAnalysisOverviewResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24518
+ if (message.status !== undefined) {
24519
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
24520
+ }
24521
+ if (message.sessions !== 0) {
24522
+ writer.uint32(16).uint64(message.sessions);
24523
+ }
24524
+ for (const v of message.workTypeCounts) {
24525
+ SessionWorkTypeCount.encode(v!, writer.uint32(26).fork()).join();
24526
+ }
24527
+ for (const v of message.scoredSessions) {
24528
+ ScoredSession.encode(v!, writer.uint32(34).fork()).join();
24529
+ }
24530
+ if (message.scoredSessionCount !== 0) {
24531
+ writer.uint32(40).uint64(message.scoredSessionCount);
24532
+ }
24533
+ return writer;
24534
+ },
24535
+
24536
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisOverviewResponse {
24537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24538
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24539
+ if (previousRecursionDepth >= 100) {
24540
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24541
+ }
24542
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24543
+ try {
24544
+ const end = length === undefined ? reader.len : reader.pos + length;
24545
+ const message = createBaseGetSessionAnalysisOverviewResponse();
24546
+ while (reader.pos < end) {
24547
+ const tag = reader.uint32();
24548
+ switch (tag >>> 3) {
24549
+ case 1: {
24550
+ if (tag !== 10) {
24551
+ break;
24552
+ }
24553
+
24554
+ message.status = ResponseStatus.decode(reader, reader.uint32());
24555
+ continue;
24556
+ }
24557
+ case 2: {
24558
+ if (tag !== 16) {
24559
+ break;
24560
+ }
24561
+
24562
+ message.sessions = longToNumber(reader.uint64());
24563
+ continue;
24564
+ }
24565
+ case 3: {
24566
+ if (tag !== 26) {
24567
+ break;
24568
+ }
24569
+
24570
+ message.workTypeCounts.push(SessionWorkTypeCount.decode(reader, reader.uint32()));
24571
+ continue;
24572
+ }
24573
+ case 4: {
24574
+ if (tag !== 34) {
24575
+ break;
24576
+ }
24577
+
24578
+ message.scoredSessions.push(ScoredSession.decode(reader, reader.uint32()));
24579
+ continue;
24580
+ }
24581
+ case 5: {
24582
+ if (tag !== 40) {
24583
+ break;
24584
+ }
24585
+
24586
+ message.scoredSessionCount = longToNumber(reader.uint64());
24587
+ continue;
24588
+ }
24589
+ }
24590
+ if ((tag & 7) === 4 || tag === 0) {
24591
+ break;
24592
+ }
24593
+ reader.skip(tag & 7);
24594
+ }
24595
+ return message;
24596
+ } finally {
24597
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24598
+ }
24599
+ },
24600
+
24601
+ fromJSON(object: any): GetSessionAnalysisOverviewResponse {
24602
+ return {
24603
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
24604
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
24605
+ workTypeCounts: globalThis.Array.isArray(object?.workTypeCounts)
24606
+ ? object.workTypeCounts.map((e: any) => SessionWorkTypeCount.fromJSON(e))
24607
+ : globalThis.Array.isArray(object?.work_type_counts)
24608
+ ? object.work_type_counts.map((e: any) => SessionWorkTypeCount.fromJSON(e))
24609
+ : [],
24610
+ scoredSessions: globalThis.Array.isArray(object?.scoredSessions)
24611
+ ? object.scoredSessions.map((e: any) => ScoredSession.fromJSON(e))
24612
+ : globalThis.Array.isArray(object?.scored_sessions)
24613
+ ? object.scored_sessions.map((e: any) => ScoredSession.fromJSON(e))
24614
+ : [],
24615
+ scoredSessionCount: isSet(object.scoredSessionCount)
24616
+ ? globalThis.Number(object.scoredSessionCount)
24617
+ : isSet(object.scored_session_count)
24618
+ ? globalThis.Number(object.scored_session_count)
24619
+ : 0,
24620
+ };
24621
+ },
24622
+
24623
+ toJSON(message: GetSessionAnalysisOverviewResponse): unknown {
24624
+ const obj: any = {};
24625
+ if (message.status !== undefined) {
24626
+ obj.status = ResponseStatus.toJSON(message.status);
24627
+ }
24628
+ if (message.sessions !== 0) {
24629
+ obj.sessions = Math.round(message.sessions);
24630
+ }
24631
+ if (message.workTypeCounts?.length) {
24632
+ obj.workTypeCounts = message.workTypeCounts.map((e) => SessionWorkTypeCount.toJSON(e));
24633
+ }
24634
+ if (message.scoredSessions?.length) {
24635
+ obj.scoredSessions = message.scoredSessions.map((e) => ScoredSession.toJSON(e));
24636
+ }
24637
+ if (message.scoredSessionCount !== 0) {
24638
+ obj.scoredSessionCount = Math.round(message.scoredSessionCount);
24639
+ }
24640
+ return obj;
24641
+ },
24642
+
24643
+ create<I extends Exact<DeepPartial<GetSessionAnalysisOverviewResponse>, I>>(
24644
+ base?: I,
24645
+ ): GetSessionAnalysisOverviewResponse {
24646
+ return GetSessionAnalysisOverviewResponse.fromPartial(base ?? ({} as any));
24647
+ },
24648
+ fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisOverviewResponse>, I>>(
24649
+ object: I,
24650
+ ): GetSessionAnalysisOverviewResponse {
24651
+ const message = createBaseGetSessionAnalysisOverviewResponse();
24652
+ message.status = (object.status !== undefined && object.status !== null)
24653
+ ? ResponseStatus.fromPartial(object.status)
24654
+ : undefined;
24655
+ message.sessions = object.sessions ?? 0;
24656
+ message.workTypeCounts = object.workTypeCounts?.map((e) => SessionWorkTypeCount.fromPartial(e)) || [];
24657
+ message.scoredSessions = object.scoredSessions?.map((e) => ScoredSession.fromPartial(e)) || [];
24658
+ message.scoredSessionCount = object.scoredSessionCount ?? 0;
24659
+ return message;
24660
+ },
24661
+ };
24662
+
24663
+ function createBaseSessionWorkTypeCount(): SessionWorkTypeCount {
24664
+ return { workType: "", sessions: 0, lastActivityAt: undefined };
24665
+ }
24666
+
24667
+ export const SessionWorkTypeCount: MessageFns<SessionWorkTypeCount> = {
24668
+ encode(message: SessionWorkTypeCount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24669
+ if (message.workType !== "") {
24670
+ writer.uint32(10).string(message.workType);
24671
+ }
24672
+ if (message.sessions !== 0) {
24673
+ writer.uint32(16).uint64(message.sessions);
24674
+ }
24675
+ if (message.lastActivityAt !== undefined) {
24676
+ Timestamp.encode(toTimestamp(message.lastActivityAt), writer.uint32(26).fork()).join();
24677
+ }
24678
+ return writer;
24679
+ },
24680
+
24681
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionWorkTypeCount {
24682
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24683
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24684
+ if (previousRecursionDepth >= 100) {
24685
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24686
+ }
24687
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24688
+ try {
24689
+ const end = length === undefined ? reader.len : reader.pos + length;
24690
+ const message = createBaseSessionWorkTypeCount();
24691
+ while (reader.pos < end) {
24692
+ const tag = reader.uint32();
24693
+ switch (tag >>> 3) {
24694
+ case 1: {
24695
+ if (tag !== 10) {
24696
+ break;
24697
+ }
24698
+
24699
+ message.workType = reader.string();
24700
+ continue;
24701
+ }
24702
+ case 2: {
24703
+ if (tag !== 16) {
24704
+ break;
24705
+ }
24706
+
24707
+ message.sessions = longToNumber(reader.uint64());
24708
+ continue;
24709
+ }
24710
+ case 3: {
24711
+ if (tag !== 26) {
24712
+ break;
24713
+ }
24714
+
24715
+ message.lastActivityAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24716
+ continue;
24717
+ }
24718
+ }
24719
+ if ((tag & 7) === 4 || tag === 0) {
24720
+ break;
24721
+ }
24722
+ reader.skip(tag & 7);
24723
+ }
24724
+ return message;
24725
+ } finally {
24726
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24727
+ }
24728
+ },
24729
+
24730
+ fromJSON(object: any): SessionWorkTypeCount {
24731
+ return {
24732
+ workType: isSet(object.workType)
24733
+ ? globalThis.String(object.workType)
24734
+ : isSet(object.work_type)
24735
+ ? globalThis.String(object.work_type)
24736
+ : "",
24737
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
24738
+ lastActivityAt: isSet(object.lastActivityAt)
24739
+ ? fromJsonTimestamp(object.lastActivityAt)
24740
+ : isSet(object.last_activity_at)
24741
+ ? fromJsonTimestamp(object.last_activity_at)
24742
+ : undefined,
24743
+ };
24744
+ },
24745
+
24746
+ toJSON(message: SessionWorkTypeCount): unknown {
24747
+ const obj: any = {};
24748
+ if (message.workType !== "") {
24749
+ obj.workType = message.workType;
24750
+ }
24751
+ if (message.sessions !== 0) {
24752
+ obj.sessions = Math.round(message.sessions);
24753
+ }
24754
+ if (message.lastActivityAt !== undefined) {
24755
+ obj.lastActivityAt = message.lastActivityAt.toISOString();
24756
+ }
24757
+ return obj;
24758
+ },
24759
+
24760
+ create<I extends Exact<DeepPartial<SessionWorkTypeCount>, I>>(base?: I): SessionWorkTypeCount {
24761
+ return SessionWorkTypeCount.fromPartial(base ?? ({} as any));
24762
+ },
24763
+ fromPartial<I extends Exact<DeepPartial<SessionWorkTypeCount>, I>>(object: I): SessionWorkTypeCount {
24764
+ const message = createBaseSessionWorkTypeCount();
24765
+ message.workType = object.workType ?? "";
24766
+ message.sessions = object.sessions ?? 0;
24767
+ message.lastActivityAt = object.lastActivityAt ?? undefined;
24768
+ return message;
24769
+ },
24770
+ };
24771
+
24772
+ function createBaseScoredSession(): ScoredSession {
24773
+ return {
24774
+ sourceSystem: "",
24775
+ sessionId: "",
24776
+ lastActivityAt: undefined,
24777
+ title: "",
24778
+ clients: [],
24779
+ sessionScore: 0,
24780
+ sessionScoreRubric: 0,
24781
+ };
24782
+ }
24783
+
24784
+ export const ScoredSession: MessageFns<ScoredSession> = {
24785
+ encode(message: ScoredSession, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24786
+ if (message.sourceSystem !== "") {
24787
+ writer.uint32(10).string(message.sourceSystem);
24788
+ }
24789
+ if (message.sessionId !== "") {
24790
+ writer.uint32(18).string(message.sessionId);
24791
+ }
24792
+ if (message.lastActivityAt !== undefined) {
24793
+ Timestamp.encode(toTimestamp(message.lastActivityAt), writer.uint32(26).fork()).join();
24794
+ }
24795
+ if (message.title !== "") {
24796
+ writer.uint32(34).string(message.title);
24797
+ }
24798
+ for (const v of message.clients) {
24799
+ writer.uint32(42).string(v!);
24800
+ }
24801
+ if (message.sessionScore !== 0) {
24802
+ writer.uint32(48).int32(message.sessionScore);
24803
+ }
24804
+ if (message.sessionScoreRubric !== 0) {
24805
+ writer.uint32(56).int32(message.sessionScoreRubric);
24806
+ }
24807
+ return writer;
24808
+ },
24809
+
24810
+ decode(input: BinaryReader | Uint8Array, length?: number): ScoredSession {
24811
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24812
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24813
+ if (previousRecursionDepth >= 100) {
24814
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24815
+ }
24816
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24817
+ try {
24818
+ const end = length === undefined ? reader.len : reader.pos + length;
24819
+ const message = createBaseScoredSession();
24820
+ while (reader.pos < end) {
24821
+ const tag = reader.uint32();
24822
+ switch (tag >>> 3) {
24823
+ case 1: {
24824
+ if (tag !== 10) {
24825
+ break;
24826
+ }
24827
+
24828
+ message.sourceSystem = reader.string();
24829
+ continue;
24830
+ }
24831
+ case 2: {
24832
+ if (tag !== 18) {
24833
+ break;
24834
+ }
24835
+
24836
+ message.sessionId = reader.string();
24837
+ continue;
24838
+ }
24839
+ case 3: {
24840
+ if (tag !== 26) {
24841
+ break;
24842
+ }
24843
+
24844
+ message.lastActivityAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
24845
+ continue;
24846
+ }
24847
+ case 4: {
24848
+ if (tag !== 34) {
24849
+ break;
24850
+ }
24851
+
24852
+ message.title = reader.string();
24853
+ continue;
24854
+ }
24855
+ case 5: {
24856
+ if (tag !== 42) {
24857
+ break;
24858
+ }
24859
+
24860
+ message.clients.push(reader.string());
24861
+ continue;
24862
+ }
24863
+ case 6: {
24864
+ if (tag !== 48) {
24865
+ break;
24866
+ }
24867
+
24868
+ message.sessionScore = reader.int32();
24869
+ continue;
24870
+ }
24871
+ case 7: {
24872
+ if (tag !== 56) {
24873
+ break;
24874
+ }
24875
+
24876
+ message.sessionScoreRubric = reader.int32() as any;
24877
+ continue;
24878
+ }
24879
+ }
24880
+ if ((tag & 7) === 4 || tag === 0) {
24881
+ break;
24882
+ }
24883
+ reader.skip(tag & 7);
24884
+ }
24885
+ return message;
24886
+ } finally {
24887
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
24888
+ }
24889
+ },
24890
+
24891
+ fromJSON(object: any): ScoredSession {
24892
+ return {
24893
+ sourceSystem: isSet(object.sourceSystem)
24894
+ ? globalThis.String(object.sourceSystem)
24895
+ : isSet(object.source_system)
24896
+ ? globalThis.String(object.source_system)
24897
+ : "",
24898
+ sessionId: isSet(object.sessionId)
24899
+ ? globalThis.String(object.sessionId)
24900
+ : isSet(object.session_id)
24901
+ ? globalThis.String(object.session_id)
24902
+ : "",
24903
+ lastActivityAt: isSet(object.lastActivityAt)
24904
+ ? fromJsonTimestamp(object.lastActivityAt)
24905
+ : isSet(object.last_activity_at)
24906
+ ? fromJsonTimestamp(object.last_activity_at)
24907
+ : undefined,
24908
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
24909
+ clients: globalThis.Array.isArray(object?.clients) ? object.clients.map((e: any) => globalThis.String(e)) : [],
24910
+ sessionScore: isSet(object.sessionScore)
24911
+ ? globalThis.Number(object.sessionScore)
24912
+ : isSet(object.session_score)
24913
+ ? globalThis.Number(object.session_score)
24914
+ : 0,
24915
+ sessionScoreRubric: isSet(object.sessionScoreRubric)
24916
+ ? aISessionScoreRubricFromJSON(object.sessionScoreRubric)
24917
+ : isSet(object.session_score_rubric)
24918
+ ? aISessionScoreRubricFromJSON(object.session_score_rubric)
24919
+ : 0,
24920
+ };
24921
+ },
24922
+
24923
+ toJSON(message: ScoredSession): unknown {
24924
+ const obj: any = {};
24925
+ if (message.sourceSystem !== "") {
24926
+ obj.sourceSystem = message.sourceSystem;
24927
+ }
24928
+ if (message.sessionId !== "") {
24929
+ obj.sessionId = message.sessionId;
24930
+ }
24931
+ if (message.lastActivityAt !== undefined) {
24932
+ obj.lastActivityAt = message.lastActivityAt.toISOString();
24933
+ }
24934
+ if (message.title !== "") {
24935
+ obj.title = message.title;
24936
+ }
24937
+ if (message.clients?.length) {
24938
+ obj.clients = message.clients;
24939
+ }
24940
+ if (message.sessionScore !== 0) {
24941
+ obj.sessionScore = Math.round(message.sessionScore);
24942
+ }
24943
+ if (message.sessionScoreRubric !== 0) {
24944
+ obj.sessionScoreRubric = aISessionScoreRubricToJSON(message.sessionScoreRubric);
24945
+ }
24946
+ return obj;
24947
+ },
24948
+
24949
+ create<I extends Exact<DeepPartial<ScoredSession>, I>>(base?: I): ScoredSession {
24950
+ return ScoredSession.fromPartial(base ?? ({} as any));
24951
+ },
24952
+ fromPartial<I extends Exact<DeepPartial<ScoredSession>, I>>(object: I): ScoredSession {
24953
+ const message = createBaseScoredSession();
24954
+ message.sourceSystem = object.sourceSystem ?? "";
24955
+ message.sessionId = object.sessionId ?? "";
24956
+ message.lastActivityAt = object.lastActivityAt ?? undefined;
24957
+ message.title = object.title ?? "";
24958
+ message.clients = object.clients?.map((e) => e) || [];
24959
+ message.sessionScore = object.sessionScore ?? 0;
24960
+ message.sessionScoreRubric = object.sessionScoreRubric ?? 0;
24961
+ return message;
24962
+ },
24963
+ };
24964
+
24965
+ function createBaseGetSessionAnalysisRequest(): GetSessionAnalysisRequest {
24966
+ return { organizationId: "", projectId: "", sourceSystem: "", sessionId: "" };
24967
+ }
24968
+
24969
+ export const GetSessionAnalysisRequest: MessageFns<GetSessionAnalysisRequest> = {
24970
+ encode(message: GetSessionAnalysisRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
24971
+ if (message.organizationId !== "") {
24972
+ writer.uint32(10).string(message.organizationId);
24973
+ }
24974
+ if (message.projectId !== "") {
24975
+ writer.uint32(18).string(message.projectId);
24976
+ }
24977
+ if (message.sourceSystem !== "") {
24978
+ writer.uint32(26).string(message.sourceSystem);
24979
+ }
24980
+ if (message.sessionId !== "") {
24981
+ writer.uint32(34).string(message.sessionId);
24982
+ }
24983
+ return writer;
24984
+ },
24985
+
24986
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSessionAnalysisRequest {
24987
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
24988
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
24989
+ if (previousRecursionDepth >= 100) {
24990
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
24991
+ }
24992
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
24993
+ try {
24994
+ const end = length === undefined ? reader.len : reader.pos + length;
24995
+ const message = createBaseGetSessionAnalysisRequest();
24996
+ while (reader.pos < end) {
24997
+ const tag = reader.uint32();
24998
+ switch (tag >>> 3) {
24999
+ case 1: {
25000
+ if (tag !== 10) {
25001
+ break;
25002
+ }
25003
+
25004
+ message.organizationId = reader.string();
25005
+ continue;
25006
+ }
25007
+ case 2: {
25008
+ if (tag !== 18) {
25009
+ break;
25010
+ }
25011
+
25012
+ message.projectId = reader.string();
25013
+ continue;
25014
+ }
25015
+ case 3: {
25016
+ if (tag !== 26) {
25017
+ break;
25018
+ }
25019
+
25020
+ message.sourceSystem = reader.string();
25021
+ continue;
25022
+ }
25023
+ case 4: {
25024
+ if (tag !== 34) {
25025
+ break;
25026
+ }
25027
+
25028
+ message.sessionId = reader.string();
25029
+ continue;
25030
+ }
25031
+ }
25032
+ if ((tag & 7) === 4 || tag === 0) {
25033
+ break;
25034
+ }
25035
+ reader.skip(tag & 7);
25036
+ }
25037
+ return message;
25038
+ } finally {
25039
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
25040
+ }
25041
+ },
25042
+
25043
+ fromJSON(object: any): GetSessionAnalysisRequest {
25044
+ return {
25045
+ organizationId: isSet(object.organizationId)
25046
+ ? globalThis.String(object.organizationId)
25047
+ : isSet(object.organization_id)
25048
+ ? globalThis.String(object.organization_id)
25049
+ : "",
25050
+ projectId: isSet(object.projectId)
25051
+ ? globalThis.String(object.projectId)
25052
+ : isSet(object.project_id)
25053
+ ? globalThis.String(object.project_id)
25054
+ : "",
25055
+ sourceSystem: isSet(object.sourceSystem)
25056
+ ? globalThis.String(object.sourceSystem)
25057
+ : isSet(object.source_system)
25058
+ ? globalThis.String(object.source_system)
25059
+ : "",
25060
+ sessionId: isSet(object.sessionId)
25061
+ ? globalThis.String(object.sessionId)
25062
+ : isSet(object.session_id)
25063
+ ? globalThis.String(object.session_id)
25064
+ : "",
25065
+ };
25066
+ },
25067
+
25068
+ toJSON(message: GetSessionAnalysisRequest): unknown {
25069
+ const obj: any = {};
25070
+ if (message.organizationId !== "") {
25071
+ obj.organizationId = message.organizationId;
25072
+ }
25073
+ if (message.projectId !== "") {
25074
+ obj.projectId = message.projectId;
25075
+ }
25076
+ if (message.sourceSystem !== "") {
25077
+ obj.sourceSystem = message.sourceSystem;
25078
+ }
25079
+ if (message.sessionId !== "") {
25080
+ obj.sessionId = message.sessionId;
25081
+ }
25082
+ return obj;
25083
+ },
25084
+
25085
+ create<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(base?: I): GetSessionAnalysisRequest {
25086
+ return GetSessionAnalysisRequest.fromPartial(base ?? ({} as any));
25087
+ },
25088
+ fromPartial<I extends Exact<DeepPartial<GetSessionAnalysisRequest>, I>>(object: I): GetSessionAnalysisRequest {
25089
+ const message = createBaseGetSessionAnalysisRequest();
25090
+ message.organizationId = object.organizationId ?? "";
25091
+ message.projectId = object.projectId ?? "";
25092
+ message.sourceSystem = object.sourceSystem ?? "";
25093
+ message.sessionId = object.sessionId ?? "";
25094
+ return message;
25095
+ },
25096
+ };
25097
+
25098
+ function createBaseListSessionInsightsRequest(): ListSessionInsightsRequest {
25099
+ return { organizationId: "", projectId: "", filter: undefined, sort: 0, pageSize: 0, pageToken: "" };
25100
+ }
25101
+
25102
+ export const ListSessionInsightsRequest: MessageFns<ListSessionInsightsRequest> = {
25103
+ encode(message: ListSessionInsightsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
25104
+ if (message.organizationId !== "") {
25105
+ writer.uint32(10).string(message.organizationId);
25106
+ }
25107
+ if (message.projectId !== "") {
25108
+ writer.uint32(18).string(message.projectId);
25109
+ }
25110
+ if (message.filter !== undefined) {
25111
+ SessionInsightFilter.encode(message.filter, writer.uint32(26).fork()).join();
25112
+ }
25113
+ if (message.sort !== 0) {
25114
+ writer.uint32(32).int32(message.sort);
25115
+ }
25116
+ if (message.pageSize !== 0) {
25117
+ writer.uint32(40).int32(message.pageSize);
25118
+ }
25119
+ if (message.pageToken !== "") {
25120
+ writer.uint32(50).string(message.pageToken);
25121
+ }
25122
+ return writer;
25123
+ },
25124
+
25125
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSessionInsightsRequest {
25126
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
25127
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
25128
+ if (previousRecursionDepth >= 100) {
25129
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
25130
+ }
25131
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
25132
+ try {
25133
+ const end = length === undefined ? reader.len : reader.pos + length;
25134
+ const message = createBaseListSessionInsightsRequest();
23829
25135
  while (reader.pos < end) {
23830
25136
  const tag = reader.uint32();
23831
25137
  switch (tag >>> 3) {
@@ -35546,6 +36852,24 @@ export interface AIGatewayService {
35546
36852
  * calls, tokens and cost, and each git action's count. Mirrors telemetry.api.v1.
35547
36853
  */
35548
36854
  GetSessionUsageTrend(request: SessionUsageTrendRequest, metadata?: Metadata): Promise<SessionUsageTrendResponse>;
36855
+ /**
36856
+ * The sessions ListSessions lists with filter.active_after, per hour or calendar day of each session's last activity
36857
+ * and source system: how many sessions, and their whole-session model calls, tokens and cost. Each session's
36858
+ * lifetime totals land in the bucket of its last activity. Unpaged, bounded by its window. Mirrors ai.api.v1.
36859
+ */
36860
+ GetSessionTotalsTrend(
36861
+ request: GetSessionTotalsTrendRequest,
36862
+ metadata?: Metadata,
36863
+ ): Promise<GetSessionTotalsTrendResponse>;
36864
+ /**
36865
+ * The sessions ListSessions lists for the same principals, source systems and active_after, rolled up from what
36866
+ * the analysis jobs wrote: how many sessions, how many carry each work type, and the latest 20 that carry a score
36867
+ * with how many do. Mirrors ai.api.v1.
36868
+ */
36869
+ GetSessionAnalysisOverview(
36870
+ request: GetSessionAnalysisOverviewRequest,
36871
+ metadata?: Metadata,
36872
+ ): Promise<GetSessionAnalysisOverviewResponse>;
35549
36873
  /**
35550
36874
  * One session's latest score against the scorer's rubric, with each criterion's assessment and improvement, and
35551
36875
  * its latest insights with their cause and action; each part absent until its job has run. Mirrors ai.api.v1.
@@ -35684,6 +37008,8 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
35684
37008
  this.GetReasoningTrendContribution = this.GetReasoningTrendContribution.bind(this);
35685
37009
  this.SetReasoningTrendContribution = this.SetReasoningTrendContribution.bind(this);
35686
37010
  this.GetSessionUsageTrend = this.GetSessionUsageTrend.bind(this);
37011
+ this.GetSessionTotalsTrend = this.GetSessionTotalsTrend.bind(this);
37012
+ this.GetSessionAnalysisOverview = this.GetSessionAnalysisOverview.bind(this);
35687
37013
  this.GetSessionAnalysis = this.GetSessionAnalysis.bind(this);
35688
37014
  this.ListSessionInsights = this.ListSessionInsights.bind(this);
35689
37015
  this.GetSessionScoreTrend = this.GetSessionScoreTrend.bind(this);
@@ -35891,6 +37217,24 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
35891
37217
  return promise.then((data) => SessionUsageTrendResponse.decode(new BinaryReader(data)));
35892
37218
  }
35893
37219
 
37220
+ GetSessionTotalsTrend(
37221
+ request: GetSessionTotalsTrendRequest,
37222
+ metadata?: Metadata,
37223
+ ): Promise<GetSessionTotalsTrendResponse> {
37224
+ const data = GetSessionTotalsTrendRequest.encode(request).finish();
37225
+ const promise = this.rpc.request(this.service, "GetSessionTotalsTrend", data, metadata);
37226
+ return promise.then((data) => GetSessionTotalsTrendResponse.decode(new BinaryReader(data)));
37227
+ }
37228
+
37229
+ GetSessionAnalysisOverview(
37230
+ request: GetSessionAnalysisOverviewRequest,
37231
+ metadata?: Metadata,
37232
+ ): Promise<GetSessionAnalysisOverviewResponse> {
37233
+ const data = GetSessionAnalysisOverviewRequest.encode(request).finish();
37234
+ const promise = this.rpc.request(this.service, "GetSessionAnalysisOverview", data, metadata);
37235
+ return promise.then((data) => GetSessionAnalysisOverviewResponse.decode(new BinaryReader(data)));
37236
+ }
37237
+
35894
37238
  GetSessionAnalysis(request: GetSessionAnalysisRequest, metadata?: Metadata): Promise<GetSessionAnalysisResponse> {
35895
37239
  const data = GetSessionAnalysisRequest.encode(request).finish();
35896
37240
  const promise = this.rpc.request(this.service, "GetSessionAnalysis", data, metadata);