@miradorlabs/web-grpc 2.45.0 → 2.48.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.
@@ -9,8 +9,17 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
9
  import type { Metadata } from "@grpc/grpc-js";
10
10
  import { Observable } from "rxjs";
11
11
  import { map } from "rxjs/operators";
12
+ import { Duration } from "../../../../google/protobuf/duration";
12
13
  import { Timestamp } from "../../../../google/protobuf/timestamp";
13
14
  import { ResponseStatus } from "../../common/v1/status";
15
+ import {
16
+ AnalyticsTimeInterval,
17
+ analyticsTimeIntervalFromJSON,
18
+ analyticsTimeIntervalToJSON,
19
+ AnalyticsTimeWindow,
20
+ analyticsTimeWindowFromJSON,
21
+ analyticsTimeWindowToJSON,
22
+ } from "./trace_gateway";
14
23
 
15
24
  export const protobufPackage = "gateway.web.v1";
16
25
 
@@ -254,6 +263,255 @@ export function aIGitOutcomeToJSON(object: AIGitOutcome): string {
254
263
  }
255
264
  }
256
265
 
266
+ export enum AIGitActivityDimension {
267
+ AI_GIT_ACTIVITY_DIMENSION_UNSPECIFIED = 0,
268
+ AI_GIT_ACTIVITY_DIMENSION_SOURCE_SYSTEM = 1,
269
+ AI_GIT_ACTIVITY_DIMENSION_REPOSITORY = 2,
270
+ AI_GIT_ACTIVITY_DIMENSION_ACTION = 3,
271
+ AI_GIT_ACTIVITY_DIMENSION_OUTCOME = 4,
272
+ AI_GIT_ACTIVITY_DIMENSION_SESSION = 5,
273
+ UNRECOGNIZED = -1,
274
+ }
275
+
276
+ export function aIGitActivityDimensionFromJSON(object: any): AIGitActivityDimension {
277
+ switch (object) {
278
+ case 0:
279
+ case "AI_GIT_ACTIVITY_DIMENSION_UNSPECIFIED":
280
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_UNSPECIFIED;
281
+ case 1:
282
+ case "AI_GIT_ACTIVITY_DIMENSION_SOURCE_SYSTEM":
283
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_SOURCE_SYSTEM;
284
+ case 2:
285
+ case "AI_GIT_ACTIVITY_DIMENSION_REPOSITORY":
286
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_REPOSITORY;
287
+ case 3:
288
+ case "AI_GIT_ACTIVITY_DIMENSION_ACTION":
289
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_ACTION;
290
+ case 4:
291
+ case "AI_GIT_ACTIVITY_DIMENSION_OUTCOME":
292
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_OUTCOME;
293
+ case 5:
294
+ case "AI_GIT_ACTIVITY_DIMENSION_SESSION":
295
+ return AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_SESSION;
296
+ case -1:
297
+ case "UNRECOGNIZED":
298
+ default:
299
+ return AIGitActivityDimension.UNRECOGNIZED;
300
+ }
301
+ }
302
+
303
+ export function aIGitActivityDimensionToJSON(object: AIGitActivityDimension): string {
304
+ switch (object) {
305
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_UNSPECIFIED:
306
+ return "AI_GIT_ACTIVITY_DIMENSION_UNSPECIFIED";
307
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_SOURCE_SYSTEM:
308
+ return "AI_GIT_ACTIVITY_DIMENSION_SOURCE_SYSTEM";
309
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_REPOSITORY:
310
+ return "AI_GIT_ACTIVITY_DIMENSION_REPOSITORY";
311
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_ACTION:
312
+ return "AI_GIT_ACTIVITY_DIMENSION_ACTION";
313
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_OUTCOME:
314
+ return "AI_GIT_ACTIVITY_DIMENSION_OUTCOME";
315
+ case AIGitActivityDimension.AI_GIT_ACTIVITY_DIMENSION_SESSION:
316
+ return "AI_GIT_ACTIVITY_DIMENSION_SESSION";
317
+ case AIGitActivityDimension.UNRECOGNIZED:
318
+ default:
319
+ return "UNRECOGNIZED";
320
+ }
321
+ }
322
+
323
+ export enum AIFileLifecycle {
324
+ AI_FILE_LIFECYCLE_UNSPECIFIED = 0,
325
+ AI_FILE_LIFECYCLE_UNLANDED = 1,
326
+ AI_FILE_LIFECYCLE_CHANGED_SINCE_COMMIT = 2,
327
+ AI_FILE_LIFECYCLE_COMMITTED_NOT_PUSHED = 3,
328
+ AI_FILE_LIFECYCLE_PUSHED = 4,
329
+ AI_FILE_LIFECYCLE_DISCARDED = 5,
330
+ UNRECOGNIZED = -1,
331
+ }
332
+
333
+ export function aIFileLifecycleFromJSON(object: any): AIFileLifecycle {
334
+ switch (object) {
335
+ case 0:
336
+ case "AI_FILE_LIFECYCLE_UNSPECIFIED":
337
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_UNSPECIFIED;
338
+ case 1:
339
+ case "AI_FILE_LIFECYCLE_UNLANDED":
340
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_UNLANDED;
341
+ case 2:
342
+ case "AI_FILE_LIFECYCLE_CHANGED_SINCE_COMMIT":
343
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_CHANGED_SINCE_COMMIT;
344
+ case 3:
345
+ case "AI_FILE_LIFECYCLE_COMMITTED_NOT_PUSHED":
346
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_COMMITTED_NOT_PUSHED;
347
+ case 4:
348
+ case "AI_FILE_LIFECYCLE_PUSHED":
349
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_PUSHED;
350
+ case 5:
351
+ case "AI_FILE_LIFECYCLE_DISCARDED":
352
+ return AIFileLifecycle.AI_FILE_LIFECYCLE_DISCARDED;
353
+ case -1:
354
+ case "UNRECOGNIZED":
355
+ default:
356
+ return AIFileLifecycle.UNRECOGNIZED;
357
+ }
358
+ }
359
+
360
+ export function aIFileLifecycleToJSON(object: AIFileLifecycle): string {
361
+ switch (object) {
362
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_UNSPECIFIED:
363
+ return "AI_FILE_LIFECYCLE_UNSPECIFIED";
364
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_UNLANDED:
365
+ return "AI_FILE_LIFECYCLE_UNLANDED";
366
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_CHANGED_SINCE_COMMIT:
367
+ return "AI_FILE_LIFECYCLE_CHANGED_SINCE_COMMIT";
368
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_COMMITTED_NOT_PUSHED:
369
+ return "AI_FILE_LIFECYCLE_COMMITTED_NOT_PUSHED";
370
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_PUSHED:
371
+ return "AI_FILE_LIFECYCLE_PUSHED";
372
+ case AIFileLifecycle.AI_FILE_LIFECYCLE_DISCARDED:
373
+ return "AI_FILE_LIFECYCLE_DISCARDED";
374
+ case AIFileLifecycle.UNRECOGNIZED:
375
+ default:
376
+ return "UNRECOGNIZED";
377
+ }
378
+ }
379
+
380
+ export enum AIFileTier {
381
+ AI_FILE_TIER_UNSPECIFIED = 0,
382
+ AI_FILE_TIER_ACTIVE = 1,
383
+ AI_FILE_TIER_OPEN = 2,
384
+ AI_FILE_TIER_STALE = 3,
385
+ AI_FILE_TIER_ABANDONED_HORIZON = 4,
386
+ UNRECOGNIZED = -1,
387
+ }
388
+
389
+ export function aIFileTierFromJSON(object: any): AIFileTier {
390
+ switch (object) {
391
+ case 0:
392
+ case "AI_FILE_TIER_UNSPECIFIED":
393
+ return AIFileTier.AI_FILE_TIER_UNSPECIFIED;
394
+ case 1:
395
+ case "AI_FILE_TIER_ACTIVE":
396
+ return AIFileTier.AI_FILE_TIER_ACTIVE;
397
+ case 2:
398
+ case "AI_FILE_TIER_OPEN":
399
+ return AIFileTier.AI_FILE_TIER_OPEN;
400
+ case 3:
401
+ case "AI_FILE_TIER_STALE":
402
+ return AIFileTier.AI_FILE_TIER_STALE;
403
+ case 4:
404
+ case "AI_FILE_TIER_ABANDONED_HORIZON":
405
+ return AIFileTier.AI_FILE_TIER_ABANDONED_HORIZON;
406
+ case -1:
407
+ case "UNRECOGNIZED":
408
+ default:
409
+ return AIFileTier.UNRECOGNIZED;
410
+ }
411
+ }
412
+
413
+ export function aIFileTierToJSON(object: AIFileTier): string {
414
+ switch (object) {
415
+ case AIFileTier.AI_FILE_TIER_UNSPECIFIED:
416
+ return "AI_FILE_TIER_UNSPECIFIED";
417
+ case AIFileTier.AI_FILE_TIER_ACTIVE:
418
+ return "AI_FILE_TIER_ACTIVE";
419
+ case AIFileTier.AI_FILE_TIER_OPEN:
420
+ return "AI_FILE_TIER_OPEN";
421
+ case AIFileTier.AI_FILE_TIER_STALE:
422
+ return "AI_FILE_TIER_STALE";
423
+ case AIFileTier.AI_FILE_TIER_ABANDONED_HORIZON:
424
+ return "AI_FILE_TIER_ABANDONED_HORIZON";
425
+ case AIFileTier.UNRECOGNIZED:
426
+ default:
427
+ return "UNRECOGNIZED";
428
+ }
429
+ }
430
+
431
+ export enum AIFileConfidence {
432
+ AI_FILE_CONFIDENCE_UNSPECIFIED = 0,
433
+ AI_FILE_CONFIDENCE_OBSERVED = 1,
434
+ AI_FILE_CONFIDENCE_INFERRED = 2,
435
+ UNRECOGNIZED = -1,
436
+ }
437
+
438
+ export function aIFileConfidenceFromJSON(object: any): AIFileConfidence {
439
+ switch (object) {
440
+ case 0:
441
+ case "AI_FILE_CONFIDENCE_UNSPECIFIED":
442
+ return AIFileConfidence.AI_FILE_CONFIDENCE_UNSPECIFIED;
443
+ case 1:
444
+ case "AI_FILE_CONFIDENCE_OBSERVED":
445
+ return AIFileConfidence.AI_FILE_CONFIDENCE_OBSERVED;
446
+ case 2:
447
+ case "AI_FILE_CONFIDENCE_INFERRED":
448
+ return AIFileConfidence.AI_FILE_CONFIDENCE_INFERRED;
449
+ case -1:
450
+ case "UNRECOGNIZED":
451
+ default:
452
+ return AIFileConfidence.UNRECOGNIZED;
453
+ }
454
+ }
455
+
456
+ export function aIFileConfidenceToJSON(object: AIFileConfidence): string {
457
+ switch (object) {
458
+ case AIFileConfidence.AI_FILE_CONFIDENCE_UNSPECIFIED:
459
+ return "AI_FILE_CONFIDENCE_UNSPECIFIED";
460
+ case AIFileConfidence.AI_FILE_CONFIDENCE_OBSERVED:
461
+ return "AI_FILE_CONFIDENCE_OBSERVED";
462
+ case AIFileConfidence.AI_FILE_CONFIDENCE_INFERRED:
463
+ return "AI_FILE_CONFIDENCE_INFERRED";
464
+ case AIFileConfidence.UNRECOGNIZED:
465
+ default:
466
+ return "UNRECOGNIZED";
467
+ }
468
+ }
469
+
470
+ export enum AIFileStateGroupBy {
471
+ AI_FILE_STATE_GROUP_BY_UNSPECIFIED = 0,
472
+ AI_FILE_STATE_GROUP_BY_REPOSITORY = 1,
473
+ AI_FILE_STATE_GROUP_BY_REF = 2,
474
+ AI_FILE_STATE_GROUP_BY_SESSION = 3,
475
+ UNRECOGNIZED = -1,
476
+ }
477
+
478
+ export function aIFileStateGroupByFromJSON(object: any): AIFileStateGroupBy {
479
+ switch (object) {
480
+ case 0:
481
+ case "AI_FILE_STATE_GROUP_BY_UNSPECIFIED":
482
+ return AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_UNSPECIFIED;
483
+ case 1:
484
+ case "AI_FILE_STATE_GROUP_BY_REPOSITORY":
485
+ return AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_REPOSITORY;
486
+ case 2:
487
+ case "AI_FILE_STATE_GROUP_BY_REF":
488
+ return AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_REF;
489
+ case 3:
490
+ case "AI_FILE_STATE_GROUP_BY_SESSION":
491
+ return AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_SESSION;
492
+ case -1:
493
+ case "UNRECOGNIZED":
494
+ default:
495
+ return AIFileStateGroupBy.UNRECOGNIZED;
496
+ }
497
+ }
498
+
499
+ export function aIFileStateGroupByToJSON(object: AIFileStateGroupBy): string {
500
+ switch (object) {
501
+ case AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_UNSPECIFIED:
502
+ return "AI_FILE_STATE_GROUP_BY_UNSPECIFIED";
503
+ case AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_REPOSITORY:
504
+ return "AI_FILE_STATE_GROUP_BY_REPOSITORY";
505
+ case AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_REF:
506
+ return "AI_FILE_STATE_GROUP_BY_REF";
507
+ case AIFileStateGroupBy.AI_FILE_STATE_GROUP_BY_SESSION:
508
+ return "AI_FILE_STATE_GROUP_BY_SESSION";
509
+ case AIFileStateGroupBy.UNRECOGNIZED:
510
+ default:
511
+ return "UNRECOGNIZED";
512
+ }
513
+ }
514
+
257
515
  export interface ListSessionsRequest {
258
516
  organizationId: string;
259
517
  projectId: string;
@@ -433,23 +691,37 @@ export interface UpdatePrincipalResponse {
433
691
  principal: AIPrincipal | undefined;
434
692
  }
435
693
 
694
+ /**
695
+ * AIGitActivityFilter mirrors telemetry.api.v1.AIGitActivityFilter. session_id is
696
+ * the durable session identity from AISession.session_id; fields AND, repeated
697
+ * values OR (any-of); empty = unconstrained. event_time bounds are REQUIRED when
698
+ * session_id is empty.
699
+ */
700
+ export interface AIGitActivityFilter {
701
+ sessionId: string[];
702
+ sourceSystem: string[];
703
+ eventTimeAfter?: Date | undefined;
704
+ eventTimeBefore?: Date | undefined;
705
+ }
706
+
436
707
  export interface ListGitActivitiesRequest {
437
708
  organizationId: string;
438
709
  projectId: string;
439
- routingKey: string;
440
- sourceSystem: string;
710
+ filter: AIGitActivityFilter | undefined;
711
+ pageSize: number;
712
+ pageToken: string;
441
713
  }
442
714
 
443
715
  export interface ListGitActivitiesResponse {
444
716
  status: ResponseStatus | undefined;
445
717
  activities: AIGitActivity[];
718
+ nextPageToken: string;
446
719
  }
447
720
 
448
721
  export interface StreamGitActivitiesRequest {
449
722
  organizationId: string;
450
723
  projectId: string;
451
- routingKey: string;
452
- sourceSystem: string;
724
+ filter: AIGitActivityFilter | undefined;
453
725
  }
454
726
 
455
727
  /**
@@ -499,12 +771,164 @@ export interface AIGitActivity {
499
771
  activityId: string;
500
772
  }
501
773
 
774
+ export interface GitActivitySummaryRequest {
775
+ organizationId: string;
776
+ projectId: string;
777
+ /**
778
+ * filter's session_id / source_system apply; its event-time bounds are ignored
779
+ * (time_window is the range).
780
+ */
781
+ filter:
782
+ | AIGitActivityFilter
783
+ | undefined;
784
+ /** the range; UNSPECIFIED is rejected */
785
+ timeWindow: AnalyticsTimeWindow;
786
+ /** bucket width */
787
+ timeInterval: AnalyticsTimeInterval;
788
+ groupBy: AIGitActivityDimension;
789
+ }
790
+
791
+ export interface GetGitActivitySummaryResponse {
792
+ status: ResponseStatus | undefined;
793
+ summary: GitActivitySummary | undefined;
794
+ }
795
+
796
+ /**
797
+ * GitActivitySummary is the windowed, dimension-sliced trend series plus the
798
+ * whole-window totals. Unary carries it inside GetGitActivitySummaryResponse; each
799
+ * stream frame is a complete re-derived snapshot (streams carry no ResponseStatus).
800
+ */
801
+ export interface GitActivitySummary {
802
+ buckets: GitActivitySummaryBucket[];
803
+ totals: GitActivityMeasures | undefined;
804
+ windowStart: Date | undefined;
805
+ windowEnd: Date | undefined;
806
+ groupBy: AIGitActivityDimension;
807
+ }
808
+
809
+ export interface GitActivitySummaryBucket {
810
+ bucketStart: Date | undefined;
811
+ groups: GitActivitySummaryGroup[];
812
+ }
813
+
814
+ export interface GitActivitySummaryGroup {
815
+ /** group_by value; empty when group_by is UNSPECIFIED */
816
+ key: string;
817
+ measures: GitActivityMeasures | undefined;
818
+ }
819
+
820
+ export interface GitActivityMeasures {
821
+ total: number;
822
+ branchesCreated: number;
823
+ commits: number;
824
+ pushes: number;
825
+ pullRequestsCreated: number;
826
+ pullRequestsMerged: number;
827
+ filesChanged: number;
828
+ insertions: number;
829
+ deletions: number;
830
+ distinctRepositories: number;
831
+ distinctSessions: number;
832
+ }
833
+
834
+ export interface AIFileStateFilter {
835
+ repositoryKey: string[];
836
+ ref: string[];
837
+ state: AIFileLifecycle[];
838
+ tier: AIFileTier[];
839
+ sessionId: string[];
840
+ minAge?: Duration | undefined;
841
+ activeAfter?: Date | undefined;
842
+ activeBefore?: Date | undefined;
843
+ abandonedHorizon?: Duration | undefined;
844
+ }
845
+
846
+ export interface ListFileStatesRequest {
847
+ organizationId: string;
848
+ projectId: string;
849
+ filter: AIFileStateFilter | undefined;
850
+ pageSize: number;
851
+ pageToken: string;
852
+ }
853
+
854
+ export interface ListFileStatesResponse {
855
+ status: ResponseStatus | undefined;
856
+ files: AIFileStateRow[];
857
+ nextPageToken: string;
858
+ }
859
+
860
+ export interface AIFileStateRow {
861
+ repositoryKey: string;
862
+ ref: string;
863
+ path: string;
864
+ oldPath: string;
865
+ state: AIFileLifecycle;
866
+ tier: AIFileTier;
867
+ confidence: AIFileConfidence;
868
+ firstEditedAt: Date | undefined;
869
+ lastEditedAt: Date | undefined;
870
+ lastStagedAt: Date | undefined;
871
+ lastCommittedAt: Date | undefined;
872
+ lastCommitSha: string;
873
+ lastPushedAt: Date | undefined;
874
+ discardedAt: Date | undefined;
875
+ discardReason: string;
876
+ editCount: number;
877
+ sessionId: string[];
878
+ unlandedCostUsd: number;
879
+ unlandedOutputTokens: number;
880
+ }
881
+
882
+ export interface FileStateSummaryRequest {
883
+ organizationId: string;
884
+ projectId: string;
885
+ filter: AIFileStateFilter | undefined;
886
+ abandonedHorizon?: Duration | undefined;
887
+ groupBy: AIFileStateGroupBy;
888
+ }
889
+
890
+ export interface GetFileStateSummaryResponse {
891
+ status: ResponseStatus | undefined;
892
+ summary: FileStateSummary | undefined;
893
+ }
894
+
895
+ export interface FileStateSummary {
896
+ totals: FileStateTiers | undefined;
897
+ groups: FileStateGroup[];
898
+ asOf: Date | undefined;
899
+ groupBy: AIFileStateGroupBy;
900
+ }
901
+
902
+ export interface FileStateTiers {
903
+ active: FileStateTierBucket | undefined;
904
+ open: FileStateTierBucket | undefined;
905
+ stale: FileStateTierBucket | undefined;
906
+ abandonedHorizon: FileStateTierBucket | undefined;
907
+ discarded: FileStateTierBucket | undefined;
908
+ }
909
+
910
+ export interface FileStateTierBucket {
911
+ files: number;
912
+ branches: number;
913
+ sessions: number;
914
+ costUsd: number;
915
+ costUsdUnverified: number;
916
+ outputTokens: number;
917
+ oldestAge: Duration | undefined;
918
+ filesUnverified: number;
919
+ }
920
+
921
+ export interface FileStateGroup {
922
+ key: string;
923
+ tiers: FileStateTiers | undefined;
924
+ }
925
+
502
926
  export interface AITokenUsage {
503
927
  inputTokens: number;
504
928
  outputTokens: number;
505
929
  cacheReadTokens: number;
506
930
  cacheWriteTokens: number;
507
- providerCostUsdNano: number;
931
+ providerCostUsd: number;
508
932
  }
509
933
 
510
934
  function createBaseListSessionsRequest(): ListSessionsRequest {
@@ -3429,28 +3853,28 @@ export const UpdatePrincipalResponse: MessageFns<UpdatePrincipalResponse> = {
3429
3853
  },
3430
3854
  };
3431
3855
 
3432
- function createBaseListGitActivitiesRequest(): ListGitActivitiesRequest {
3433
- return { organizationId: "", projectId: "", routingKey: "", sourceSystem: "" };
3856
+ function createBaseAIGitActivityFilter(): AIGitActivityFilter {
3857
+ return { sessionId: [], sourceSystem: [], eventTimeAfter: undefined, eventTimeBefore: undefined };
3434
3858
  }
3435
3859
 
3436
- export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3437
- encode(message: ListGitActivitiesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3438
- if (message.organizationId !== "") {
3439
- writer.uint32(10).string(message.organizationId);
3860
+ export const AIGitActivityFilter: MessageFns<AIGitActivityFilter> = {
3861
+ encode(message: AIGitActivityFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3862
+ for (const v of message.sessionId) {
3863
+ writer.uint32(10).string(v!);
3440
3864
  }
3441
- if (message.projectId !== "") {
3442
- writer.uint32(18).string(message.projectId);
3865
+ for (const v of message.sourceSystem) {
3866
+ writer.uint32(18).string(v!);
3443
3867
  }
3444
- if (message.routingKey !== "") {
3445
- writer.uint32(26).string(message.routingKey);
3868
+ if (message.eventTimeAfter !== undefined) {
3869
+ Timestamp.encode(toTimestamp(message.eventTimeAfter), writer.uint32(26).fork()).join();
3446
3870
  }
3447
- if (message.sourceSystem !== "") {
3448
- writer.uint32(34).string(message.sourceSystem);
3871
+ if (message.eventTimeBefore !== undefined) {
3872
+ Timestamp.encode(toTimestamp(message.eventTimeBefore), writer.uint32(34).fork()).join();
3449
3873
  }
3450
3874
  return writer;
3451
3875
  },
3452
3876
 
3453
- decode(input: BinaryReader | Uint8Array, length?: number): ListGitActivitiesRequest {
3877
+ decode(input: BinaryReader | Uint8Array, length?: number): AIGitActivityFilter {
3454
3878
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3455
3879
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
3456
3880
  if (previousRecursionDepth >= 100) {
@@ -3459,7 +3883,7 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3459
3883
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
3460
3884
  try {
3461
3885
  const end = length === undefined ? reader.len : reader.pos + length;
3462
- const message = createBaseListGitActivitiesRequest();
3886
+ const message = createBaseAIGitActivityFilter();
3463
3887
  while (reader.pos < end) {
3464
3888
  const tag = reader.uint32();
3465
3889
  switch (tag >>> 3) {
@@ -3468,7 +3892,7 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3468
3892
  break;
3469
3893
  }
3470
3894
 
3471
- message.organizationId = reader.string();
3895
+ message.sessionId.push(reader.string());
3472
3896
  continue;
3473
3897
  }
3474
3898
  case 2: {
@@ -3476,7 +3900,7 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3476
3900
  break;
3477
3901
  }
3478
3902
 
3479
- message.projectId = reader.string();
3903
+ message.sourceSystem.push(reader.string());
3480
3904
  continue;
3481
3905
  }
3482
3906
  case 3: {
@@ -3484,7 +3908,7 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3484
3908
  break;
3485
3909
  }
3486
3910
 
3487
- message.routingKey = reader.string();
3911
+ message.eventTimeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3488
3912
  continue;
3489
3913
  }
3490
3914
  case 4: {
@@ -3492,7 +3916,7 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3492
3916
  break;
3493
3917
  }
3494
3918
 
3495
- message.sourceSystem = reader.string();
3919
+ message.eventTimeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3496
3920
  continue;
3497
3921
  }
3498
3922
  }
@@ -3507,73 +3931,227 @@ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3507
3931
  }
3508
3932
  },
3509
3933
 
3510
- fromJSON(object: any): ListGitActivitiesRequest {
3934
+ fromJSON(object: any): AIGitActivityFilter {
3511
3935
  return {
3512
- organizationId: isSet(object.organizationId)
3513
- ? globalThis.String(object.organizationId)
3514
- : isSet(object.organization_id)
3515
- ? globalThis.String(object.organization_id)
3516
- : "",
3517
- projectId: isSet(object.projectId)
3518
- ? globalThis.String(object.projectId)
3519
- : isSet(object.project_id)
3520
- ? globalThis.String(object.project_id)
3521
- : "",
3522
- routingKey: isSet(object.routingKey)
3523
- ? globalThis.String(object.routingKey)
3524
- : isSet(object.routing_key)
3525
- ? globalThis.String(object.routing_key)
3526
- : "",
3527
- sourceSystem: isSet(object.sourceSystem)
3528
- ? globalThis.String(object.sourceSystem)
3529
- : isSet(object.source_system)
3530
- ? globalThis.String(object.source_system)
3531
- : "",
3936
+ sessionId: globalThis.Array.isArray(object?.sessionId)
3937
+ ? object.sessionId.map((e: any) => globalThis.String(e))
3938
+ : globalThis.Array.isArray(object?.session_id)
3939
+ ? object.session_id.map((e: any) => globalThis.String(e))
3940
+ : [],
3941
+ sourceSystem: globalThis.Array.isArray(object?.sourceSystem)
3942
+ ? object.sourceSystem.map((e: any) => globalThis.String(e))
3943
+ : globalThis.Array.isArray(object?.source_system)
3944
+ ? object.source_system.map((e: any) => globalThis.String(e))
3945
+ : [],
3946
+ eventTimeAfter: isSet(object.eventTimeAfter)
3947
+ ? fromJsonTimestamp(object.eventTimeAfter)
3948
+ : isSet(object.event_time_after)
3949
+ ? fromJsonTimestamp(object.event_time_after)
3950
+ : undefined,
3951
+ eventTimeBefore: isSet(object.eventTimeBefore)
3952
+ ? fromJsonTimestamp(object.eventTimeBefore)
3953
+ : isSet(object.event_time_before)
3954
+ ? fromJsonTimestamp(object.event_time_before)
3955
+ : undefined,
3532
3956
  };
3533
3957
  },
3534
3958
 
3535
- toJSON(message: ListGitActivitiesRequest): unknown {
3959
+ toJSON(message: AIGitActivityFilter): unknown {
3536
3960
  const obj: any = {};
3537
- if (message.organizationId !== "") {
3538
- obj.organizationId = message.organizationId;
3961
+ if (message.sessionId?.length) {
3962
+ obj.sessionId = message.sessionId;
3539
3963
  }
3540
- if (message.projectId !== "") {
3541
- obj.projectId = message.projectId;
3964
+ if (message.sourceSystem?.length) {
3965
+ obj.sourceSystem = message.sourceSystem;
3542
3966
  }
3543
- if (message.routingKey !== "") {
3544
- obj.routingKey = message.routingKey;
3967
+ if (message.eventTimeAfter !== undefined) {
3968
+ obj.eventTimeAfter = message.eventTimeAfter.toISOString();
3545
3969
  }
3546
- if (message.sourceSystem !== "") {
3547
- obj.sourceSystem = message.sourceSystem;
3970
+ if (message.eventTimeBefore !== undefined) {
3971
+ obj.eventTimeBefore = message.eventTimeBefore.toISOString();
3548
3972
  }
3549
3973
  return obj;
3550
3974
  },
3551
3975
 
3552
- create<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(base?: I): ListGitActivitiesRequest {
3553
- return ListGitActivitiesRequest.fromPartial(base ?? ({} as any));
3976
+ create<I extends Exact<DeepPartial<AIGitActivityFilter>, I>>(base?: I): AIGitActivityFilter {
3977
+ return AIGitActivityFilter.fromPartial(base ?? ({} as any));
3554
3978
  },
3555
- fromPartial<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(object: I): ListGitActivitiesRequest {
3556
- const message = createBaseListGitActivitiesRequest();
3557
- message.organizationId = object.organizationId ?? "";
3558
- message.projectId = object.projectId ?? "";
3559
- message.routingKey = object.routingKey ?? "";
3560
- message.sourceSystem = object.sourceSystem ?? "";
3979
+ fromPartial<I extends Exact<DeepPartial<AIGitActivityFilter>, I>>(object: I): AIGitActivityFilter {
3980
+ const message = createBaseAIGitActivityFilter();
3981
+ message.sessionId = object.sessionId?.map((e) => e) || [];
3982
+ message.sourceSystem = object.sourceSystem?.map((e) => e) || [];
3983
+ message.eventTimeAfter = object.eventTimeAfter ?? undefined;
3984
+ message.eventTimeBefore = object.eventTimeBefore ?? undefined;
3561
3985
  return message;
3562
3986
  },
3563
3987
  };
3564
3988
 
3565
- function createBaseListGitActivitiesResponse(): ListGitActivitiesResponse {
3566
- return { status: undefined, activities: [] };
3989
+ function createBaseListGitActivitiesRequest(): ListGitActivitiesRequest {
3990
+ return { organizationId: "", projectId: "", filter: undefined, pageSize: 0, pageToken: "" };
3567
3991
  }
3568
3992
 
3569
- export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> = {
3570
- encode(message: ListGitActivitiesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3571
- if (message.status !== undefined) {
3572
- ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
3993
+ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
3994
+ encode(message: ListGitActivitiesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3995
+ if (message.organizationId !== "") {
3996
+ writer.uint32(10).string(message.organizationId);
3997
+ }
3998
+ if (message.projectId !== "") {
3999
+ writer.uint32(18).string(message.projectId);
4000
+ }
4001
+ if (message.filter !== undefined) {
4002
+ AIGitActivityFilter.encode(message.filter, writer.uint32(26).fork()).join();
4003
+ }
4004
+ if (message.pageSize !== 0) {
4005
+ writer.uint32(32).int32(message.pageSize);
4006
+ }
4007
+ if (message.pageToken !== "") {
4008
+ writer.uint32(42).string(message.pageToken);
4009
+ }
4010
+ return writer;
4011
+ },
4012
+
4013
+ decode(input: BinaryReader | Uint8Array, length?: number): ListGitActivitiesRequest {
4014
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4015
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
4016
+ if (previousRecursionDepth >= 100) {
4017
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
4018
+ }
4019
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
4020
+ try {
4021
+ const end = length === undefined ? reader.len : reader.pos + length;
4022
+ const message = createBaseListGitActivitiesRequest();
4023
+ while (reader.pos < end) {
4024
+ const tag = reader.uint32();
4025
+ switch (tag >>> 3) {
4026
+ case 1: {
4027
+ if (tag !== 10) {
4028
+ break;
4029
+ }
4030
+
4031
+ message.organizationId = reader.string();
4032
+ continue;
4033
+ }
4034
+ case 2: {
4035
+ if (tag !== 18) {
4036
+ break;
4037
+ }
4038
+
4039
+ message.projectId = reader.string();
4040
+ continue;
4041
+ }
4042
+ case 3: {
4043
+ if (tag !== 26) {
4044
+ break;
4045
+ }
4046
+
4047
+ message.filter = AIGitActivityFilter.decode(reader, reader.uint32());
4048
+ continue;
4049
+ }
4050
+ case 4: {
4051
+ if (tag !== 32) {
4052
+ break;
4053
+ }
4054
+
4055
+ message.pageSize = reader.int32();
4056
+ continue;
4057
+ }
4058
+ case 5: {
4059
+ if (tag !== 42) {
4060
+ break;
4061
+ }
4062
+
4063
+ message.pageToken = reader.string();
4064
+ continue;
4065
+ }
4066
+ }
4067
+ if ((tag & 7) === 4 || tag === 0) {
4068
+ break;
4069
+ }
4070
+ reader.skip(tag & 7);
4071
+ }
4072
+ return message;
4073
+ } finally {
4074
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
4075
+ }
4076
+ },
4077
+
4078
+ fromJSON(object: any): ListGitActivitiesRequest {
4079
+ return {
4080
+ organizationId: isSet(object.organizationId)
4081
+ ? globalThis.String(object.organizationId)
4082
+ : isSet(object.organization_id)
4083
+ ? globalThis.String(object.organization_id)
4084
+ : "",
4085
+ projectId: isSet(object.projectId)
4086
+ ? globalThis.String(object.projectId)
4087
+ : isSet(object.project_id)
4088
+ ? globalThis.String(object.project_id)
4089
+ : "",
4090
+ filter: isSet(object.filter) ? AIGitActivityFilter.fromJSON(object.filter) : undefined,
4091
+ pageSize: isSet(object.pageSize)
4092
+ ? globalThis.Number(object.pageSize)
4093
+ : isSet(object.page_size)
4094
+ ? globalThis.Number(object.page_size)
4095
+ : 0,
4096
+ pageToken: isSet(object.pageToken)
4097
+ ? globalThis.String(object.pageToken)
4098
+ : isSet(object.page_token)
4099
+ ? globalThis.String(object.page_token)
4100
+ : "",
4101
+ };
4102
+ },
4103
+
4104
+ toJSON(message: ListGitActivitiesRequest): unknown {
4105
+ const obj: any = {};
4106
+ if (message.organizationId !== "") {
4107
+ obj.organizationId = message.organizationId;
4108
+ }
4109
+ if (message.projectId !== "") {
4110
+ obj.projectId = message.projectId;
4111
+ }
4112
+ if (message.filter !== undefined) {
4113
+ obj.filter = AIGitActivityFilter.toJSON(message.filter);
4114
+ }
4115
+ if (message.pageSize !== 0) {
4116
+ obj.pageSize = Math.round(message.pageSize);
4117
+ }
4118
+ if (message.pageToken !== "") {
4119
+ obj.pageToken = message.pageToken;
4120
+ }
4121
+ return obj;
4122
+ },
4123
+
4124
+ create<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(base?: I): ListGitActivitiesRequest {
4125
+ return ListGitActivitiesRequest.fromPartial(base ?? ({} as any));
4126
+ },
4127
+ fromPartial<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(object: I): ListGitActivitiesRequest {
4128
+ const message = createBaseListGitActivitiesRequest();
4129
+ message.organizationId = object.organizationId ?? "";
4130
+ message.projectId = object.projectId ?? "";
4131
+ message.filter = (object.filter !== undefined && object.filter !== null)
4132
+ ? AIGitActivityFilter.fromPartial(object.filter)
4133
+ : undefined;
4134
+ message.pageSize = object.pageSize ?? 0;
4135
+ message.pageToken = object.pageToken ?? "";
4136
+ return message;
4137
+ },
4138
+ };
4139
+
4140
+ function createBaseListGitActivitiesResponse(): ListGitActivitiesResponse {
4141
+ return { status: undefined, activities: [], nextPageToken: "" };
4142
+ }
4143
+
4144
+ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> = {
4145
+ encode(message: ListGitActivitiesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4146
+ if (message.status !== undefined) {
4147
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
3573
4148
  }
3574
4149
  for (const v of message.activities) {
3575
4150
  AIGitActivity.encode(v!, writer.uint32(18).fork()).join();
3576
4151
  }
4152
+ if (message.nextPageToken !== "") {
4153
+ writer.uint32(26).string(message.nextPageToken);
4154
+ }
3577
4155
  return writer;
3578
4156
  },
3579
4157
 
@@ -3606,6 +4184,14 @@ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> =
3606
4184
  message.activities.push(AIGitActivity.decode(reader, reader.uint32()));
3607
4185
  continue;
3608
4186
  }
4187
+ case 3: {
4188
+ if (tag !== 26) {
4189
+ break;
4190
+ }
4191
+
4192
+ message.nextPageToken = reader.string();
4193
+ continue;
4194
+ }
3609
4195
  }
3610
4196
  if ((tag & 7) === 4 || tag === 0) {
3611
4197
  break;
@@ -3624,6 +4210,11 @@ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> =
3624
4210
  activities: globalThis.Array.isArray(object?.activities)
3625
4211
  ? object.activities.map((e: any) => AIGitActivity.fromJSON(e))
3626
4212
  : [],
4213
+ nextPageToken: isSet(object.nextPageToken)
4214
+ ? globalThis.String(object.nextPageToken)
4215
+ : isSet(object.next_page_token)
4216
+ ? globalThis.String(object.next_page_token)
4217
+ : "",
3627
4218
  };
3628
4219
  },
3629
4220
 
@@ -3635,6 +4226,9 @@ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> =
3635
4226
  if (message.activities?.length) {
3636
4227
  obj.activities = message.activities.map((e) => AIGitActivity.toJSON(e));
3637
4228
  }
4229
+ if (message.nextPageToken !== "") {
4230
+ obj.nextPageToken = message.nextPageToken;
4231
+ }
3638
4232
  return obj;
3639
4233
  },
3640
4234
 
@@ -3647,12 +4241,13 @@ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> =
3647
4241
  ? ResponseStatus.fromPartial(object.status)
3648
4242
  : undefined;
3649
4243
  message.activities = object.activities?.map((e) => AIGitActivity.fromPartial(e)) || [];
4244
+ message.nextPageToken = object.nextPageToken ?? "";
3650
4245
  return message;
3651
4246
  },
3652
4247
  };
3653
4248
 
3654
4249
  function createBaseStreamGitActivitiesRequest(): StreamGitActivitiesRequest {
3655
- return { organizationId: "", projectId: "", routingKey: "", sourceSystem: "" };
4250
+ return { organizationId: "", projectId: "", filter: undefined };
3656
4251
  }
3657
4252
 
3658
4253
  export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest> = {
@@ -3663,11 +4258,8 @@ export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest>
3663
4258
  if (message.projectId !== "") {
3664
4259
  writer.uint32(18).string(message.projectId);
3665
4260
  }
3666
- if (message.routingKey !== "") {
3667
- writer.uint32(26).string(message.routingKey);
3668
- }
3669
- if (message.sourceSystem !== "") {
3670
- writer.uint32(34).string(message.sourceSystem);
4261
+ if (message.filter !== undefined) {
4262
+ AIGitActivityFilter.encode(message.filter, writer.uint32(26).fork()).join();
3671
4263
  }
3672
4264
  return writer;
3673
4265
  },
@@ -3706,15 +4298,7 @@ export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest>
3706
4298
  break;
3707
4299
  }
3708
4300
 
3709
- message.routingKey = reader.string();
3710
- continue;
3711
- }
3712
- case 4: {
3713
- if (tag !== 34) {
3714
- break;
3715
- }
3716
-
3717
- message.sourceSystem = reader.string();
4301
+ message.filter = AIGitActivityFilter.decode(reader, reader.uint32());
3718
4302
  continue;
3719
4303
  }
3720
4304
  }
@@ -3741,16 +4325,7 @@ export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest>
3741
4325
  : isSet(object.project_id)
3742
4326
  ? globalThis.String(object.project_id)
3743
4327
  : "",
3744
- routingKey: isSet(object.routingKey)
3745
- ? globalThis.String(object.routingKey)
3746
- : isSet(object.routing_key)
3747
- ? globalThis.String(object.routing_key)
3748
- : "",
3749
- sourceSystem: isSet(object.sourceSystem)
3750
- ? globalThis.String(object.sourceSystem)
3751
- : isSet(object.source_system)
3752
- ? globalThis.String(object.source_system)
3753
- : "",
4328
+ filter: isSet(object.filter) ? AIGitActivityFilter.fromJSON(object.filter) : undefined,
3754
4329
  };
3755
4330
  },
3756
4331
 
@@ -3762,11 +4337,8 @@ export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest>
3762
4337
  if (message.projectId !== "") {
3763
4338
  obj.projectId = message.projectId;
3764
4339
  }
3765
- if (message.routingKey !== "") {
3766
- obj.routingKey = message.routingKey;
3767
- }
3768
- if (message.sourceSystem !== "") {
3769
- obj.sourceSystem = message.sourceSystem;
4340
+ if (message.filter !== undefined) {
4341
+ obj.filter = AIGitActivityFilter.toJSON(message.filter);
3770
4342
  }
3771
4343
  return obj;
3772
4344
  },
@@ -3778,8 +4350,9 @@ export const StreamGitActivitiesRequest: MessageFns<StreamGitActivitiesRequest>
3778
4350
  const message = createBaseStreamGitActivitiesRequest();
3779
4351
  message.organizationId = object.organizationId ?? "";
3780
4352
  message.projectId = object.projectId ?? "";
3781
- message.routingKey = object.routingKey ?? "";
3782
- message.sourceSystem = object.sourceSystem ?? "";
4353
+ message.filter = (object.filter !== undefined && object.filter !== null)
4354
+ ? AIGitActivityFilter.fromPartial(object.filter)
4355
+ : undefined;
3783
4356
  return message;
3784
4357
  },
3785
4358
  };
@@ -4574,31 +5147,34 @@ export const AIGitActivity: MessageFns<AIGitActivity> = {
4574
5147
  },
4575
5148
  };
4576
5149
 
4577
- function createBaseAITokenUsage(): AITokenUsage {
4578
- return { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, providerCostUsdNano: 0 };
5150
+ function createBaseGitActivitySummaryRequest(): GitActivitySummaryRequest {
5151
+ return { organizationId: "", projectId: "", filter: undefined, timeWindow: 0, timeInterval: 0, groupBy: 0 };
4579
5152
  }
4580
5153
 
4581
- export const AITokenUsage: MessageFns<AITokenUsage> = {
4582
- encode(message: AITokenUsage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4583
- if (message.inputTokens !== 0) {
4584
- writer.uint32(8).uint64(message.inputTokens);
5154
+ export const GitActivitySummaryRequest: MessageFns<GitActivitySummaryRequest> = {
5155
+ encode(message: GitActivitySummaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5156
+ if (message.organizationId !== "") {
5157
+ writer.uint32(10).string(message.organizationId);
4585
5158
  }
4586
- if (message.outputTokens !== 0) {
4587
- writer.uint32(16).uint64(message.outputTokens);
5159
+ if (message.projectId !== "") {
5160
+ writer.uint32(18).string(message.projectId);
4588
5161
  }
4589
- if (message.cacheReadTokens !== 0) {
4590
- writer.uint32(24).uint64(message.cacheReadTokens);
5162
+ if (message.filter !== undefined) {
5163
+ AIGitActivityFilter.encode(message.filter, writer.uint32(26).fork()).join();
4591
5164
  }
4592
- if (message.cacheWriteTokens !== 0) {
4593
- writer.uint32(32).uint64(message.cacheWriteTokens);
5165
+ if (message.timeWindow !== 0) {
5166
+ writer.uint32(32).int32(message.timeWindow);
4594
5167
  }
4595
- if (message.providerCostUsdNano !== 0) {
4596
- writer.uint32(40).int64(message.providerCostUsdNano);
5168
+ if (message.timeInterval !== 0) {
5169
+ writer.uint32(40).int32(message.timeInterval);
5170
+ }
5171
+ if (message.groupBy !== 0) {
5172
+ writer.uint32(48).int32(message.groupBy);
4597
5173
  }
4598
5174
  return writer;
4599
5175
  },
4600
5176
 
4601
- decode(input: BinaryReader | Uint8Array, length?: number): AITokenUsage {
5177
+ decode(input: BinaryReader | Uint8Array, length?: number): GitActivitySummaryRequest {
4602
5178
  const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4603
5179
  const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
4604
5180
  if (previousRecursionDepth >= 100) {
@@ -4607,32 +5183,32 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4607
5183
  (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
4608
5184
  try {
4609
5185
  const end = length === undefined ? reader.len : reader.pos + length;
4610
- const message = createBaseAITokenUsage();
5186
+ const message = createBaseGitActivitySummaryRequest();
4611
5187
  while (reader.pos < end) {
4612
5188
  const tag = reader.uint32();
4613
5189
  switch (tag >>> 3) {
4614
5190
  case 1: {
4615
- if (tag !== 8) {
5191
+ if (tag !== 10) {
4616
5192
  break;
4617
5193
  }
4618
5194
 
4619
- message.inputTokens = longToNumber(reader.uint64());
5195
+ message.organizationId = reader.string();
4620
5196
  continue;
4621
5197
  }
4622
5198
  case 2: {
4623
- if (tag !== 16) {
5199
+ if (tag !== 18) {
4624
5200
  break;
4625
5201
  }
4626
5202
 
4627
- message.outputTokens = longToNumber(reader.uint64());
5203
+ message.projectId = reader.string();
4628
5204
  continue;
4629
5205
  }
4630
5206
  case 3: {
4631
- if (tag !== 24) {
5207
+ if (tag !== 26) {
4632
5208
  break;
4633
5209
  }
4634
5210
 
4635
- message.cacheReadTokens = longToNumber(reader.uint64());
5211
+ message.filter = AIGitActivityFilter.decode(reader, reader.uint32());
4636
5212
  continue;
4637
5213
  }
4638
5214
  case 4: {
@@ -4640,7 +5216,7 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4640
5216
  break;
4641
5217
  }
4642
5218
 
4643
- message.cacheWriteTokens = longToNumber(reader.uint64());
5219
+ message.timeWindow = reader.int32() as any;
4644
5220
  continue;
4645
5221
  }
4646
5222
  case 5: {
@@ -4648,7 +5224,15 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4648
5224
  break;
4649
5225
  }
4650
5226
 
4651
- message.providerCostUsdNano = longToNumber(reader.int64());
5227
+ message.timeInterval = reader.int32() as any;
5228
+ continue;
5229
+ }
5230
+ case 6: {
5231
+ if (tag !== 48) {
5232
+ break;
5233
+ }
5234
+
5235
+ message.groupBy = reader.int32() as any;
4652
5236
  continue;
4653
5237
  }
4654
5238
  }
@@ -4663,14 +5247,2622 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4663
5247
  }
4664
5248
  },
4665
5249
 
4666
- fromJSON(object: any): AITokenUsage {
5250
+ fromJSON(object: any): GitActivitySummaryRequest {
4667
5251
  return {
4668
- inputTokens: isSet(object.inputTokens)
4669
- ? globalThis.Number(object.inputTokens)
4670
- : isSet(object.input_tokens)
4671
- ? globalThis.Number(object.input_tokens)
5252
+ organizationId: isSet(object.organizationId)
5253
+ ? globalThis.String(object.organizationId)
5254
+ : isSet(object.organization_id)
5255
+ ? globalThis.String(object.organization_id)
5256
+ : "",
5257
+ projectId: isSet(object.projectId)
5258
+ ? globalThis.String(object.projectId)
5259
+ : isSet(object.project_id)
5260
+ ? globalThis.String(object.project_id)
5261
+ : "",
5262
+ filter: isSet(object.filter) ? AIGitActivityFilter.fromJSON(object.filter) : undefined,
5263
+ timeWindow: isSet(object.timeWindow)
5264
+ ? analyticsTimeWindowFromJSON(object.timeWindow)
5265
+ : isSet(object.time_window)
5266
+ ? analyticsTimeWindowFromJSON(object.time_window)
4672
5267
  : 0,
4673
- outputTokens: isSet(object.outputTokens)
5268
+ timeInterval: isSet(object.timeInterval)
5269
+ ? analyticsTimeIntervalFromJSON(object.timeInterval)
5270
+ : isSet(object.time_interval)
5271
+ ? analyticsTimeIntervalFromJSON(object.time_interval)
5272
+ : 0,
5273
+ groupBy: isSet(object.groupBy)
5274
+ ? aIGitActivityDimensionFromJSON(object.groupBy)
5275
+ : isSet(object.group_by)
5276
+ ? aIGitActivityDimensionFromJSON(object.group_by)
5277
+ : 0,
5278
+ };
5279
+ },
5280
+
5281
+ toJSON(message: GitActivitySummaryRequest): unknown {
5282
+ const obj: any = {};
5283
+ if (message.organizationId !== "") {
5284
+ obj.organizationId = message.organizationId;
5285
+ }
5286
+ if (message.projectId !== "") {
5287
+ obj.projectId = message.projectId;
5288
+ }
5289
+ if (message.filter !== undefined) {
5290
+ obj.filter = AIGitActivityFilter.toJSON(message.filter);
5291
+ }
5292
+ if (message.timeWindow !== 0) {
5293
+ obj.timeWindow = analyticsTimeWindowToJSON(message.timeWindow);
5294
+ }
5295
+ if (message.timeInterval !== 0) {
5296
+ obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
5297
+ }
5298
+ if (message.groupBy !== 0) {
5299
+ obj.groupBy = aIGitActivityDimensionToJSON(message.groupBy);
5300
+ }
5301
+ return obj;
5302
+ },
5303
+
5304
+ create<I extends Exact<DeepPartial<GitActivitySummaryRequest>, I>>(base?: I): GitActivitySummaryRequest {
5305
+ return GitActivitySummaryRequest.fromPartial(base ?? ({} as any));
5306
+ },
5307
+ fromPartial<I extends Exact<DeepPartial<GitActivitySummaryRequest>, I>>(object: I): GitActivitySummaryRequest {
5308
+ const message = createBaseGitActivitySummaryRequest();
5309
+ message.organizationId = object.organizationId ?? "";
5310
+ message.projectId = object.projectId ?? "";
5311
+ message.filter = (object.filter !== undefined && object.filter !== null)
5312
+ ? AIGitActivityFilter.fromPartial(object.filter)
5313
+ : undefined;
5314
+ message.timeWindow = object.timeWindow ?? 0;
5315
+ message.timeInterval = object.timeInterval ?? 0;
5316
+ message.groupBy = object.groupBy ?? 0;
5317
+ return message;
5318
+ },
5319
+ };
5320
+
5321
+ function createBaseGetGitActivitySummaryResponse(): GetGitActivitySummaryResponse {
5322
+ return { status: undefined, summary: undefined };
5323
+ }
5324
+
5325
+ export const GetGitActivitySummaryResponse: MessageFns<GetGitActivitySummaryResponse> = {
5326
+ encode(message: GetGitActivitySummaryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5327
+ if (message.status !== undefined) {
5328
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
5329
+ }
5330
+ if (message.summary !== undefined) {
5331
+ GitActivitySummary.encode(message.summary, writer.uint32(18).fork()).join();
5332
+ }
5333
+ return writer;
5334
+ },
5335
+
5336
+ decode(input: BinaryReader | Uint8Array, length?: number): GetGitActivitySummaryResponse {
5337
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5338
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5339
+ if (previousRecursionDepth >= 100) {
5340
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5341
+ }
5342
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5343
+ try {
5344
+ const end = length === undefined ? reader.len : reader.pos + length;
5345
+ const message = createBaseGetGitActivitySummaryResponse();
5346
+ while (reader.pos < end) {
5347
+ const tag = reader.uint32();
5348
+ switch (tag >>> 3) {
5349
+ case 1: {
5350
+ if (tag !== 10) {
5351
+ break;
5352
+ }
5353
+
5354
+ message.status = ResponseStatus.decode(reader, reader.uint32());
5355
+ continue;
5356
+ }
5357
+ case 2: {
5358
+ if (tag !== 18) {
5359
+ break;
5360
+ }
5361
+
5362
+ message.summary = GitActivitySummary.decode(reader, reader.uint32());
5363
+ continue;
5364
+ }
5365
+ }
5366
+ if ((tag & 7) === 4 || tag === 0) {
5367
+ break;
5368
+ }
5369
+ reader.skip(tag & 7);
5370
+ }
5371
+ return message;
5372
+ } finally {
5373
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5374
+ }
5375
+ },
5376
+
5377
+ fromJSON(object: any): GetGitActivitySummaryResponse {
5378
+ return {
5379
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
5380
+ summary: isSet(object.summary) ? GitActivitySummary.fromJSON(object.summary) : undefined,
5381
+ };
5382
+ },
5383
+
5384
+ toJSON(message: GetGitActivitySummaryResponse): unknown {
5385
+ const obj: any = {};
5386
+ if (message.status !== undefined) {
5387
+ obj.status = ResponseStatus.toJSON(message.status);
5388
+ }
5389
+ if (message.summary !== undefined) {
5390
+ obj.summary = GitActivitySummary.toJSON(message.summary);
5391
+ }
5392
+ return obj;
5393
+ },
5394
+
5395
+ create<I extends Exact<DeepPartial<GetGitActivitySummaryResponse>, I>>(base?: I): GetGitActivitySummaryResponse {
5396
+ return GetGitActivitySummaryResponse.fromPartial(base ?? ({} as any));
5397
+ },
5398
+ fromPartial<I extends Exact<DeepPartial<GetGitActivitySummaryResponse>, I>>(
5399
+ object: I,
5400
+ ): GetGitActivitySummaryResponse {
5401
+ const message = createBaseGetGitActivitySummaryResponse();
5402
+ message.status = (object.status !== undefined && object.status !== null)
5403
+ ? ResponseStatus.fromPartial(object.status)
5404
+ : undefined;
5405
+ message.summary = (object.summary !== undefined && object.summary !== null)
5406
+ ? GitActivitySummary.fromPartial(object.summary)
5407
+ : undefined;
5408
+ return message;
5409
+ },
5410
+ };
5411
+
5412
+ function createBaseGitActivitySummary(): GitActivitySummary {
5413
+ return { buckets: [], totals: undefined, windowStart: undefined, windowEnd: undefined, groupBy: 0 };
5414
+ }
5415
+
5416
+ export const GitActivitySummary: MessageFns<GitActivitySummary> = {
5417
+ encode(message: GitActivitySummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5418
+ for (const v of message.buckets) {
5419
+ GitActivitySummaryBucket.encode(v!, writer.uint32(10).fork()).join();
5420
+ }
5421
+ if (message.totals !== undefined) {
5422
+ GitActivityMeasures.encode(message.totals, writer.uint32(18).fork()).join();
5423
+ }
5424
+ if (message.windowStart !== undefined) {
5425
+ Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(26).fork()).join();
5426
+ }
5427
+ if (message.windowEnd !== undefined) {
5428
+ Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(34).fork()).join();
5429
+ }
5430
+ if (message.groupBy !== 0) {
5431
+ writer.uint32(40).int32(message.groupBy);
5432
+ }
5433
+ return writer;
5434
+ },
5435
+
5436
+ decode(input: BinaryReader | Uint8Array, length?: number): GitActivitySummary {
5437
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5438
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5439
+ if (previousRecursionDepth >= 100) {
5440
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5441
+ }
5442
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5443
+ try {
5444
+ const end = length === undefined ? reader.len : reader.pos + length;
5445
+ const message = createBaseGitActivitySummary();
5446
+ while (reader.pos < end) {
5447
+ const tag = reader.uint32();
5448
+ switch (tag >>> 3) {
5449
+ case 1: {
5450
+ if (tag !== 10) {
5451
+ break;
5452
+ }
5453
+
5454
+ message.buckets.push(GitActivitySummaryBucket.decode(reader, reader.uint32()));
5455
+ continue;
5456
+ }
5457
+ case 2: {
5458
+ if (tag !== 18) {
5459
+ break;
5460
+ }
5461
+
5462
+ message.totals = GitActivityMeasures.decode(reader, reader.uint32());
5463
+ continue;
5464
+ }
5465
+ case 3: {
5466
+ if (tag !== 26) {
5467
+ break;
5468
+ }
5469
+
5470
+ message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5471
+ continue;
5472
+ }
5473
+ case 4: {
5474
+ if (tag !== 34) {
5475
+ break;
5476
+ }
5477
+
5478
+ message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5479
+ continue;
5480
+ }
5481
+ case 5: {
5482
+ if (tag !== 40) {
5483
+ break;
5484
+ }
5485
+
5486
+ message.groupBy = reader.int32() as any;
5487
+ continue;
5488
+ }
5489
+ }
5490
+ if ((tag & 7) === 4 || tag === 0) {
5491
+ break;
5492
+ }
5493
+ reader.skip(tag & 7);
5494
+ }
5495
+ return message;
5496
+ } finally {
5497
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5498
+ }
5499
+ },
5500
+
5501
+ fromJSON(object: any): GitActivitySummary {
5502
+ return {
5503
+ buckets: globalThis.Array.isArray(object?.buckets)
5504
+ ? object.buckets.map((e: any) => GitActivitySummaryBucket.fromJSON(e))
5505
+ : [],
5506
+ totals: isSet(object.totals) ? GitActivityMeasures.fromJSON(object.totals) : undefined,
5507
+ windowStart: isSet(object.windowStart)
5508
+ ? fromJsonTimestamp(object.windowStart)
5509
+ : isSet(object.window_start)
5510
+ ? fromJsonTimestamp(object.window_start)
5511
+ : undefined,
5512
+ windowEnd: isSet(object.windowEnd)
5513
+ ? fromJsonTimestamp(object.windowEnd)
5514
+ : isSet(object.window_end)
5515
+ ? fromJsonTimestamp(object.window_end)
5516
+ : undefined,
5517
+ groupBy: isSet(object.groupBy)
5518
+ ? aIGitActivityDimensionFromJSON(object.groupBy)
5519
+ : isSet(object.group_by)
5520
+ ? aIGitActivityDimensionFromJSON(object.group_by)
5521
+ : 0,
5522
+ };
5523
+ },
5524
+
5525
+ toJSON(message: GitActivitySummary): unknown {
5526
+ const obj: any = {};
5527
+ if (message.buckets?.length) {
5528
+ obj.buckets = message.buckets.map((e) => GitActivitySummaryBucket.toJSON(e));
5529
+ }
5530
+ if (message.totals !== undefined) {
5531
+ obj.totals = GitActivityMeasures.toJSON(message.totals);
5532
+ }
5533
+ if (message.windowStart !== undefined) {
5534
+ obj.windowStart = message.windowStart.toISOString();
5535
+ }
5536
+ if (message.windowEnd !== undefined) {
5537
+ obj.windowEnd = message.windowEnd.toISOString();
5538
+ }
5539
+ if (message.groupBy !== 0) {
5540
+ obj.groupBy = aIGitActivityDimensionToJSON(message.groupBy);
5541
+ }
5542
+ return obj;
5543
+ },
5544
+
5545
+ create<I extends Exact<DeepPartial<GitActivitySummary>, I>>(base?: I): GitActivitySummary {
5546
+ return GitActivitySummary.fromPartial(base ?? ({} as any));
5547
+ },
5548
+ fromPartial<I extends Exact<DeepPartial<GitActivitySummary>, I>>(object: I): GitActivitySummary {
5549
+ const message = createBaseGitActivitySummary();
5550
+ message.buckets = object.buckets?.map((e) => GitActivitySummaryBucket.fromPartial(e)) || [];
5551
+ message.totals = (object.totals !== undefined && object.totals !== null)
5552
+ ? GitActivityMeasures.fromPartial(object.totals)
5553
+ : undefined;
5554
+ message.windowStart = object.windowStart ?? undefined;
5555
+ message.windowEnd = object.windowEnd ?? undefined;
5556
+ message.groupBy = object.groupBy ?? 0;
5557
+ return message;
5558
+ },
5559
+ };
5560
+
5561
+ function createBaseGitActivitySummaryBucket(): GitActivitySummaryBucket {
5562
+ return { bucketStart: undefined, groups: [] };
5563
+ }
5564
+
5565
+ export const GitActivitySummaryBucket: MessageFns<GitActivitySummaryBucket> = {
5566
+ encode(message: GitActivitySummaryBucket, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5567
+ if (message.bucketStart !== undefined) {
5568
+ Timestamp.encode(toTimestamp(message.bucketStart), writer.uint32(10).fork()).join();
5569
+ }
5570
+ for (const v of message.groups) {
5571
+ GitActivitySummaryGroup.encode(v!, writer.uint32(18).fork()).join();
5572
+ }
5573
+ return writer;
5574
+ },
5575
+
5576
+ decode(input: BinaryReader | Uint8Array, length?: number): GitActivitySummaryBucket {
5577
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5578
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5579
+ if (previousRecursionDepth >= 100) {
5580
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5581
+ }
5582
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5583
+ try {
5584
+ const end = length === undefined ? reader.len : reader.pos + length;
5585
+ const message = createBaseGitActivitySummaryBucket();
5586
+ while (reader.pos < end) {
5587
+ const tag = reader.uint32();
5588
+ switch (tag >>> 3) {
5589
+ case 1: {
5590
+ if (tag !== 10) {
5591
+ break;
5592
+ }
5593
+
5594
+ message.bucketStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5595
+ continue;
5596
+ }
5597
+ case 2: {
5598
+ if (tag !== 18) {
5599
+ break;
5600
+ }
5601
+
5602
+ message.groups.push(GitActivitySummaryGroup.decode(reader, reader.uint32()));
5603
+ continue;
5604
+ }
5605
+ }
5606
+ if ((tag & 7) === 4 || tag === 0) {
5607
+ break;
5608
+ }
5609
+ reader.skip(tag & 7);
5610
+ }
5611
+ return message;
5612
+ } finally {
5613
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5614
+ }
5615
+ },
5616
+
5617
+ fromJSON(object: any): GitActivitySummaryBucket {
5618
+ return {
5619
+ bucketStart: isSet(object.bucketStart)
5620
+ ? fromJsonTimestamp(object.bucketStart)
5621
+ : isSet(object.bucket_start)
5622
+ ? fromJsonTimestamp(object.bucket_start)
5623
+ : undefined,
5624
+ groups: globalThis.Array.isArray(object?.groups)
5625
+ ? object.groups.map((e: any) => GitActivitySummaryGroup.fromJSON(e))
5626
+ : [],
5627
+ };
5628
+ },
5629
+
5630
+ toJSON(message: GitActivitySummaryBucket): unknown {
5631
+ const obj: any = {};
5632
+ if (message.bucketStart !== undefined) {
5633
+ obj.bucketStart = message.bucketStart.toISOString();
5634
+ }
5635
+ if (message.groups?.length) {
5636
+ obj.groups = message.groups.map((e) => GitActivitySummaryGroup.toJSON(e));
5637
+ }
5638
+ return obj;
5639
+ },
5640
+
5641
+ create<I extends Exact<DeepPartial<GitActivitySummaryBucket>, I>>(base?: I): GitActivitySummaryBucket {
5642
+ return GitActivitySummaryBucket.fromPartial(base ?? ({} as any));
5643
+ },
5644
+ fromPartial<I extends Exact<DeepPartial<GitActivitySummaryBucket>, I>>(object: I): GitActivitySummaryBucket {
5645
+ const message = createBaseGitActivitySummaryBucket();
5646
+ message.bucketStart = object.bucketStart ?? undefined;
5647
+ message.groups = object.groups?.map((e) => GitActivitySummaryGroup.fromPartial(e)) || [];
5648
+ return message;
5649
+ },
5650
+ };
5651
+
5652
+ function createBaseGitActivitySummaryGroup(): GitActivitySummaryGroup {
5653
+ return { key: "", measures: undefined };
5654
+ }
5655
+
5656
+ export const GitActivitySummaryGroup: MessageFns<GitActivitySummaryGroup> = {
5657
+ encode(message: GitActivitySummaryGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5658
+ if (message.key !== "") {
5659
+ writer.uint32(10).string(message.key);
5660
+ }
5661
+ if (message.measures !== undefined) {
5662
+ GitActivityMeasures.encode(message.measures, writer.uint32(18).fork()).join();
5663
+ }
5664
+ return writer;
5665
+ },
5666
+
5667
+ decode(input: BinaryReader | Uint8Array, length?: number): GitActivitySummaryGroup {
5668
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5669
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5670
+ if (previousRecursionDepth >= 100) {
5671
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5672
+ }
5673
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5674
+ try {
5675
+ const end = length === undefined ? reader.len : reader.pos + length;
5676
+ const message = createBaseGitActivitySummaryGroup();
5677
+ while (reader.pos < end) {
5678
+ const tag = reader.uint32();
5679
+ switch (tag >>> 3) {
5680
+ case 1: {
5681
+ if (tag !== 10) {
5682
+ break;
5683
+ }
5684
+
5685
+ message.key = reader.string();
5686
+ continue;
5687
+ }
5688
+ case 2: {
5689
+ if (tag !== 18) {
5690
+ break;
5691
+ }
5692
+
5693
+ message.measures = GitActivityMeasures.decode(reader, reader.uint32());
5694
+ continue;
5695
+ }
5696
+ }
5697
+ if ((tag & 7) === 4 || tag === 0) {
5698
+ break;
5699
+ }
5700
+ reader.skip(tag & 7);
5701
+ }
5702
+ return message;
5703
+ } finally {
5704
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5705
+ }
5706
+ },
5707
+
5708
+ fromJSON(object: any): GitActivitySummaryGroup {
5709
+ return {
5710
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
5711
+ measures: isSet(object.measures) ? GitActivityMeasures.fromJSON(object.measures) : undefined,
5712
+ };
5713
+ },
5714
+
5715
+ toJSON(message: GitActivitySummaryGroup): unknown {
5716
+ const obj: any = {};
5717
+ if (message.key !== "") {
5718
+ obj.key = message.key;
5719
+ }
5720
+ if (message.measures !== undefined) {
5721
+ obj.measures = GitActivityMeasures.toJSON(message.measures);
5722
+ }
5723
+ return obj;
5724
+ },
5725
+
5726
+ create<I extends Exact<DeepPartial<GitActivitySummaryGroup>, I>>(base?: I): GitActivitySummaryGroup {
5727
+ return GitActivitySummaryGroup.fromPartial(base ?? ({} as any));
5728
+ },
5729
+ fromPartial<I extends Exact<DeepPartial<GitActivitySummaryGroup>, I>>(object: I): GitActivitySummaryGroup {
5730
+ const message = createBaseGitActivitySummaryGroup();
5731
+ message.key = object.key ?? "";
5732
+ message.measures = (object.measures !== undefined && object.measures !== null)
5733
+ ? GitActivityMeasures.fromPartial(object.measures)
5734
+ : undefined;
5735
+ return message;
5736
+ },
5737
+ };
5738
+
5739
+ function createBaseGitActivityMeasures(): GitActivityMeasures {
5740
+ return {
5741
+ total: 0,
5742
+ branchesCreated: 0,
5743
+ commits: 0,
5744
+ pushes: 0,
5745
+ pullRequestsCreated: 0,
5746
+ pullRequestsMerged: 0,
5747
+ filesChanged: 0,
5748
+ insertions: 0,
5749
+ deletions: 0,
5750
+ distinctRepositories: 0,
5751
+ distinctSessions: 0,
5752
+ };
5753
+ }
5754
+
5755
+ export const GitActivityMeasures: MessageFns<GitActivityMeasures> = {
5756
+ encode(message: GitActivityMeasures, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5757
+ if (message.total !== 0) {
5758
+ writer.uint32(8).uint64(message.total);
5759
+ }
5760
+ if (message.branchesCreated !== 0) {
5761
+ writer.uint32(16).uint64(message.branchesCreated);
5762
+ }
5763
+ if (message.commits !== 0) {
5764
+ writer.uint32(24).uint64(message.commits);
5765
+ }
5766
+ if (message.pushes !== 0) {
5767
+ writer.uint32(32).uint64(message.pushes);
5768
+ }
5769
+ if (message.pullRequestsCreated !== 0) {
5770
+ writer.uint32(40).uint64(message.pullRequestsCreated);
5771
+ }
5772
+ if (message.pullRequestsMerged !== 0) {
5773
+ writer.uint32(48).uint64(message.pullRequestsMerged);
5774
+ }
5775
+ if (message.filesChanged !== 0) {
5776
+ writer.uint32(56).uint64(message.filesChanged);
5777
+ }
5778
+ if (message.insertions !== 0) {
5779
+ writer.uint32(64).uint64(message.insertions);
5780
+ }
5781
+ if (message.deletions !== 0) {
5782
+ writer.uint32(72).uint64(message.deletions);
5783
+ }
5784
+ if (message.distinctRepositories !== 0) {
5785
+ writer.uint32(80).uint64(message.distinctRepositories);
5786
+ }
5787
+ if (message.distinctSessions !== 0) {
5788
+ writer.uint32(88).uint64(message.distinctSessions);
5789
+ }
5790
+ return writer;
5791
+ },
5792
+
5793
+ decode(input: BinaryReader | Uint8Array, length?: number): GitActivityMeasures {
5794
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5795
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5796
+ if (previousRecursionDepth >= 100) {
5797
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5798
+ }
5799
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5800
+ try {
5801
+ const end = length === undefined ? reader.len : reader.pos + length;
5802
+ const message = createBaseGitActivityMeasures();
5803
+ while (reader.pos < end) {
5804
+ const tag = reader.uint32();
5805
+ switch (tag >>> 3) {
5806
+ case 1: {
5807
+ if (tag !== 8) {
5808
+ break;
5809
+ }
5810
+
5811
+ message.total = longToNumber(reader.uint64());
5812
+ continue;
5813
+ }
5814
+ case 2: {
5815
+ if (tag !== 16) {
5816
+ break;
5817
+ }
5818
+
5819
+ message.branchesCreated = longToNumber(reader.uint64());
5820
+ continue;
5821
+ }
5822
+ case 3: {
5823
+ if (tag !== 24) {
5824
+ break;
5825
+ }
5826
+
5827
+ message.commits = longToNumber(reader.uint64());
5828
+ continue;
5829
+ }
5830
+ case 4: {
5831
+ if (tag !== 32) {
5832
+ break;
5833
+ }
5834
+
5835
+ message.pushes = longToNumber(reader.uint64());
5836
+ continue;
5837
+ }
5838
+ case 5: {
5839
+ if (tag !== 40) {
5840
+ break;
5841
+ }
5842
+
5843
+ message.pullRequestsCreated = longToNumber(reader.uint64());
5844
+ continue;
5845
+ }
5846
+ case 6: {
5847
+ if (tag !== 48) {
5848
+ break;
5849
+ }
5850
+
5851
+ message.pullRequestsMerged = longToNumber(reader.uint64());
5852
+ continue;
5853
+ }
5854
+ case 7: {
5855
+ if (tag !== 56) {
5856
+ break;
5857
+ }
5858
+
5859
+ message.filesChanged = longToNumber(reader.uint64());
5860
+ continue;
5861
+ }
5862
+ case 8: {
5863
+ if (tag !== 64) {
5864
+ break;
5865
+ }
5866
+
5867
+ message.insertions = longToNumber(reader.uint64());
5868
+ continue;
5869
+ }
5870
+ case 9: {
5871
+ if (tag !== 72) {
5872
+ break;
5873
+ }
5874
+
5875
+ message.deletions = longToNumber(reader.uint64());
5876
+ continue;
5877
+ }
5878
+ case 10: {
5879
+ if (tag !== 80) {
5880
+ break;
5881
+ }
5882
+
5883
+ message.distinctRepositories = longToNumber(reader.uint64());
5884
+ continue;
5885
+ }
5886
+ case 11: {
5887
+ if (tag !== 88) {
5888
+ break;
5889
+ }
5890
+
5891
+ message.distinctSessions = longToNumber(reader.uint64());
5892
+ continue;
5893
+ }
5894
+ }
5895
+ if ((tag & 7) === 4 || tag === 0) {
5896
+ break;
5897
+ }
5898
+ reader.skip(tag & 7);
5899
+ }
5900
+ return message;
5901
+ } finally {
5902
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5903
+ }
5904
+ },
5905
+
5906
+ fromJSON(object: any): GitActivityMeasures {
5907
+ return {
5908
+ total: isSet(object.total) ? globalThis.Number(object.total) : 0,
5909
+ branchesCreated: isSet(object.branchesCreated)
5910
+ ? globalThis.Number(object.branchesCreated)
5911
+ : isSet(object.branches_created)
5912
+ ? globalThis.Number(object.branches_created)
5913
+ : 0,
5914
+ commits: isSet(object.commits) ? globalThis.Number(object.commits) : 0,
5915
+ pushes: isSet(object.pushes) ? globalThis.Number(object.pushes) : 0,
5916
+ pullRequestsCreated: isSet(object.pullRequestsCreated)
5917
+ ? globalThis.Number(object.pullRequestsCreated)
5918
+ : isSet(object.pull_requests_created)
5919
+ ? globalThis.Number(object.pull_requests_created)
5920
+ : 0,
5921
+ pullRequestsMerged: isSet(object.pullRequestsMerged)
5922
+ ? globalThis.Number(object.pullRequestsMerged)
5923
+ : isSet(object.pull_requests_merged)
5924
+ ? globalThis.Number(object.pull_requests_merged)
5925
+ : 0,
5926
+ filesChanged: isSet(object.filesChanged)
5927
+ ? globalThis.Number(object.filesChanged)
5928
+ : isSet(object.files_changed)
5929
+ ? globalThis.Number(object.files_changed)
5930
+ : 0,
5931
+ insertions: isSet(object.insertions) ? globalThis.Number(object.insertions) : 0,
5932
+ deletions: isSet(object.deletions) ? globalThis.Number(object.deletions) : 0,
5933
+ distinctRepositories: isSet(object.distinctRepositories)
5934
+ ? globalThis.Number(object.distinctRepositories)
5935
+ : isSet(object.distinct_repositories)
5936
+ ? globalThis.Number(object.distinct_repositories)
5937
+ : 0,
5938
+ distinctSessions: isSet(object.distinctSessions)
5939
+ ? globalThis.Number(object.distinctSessions)
5940
+ : isSet(object.distinct_sessions)
5941
+ ? globalThis.Number(object.distinct_sessions)
5942
+ : 0,
5943
+ };
5944
+ },
5945
+
5946
+ toJSON(message: GitActivityMeasures): unknown {
5947
+ const obj: any = {};
5948
+ if (message.total !== 0) {
5949
+ obj.total = Math.round(message.total);
5950
+ }
5951
+ if (message.branchesCreated !== 0) {
5952
+ obj.branchesCreated = Math.round(message.branchesCreated);
5953
+ }
5954
+ if (message.commits !== 0) {
5955
+ obj.commits = Math.round(message.commits);
5956
+ }
5957
+ if (message.pushes !== 0) {
5958
+ obj.pushes = Math.round(message.pushes);
5959
+ }
5960
+ if (message.pullRequestsCreated !== 0) {
5961
+ obj.pullRequestsCreated = Math.round(message.pullRequestsCreated);
5962
+ }
5963
+ if (message.pullRequestsMerged !== 0) {
5964
+ obj.pullRequestsMerged = Math.round(message.pullRequestsMerged);
5965
+ }
5966
+ if (message.filesChanged !== 0) {
5967
+ obj.filesChanged = Math.round(message.filesChanged);
5968
+ }
5969
+ if (message.insertions !== 0) {
5970
+ obj.insertions = Math.round(message.insertions);
5971
+ }
5972
+ if (message.deletions !== 0) {
5973
+ obj.deletions = Math.round(message.deletions);
5974
+ }
5975
+ if (message.distinctRepositories !== 0) {
5976
+ obj.distinctRepositories = Math.round(message.distinctRepositories);
5977
+ }
5978
+ if (message.distinctSessions !== 0) {
5979
+ obj.distinctSessions = Math.round(message.distinctSessions);
5980
+ }
5981
+ return obj;
5982
+ },
5983
+
5984
+ create<I extends Exact<DeepPartial<GitActivityMeasures>, I>>(base?: I): GitActivityMeasures {
5985
+ return GitActivityMeasures.fromPartial(base ?? ({} as any));
5986
+ },
5987
+ fromPartial<I extends Exact<DeepPartial<GitActivityMeasures>, I>>(object: I): GitActivityMeasures {
5988
+ const message = createBaseGitActivityMeasures();
5989
+ message.total = object.total ?? 0;
5990
+ message.branchesCreated = object.branchesCreated ?? 0;
5991
+ message.commits = object.commits ?? 0;
5992
+ message.pushes = object.pushes ?? 0;
5993
+ message.pullRequestsCreated = object.pullRequestsCreated ?? 0;
5994
+ message.pullRequestsMerged = object.pullRequestsMerged ?? 0;
5995
+ message.filesChanged = object.filesChanged ?? 0;
5996
+ message.insertions = object.insertions ?? 0;
5997
+ message.deletions = object.deletions ?? 0;
5998
+ message.distinctRepositories = object.distinctRepositories ?? 0;
5999
+ message.distinctSessions = object.distinctSessions ?? 0;
6000
+ return message;
6001
+ },
6002
+ };
6003
+
6004
+ function createBaseAIFileStateFilter(): AIFileStateFilter {
6005
+ return {
6006
+ repositoryKey: [],
6007
+ ref: [],
6008
+ state: [],
6009
+ tier: [],
6010
+ sessionId: [],
6011
+ minAge: undefined,
6012
+ activeAfter: undefined,
6013
+ activeBefore: undefined,
6014
+ abandonedHorizon: undefined,
6015
+ };
6016
+ }
6017
+
6018
+ export const AIFileStateFilter: MessageFns<AIFileStateFilter> = {
6019
+ encode(message: AIFileStateFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6020
+ for (const v of message.repositoryKey) {
6021
+ writer.uint32(10).string(v!);
6022
+ }
6023
+ for (const v of message.ref) {
6024
+ writer.uint32(18).string(v!);
6025
+ }
6026
+ writer.uint32(26).fork();
6027
+ for (const v of message.state) {
6028
+ writer.int32(v);
6029
+ }
6030
+ writer.join();
6031
+ writer.uint32(34).fork();
6032
+ for (const v of message.tier) {
6033
+ writer.int32(v);
6034
+ }
6035
+ writer.join();
6036
+ for (const v of message.sessionId) {
6037
+ writer.uint32(42).string(v!);
6038
+ }
6039
+ if (message.minAge !== undefined) {
6040
+ Duration.encode(message.minAge, writer.uint32(50).fork()).join();
6041
+ }
6042
+ if (message.activeAfter !== undefined) {
6043
+ Timestamp.encode(toTimestamp(message.activeAfter), writer.uint32(58).fork()).join();
6044
+ }
6045
+ if (message.activeBefore !== undefined) {
6046
+ Timestamp.encode(toTimestamp(message.activeBefore), writer.uint32(66).fork()).join();
6047
+ }
6048
+ if (message.abandonedHorizon !== undefined) {
6049
+ Duration.encode(message.abandonedHorizon, writer.uint32(74).fork()).join();
6050
+ }
6051
+ return writer;
6052
+ },
6053
+
6054
+ decode(input: BinaryReader | Uint8Array, length?: number): AIFileStateFilter {
6055
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6056
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6057
+ if (previousRecursionDepth >= 100) {
6058
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6059
+ }
6060
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6061
+ try {
6062
+ const end = length === undefined ? reader.len : reader.pos + length;
6063
+ const message = createBaseAIFileStateFilter();
6064
+ while (reader.pos < end) {
6065
+ const tag = reader.uint32();
6066
+ switch (tag >>> 3) {
6067
+ case 1: {
6068
+ if (tag !== 10) {
6069
+ break;
6070
+ }
6071
+
6072
+ message.repositoryKey.push(reader.string());
6073
+ continue;
6074
+ }
6075
+ case 2: {
6076
+ if (tag !== 18) {
6077
+ break;
6078
+ }
6079
+
6080
+ message.ref.push(reader.string());
6081
+ continue;
6082
+ }
6083
+ case 3: {
6084
+ if (tag === 24) {
6085
+ message.state.push(reader.int32() as any);
6086
+
6087
+ continue;
6088
+ }
6089
+
6090
+ if (tag === 26) {
6091
+ const end2 = reader.uint32() + reader.pos;
6092
+ while (reader.pos < end2) {
6093
+ message.state.push(reader.int32() as any);
6094
+ }
6095
+
6096
+ continue;
6097
+ }
6098
+
6099
+ break;
6100
+ }
6101
+ case 4: {
6102
+ if (tag === 32) {
6103
+ message.tier.push(reader.int32() as any);
6104
+
6105
+ continue;
6106
+ }
6107
+
6108
+ if (tag === 34) {
6109
+ const end2 = reader.uint32() + reader.pos;
6110
+ while (reader.pos < end2) {
6111
+ message.tier.push(reader.int32() as any);
6112
+ }
6113
+
6114
+ continue;
6115
+ }
6116
+
6117
+ break;
6118
+ }
6119
+ case 5: {
6120
+ if (tag !== 42) {
6121
+ break;
6122
+ }
6123
+
6124
+ message.sessionId.push(reader.string());
6125
+ continue;
6126
+ }
6127
+ case 6: {
6128
+ if (tag !== 50) {
6129
+ break;
6130
+ }
6131
+
6132
+ message.minAge = Duration.decode(reader, reader.uint32());
6133
+ continue;
6134
+ }
6135
+ case 7: {
6136
+ if (tag !== 58) {
6137
+ break;
6138
+ }
6139
+
6140
+ message.activeAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6141
+ continue;
6142
+ }
6143
+ case 8: {
6144
+ if (tag !== 66) {
6145
+ break;
6146
+ }
6147
+
6148
+ message.activeBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6149
+ continue;
6150
+ }
6151
+ case 9: {
6152
+ if (tag !== 74) {
6153
+ break;
6154
+ }
6155
+
6156
+ message.abandonedHorizon = Duration.decode(reader, reader.uint32());
6157
+ continue;
6158
+ }
6159
+ }
6160
+ if ((tag & 7) === 4 || tag === 0) {
6161
+ break;
6162
+ }
6163
+ reader.skip(tag & 7);
6164
+ }
6165
+ return message;
6166
+ } finally {
6167
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6168
+ }
6169
+ },
6170
+
6171
+ fromJSON(object: any): AIFileStateFilter {
6172
+ return {
6173
+ repositoryKey: globalThis.Array.isArray(object?.repositoryKey)
6174
+ ? object.repositoryKey.map((e: any) => globalThis.String(e))
6175
+ : globalThis.Array.isArray(object?.repository_key)
6176
+ ? object.repository_key.map((e: any) => globalThis.String(e))
6177
+ : [],
6178
+ ref: globalThis.Array.isArray(object?.ref) ? object.ref.map((e: any) => globalThis.String(e)) : [],
6179
+ state: globalThis.Array.isArray(object?.state) ? object.state.map((e: any) => aIFileLifecycleFromJSON(e)) : [],
6180
+ tier: globalThis.Array.isArray(object?.tier) ? object.tier.map((e: any) => aIFileTierFromJSON(e)) : [],
6181
+ sessionId: globalThis.Array.isArray(object?.sessionId)
6182
+ ? object.sessionId.map((e: any) => globalThis.String(e))
6183
+ : globalThis.Array.isArray(object?.session_id)
6184
+ ? object.session_id.map((e: any) => globalThis.String(e))
6185
+ : [],
6186
+ minAge: isSet(object.minAge)
6187
+ ? Duration.fromJSON(object.minAge)
6188
+ : isSet(object.min_age)
6189
+ ? Duration.fromJSON(object.min_age)
6190
+ : undefined,
6191
+ activeAfter: isSet(object.activeAfter)
6192
+ ? fromJsonTimestamp(object.activeAfter)
6193
+ : isSet(object.active_after)
6194
+ ? fromJsonTimestamp(object.active_after)
6195
+ : undefined,
6196
+ activeBefore: isSet(object.activeBefore)
6197
+ ? fromJsonTimestamp(object.activeBefore)
6198
+ : isSet(object.active_before)
6199
+ ? fromJsonTimestamp(object.active_before)
6200
+ : undefined,
6201
+ abandonedHorizon: isSet(object.abandonedHorizon)
6202
+ ? Duration.fromJSON(object.abandonedHorizon)
6203
+ : isSet(object.abandoned_horizon)
6204
+ ? Duration.fromJSON(object.abandoned_horizon)
6205
+ : undefined,
6206
+ };
6207
+ },
6208
+
6209
+ toJSON(message: AIFileStateFilter): unknown {
6210
+ const obj: any = {};
6211
+ if (message.repositoryKey?.length) {
6212
+ obj.repositoryKey = message.repositoryKey;
6213
+ }
6214
+ if (message.ref?.length) {
6215
+ obj.ref = message.ref;
6216
+ }
6217
+ if (message.state?.length) {
6218
+ obj.state = message.state.map((e) => aIFileLifecycleToJSON(e));
6219
+ }
6220
+ if (message.tier?.length) {
6221
+ obj.tier = message.tier.map((e) => aIFileTierToJSON(e));
6222
+ }
6223
+ if (message.sessionId?.length) {
6224
+ obj.sessionId = message.sessionId;
6225
+ }
6226
+ if (message.minAge !== undefined) {
6227
+ obj.minAge = Duration.toJSON(message.minAge);
6228
+ }
6229
+ if (message.activeAfter !== undefined) {
6230
+ obj.activeAfter = message.activeAfter.toISOString();
6231
+ }
6232
+ if (message.activeBefore !== undefined) {
6233
+ obj.activeBefore = message.activeBefore.toISOString();
6234
+ }
6235
+ if (message.abandonedHorizon !== undefined) {
6236
+ obj.abandonedHorizon = Duration.toJSON(message.abandonedHorizon);
6237
+ }
6238
+ return obj;
6239
+ },
6240
+
6241
+ create<I extends Exact<DeepPartial<AIFileStateFilter>, I>>(base?: I): AIFileStateFilter {
6242
+ return AIFileStateFilter.fromPartial(base ?? ({} as any));
6243
+ },
6244
+ fromPartial<I extends Exact<DeepPartial<AIFileStateFilter>, I>>(object: I): AIFileStateFilter {
6245
+ const message = createBaseAIFileStateFilter();
6246
+ message.repositoryKey = object.repositoryKey?.map((e) => e) || [];
6247
+ message.ref = object.ref?.map((e) => e) || [];
6248
+ message.state = object.state?.map((e) => e) || [];
6249
+ message.tier = object.tier?.map((e) => e) || [];
6250
+ message.sessionId = object.sessionId?.map((e) => e) || [];
6251
+ message.minAge = (object.minAge !== undefined && object.minAge !== null)
6252
+ ? Duration.fromPartial(object.minAge)
6253
+ : undefined;
6254
+ message.activeAfter = object.activeAfter ?? undefined;
6255
+ message.activeBefore = object.activeBefore ?? undefined;
6256
+ message.abandonedHorizon = (object.abandonedHorizon !== undefined && object.abandonedHorizon !== null)
6257
+ ? Duration.fromPartial(object.abandonedHorizon)
6258
+ : undefined;
6259
+ return message;
6260
+ },
6261
+ };
6262
+
6263
+ function createBaseListFileStatesRequest(): ListFileStatesRequest {
6264
+ return { organizationId: "", projectId: "", filter: undefined, pageSize: 0, pageToken: "" };
6265
+ }
6266
+
6267
+ export const ListFileStatesRequest: MessageFns<ListFileStatesRequest> = {
6268
+ encode(message: ListFileStatesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6269
+ if (message.organizationId !== "") {
6270
+ writer.uint32(10).string(message.organizationId);
6271
+ }
6272
+ if (message.projectId !== "") {
6273
+ writer.uint32(18).string(message.projectId);
6274
+ }
6275
+ if (message.filter !== undefined) {
6276
+ AIFileStateFilter.encode(message.filter, writer.uint32(26).fork()).join();
6277
+ }
6278
+ if (message.pageSize !== 0) {
6279
+ writer.uint32(32).int32(message.pageSize);
6280
+ }
6281
+ if (message.pageToken !== "") {
6282
+ writer.uint32(42).string(message.pageToken);
6283
+ }
6284
+ return writer;
6285
+ },
6286
+
6287
+ decode(input: BinaryReader | Uint8Array, length?: number): ListFileStatesRequest {
6288
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6289
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6290
+ if (previousRecursionDepth >= 100) {
6291
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6292
+ }
6293
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6294
+ try {
6295
+ const end = length === undefined ? reader.len : reader.pos + length;
6296
+ const message = createBaseListFileStatesRequest();
6297
+ while (reader.pos < end) {
6298
+ const tag = reader.uint32();
6299
+ switch (tag >>> 3) {
6300
+ case 1: {
6301
+ if (tag !== 10) {
6302
+ break;
6303
+ }
6304
+
6305
+ message.organizationId = reader.string();
6306
+ continue;
6307
+ }
6308
+ case 2: {
6309
+ if (tag !== 18) {
6310
+ break;
6311
+ }
6312
+
6313
+ message.projectId = reader.string();
6314
+ continue;
6315
+ }
6316
+ case 3: {
6317
+ if (tag !== 26) {
6318
+ break;
6319
+ }
6320
+
6321
+ message.filter = AIFileStateFilter.decode(reader, reader.uint32());
6322
+ continue;
6323
+ }
6324
+ case 4: {
6325
+ if (tag !== 32) {
6326
+ break;
6327
+ }
6328
+
6329
+ message.pageSize = reader.int32();
6330
+ continue;
6331
+ }
6332
+ case 5: {
6333
+ if (tag !== 42) {
6334
+ break;
6335
+ }
6336
+
6337
+ message.pageToken = reader.string();
6338
+ continue;
6339
+ }
6340
+ }
6341
+ if ((tag & 7) === 4 || tag === 0) {
6342
+ break;
6343
+ }
6344
+ reader.skip(tag & 7);
6345
+ }
6346
+ return message;
6347
+ } finally {
6348
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6349
+ }
6350
+ },
6351
+
6352
+ fromJSON(object: any): ListFileStatesRequest {
6353
+ return {
6354
+ organizationId: isSet(object.organizationId)
6355
+ ? globalThis.String(object.organizationId)
6356
+ : isSet(object.organization_id)
6357
+ ? globalThis.String(object.organization_id)
6358
+ : "",
6359
+ projectId: isSet(object.projectId)
6360
+ ? globalThis.String(object.projectId)
6361
+ : isSet(object.project_id)
6362
+ ? globalThis.String(object.project_id)
6363
+ : "",
6364
+ filter: isSet(object.filter) ? AIFileStateFilter.fromJSON(object.filter) : undefined,
6365
+ pageSize: isSet(object.pageSize)
6366
+ ? globalThis.Number(object.pageSize)
6367
+ : isSet(object.page_size)
6368
+ ? globalThis.Number(object.page_size)
6369
+ : 0,
6370
+ pageToken: isSet(object.pageToken)
6371
+ ? globalThis.String(object.pageToken)
6372
+ : isSet(object.page_token)
6373
+ ? globalThis.String(object.page_token)
6374
+ : "",
6375
+ };
6376
+ },
6377
+
6378
+ toJSON(message: ListFileStatesRequest): unknown {
6379
+ const obj: any = {};
6380
+ if (message.organizationId !== "") {
6381
+ obj.organizationId = message.organizationId;
6382
+ }
6383
+ if (message.projectId !== "") {
6384
+ obj.projectId = message.projectId;
6385
+ }
6386
+ if (message.filter !== undefined) {
6387
+ obj.filter = AIFileStateFilter.toJSON(message.filter);
6388
+ }
6389
+ if (message.pageSize !== 0) {
6390
+ obj.pageSize = Math.round(message.pageSize);
6391
+ }
6392
+ if (message.pageToken !== "") {
6393
+ obj.pageToken = message.pageToken;
6394
+ }
6395
+ return obj;
6396
+ },
6397
+
6398
+ create<I extends Exact<DeepPartial<ListFileStatesRequest>, I>>(base?: I): ListFileStatesRequest {
6399
+ return ListFileStatesRequest.fromPartial(base ?? ({} as any));
6400
+ },
6401
+ fromPartial<I extends Exact<DeepPartial<ListFileStatesRequest>, I>>(object: I): ListFileStatesRequest {
6402
+ const message = createBaseListFileStatesRequest();
6403
+ message.organizationId = object.organizationId ?? "";
6404
+ message.projectId = object.projectId ?? "";
6405
+ message.filter = (object.filter !== undefined && object.filter !== null)
6406
+ ? AIFileStateFilter.fromPartial(object.filter)
6407
+ : undefined;
6408
+ message.pageSize = object.pageSize ?? 0;
6409
+ message.pageToken = object.pageToken ?? "";
6410
+ return message;
6411
+ },
6412
+ };
6413
+
6414
+ function createBaseListFileStatesResponse(): ListFileStatesResponse {
6415
+ return { status: undefined, files: [], nextPageToken: "" };
6416
+ }
6417
+
6418
+ export const ListFileStatesResponse: MessageFns<ListFileStatesResponse> = {
6419
+ encode(message: ListFileStatesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6420
+ if (message.status !== undefined) {
6421
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
6422
+ }
6423
+ for (const v of message.files) {
6424
+ AIFileStateRow.encode(v!, writer.uint32(18).fork()).join();
6425
+ }
6426
+ if (message.nextPageToken !== "") {
6427
+ writer.uint32(26).string(message.nextPageToken);
6428
+ }
6429
+ return writer;
6430
+ },
6431
+
6432
+ decode(input: BinaryReader | Uint8Array, length?: number): ListFileStatesResponse {
6433
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6434
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6435
+ if (previousRecursionDepth >= 100) {
6436
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6437
+ }
6438
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6439
+ try {
6440
+ const end = length === undefined ? reader.len : reader.pos + length;
6441
+ const message = createBaseListFileStatesResponse();
6442
+ while (reader.pos < end) {
6443
+ const tag = reader.uint32();
6444
+ switch (tag >>> 3) {
6445
+ case 1: {
6446
+ if (tag !== 10) {
6447
+ break;
6448
+ }
6449
+
6450
+ message.status = ResponseStatus.decode(reader, reader.uint32());
6451
+ continue;
6452
+ }
6453
+ case 2: {
6454
+ if (tag !== 18) {
6455
+ break;
6456
+ }
6457
+
6458
+ message.files.push(AIFileStateRow.decode(reader, reader.uint32()));
6459
+ continue;
6460
+ }
6461
+ case 3: {
6462
+ if (tag !== 26) {
6463
+ break;
6464
+ }
6465
+
6466
+ message.nextPageToken = reader.string();
6467
+ continue;
6468
+ }
6469
+ }
6470
+ if ((tag & 7) === 4 || tag === 0) {
6471
+ break;
6472
+ }
6473
+ reader.skip(tag & 7);
6474
+ }
6475
+ return message;
6476
+ } finally {
6477
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6478
+ }
6479
+ },
6480
+
6481
+ fromJSON(object: any): ListFileStatesResponse {
6482
+ return {
6483
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
6484
+ files: globalThis.Array.isArray(object?.files) ? object.files.map((e: any) => AIFileStateRow.fromJSON(e)) : [],
6485
+ nextPageToken: isSet(object.nextPageToken)
6486
+ ? globalThis.String(object.nextPageToken)
6487
+ : isSet(object.next_page_token)
6488
+ ? globalThis.String(object.next_page_token)
6489
+ : "",
6490
+ };
6491
+ },
6492
+
6493
+ toJSON(message: ListFileStatesResponse): unknown {
6494
+ const obj: any = {};
6495
+ if (message.status !== undefined) {
6496
+ obj.status = ResponseStatus.toJSON(message.status);
6497
+ }
6498
+ if (message.files?.length) {
6499
+ obj.files = message.files.map((e) => AIFileStateRow.toJSON(e));
6500
+ }
6501
+ if (message.nextPageToken !== "") {
6502
+ obj.nextPageToken = message.nextPageToken;
6503
+ }
6504
+ return obj;
6505
+ },
6506
+
6507
+ create<I extends Exact<DeepPartial<ListFileStatesResponse>, I>>(base?: I): ListFileStatesResponse {
6508
+ return ListFileStatesResponse.fromPartial(base ?? ({} as any));
6509
+ },
6510
+ fromPartial<I extends Exact<DeepPartial<ListFileStatesResponse>, I>>(object: I): ListFileStatesResponse {
6511
+ const message = createBaseListFileStatesResponse();
6512
+ message.status = (object.status !== undefined && object.status !== null)
6513
+ ? ResponseStatus.fromPartial(object.status)
6514
+ : undefined;
6515
+ message.files = object.files?.map((e) => AIFileStateRow.fromPartial(e)) || [];
6516
+ message.nextPageToken = object.nextPageToken ?? "";
6517
+ return message;
6518
+ },
6519
+ };
6520
+
6521
+ function createBaseAIFileStateRow(): AIFileStateRow {
6522
+ return {
6523
+ repositoryKey: "",
6524
+ ref: "",
6525
+ path: "",
6526
+ oldPath: "",
6527
+ state: 0,
6528
+ tier: 0,
6529
+ confidence: 0,
6530
+ firstEditedAt: undefined,
6531
+ lastEditedAt: undefined,
6532
+ lastStagedAt: undefined,
6533
+ lastCommittedAt: undefined,
6534
+ lastCommitSha: "",
6535
+ lastPushedAt: undefined,
6536
+ discardedAt: undefined,
6537
+ discardReason: "",
6538
+ editCount: 0,
6539
+ sessionId: [],
6540
+ unlandedCostUsd: 0,
6541
+ unlandedOutputTokens: 0,
6542
+ };
6543
+ }
6544
+
6545
+ export const AIFileStateRow: MessageFns<AIFileStateRow> = {
6546
+ encode(message: AIFileStateRow, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6547
+ if (message.repositoryKey !== "") {
6548
+ writer.uint32(10).string(message.repositoryKey);
6549
+ }
6550
+ if (message.ref !== "") {
6551
+ writer.uint32(18).string(message.ref);
6552
+ }
6553
+ if (message.path !== "") {
6554
+ writer.uint32(26).string(message.path);
6555
+ }
6556
+ if (message.oldPath !== "") {
6557
+ writer.uint32(34).string(message.oldPath);
6558
+ }
6559
+ if (message.state !== 0) {
6560
+ writer.uint32(40).int32(message.state);
6561
+ }
6562
+ if (message.tier !== 0) {
6563
+ writer.uint32(48).int32(message.tier);
6564
+ }
6565
+ if (message.confidence !== 0) {
6566
+ writer.uint32(56).int32(message.confidence);
6567
+ }
6568
+ if (message.firstEditedAt !== undefined) {
6569
+ Timestamp.encode(toTimestamp(message.firstEditedAt), writer.uint32(66).fork()).join();
6570
+ }
6571
+ if (message.lastEditedAt !== undefined) {
6572
+ Timestamp.encode(toTimestamp(message.lastEditedAt), writer.uint32(74).fork()).join();
6573
+ }
6574
+ if (message.lastStagedAt !== undefined) {
6575
+ Timestamp.encode(toTimestamp(message.lastStagedAt), writer.uint32(82).fork()).join();
6576
+ }
6577
+ if (message.lastCommittedAt !== undefined) {
6578
+ Timestamp.encode(toTimestamp(message.lastCommittedAt), writer.uint32(90).fork()).join();
6579
+ }
6580
+ if (message.lastCommitSha !== "") {
6581
+ writer.uint32(98).string(message.lastCommitSha);
6582
+ }
6583
+ if (message.lastPushedAt !== undefined) {
6584
+ Timestamp.encode(toTimestamp(message.lastPushedAt), writer.uint32(106).fork()).join();
6585
+ }
6586
+ if (message.discardedAt !== undefined) {
6587
+ Timestamp.encode(toTimestamp(message.discardedAt), writer.uint32(114).fork()).join();
6588
+ }
6589
+ if (message.discardReason !== "") {
6590
+ writer.uint32(122).string(message.discardReason);
6591
+ }
6592
+ if (message.editCount !== 0) {
6593
+ writer.uint32(128).uint32(message.editCount);
6594
+ }
6595
+ for (const v of message.sessionId) {
6596
+ writer.uint32(138).string(v!);
6597
+ }
6598
+ if (message.unlandedCostUsd !== 0) {
6599
+ writer.uint32(145).double(message.unlandedCostUsd);
6600
+ }
6601
+ if (message.unlandedOutputTokens !== 0) {
6602
+ writer.uint32(152).uint64(message.unlandedOutputTokens);
6603
+ }
6604
+ return writer;
6605
+ },
6606
+
6607
+ decode(input: BinaryReader | Uint8Array, length?: number): AIFileStateRow {
6608
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6609
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6610
+ if (previousRecursionDepth >= 100) {
6611
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6612
+ }
6613
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6614
+ try {
6615
+ const end = length === undefined ? reader.len : reader.pos + length;
6616
+ const message = createBaseAIFileStateRow();
6617
+ while (reader.pos < end) {
6618
+ const tag = reader.uint32();
6619
+ switch (tag >>> 3) {
6620
+ case 1: {
6621
+ if (tag !== 10) {
6622
+ break;
6623
+ }
6624
+
6625
+ message.repositoryKey = reader.string();
6626
+ continue;
6627
+ }
6628
+ case 2: {
6629
+ if (tag !== 18) {
6630
+ break;
6631
+ }
6632
+
6633
+ message.ref = reader.string();
6634
+ continue;
6635
+ }
6636
+ case 3: {
6637
+ if (tag !== 26) {
6638
+ break;
6639
+ }
6640
+
6641
+ message.path = reader.string();
6642
+ continue;
6643
+ }
6644
+ case 4: {
6645
+ if (tag !== 34) {
6646
+ break;
6647
+ }
6648
+
6649
+ message.oldPath = reader.string();
6650
+ continue;
6651
+ }
6652
+ case 5: {
6653
+ if (tag !== 40) {
6654
+ break;
6655
+ }
6656
+
6657
+ message.state = reader.int32() as any;
6658
+ continue;
6659
+ }
6660
+ case 6: {
6661
+ if (tag !== 48) {
6662
+ break;
6663
+ }
6664
+
6665
+ message.tier = reader.int32() as any;
6666
+ continue;
6667
+ }
6668
+ case 7: {
6669
+ if (tag !== 56) {
6670
+ break;
6671
+ }
6672
+
6673
+ message.confidence = reader.int32() as any;
6674
+ continue;
6675
+ }
6676
+ case 8: {
6677
+ if (tag !== 66) {
6678
+ break;
6679
+ }
6680
+
6681
+ message.firstEditedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6682
+ continue;
6683
+ }
6684
+ case 9: {
6685
+ if (tag !== 74) {
6686
+ break;
6687
+ }
6688
+
6689
+ message.lastEditedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6690
+ continue;
6691
+ }
6692
+ case 10: {
6693
+ if (tag !== 82) {
6694
+ break;
6695
+ }
6696
+
6697
+ message.lastStagedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6698
+ continue;
6699
+ }
6700
+ case 11: {
6701
+ if (tag !== 90) {
6702
+ break;
6703
+ }
6704
+
6705
+ message.lastCommittedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6706
+ continue;
6707
+ }
6708
+ case 12: {
6709
+ if (tag !== 98) {
6710
+ break;
6711
+ }
6712
+
6713
+ message.lastCommitSha = reader.string();
6714
+ continue;
6715
+ }
6716
+ case 13: {
6717
+ if (tag !== 106) {
6718
+ break;
6719
+ }
6720
+
6721
+ message.lastPushedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6722
+ continue;
6723
+ }
6724
+ case 14: {
6725
+ if (tag !== 114) {
6726
+ break;
6727
+ }
6728
+
6729
+ message.discardedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
6730
+ continue;
6731
+ }
6732
+ case 15: {
6733
+ if (tag !== 122) {
6734
+ break;
6735
+ }
6736
+
6737
+ message.discardReason = reader.string();
6738
+ continue;
6739
+ }
6740
+ case 16: {
6741
+ if (tag !== 128) {
6742
+ break;
6743
+ }
6744
+
6745
+ message.editCount = reader.uint32();
6746
+ continue;
6747
+ }
6748
+ case 17: {
6749
+ if (tag !== 138) {
6750
+ break;
6751
+ }
6752
+
6753
+ message.sessionId.push(reader.string());
6754
+ continue;
6755
+ }
6756
+ case 18: {
6757
+ if (tag !== 145) {
6758
+ break;
6759
+ }
6760
+
6761
+ message.unlandedCostUsd = reader.double();
6762
+ continue;
6763
+ }
6764
+ case 19: {
6765
+ if (tag !== 152) {
6766
+ break;
6767
+ }
6768
+
6769
+ message.unlandedOutputTokens = longToNumber(reader.uint64());
6770
+ continue;
6771
+ }
6772
+ }
6773
+ if ((tag & 7) === 4 || tag === 0) {
6774
+ break;
6775
+ }
6776
+ reader.skip(tag & 7);
6777
+ }
6778
+ return message;
6779
+ } finally {
6780
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6781
+ }
6782
+ },
6783
+
6784
+ fromJSON(object: any): AIFileStateRow {
6785
+ return {
6786
+ repositoryKey: isSet(object.repositoryKey)
6787
+ ? globalThis.String(object.repositoryKey)
6788
+ : isSet(object.repository_key)
6789
+ ? globalThis.String(object.repository_key)
6790
+ : "",
6791
+ ref: isSet(object.ref) ? globalThis.String(object.ref) : "",
6792
+ path: isSet(object.path) ? globalThis.String(object.path) : "",
6793
+ oldPath: isSet(object.oldPath)
6794
+ ? globalThis.String(object.oldPath)
6795
+ : isSet(object.old_path)
6796
+ ? globalThis.String(object.old_path)
6797
+ : "",
6798
+ state: isSet(object.state) ? aIFileLifecycleFromJSON(object.state) : 0,
6799
+ tier: isSet(object.tier) ? aIFileTierFromJSON(object.tier) : 0,
6800
+ confidence: isSet(object.confidence) ? aIFileConfidenceFromJSON(object.confidence) : 0,
6801
+ firstEditedAt: isSet(object.firstEditedAt)
6802
+ ? fromJsonTimestamp(object.firstEditedAt)
6803
+ : isSet(object.first_edited_at)
6804
+ ? fromJsonTimestamp(object.first_edited_at)
6805
+ : undefined,
6806
+ lastEditedAt: isSet(object.lastEditedAt)
6807
+ ? fromJsonTimestamp(object.lastEditedAt)
6808
+ : isSet(object.last_edited_at)
6809
+ ? fromJsonTimestamp(object.last_edited_at)
6810
+ : undefined,
6811
+ lastStagedAt: isSet(object.lastStagedAt)
6812
+ ? fromJsonTimestamp(object.lastStagedAt)
6813
+ : isSet(object.last_staged_at)
6814
+ ? fromJsonTimestamp(object.last_staged_at)
6815
+ : undefined,
6816
+ lastCommittedAt: isSet(object.lastCommittedAt)
6817
+ ? fromJsonTimestamp(object.lastCommittedAt)
6818
+ : isSet(object.last_committed_at)
6819
+ ? fromJsonTimestamp(object.last_committed_at)
6820
+ : undefined,
6821
+ lastCommitSha: isSet(object.lastCommitSha)
6822
+ ? globalThis.String(object.lastCommitSha)
6823
+ : isSet(object.last_commit_sha)
6824
+ ? globalThis.String(object.last_commit_sha)
6825
+ : "",
6826
+ lastPushedAt: isSet(object.lastPushedAt)
6827
+ ? fromJsonTimestamp(object.lastPushedAt)
6828
+ : isSet(object.last_pushed_at)
6829
+ ? fromJsonTimestamp(object.last_pushed_at)
6830
+ : undefined,
6831
+ discardedAt: isSet(object.discardedAt)
6832
+ ? fromJsonTimestamp(object.discardedAt)
6833
+ : isSet(object.discarded_at)
6834
+ ? fromJsonTimestamp(object.discarded_at)
6835
+ : undefined,
6836
+ discardReason: isSet(object.discardReason)
6837
+ ? globalThis.String(object.discardReason)
6838
+ : isSet(object.discard_reason)
6839
+ ? globalThis.String(object.discard_reason)
6840
+ : "",
6841
+ editCount: isSet(object.editCount)
6842
+ ? globalThis.Number(object.editCount)
6843
+ : isSet(object.edit_count)
6844
+ ? globalThis.Number(object.edit_count)
6845
+ : 0,
6846
+ sessionId: globalThis.Array.isArray(object?.sessionId)
6847
+ ? object.sessionId.map((e: any) => globalThis.String(e))
6848
+ : globalThis.Array.isArray(object?.session_id)
6849
+ ? object.session_id.map((e: any) => globalThis.String(e))
6850
+ : [],
6851
+ unlandedCostUsd: isSet(object.unlandedCostUsd)
6852
+ ? globalThis.Number(object.unlandedCostUsd)
6853
+ : isSet(object.unlanded_cost_usd)
6854
+ ? globalThis.Number(object.unlanded_cost_usd)
6855
+ : 0,
6856
+ unlandedOutputTokens: isSet(object.unlandedOutputTokens)
6857
+ ? globalThis.Number(object.unlandedOutputTokens)
6858
+ : isSet(object.unlanded_output_tokens)
6859
+ ? globalThis.Number(object.unlanded_output_tokens)
6860
+ : 0,
6861
+ };
6862
+ },
6863
+
6864
+ toJSON(message: AIFileStateRow): unknown {
6865
+ const obj: any = {};
6866
+ if (message.repositoryKey !== "") {
6867
+ obj.repositoryKey = message.repositoryKey;
6868
+ }
6869
+ if (message.ref !== "") {
6870
+ obj.ref = message.ref;
6871
+ }
6872
+ if (message.path !== "") {
6873
+ obj.path = message.path;
6874
+ }
6875
+ if (message.oldPath !== "") {
6876
+ obj.oldPath = message.oldPath;
6877
+ }
6878
+ if (message.state !== 0) {
6879
+ obj.state = aIFileLifecycleToJSON(message.state);
6880
+ }
6881
+ if (message.tier !== 0) {
6882
+ obj.tier = aIFileTierToJSON(message.tier);
6883
+ }
6884
+ if (message.confidence !== 0) {
6885
+ obj.confidence = aIFileConfidenceToJSON(message.confidence);
6886
+ }
6887
+ if (message.firstEditedAt !== undefined) {
6888
+ obj.firstEditedAt = message.firstEditedAt.toISOString();
6889
+ }
6890
+ if (message.lastEditedAt !== undefined) {
6891
+ obj.lastEditedAt = message.lastEditedAt.toISOString();
6892
+ }
6893
+ if (message.lastStagedAt !== undefined) {
6894
+ obj.lastStagedAt = message.lastStagedAt.toISOString();
6895
+ }
6896
+ if (message.lastCommittedAt !== undefined) {
6897
+ obj.lastCommittedAt = message.lastCommittedAt.toISOString();
6898
+ }
6899
+ if (message.lastCommitSha !== "") {
6900
+ obj.lastCommitSha = message.lastCommitSha;
6901
+ }
6902
+ if (message.lastPushedAt !== undefined) {
6903
+ obj.lastPushedAt = message.lastPushedAt.toISOString();
6904
+ }
6905
+ if (message.discardedAt !== undefined) {
6906
+ obj.discardedAt = message.discardedAt.toISOString();
6907
+ }
6908
+ if (message.discardReason !== "") {
6909
+ obj.discardReason = message.discardReason;
6910
+ }
6911
+ if (message.editCount !== 0) {
6912
+ obj.editCount = Math.round(message.editCount);
6913
+ }
6914
+ if (message.sessionId?.length) {
6915
+ obj.sessionId = message.sessionId;
6916
+ }
6917
+ if (message.unlandedCostUsd !== 0) {
6918
+ obj.unlandedCostUsd = message.unlandedCostUsd;
6919
+ }
6920
+ if (message.unlandedOutputTokens !== 0) {
6921
+ obj.unlandedOutputTokens = Math.round(message.unlandedOutputTokens);
6922
+ }
6923
+ return obj;
6924
+ },
6925
+
6926
+ create<I extends Exact<DeepPartial<AIFileStateRow>, I>>(base?: I): AIFileStateRow {
6927
+ return AIFileStateRow.fromPartial(base ?? ({} as any));
6928
+ },
6929
+ fromPartial<I extends Exact<DeepPartial<AIFileStateRow>, I>>(object: I): AIFileStateRow {
6930
+ const message = createBaseAIFileStateRow();
6931
+ message.repositoryKey = object.repositoryKey ?? "";
6932
+ message.ref = object.ref ?? "";
6933
+ message.path = object.path ?? "";
6934
+ message.oldPath = object.oldPath ?? "";
6935
+ message.state = object.state ?? 0;
6936
+ message.tier = object.tier ?? 0;
6937
+ message.confidence = object.confidence ?? 0;
6938
+ message.firstEditedAt = object.firstEditedAt ?? undefined;
6939
+ message.lastEditedAt = object.lastEditedAt ?? undefined;
6940
+ message.lastStagedAt = object.lastStagedAt ?? undefined;
6941
+ message.lastCommittedAt = object.lastCommittedAt ?? undefined;
6942
+ message.lastCommitSha = object.lastCommitSha ?? "";
6943
+ message.lastPushedAt = object.lastPushedAt ?? undefined;
6944
+ message.discardedAt = object.discardedAt ?? undefined;
6945
+ message.discardReason = object.discardReason ?? "";
6946
+ message.editCount = object.editCount ?? 0;
6947
+ message.sessionId = object.sessionId?.map((e) => e) || [];
6948
+ message.unlandedCostUsd = object.unlandedCostUsd ?? 0;
6949
+ message.unlandedOutputTokens = object.unlandedOutputTokens ?? 0;
6950
+ return message;
6951
+ },
6952
+ };
6953
+
6954
+ function createBaseFileStateSummaryRequest(): FileStateSummaryRequest {
6955
+ return { organizationId: "", projectId: "", filter: undefined, abandonedHorizon: undefined, groupBy: 0 };
6956
+ }
6957
+
6958
+ export const FileStateSummaryRequest: MessageFns<FileStateSummaryRequest> = {
6959
+ encode(message: FileStateSummaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6960
+ if (message.organizationId !== "") {
6961
+ writer.uint32(10).string(message.organizationId);
6962
+ }
6963
+ if (message.projectId !== "") {
6964
+ writer.uint32(18).string(message.projectId);
6965
+ }
6966
+ if (message.filter !== undefined) {
6967
+ AIFileStateFilter.encode(message.filter, writer.uint32(26).fork()).join();
6968
+ }
6969
+ if (message.abandonedHorizon !== undefined) {
6970
+ Duration.encode(message.abandonedHorizon, writer.uint32(34).fork()).join();
6971
+ }
6972
+ if (message.groupBy !== 0) {
6973
+ writer.uint32(40).int32(message.groupBy);
6974
+ }
6975
+ return writer;
6976
+ },
6977
+
6978
+ decode(input: BinaryReader | Uint8Array, length?: number): FileStateSummaryRequest {
6979
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6980
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6981
+ if (previousRecursionDepth >= 100) {
6982
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6983
+ }
6984
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6985
+ try {
6986
+ const end = length === undefined ? reader.len : reader.pos + length;
6987
+ const message = createBaseFileStateSummaryRequest();
6988
+ while (reader.pos < end) {
6989
+ const tag = reader.uint32();
6990
+ switch (tag >>> 3) {
6991
+ case 1: {
6992
+ if (tag !== 10) {
6993
+ break;
6994
+ }
6995
+
6996
+ message.organizationId = reader.string();
6997
+ continue;
6998
+ }
6999
+ case 2: {
7000
+ if (tag !== 18) {
7001
+ break;
7002
+ }
7003
+
7004
+ message.projectId = reader.string();
7005
+ continue;
7006
+ }
7007
+ case 3: {
7008
+ if (tag !== 26) {
7009
+ break;
7010
+ }
7011
+
7012
+ message.filter = AIFileStateFilter.decode(reader, reader.uint32());
7013
+ continue;
7014
+ }
7015
+ case 4: {
7016
+ if (tag !== 34) {
7017
+ break;
7018
+ }
7019
+
7020
+ message.abandonedHorizon = Duration.decode(reader, reader.uint32());
7021
+ continue;
7022
+ }
7023
+ case 5: {
7024
+ if (tag !== 40) {
7025
+ break;
7026
+ }
7027
+
7028
+ message.groupBy = reader.int32() as any;
7029
+ continue;
7030
+ }
7031
+ }
7032
+ if ((tag & 7) === 4 || tag === 0) {
7033
+ break;
7034
+ }
7035
+ reader.skip(tag & 7);
7036
+ }
7037
+ return message;
7038
+ } finally {
7039
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7040
+ }
7041
+ },
7042
+
7043
+ fromJSON(object: any): FileStateSummaryRequest {
7044
+ return {
7045
+ organizationId: isSet(object.organizationId)
7046
+ ? globalThis.String(object.organizationId)
7047
+ : isSet(object.organization_id)
7048
+ ? globalThis.String(object.organization_id)
7049
+ : "",
7050
+ projectId: isSet(object.projectId)
7051
+ ? globalThis.String(object.projectId)
7052
+ : isSet(object.project_id)
7053
+ ? globalThis.String(object.project_id)
7054
+ : "",
7055
+ filter: isSet(object.filter) ? AIFileStateFilter.fromJSON(object.filter) : undefined,
7056
+ abandonedHorizon: isSet(object.abandonedHorizon)
7057
+ ? Duration.fromJSON(object.abandonedHorizon)
7058
+ : isSet(object.abandoned_horizon)
7059
+ ? Duration.fromJSON(object.abandoned_horizon)
7060
+ : undefined,
7061
+ groupBy: isSet(object.groupBy)
7062
+ ? aIFileStateGroupByFromJSON(object.groupBy)
7063
+ : isSet(object.group_by)
7064
+ ? aIFileStateGroupByFromJSON(object.group_by)
7065
+ : 0,
7066
+ };
7067
+ },
7068
+
7069
+ toJSON(message: FileStateSummaryRequest): unknown {
7070
+ const obj: any = {};
7071
+ if (message.organizationId !== "") {
7072
+ obj.organizationId = message.organizationId;
7073
+ }
7074
+ if (message.projectId !== "") {
7075
+ obj.projectId = message.projectId;
7076
+ }
7077
+ if (message.filter !== undefined) {
7078
+ obj.filter = AIFileStateFilter.toJSON(message.filter);
7079
+ }
7080
+ if (message.abandonedHorizon !== undefined) {
7081
+ obj.abandonedHorizon = Duration.toJSON(message.abandonedHorizon);
7082
+ }
7083
+ if (message.groupBy !== 0) {
7084
+ obj.groupBy = aIFileStateGroupByToJSON(message.groupBy);
7085
+ }
7086
+ return obj;
7087
+ },
7088
+
7089
+ create<I extends Exact<DeepPartial<FileStateSummaryRequest>, I>>(base?: I): FileStateSummaryRequest {
7090
+ return FileStateSummaryRequest.fromPartial(base ?? ({} as any));
7091
+ },
7092
+ fromPartial<I extends Exact<DeepPartial<FileStateSummaryRequest>, I>>(object: I): FileStateSummaryRequest {
7093
+ const message = createBaseFileStateSummaryRequest();
7094
+ message.organizationId = object.organizationId ?? "";
7095
+ message.projectId = object.projectId ?? "";
7096
+ message.filter = (object.filter !== undefined && object.filter !== null)
7097
+ ? AIFileStateFilter.fromPartial(object.filter)
7098
+ : undefined;
7099
+ message.abandonedHorizon = (object.abandonedHorizon !== undefined && object.abandonedHorizon !== null)
7100
+ ? Duration.fromPartial(object.abandonedHorizon)
7101
+ : undefined;
7102
+ message.groupBy = object.groupBy ?? 0;
7103
+ return message;
7104
+ },
7105
+ };
7106
+
7107
+ function createBaseGetFileStateSummaryResponse(): GetFileStateSummaryResponse {
7108
+ return { status: undefined, summary: undefined };
7109
+ }
7110
+
7111
+ export const GetFileStateSummaryResponse: MessageFns<GetFileStateSummaryResponse> = {
7112
+ encode(message: GetFileStateSummaryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7113
+ if (message.status !== undefined) {
7114
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
7115
+ }
7116
+ if (message.summary !== undefined) {
7117
+ FileStateSummary.encode(message.summary, writer.uint32(18).fork()).join();
7118
+ }
7119
+ return writer;
7120
+ },
7121
+
7122
+ decode(input: BinaryReader | Uint8Array, length?: number): GetFileStateSummaryResponse {
7123
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7124
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7125
+ if (previousRecursionDepth >= 100) {
7126
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7127
+ }
7128
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7129
+ try {
7130
+ const end = length === undefined ? reader.len : reader.pos + length;
7131
+ const message = createBaseGetFileStateSummaryResponse();
7132
+ while (reader.pos < end) {
7133
+ const tag = reader.uint32();
7134
+ switch (tag >>> 3) {
7135
+ case 1: {
7136
+ if (tag !== 10) {
7137
+ break;
7138
+ }
7139
+
7140
+ message.status = ResponseStatus.decode(reader, reader.uint32());
7141
+ continue;
7142
+ }
7143
+ case 2: {
7144
+ if (tag !== 18) {
7145
+ break;
7146
+ }
7147
+
7148
+ message.summary = FileStateSummary.decode(reader, reader.uint32());
7149
+ continue;
7150
+ }
7151
+ }
7152
+ if ((tag & 7) === 4 || tag === 0) {
7153
+ break;
7154
+ }
7155
+ reader.skip(tag & 7);
7156
+ }
7157
+ return message;
7158
+ } finally {
7159
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7160
+ }
7161
+ },
7162
+
7163
+ fromJSON(object: any): GetFileStateSummaryResponse {
7164
+ return {
7165
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
7166
+ summary: isSet(object.summary) ? FileStateSummary.fromJSON(object.summary) : undefined,
7167
+ };
7168
+ },
7169
+
7170
+ toJSON(message: GetFileStateSummaryResponse): unknown {
7171
+ const obj: any = {};
7172
+ if (message.status !== undefined) {
7173
+ obj.status = ResponseStatus.toJSON(message.status);
7174
+ }
7175
+ if (message.summary !== undefined) {
7176
+ obj.summary = FileStateSummary.toJSON(message.summary);
7177
+ }
7178
+ return obj;
7179
+ },
7180
+
7181
+ create<I extends Exact<DeepPartial<GetFileStateSummaryResponse>, I>>(base?: I): GetFileStateSummaryResponse {
7182
+ return GetFileStateSummaryResponse.fromPartial(base ?? ({} as any));
7183
+ },
7184
+ fromPartial<I extends Exact<DeepPartial<GetFileStateSummaryResponse>, I>>(object: I): GetFileStateSummaryResponse {
7185
+ const message = createBaseGetFileStateSummaryResponse();
7186
+ message.status = (object.status !== undefined && object.status !== null)
7187
+ ? ResponseStatus.fromPartial(object.status)
7188
+ : undefined;
7189
+ message.summary = (object.summary !== undefined && object.summary !== null)
7190
+ ? FileStateSummary.fromPartial(object.summary)
7191
+ : undefined;
7192
+ return message;
7193
+ },
7194
+ };
7195
+
7196
+ function createBaseFileStateSummary(): FileStateSummary {
7197
+ return { totals: undefined, groups: [], asOf: undefined, groupBy: 0 };
7198
+ }
7199
+
7200
+ export const FileStateSummary: MessageFns<FileStateSummary> = {
7201
+ encode(message: FileStateSummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7202
+ if (message.totals !== undefined) {
7203
+ FileStateTiers.encode(message.totals, writer.uint32(10).fork()).join();
7204
+ }
7205
+ for (const v of message.groups) {
7206
+ FileStateGroup.encode(v!, writer.uint32(18).fork()).join();
7207
+ }
7208
+ if (message.asOf !== undefined) {
7209
+ Timestamp.encode(toTimestamp(message.asOf), writer.uint32(26).fork()).join();
7210
+ }
7211
+ if (message.groupBy !== 0) {
7212
+ writer.uint32(32).int32(message.groupBy);
7213
+ }
7214
+ return writer;
7215
+ },
7216
+
7217
+ decode(input: BinaryReader | Uint8Array, length?: number): FileStateSummary {
7218
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7219
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7220
+ if (previousRecursionDepth >= 100) {
7221
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7222
+ }
7223
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7224
+ try {
7225
+ const end = length === undefined ? reader.len : reader.pos + length;
7226
+ const message = createBaseFileStateSummary();
7227
+ while (reader.pos < end) {
7228
+ const tag = reader.uint32();
7229
+ switch (tag >>> 3) {
7230
+ case 1: {
7231
+ if (tag !== 10) {
7232
+ break;
7233
+ }
7234
+
7235
+ message.totals = FileStateTiers.decode(reader, reader.uint32());
7236
+ continue;
7237
+ }
7238
+ case 2: {
7239
+ if (tag !== 18) {
7240
+ break;
7241
+ }
7242
+
7243
+ message.groups.push(FileStateGroup.decode(reader, reader.uint32()));
7244
+ continue;
7245
+ }
7246
+ case 3: {
7247
+ if (tag !== 26) {
7248
+ break;
7249
+ }
7250
+
7251
+ message.asOf = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
7252
+ continue;
7253
+ }
7254
+ case 4: {
7255
+ if (tag !== 32) {
7256
+ break;
7257
+ }
7258
+
7259
+ message.groupBy = reader.int32() as any;
7260
+ continue;
7261
+ }
7262
+ }
7263
+ if ((tag & 7) === 4 || tag === 0) {
7264
+ break;
7265
+ }
7266
+ reader.skip(tag & 7);
7267
+ }
7268
+ return message;
7269
+ } finally {
7270
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7271
+ }
7272
+ },
7273
+
7274
+ fromJSON(object: any): FileStateSummary {
7275
+ return {
7276
+ totals: isSet(object.totals) ? FileStateTiers.fromJSON(object.totals) : undefined,
7277
+ groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e: any) => FileStateGroup.fromJSON(e)) : [],
7278
+ asOf: isSet(object.asOf)
7279
+ ? fromJsonTimestamp(object.asOf)
7280
+ : isSet(object.as_of)
7281
+ ? fromJsonTimestamp(object.as_of)
7282
+ : undefined,
7283
+ groupBy: isSet(object.groupBy)
7284
+ ? aIFileStateGroupByFromJSON(object.groupBy)
7285
+ : isSet(object.group_by)
7286
+ ? aIFileStateGroupByFromJSON(object.group_by)
7287
+ : 0,
7288
+ };
7289
+ },
7290
+
7291
+ toJSON(message: FileStateSummary): unknown {
7292
+ const obj: any = {};
7293
+ if (message.totals !== undefined) {
7294
+ obj.totals = FileStateTiers.toJSON(message.totals);
7295
+ }
7296
+ if (message.groups?.length) {
7297
+ obj.groups = message.groups.map((e) => FileStateGroup.toJSON(e));
7298
+ }
7299
+ if (message.asOf !== undefined) {
7300
+ obj.asOf = message.asOf.toISOString();
7301
+ }
7302
+ if (message.groupBy !== 0) {
7303
+ obj.groupBy = aIFileStateGroupByToJSON(message.groupBy);
7304
+ }
7305
+ return obj;
7306
+ },
7307
+
7308
+ create<I extends Exact<DeepPartial<FileStateSummary>, I>>(base?: I): FileStateSummary {
7309
+ return FileStateSummary.fromPartial(base ?? ({} as any));
7310
+ },
7311
+ fromPartial<I extends Exact<DeepPartial<FileStateSummary>, I>>(object: I): FileStateSummary {
7312
+ const message = createBaseFileStateSummary();
7313
+ message.totals = (object.totals !== undefined && object.totals !== null)
7314
+ ? FileStateTiers.fromPartial(object.totals)
7315
+ : undefined;
7316
+ message.groups = object.groups?.map((e) => FileStateGroup.fromPartial(e)) || [];
7317
+ message.asOf = object.asOf ?? undefined;
7318
+ message.groupBy = object.groupBy ?? 0;
7319
+ return message;
7320
+ },
7321
+ };
7322
+
7323
+ function createBaseFileStateTiers(): FileStateTiers {
7324
+ return { active: undefined, open: undefined, stale: undefined, abandonedHorizon: undefined, discarded: undefined };
7325
+ }
7326
+
7327
+ export const FileStateTiers: MessageFns<FileStateTiers> = {
7328
+ encode(message: FileStateTiers, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7329
+ if (message.active !== undefined) {
7330
+ FileStateTierBucket.encode(message.active, writer.uint32(10).fork()).join();
7331
+ }
7332
+ if (message.open !== undefined) {
7333
+ FileStateTierBucket.encode(message.open, writer.uint32(18).fork()).join();
7334
+ }
7335
+ if (message.stale !== undefined) {
7336
+ FileStateTierBucket.encode(message.stale, writer.uint32(26).fork()).join();
7337
+ }
7338
+ if (message.abandonedHorizon !== undefined) {
7339
+ FileStateTierBucket.encode(message.abandonedHorizon, writer.uint32(34).fork()).join();
7340
+ }
7341
+ if (message.discarded !== undefined) {
7342
+ FileStateTierBucket.encode(message.discarded, writer.uint32(42).fork()).join();
7343
+ }
7344
+ return writer;
7345
+ },
7346
+
7347
+ decode(input: BinaryReader | Uint8Array, length?: number): FileStateTiers {
7348
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7349
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7350
+ if (previousRecursionDepth >= 100) {
7351
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7352
+ }
7353
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7354
+ try {
7355
+ const end = length === undefined ? reader.len : reader.pos + length;
7356
+ const message = createBaseFileStateTiers();
7357
+ while (reader.pos < end) {
7358
+ const tag = reader.uint32();
7359
+ switch (tag >>> 3) {
7360
+ case 1: {
7361
+ if (tag !== 10) {
7362
+ break;
7363
+ }
7364
+
7365
+ message.active = FileStateTierBucket.decode(reader, reader.uint32());
7366
+ continue;
7367
+ }
7368
+ case 2: {
7369
+ if (tag !== 18) {
7370
+ break;
7371
+ }
7372
+
7373
+ message.open = FileStateTierBucket.decode(reader, reader.uint32());
7374
+ continue;
7375
+ }
7376
+ case 3: {
7377
+ if (tag !== 26) {
7378
+ break;
7379
+ }
7380
+
7381
+ message.stale = FileStateTierBucket.decode(reader, reader.uint32());
7382
+ continue;
7383
+ }
7384
+ case 4: {
7385
+ if (tag !== 34) {
7386
+ break;
7387
+ }
7388
+
7389
+ message.abandonedHorizon = FileStateTierBucket.decode(reader, reader.uint32());
7390
+ continue;
7391
+ }
7392
+ case 5: {
7393
+ if (tag !== 42) {
7394
+ break;
7395
+ }
7396
+
7397
+ message.discarded = FileStateTierBucket.decode(reader, reader.uint32());
7398
+ continue;
7399
+ }
7400
+ }
7401
+ if ((tag & 7) === 4 || tag === 0) {
7402
+ break;
7403
+ }
7404
+ reader.skip(tag & 7);
7405
+ }
7406
+ return message;
7407
+ } finally {
7408
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7409
+ }
7410
+ },
7411
+
7412
+ fromJSON(object: any): FileStateTiers {
7413
+ return {
7414
+ active: isSet(object.active) ? FileStateTierBucket.fromJSON(object.active) : undefined,
7415
+ open: isSet(object.open) ? FileStateTierBucket.fromJSON(object.open) : undefined,
7416
+ stale: isSet(object.stale) ? FileStateTierBucket.fromJSON(object.stale) : undefined,
7417
+ abandonedHorizon: isSet(object.abandonedHorizon)
7418
+ ? FileStateTierBucket.fromJSON(object.abandonedHorizon)
7419
+ : isSet(object.abandoned_horizon)
7420
+ ? FileStateTierBucket.fromJSON(object.abandoned_horizon)
7421
+ : undefined,
7422
+ discarded: isSet(object.discarded) ? FileStateTierBucket.fromJSON(object.discarded) : undefined,
7423
+ };
7424
+ },
7425
+
7426
+ toJSON(message: FileStateTiers): unknown {
7427
+ const obj: any = {};
7428
+ if (message.active !== undefined) {
7429
+ obj.active = FileStateTierBucket.toJSON(message.active);
7430
+ }
7431
+ if (message.open !== undefined) {
7432
+ obj.open = FileStateTierBucket.toJSON(message.open);
7433
+ }
7434
+ if (message.stale !== undefined) {
7435
+ obj.stale = FileStateTierBucket.toJSON(message.stale);
7436
+ }
7437
+ if (message.abandonedHorizon !== undefined) {
7438
+ obj.abandonedHorizon = FileStateTierBucket.toJSON(message.abandonedHorizon);
7439
+ }
7440
+ if (message.discarded !== undefined) {
7441
+ obj.discarded = FileStateTierBucket.toJSON(message.discarded);
7442
+ }
7443
+ return obj;
7444
+ },
7445
+
7446
+ create<I extends Exact<DeepPartial<FileStateTiers>, I>>(base?: I): FileStateTiers {
7447
+ return FileStateTiers.fromPartial(base ?? ({} as any));
7448
+ },
7449
+ fromPartial<I extends Exact<DeepPartial<FileStateTiers>, I>>(object: I): FileStateTiers {
7450
+ const message = createBaseFileStateTiers();
7451
+ message.active = (object.active !== undefined && object.active !== null)
7452
+ ? FileStateTierBucket.fromPartial(object.active)
7453
+ : undefined;
7454
+ message.open = (object.open !== undefined && object.open !== null)
7455
+ ? FileStateTierBucket.fromPartial(object.open)
7456
+ : undefined;
7457
+ message.stale = (object.stale !== undefined && object.stale !== null)
7458
+ ? FileStateTierBucket.fromPartial(object.stale)
7459
+ : undefined;
7460
+ message.abandonedHorizon = (object.abandonedHorizon !== undefined && object.abandonedHorizon !== null)
7461
+ ? FileStateTierBucket.fromPartial(object.abandonedHorizon)
7462
+ : undefined;
7463
+ message.discarded = (object.discarded !== undefined && object.discarded !== null)
7464
+ ? FileStateTierBucket.fromPartial(object.discarded)
7465
+ : undefined;
7466
+ return message;
7467
+ },
7468
+ };
7469
+
7470
+ function createBaseFileStateTierBucket(): FileStateTierBucket {
7471
+ return {
7472
+ files: 0,
7473
+ branches: 0,
7474
+ sessions: 0,
7475
+ costUsd: 0,
7476
+ costUsdUnverified: 0,
7477
+ outputTokens: 0,
7478
+ oldestAge: undefined,
7479
+ filesUnverified: 0,
7480
+ };
7481
+ }
7482
+
7483
+ export const FileStateTierBucket: MessageFns<FileStateTierBucket> = {
7484
+ encode(message: FileStateTierBucket, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7485
+ if (message.files !== 0) {
7486
+ writer.uint32(8).uint64(message.files);
7487
+ }
7488
+ if (message.branches !== 0) {
7489
+ writer.uint32(16).uint64(message.branches);
7490
+ }
7491
+ if (message.sessions !== 0) {
7492
+ writer.uint32(24).uint64(message.sessions);
7493
+ }
7494
+ if (message.costUsd !== 0) {
7495
+ writer.uint32(33).double(message.costUsd);
7496
+ }
7497
+ if (message.costUsdUnverified !== 0) {
7498
+ writer.uint32(41).double(message.costUsdUnverified);
7499
+ }
7500
+ if (message.outputTokens !== 0) {
7501
+ writer.uint32(48).uint64(message.outputTokens);
7502
+ }
7503
+ if (message.oldestAge !== undefined) {
7504
+ Duration.encode(message.oldestAge, writer.uint32(58).fork()).join();
7505
+ }
7506
+ if (message.filesUnverified !== 0) {
7507
+ writer.uint32(64).uint64(message.filesUnverified);
7508
+ }
7509
+ return writer;
7510
+ },
7511
+
7512
+ decode(input: BinaryReader | Uint8Array, length?: number): FileStateTierBucket {
7513
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7514
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7515
+ if (previousRecursionDepth >= 100) {
7516
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7517
+ }
7518
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7519
+ try {
7520
+ const end = length === undefined ? reader.len : reader.pos + length;
7521
+ const message = createBaseFileStateTierBucket();
7522
+ while (reader.pos < end) {
7523
+ const tag = reader.uint32();
7524
+ switch (tag >>> 3) {
7525
+ case 1: {
7526
+ if (tag !== 8) {
7527
+ break;
7528
+ }
7529
+
7530
+ message.files = longToNumber(reader.uint64());
7531
+ continue;
7532
+ }
7533
+ case 2: {
7534
+ if (tag !== 16) {
7535
+ break;
7536
+ }
7537
+
7538
+ message.branches = longToNumber(reader.uint64());
7539
+ continue;
7540
+ }
7541
+ case 3: {
7542
+ if (tag !== 24) {
7543
+ break;
7544
+ }
7545
+
7546
+ message.sessions = longToNumber(reader.uint64());
7547
+ continue;
7548
+ }
7549
+ case 4: {
7550
+ if (tag !== 33) {
7551
+ break;
7552
+ }
7553
+
7554
+ message.costUsd = reader.double();
7555
+ continue;
7556
+ }
7557
+ case 5: {
7558
+ if (tag !== 41) {
7559
+ break;
7560
+ }
7561
+
7562
+ message.costUsdUnverified = reader.double();
7563
+ continue;
7564
+ }
7565
+ case 6: {
7566
+ if (tag !== 48) {
7567
+ break;
7568
+ }
7569
+
7570
+ message.outputTokens = longToNumber(reader.uint64());
7571
+ continue;
7572
+ }
7573
+ case 7: {
7574
+ if (tag !== 58) {
7575
+ break;
7576
+ }
7577
+
7578
+ message.oldestAge = Duration.decode(reader, reader.uint32());
7579
+ continue;
7580
+ }
7581
+ case 8: {
7582
+ if (tag !== 64) {
7583
+ break;
7584
+ }
7585
+
7586
+ message.filesUnverified = longToNumber(reader.uint64());
7587
+ continue;
7588
+ }
7589
+ }
7590
+ if ((tag & 7) === 4 || tag === 0) {
7591
+ break;
7592
+ }
7593
+ reader.skip(tag & 7);
7594
+ }
7595
+ return message;
7596
+ } finally {
7597
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7598
+ }
7599
+ },
7600
+
7601
+ fromJSON(object: any): FileStateTierBucket {
7602
+ return {
7603
+ files: isSet(object.files) ? globalThis.Number(object.files) : 0,
7604
+ branches: isSet(object.branches) ? globalThis.Number(object.branches) : 0,
7605
+ sessions: isSet(object.sessions) ? globalThis.Number(object.sessions) : 0,
7606
+ costUsd: isSet(object.costUsd)
7607
+ ? globalThis.Number(object.costUsd)
7608
+ : isSet(object.cost_usd)
7609
+ ? globalThis.Number(object.cost_usd)
7610
+ : 0,
7611
+ costUsdUnverified: isSet(object.costUsdUnverified)
7612
+ ? globalThis.Number(object.costUsdUnverified)
7613
+ : isSet(object.cost_usd_unverified)
7614
+ ? globalThis.Number(object.cost_usd_unverified)
7615
+ : 0,
7616
+ outputTokens: isSet(object.outputTokens)
7617
+ ? globalThis.Number(object.outputTokens)
7618
+ : isSet(object.output_tokens)
7619
+ ? globalThis.Number(object.output_tokens)
7620
+ : 0,
7621
+ oldestAge: isSet(object.oldestAge)
7622
+ ? Duration.fromJSON(object.oldestAge)
7623
+ : isSet(object.oldest_age)
7624
+ ? Duration.fromJSON(object.oldest_age)
7625
+ : undefined,
7626
+ filesUnverified: isSet(object.filesUnverified)
7627
+ ? globalThis.Number(object.filesUnverified)
7628
+ : isSet(object.files_unverified)
7629
+ ? globalThis.Number(object.files_unverified)
7630
+ : 0,
7631
+ };
7632
+ },
7633
+
7634
+ toJSON(message: FileStateTierBucket): unknown {
7635
+ const obj: any = {};
7636
+ if (message.files !== 0) {
7637
+ obj.files = Math.round(message.files);
7638
+ }
7639
+ if (message.branches !== 0) {
7640
+ obj.branches = Math.round(message.branches);
7641
+ }
7642
+ if (message.sessions !== 0) {
7643
+ obj.sessions = Math.round(message.sessions);
7644
+ }
7645
+ if (message.costUsd !== 0) {
7646
+ obj.costUsd = message.costUsd;
7647
+ }
7648
+ if (message.costUsdUnverified !== 0) {
7649
+ obj.costUsdUnverified = message.costUsdUnverified;
7650
+ }
7651
+ if (message.outputTokens !== 0) {
7652
+ obj.outputTokens = Math.round(message.outputTokens);
7653
+ }
7654
+ if (message.oldestAge !== undefined) {
7655
+ obj.oldestAge = Duration.toJSON(message.oldestAge);
7656
+ }
7657
+ if (message.filesUnverified !== 0) {
7658
+ obj.filesUnverified = Math.round(message.filesUnverified);
7659
+ }
7660
+ return obj;
7661
+ },
7662
+
7663
+ create<I extends Exact<DeepPartial<FileStateTierBucket>, I>>(base?: I): FileStateTierBucket {
7664
+ return FileStateTierBucket.fromPartial(base ?? ({} as any));
7665
+ },
7666
+ fromPartial<I extends Exact<DeepPartial<FileStateTierBucket>, I>>(object: I): FileStateTierBucket {
7667
+ const message = createBaseFileStateTierBucket();
7668
+ message.files = object.files ?? 0;
7669
+ message.branches = object.branches ?? 0;
7670
+ message.sessions = object.sessions ?? 0;
7671
+ message.costUsd = object.costUsd ?? 0;
7672
+ message.costUsdUnverified = object.costUsdUnverified ?? 0;
7673
+ message.outputTokens = object.outputTokens ?? 0;
7674
+ message.oldestAge = (object.oldestAge !== undefined && object.oldestAge !== null)
7675
+ ? Duration.fromPartial(object.oldestAge)
7676
+ : undefined;
7677
+ message.filesUnverified = object.filesUnverified ?? 0;
7678
+ return message;
7679
+ },
7680
+ };
7681
+
7682
+ function createBaseFileStateGroup(): FileStateGroup {
7683
+ return { key: "", tiers: undefined };
7684
+ }
7685
+
7686
+ export const FileStateGroup: MessageFns<FileStateGroup> = {
7687
+ encode(message: FileStateGroup, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7688
+ if (message.key !== "") {
7689
+ writer.uint32(10).string(message.key);
7690
+ }
7691
+ if (message.tiers !== undefined) {
7692
+ FileStateTiers.encode(message.tiers, writer.uint32(18).fork()).join();
7693
+ }
7694
+ return writer;
7695
+ },
7696
+
7697
+ decode(input: BinaryReader | Uint8Array, length?: number): FileStateGroup {
7698
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7699
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7700
+ if (previousRecursionDepth >= 100) {
7701
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7702
+ }
7703
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7704
+ try {
7705
+ const end = length === undefined ? reader.len : reader.pos + length;
7706
+ const message = createBaseFileStateGroup();
7707
+ while (reader.pos < end) {
7708
+ const tag = reader.uint32();
7709
+ switch (tag >>> 3) {
7710
+ case 1: {
7711
+ if (tag !== 10) {
7712
+ break;
7713
+ }
7714
+
7715
+ message.key = reader.string();
7716
+ continue;
7717
+ }
7718
+ case 2: {
7719
+ if (tag !== 18) {
7720
+ break;
7721
+ }
7722
+
7723
+ message.tiers = FileStateTiers.decode(reader, reader.uint32());
7724
+ continue;
7725
+ }
7726
+ }
7727
+ if ((tag & 7) === 4 || tag === 0) {
7728
+ break;
7729
+ }
7730
+ reader.skip(tag & 7);
7731
+ }
7732
+ return message;
7733
+ } finally {
7734
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7735
+ }
7736
+ },
7737
+
7738
+ fromJSON(object: any): FileStateGroup {
7739
+ return {
7740
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
7741
+ tiers: isSet(object.tiers) ? FileStateTiers.fromJSON(object.tiers) : undefined,
7742
+ };
7743
+ },
7744
+
7745
+ toJSON(message: FileStateGroup): unknown {
7746
+ const obj: any = {};
7747
+ if (message.key !== "") {
7748
+ obj.key = message.key;
7749
+ }
7750
+ if (message.tiers !== undefined) {
7751
+ obj.tiers = FileStateTiers.toJSON(message.tiers);
7752
+ }
7753
+ return obj;
7754
+ },
7755
+
7756
+ create<I extends Exact<DeepPartial<FileStateGroup>, I>>(base?: I): FileStateGroup {
7757
+ return FileStateGroup.fromPartial(base ?? ({} as any));
7758
+ },
7759
+ fromPartial<I extends Exact<DeepPartial<FileStateGroup>, I>>(object: I): FileStateGroup {
7760
+ const message = createBaseFileStateGroup();
7761
+ message.key = object.key ?? "";
7762
+ message.tiers = (object.tiers !== undefined && object.tiers !== null)
7763
+ ? FileStateTiers.fromPartial(object.tiers)
7764
+ : undefined;
7765
+ return message;
7766
+ },
7767
+ };
7768
+
7769
+ function createBaseAITokenUsage(): AITokenUsage {
7770
+ return { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, providerCostUsd: 0 };
7771
+ }
7772
+
7773
+ export const AITokenUsage: MessageFns<AITokenUsage> = {
7774
+ encode(message: AITokenUsage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
7775
+ if (message.inputTokens !== 0) {
7776
+ writer.uint32(8).uint64(message.inputTokens);
7777
+ }
7778
+ if (message.outputTokens !== 0) {
7779
+ writer.uint32(16).uint64(message.outputTokens);
7780
+ }
7781
+ if (message.cacheReadTokens !== 0) {
7782
+ writer.uint32(24).uint64(message.cacheReadTokens);
7783
+ }
7784
+ if (message.cacheWriteTokens !== 0) {
7785
+ writer.uint32(32).uint64(message.cacheWriteTokens);
7786
+ }
7787
+ if (message.providerCostUsd !== 0) {
7788
+ writer.uint32(41).double(message.providerCostUsd);
7789
+ }
7790
+ return writer;
7791
+ },
7792
+
7793
+ decode(input: BinaryReader | Uint8Array, length?: number): AITokenUsage {
7794
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
7795
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
7796
+ if (previousRecursionDepth >= 100) {
7797
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
7798
+ }
7799
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
7800
+ try {
7801
+ const end = length === undefined ? reader.len : reader.pos + length;
7802
+ const message = createBaseAITokenUsage();
7803
+ while (reader.pos < end) {
7804
+ const tag = reader.uint32();
7805
+ switch (tag >>> 3) {
7806
+ case 1: {
7807
+ if (tag !== 8) {
7808
+ break;
7809
+ }
7810
+
7811
+ message.inputTokens = longToNumber(reader.uint64());
7812
+ continue;
7813
+ }
7814
+ case 2: {
7815
+ if (tag !== 16) {
7816
+ break;
7817
+ }
7818
+
7819
+ message.outputTokens = longToNumber(reader.uint64());
7820
+ continue;
7821
+ }
7822
+ case 3: {
7823
+ if (tag !== 24) {
7824
+ break;
7825
+ }
7826
+
7827
+ message.cacheReadTokens = longToNumber(reader.uint64());
7828
+ continue;
7829
+ }
7830
+ case 4: {
7831
+ if (tag !== 32) {
7832
+ break;
7833
+ }
7834
+
7835
+ message.cacheWriteTokens = longToNumber(reader.uint64());
7836
+ continue;
7837
+ }
7838
+ case 5: {
7839
+ if (tag !== 41) {
7840
+ break;
7841
+ }
7842
+
7843
+ message.providerCostUsd = reader.double();
7844
+ continue;
7845
+ }
7846
+ }
7847
+ if ((tag & 7) === 4 || tag === 0) {
7848
+ break;
7849
+ }
7850
+ reader.skip(tag & 7);
7851
+ }
7852
+ return message;
7853
+ } finally {
7854
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
7855
+ }
7856
+ },
7857
+
7858
+ fromJSON(object: any): AITokenUsage {
7859
+ return {
7860
+ inputTokens: isSet(object.inputTokens)
7861
+ ? globalThis.Number(object.inputTokens)
7862
+ : isSet(object.input_tokens)
7863
+ ? globalThis.Number(object.input_tokens)
7864
+ : 0,
7865
+ outputTokens: isSet(object.outputTokens)
4674
7866
  ? globalThis.Number(object.outputTokens)
4675
7867
  : isSet(object.output_tokens)
4676
7868
  ? globalThis.Number(object.output_tokens)
@@ -4685,10 +7877,10 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4685
7877
  : isSet(object.cache_write_tokens)
4686
7878
  ? globalThis.Number(object.cache_write_tokens)
4687
7879
  : 0,
4688
- providerCostUsdNano: isSet(object.providerCostUsdNano)
4689
- ? globalThis.Number(object.providerCostUsdNano)
4690
- : isSet(object.provider_cost_usd_nano)
4691
- ? globalThis.Number(object.provider_cost_usd_nano)
7880
+ providerCostUsd: isSet(object.providerCostUsd)
7881
+ ? globalThis.Number(object.providerCostUsd)
7882
+ : isSet(object.provider_cost_usd)
7883
+ ? globalThis.Number(object.provider_cost_usd)
4692
7884
  : 0,
4693
7885
  };
4694
7886
  },
@@ -4707,8 +7899,8 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4707
7899
  if (message.cacheWriteTokens !== 0) {
4708
7900
  obj.cacheWriteTokens = Math.round(message.cacheWriteTokens);
4709
7901
  }
4710
- if (message.providerCostUsdNano !== 0) {
4711
- obj.providerCostUsdNano = Math.round(message.providerCostUsdNano);
7902
+ if (message.providerCostUsd !== 0) {
7903
+ obj.providerCostUsd = message.providerCostUsd;
4712
7904
  }
4713
7905
  return obj;
4714
7906
  },
@@ -4722,7 +7914,7 @@ export const AITokenUsage: MessageFns<AITokenUsage> = {
4722
7914
  message.outputTokens = object.outputTokens ?? 0;
4723
7915
  message.cacheReadTokens = object.cacheReadTokens ?? 0;
4724
7916
  message.cacheWriteTokens = object.cacheWriteTokens ?? 0;
4725
- message.providerCostUsdNano = object.providerCostUsdNano ?? 0;
7917
+ message.providerCostUsd = object.providerCostUsd ?? 0;
4726
7918
  return message;
4727
7919
  },
4728
7920
  };
@@ -4751,12 +7943,29 @@ export interface AIGatewayService {
4751
7943
  StreamSessionEvents(request: StreamSessionEventsRequest, metadata?: Metadata): Observable<AISessionEventEnvelope>;
4752
7944
  ListPrincipals(request: ListPrincipalsRequest, metadata?: Metadata): Promise<ListPrincipalsResponse>;
4753
7945
  UpdatePrincipal(request: UpdatePrincipalRequest, metadata?: Metadata): Promise<UpdatePrincipalResponse>;
7946
+ /** Filtered, keyset-paginated drill-down feed of git/GitHub actions (newest first). */
4754
7947
  ListGitActivities(request: ListGitActivitiesRequest, metadata?: Metadata): Promise<ListGitActivitiesResponse>;
4755
7948
  /**
4756
- * Live stream of one session's git/GitHub actions (UPSERT per activity keyed by
7949
+ * Live stream of the filtered git/GitHub feed (UPSERT per activity keyed by
4757
7950
  * activity_id, a nonterminal GitActivitiesSnapshotCompleted, then open until cancel).
4758
7951
  */
4759
7952
  StreamGitActivities(request: StreamGitActivitiesRequest, metadata?: Metadata): Observable<GitActivityFrame>;
7953
+ /**
7954
+ * Time-bucketed rollup of the filtered git activities, sliced by one dimension —
7955
+ * the git dashboard's overview; whole-window totals ride the response.
7956
+ */
7957
+ GetGitActivitySummary(
7958
+ request: GitActivitySummaryRequest,
7959
+ metadata?: Metadata,
7960
+ ): Promise<GetGitActivitySummaryResponse>;
7961
+ /** Live stream of that rollup: a full windowed snapshot re-derived each tick. */
7962
+ StreamGitActivitySummary(request: GitActivitySummaryRequest, metadata?: Metadata): Observable<GitActivitySummary>;
7963
+ /** Per-file working-state feed (keyset-paginated) behind the unlanded-work funnel. */
7964
+ ListFileStates(request: ListFileStatesRequest, metadata?: Metadata): Promise<ListFileStatesResponse>;
7965
+ /** The unlanded-work funnel: aging tiers + discarded (git-invisible churn), observed vs unverified. */
7966
+ GetFileStateSummary(request: FileStateSummaryRequest, metadata?: Metadata): Promise<GetFileStateSummaryResponse>;
7967
+ /** Live stream of the funnel: a complete snapshot re-derived each tick. */
7968
+ StreamFileStateSummary(request: FileStateSummaryRequest, metadata?: Metadata): Observable<FileStateSummary>;
4760
7969
  }
4761
7970
 
4762
7971
  export const AIGatewayServiceServiceName = "gateway.web.v1.AIGatewayService";
@@ -4774,6 +7983,11 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
4774
7983
  this.UpdatePrincipal = this.UpdatePrincipal.bind(this);
4775
7984
  this.ListGitActivities = this.ListGitActivities.bind(this);
4776
7985
  this.StreamGitActivities = this.StreamGitActivities.bind(this);
7986
+ this.GetGitActivitySummary = this.GetGitActivitySummary.bind(this);
7987
+ this.StreamGitActivitySummary = this.StreamGitActivitySummary.bind(this);
7988
+ this.ListFileStates = this.ListFileStates.bind(this);
7989
+ this.GetFileStateSummary = this.GetFileStateSummary.bind(this);
7990
+ this.StreamFileStateSummary = this.StreamFileStateSummary.bind(this);
4777
7991
  }
4778
7992
  ListSessions(request: ListSessionsRequest, metadata?: Metadata): Promise<ListSessionsResponse> {
4779
7993
  const data = ListSessionsRequest.encode(request).finish();
@@ -4822,6 +8036,39 @@ export class AIGatewayServiceClientImpl implements AIGatewayService {
4822
8036
  const result = this.rpc.serverStreamingRequest(this.service, "StreamGitActivities", data, metadata);
4823
8037
  return result.pipe(map((data) => GitActivityFrame.decode(new BinaryReader(data))));
4824
8038
  }
8039
+
8040
+ GetGitActivitySummary(
8041
+ request: GitActivitySummaryRequest,
8042
+ metadata?: Metadata,
8043
+ ): Promise<GetGitActivitySummaryResponse> {
8044
+ const data = GitActivitySummaryRequest.encode(request).finish();
8045
+ const promise = this.rpc.request(this.service, "GetGitActivitySummary", data, metadata);
8046
+ return promise.then((data) => GetGitActivitySummaryResponse.decode(new BinaryReader(data)));
8047
+ }
8048
+
8049
+ StreamGitActivitySummary(request: GitActivitySummaryRequest, metadata?: Metadata): Observable<GitActivitySummary> {
8050
+ const data = GitActivitySummaryRequest.encode(request).finish();
8051
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamGitActivitySummary", data, metadata);
8052
+ return result.pipe(map((data) => GitActivitySummary.decode(new BinaryReader(data))));
8053
+ }
8054
+
8055
+ ListFileStates(request: ListFileStatesRequest, metadata?: Metadata): Promise<ListFileStatesResponse> {
8056
+ const data = ListFileStatesRequest.encode(request).finish();
8057
+ const promise = this.rpc.request(this.service, "ListFileStates", data, metadata);
8058
+ return promise.then((data) => ListFileStatesResponse.decode(new BinaryReader(data)));
8059
+ }
8060
+
8061
+ GetFileStateSummary(request: FileStateSummaryRequest, metadata?: Metadata): Promise<GetFileStateSummaryResponse> {
8062
+ const data = FileStateSummaryRequest.encode(request).finish();
8063
+ const promise = this.rpc.request(this.service, "GetFileStateSummary", data, metadata);
8064
+ return promise.then((data) => GetFileStateSummaryResponse.decode(new BinaryReader(data)));
8065
+ }
8066
+
8067
+ StreamFileStateSummary(request: FileStateSummaryRequest, metadata?: Metadata): Observable<FileStateSummary> {
8068
+ const data = FileStateSummaryRequest.encode(request).finish();
8069
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamFileStateSummary", data, metadata);
8070
+ return result.pipe(map((data) => FileStateSummary.decode(new BinaryReader(data))));
8071
+ }
4825
8072
  }
4826
8073
 
4827
8074
  interface Rpc {