@miradorlabs/web-grpc 2.37.0 → 2.39.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.
@@ -0,0 +1,3592 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.2
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/ai_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Observable } from "rxjs";
11
+ import { map } from "rxjs/operators";
12
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
13
+ import { ResponseStatus } from "../../common/v1/status";
14
+
15
+ export const protobufPackage = "gateway.web.v1";
16
+
17
+ export enum AISessionEventKind {
18
+ AI_SESSION_EVENT_KIND_UNSPECIFIED = 0,
19
+ AI_SESSION_EVENT_KIND_SESSION_START = 1,
20
+ AI_SESSION_EVENT_KIND_TURN_START = 2,
21
+ AI_SESSION_EVENT_KIND_USER_MESSAGE = 3,
22
+ AI_SESSION_EVENT_KIND_ASSISTANT_MESSAGE = 4,
23
+ AI_SESSION_EVENT_KIND_MODEL_CALL = 5,
24
+ AI_SESSION_EVENT_KIND_TOOL_CALL = 6,
25
+ AI_SESSION_EVENT_KIND_TOOL_RESULT = 7,
26
+ AI_SESSION_EVENT_KIND_TOOL_DECISION = 8,
27
+ AI_SESSION_EVENT_KIND_COMPACTION = 9,
28
+ AI_SESSION_EVENT_KIND_ERROR = 10,
29
+ UNRECOGNIZED = -1,
30
+ }
31
+
32
+ export function aISessionEventKindFromJSON(object: any): AISessionEventKind {
33
+ switch (object) {
34
+ case 0:
35
+ case "AI_SESSION_EVENT_KIND_UNSPECIFIED":
36
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_UNSPECIFIED;
37
+ case 1:
38
+ case "AI_SESSION_EVENT_KIND_SESSION_START":
39
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_SESSION_START;
40
+ case 2:
41
+ case "AI_SESSION_EVENT_KIND_TURN_START":
42
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_TURN_START;
43
+ case 3:
44
+ case "AI_SESSION_EVENT_KIND_USER_MESSAGE":
45
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_USER_MESSAGE;
46
+ case 4:
47
+ case "AI_SESSION_EVENT_KIND_ASSISTANT_MESSAGE":
48
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_ASSISTANT_MESSAGE;
49
+ case 5:
50
+ case "AI_SESSION_EVENT_KIND_MODEL_CALL":
51
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_MODEL_CALL;
52
+ case 6:
53
+ case "AI_SESSION_EVENT_KIND_TOOL_CALL":
54
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_CALL;
55
+ case 7:
56
+ case "AI_SESSION_EVENT_KIND_TOOL_RESULT":
57
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_RESULT;
58
+ case 8:
59
+ case "AI_SESSION_EVENT_KIND_TOOL_DECISION":
60
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_DECISION;
61
+ case 9:
62
+ case "AI_SESSION_EVENT_KIND_COMPACTION":
63
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_COMPACTION;
64
+ case 10:
65
+ case "AI_SESSION_EVENT_KIND_ERROR":
66
+ return AISessionEventKind.AI_SESSION_EVENT_KIND_ERROR;
67
+ case -1:
68
+ case "UNRECOGNIZED":
69
+ default:
70
+ return AISessionEventKind.UNRECOGNIZED;
71
+ }
72
+ }
73
+
74
+ export function aISessionEventKindToJSON(object: AISessionEventKind): string {
75
+ switch (object) {
76
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_UNSPECIFIED:
77
+ return "AI_SESSION_EVENT_KIND_UNSPECIFIED";
78
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_SESSION_START:
79
+ return "AI_SESSION_EVENT_KIND_SESSION_START";
80
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_TURN_START:
81
+ return "AI_SESSION_EVENT_KIND_TURN_START";
82
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_USER_MESSAGE:
83
+ return "AI_SESSION_EVENT_KIND_USER_MESSAGE";
84
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_ASSISTANT_MESSAGE:
85
+ return "AI_SESSION_EVENT_KIND_ASSISTANT_MESSAGE";
86
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_MODEL_CALL:
87
+ return "AI_SESSION_EVENT_KIND_MODEL_CALL";
88
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_CALL:
89
+ return "AI_SESSION_EVENT_KIND_TOOL_CALL";
90
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_RESULT:
91
+ return "AI_SESSION_EVENT_KIND_TOOL_RESULT";
92
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_TOOL_DECISION:
93
+ return "AI_SESSION_EVENT_KIND_TOOL_DECISION";
94
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_COMPACTION:
95
+ return "AI_SESSION_EVENT_KIND_COMPACTION";
96
+ case AISessionEventKind.AI_SESSION_EVENT_KIND_ERROR:
97
+ return "AI_SESSION_EVENT_KIND_ERROR";
98
+ case AISessionEventKind.UNRECOGNIZED:
99
+ default:
100
+ return "UNRECOGNIZED";
101
+ }
102
+ }
103
+
104
+ export enum AIPrincipalKind {
105
+ AI_PRINCIPAL_KIND_UNSPECIFIED = 0,
106
+ AI_PRINCIPAL_KIND_USER = 1,
107
+ AI_PRINCIPAL_KIND_API_KEY = 2,
108
+ UNRECOGNIZED = -1,
109
+ }
110
+
111
+ export function aIPrincipalKindFromJSON(object: any): AIPrincipalKind {
112
+ switch (object) {
113
+ case 0:
114
+ case "AI_PRINCIPAL_KIND_UNSPECIFIED":
115
+ return AIPrincipalKind.AI_PRINCIPAL_KIND_UNSPECIFIED;
116
+ case 1:
117
+ case "AI_PRINCIPAL_KIND_USER":
118
+ return AIPrincipalKind.AI_PRINCIPAL_KIND_USER;
119
+ case 2:
120
+ case "AI_PRINCIPAL_KIND_API_KEY":
121
+ return AIPrincipalKind.AI_PRINCIPAL_KIND_API_KEY;
122
+ case -1:
123
+ case "UNRECOGNIZED":
124
+ default:
125
+ return AIPrincipalKind.UNRECOGNIZED;
126
+ }
127
+ }
128
+
129
+ export function aIPrincipalKindToJSON(object: AIPrincipalKind): string {
130
+ switch (object) {
131
+ case AIPrincipalKind.AI_PRINCIPAL_KIND_UNSPECIFIED:
132
+ return "AI_PRINCIPAL_KIND_UNSPECIFIED";
133
+ case AIPrincipalKind.AI_PRINCIPAL_KIND_USER:
134
+ return "AI_PRINCIPAL_KIND_USER";
135
+ case AIPrincipalKind.AI_PRINCIPAL_KIND_API_KEY:
136
+ return "AI_PRINCIPAL_KIND_API_KEY";
137
+ case AIPrincipalKind.UNRECOGNIZED:
138
+ default:
139
+ return "UNRECOGNIZED";
140
+ }
141
+ }
142
+
143
+ export enum AIGitAction {
144
+ AI_GIT_ACTION_UNSPECIFIED = 0,
145
+ AI_GIT_ACTION_BRANCH_CREATE = 1,
146
+ AI_GIT_ACTION_COMMIT = 2,
147
+ AI_GIT_ACTION_PUSH = 3,
148
+ AI_GIT_ACTION_PULL_REQUEST_CREATE = 4,
149
+ AI_GIT_ACTION_PULL_REQUEST_MERGE = 5,
150
+ AI_GIT_ACTION_PULL_REQUEST_COMMENT = 6,
151
+ AI_GIT_ACTION_OTHER = 7,
152
+ UNRECOGNIZED = -1,
153
+ }
154
+
155
+ export function aIGitActionFromJSON(object: any): AIGitAction {
156
+ switch (object) {
157
+ case 0:
158
+ case "AI_GIT_ACTION_UNSPECIFIED":
159
+ return AIGitAction.AI_GIT_ACTION_UNSPECIFIED;
160
+ case 1:
161
+ case "AI_GIT_ACTION_BRANCH_CREATE":
162
+ return AIGitAction.AI_GIT_ACTION_BRANCH_CREATE;
163
+ case 2:
164
+ case "AI_GIT_ACTION_COMMIT":
165
+ return AIGitAction.AI_GIT_ACTION_COMMIT;
166
+ case 3:
167
+ case "AI_GIT_ACTION_PUSH":
168
+ return AIGitAction.AI_GIT_ACTION_PUSH;
169
+ case 4:
170
+ case "AI_GIT_ACTION_PULL_REQUEST_CREATE":
171
+ return AIGitAction.AI_GIT_ACTION_PULL_REQUEST_CREATE;
172
+ case 5:
173
+ case "AI_GIT_ACTION_PULL_REQUEST_MERGE":
174
+ return AIGitAction.AI_GIT_ACTION_PULL_REQUEST_MERGE;
175
+ case 6:
176
+ case "AI_GIT_ACTION_PULL_REQUEST_COMMENT":
177
+ return AIGitAction.AI_GIT_ACTION_PULL_REQUEST_COMMENT;
178
+ case 7:
179
+ case "AI_GIT_ACTION_OTHER":
180
+ return AIGitAction.AI_GIT_ACTION_OTHER;
181
+ case -1:
182
+ case "UNRECOGNIZED":
183
+ default:
184
+ return AIGitAction.UNRECOGNIZED;
185
+ }
186
+ }
187
+
188
+ export function aIGitActionToJSON(object: AIGitAction): string {
189
+ switch (object) {
190
+ case AIGitAction.AI_GIT_ACTION_UNSPECIFIED:
191
+ return "AI_GIT_ACTION_UNSPECIFIED";
192
+ case AIGitAction.AI_GIT_ACTION_BRANCH_CREATE:
193
+ return "AI_GIT_ACTION_BRANCH_CREATE";
194
+ case AIGitAction.AI_GIT_ACTION_COMMIT:
195
+ return "AI_GIT_ACTION_COMMIT";
196
+ case AIGitAction.AI_GIT_ACTION_PUSH:
197
+ return "AI_GIT_ACTION_PUSH";
198
+ case AIGitAction.AI_GIT_ACTION_PULL_REQUEST_CREATE:
199
+ return "AI_GIT_ACTION_PULL_REQUEST_CREATE";
200
+ case AIGitAction.AI_GIT_ACTION_PULL_REQUEST_MERGE:
201
+ return "AI_GIT_ACTION_PULL_REQUEST_MERGE";
202
+ case AIGitAction.AI_GIT_ACTION_PULL_REQUEST_COMMENT:
203
+ return "AI_GIT_ACTION_PULL_REQUEST_COMMENT";
204
+ case AIGitAction.AI_GIT_ACTION_OTHER:
205
+ return "AI_GIT_ACTION_OTHER";
206
+ case AIGitAction.UNRECOGNIZED:
207
+ default:
208
+ return "UNRECOGNIZED";
209
+ }
210
+ }
211
+
212
+ export enum AIGitOutcome {
213
+ AI_GIT_OUTCOME_UNSPECIFIED = 0,
214
+ AI_GIT_OUTCOME_ATTEMPTED = 1,
215
+ AI_GIT_OUTCOME_CONFIRMED = 2,
216
+ AI_GIT_OUTCOME_FAILED = 3,
217
+ UNRECOGNIZED = -1,
218
+ }
219
+
220
+ export function aIGitOutcomeFromJSON(object: any): AIGitOutcome {
221
+ switch (object) {
222
+ case 0:
223
+ case "AI_GIT_OUTCOME_UNSPECIFIED":
224
+ return AIGitOutcome.AI_GIT_OUTCOME_UNSPECIFIED;
225
+ case 1:
226
+ case "AI_GIT_OUTCOME_ATTEMPTED":
227
+ return AIGitOutcome.AI_GIT_OUTCOME_ATTEMPTED;
228
+ case 2:
229
+ case "AI_GIT_OUTCOME_CONFIRMED":
230
+ return AIGitOutcome.AI_GIT_OUTCOME_CONFIRMED;
231
+ case 3:
232
+ case "AI_GIT_OUTCOME_FAILED":
233
+ return AIGitOutcome.AI_GIT_OUTCOME_FAILED;
234
+ case -1:
235
+ case "UNRECOGNIZED":
236
+ default:
237
+ return AIGitOutcome.UNRECOGNIZED;
238
+ }
239
+ }
240
+
241
+ export function aIGitOutcomeToJSON(object: AIGitOutcome): string {
242
+ switch (object) {
243
+ case AIGitOutcome.AI_GIT_OUTCOME_UNSPECIFIED:
244
+ return "AI_GIT_OUTCOME_UNSPECIFIED";
245
+ case AIGitOutcome.AI_GIT_OUTCOME_ATTEMPTED:
246
+ return "AI_GIT_OUTCOME_ATTEMPTED";
247
+ case AIGitOutcome.AI_GIT_OUTCOME_CONFIRMED:
248
+ return "AI_GIT_OUTCOME_CONFIRMED";
249
+ case AIGitOutcome.AI_GIT_OUTCOME_FAILED:
250
+ return "AI_GIT_OUTCOME_FAILED";
251
+ case AIGitOutcome.UNRECOGNIZED:
252
+ default:
253
+ return "UNRECOGNIZED";
254
+ }
255
+ }
256
+
257
+ export interface ListSessionsRequest {
258
+ organizationId: string;
259
+ projectId: string;
260
+ filter: AISessionFilter | undefined;
261
+ pageSize: number;
262
+ pageToken: string;
263
+ }
264
+
265
+ export interface AISessionFilter {
266
+ sourceSystem: string[];
267
+ userId: string[];
268
+ apiKeyId: string[];
269
+ model: string[];
270
+ startedAfter?: Date | undefined;
271
+ startedBefore?: Date | undefined;
272
+ }
273
+
274
+ export interface ListSessionsResponse {
275
+ status: ResponseStatus | undefined;
276
+ sessions: AISession[];
277
+ nextPageToken: string;
278
+ totalCount?: number | undefined;
279
+ }
280
+
281
+ export interface AISession {
282
+ routingKey: string;
283
+ sourceSystem: string;
284
+ sessionId: string;
285
+ userId: string;
286
+ apiKeyId: string;
287
+ subjectOrganizationId: string;
288
+ firstSessionTime: Date | undefined;
289
+ lastActivityAt: Date | undefined;
290
+ turns: number;
291
+ modelCalls: number;
292
+ toolCalls: number;
293
+ userMessages: number;
294
+ usage: AITokenUsage | undefined;
295
+ models: string[];
296
+ providers: string[];
297
+ branchesCreated: number;
298
+ commits: number;
299
+ gitPushes: number;
300
+ pullRequestsCreated: number;
301
+ pullRequestsMerged: number;
302
+ gitOrgs: string[];
303
+ repositories: string[];
304
+ filesTouched: number;
305
+ }
306
+
307
+ export interface StreamSessionRequest {
308
+ organizationId: string;
309
+ projectId: string;
310
+ routingKey: string;
311
+ sourceSystem: string;
312
+ }
313
+
314
+ export interface AISessionEventEnvelope {
315
+ event?: AISessionEvent | undefined;
316
+ completed?: ReplayCompleted | undefined;
317
+ }
318
+
319
+ export interface ReplayCompleted {
320
+ }
321
+
322
+ export interface AISessionEvent {
323
+ kind: AISessionEventKind;
324
+ sequence?: number | undefined;
325
+ eventTime: Date | undefined;
326
+ turnId: string;
327
+ content: AIContentPart[];
328
+ usage: AITokenUsage | undefined;
329
+ model: string;
330
+ provider: string;
331
+ toolName: string;
332
+ status: string;
333
+ finishReason: string;
334
+ durationMs?: number | undefined;
335
+ ttftMs?: number | undefined;
336
+ modelCallId: string;
337
+ toolCallId: string;
338
+ }
339
+
340
+ export interface AIContentPart {
341
+ partIndex: number;
342
+ contentType: string;
343
+ content: string;
344
+ }
345
+
346
+ export interface ListPrincipalsRequest {
347
+ organizationId: string;
348
+ projectId: string;
349
+ kind?: AIPrincipalKind | undefined;
350
+ sourceSystem: string;
351
+ pageSize: number;
352
+ pageToken: string;
353
+ }
354
+
355
+ export interface ListPrincipalsResponse {
356
+ status: ResponseStatus | undefined;
357
+ principals: AIPrincipal[];
358
+ nextPageToken: string;
359
+ }
360
+
361
+ export interface AIPrincipal {
362
+ kind: AIPrincipalKind;
363
+ id: string;
364
+ name: string;
365
+ sourceSystem: string;
366
+ alias: string;
367
+ }
368
+
369
+ export interface UpdatePrincipalRequest {
370
+ organizationId: string;
371
+ projectId: string;
372
+ kind: AIPrincipalKind;
373
+ id: string;
374
+ sourceSystem: string;
375
+ alias: string;
376
+ }
377
+
378
+ export interface UpdatePrincipalResponse {
379
+ status: ResponseStatus | undefined;
380
+ principal: AIPrincipal | undefined;
381
+ }
382
+
383
+ export interface ListGitActivitiesRequest {
384
+ organizationId: string;
385
+ projectId: string;
386
+ routingKey: string;
387
+ sourceSystem: string;
388
+ }
389
+
390
+ export interface ListGitActivitiesResponse {
391
+ status: ResponseStatus | undefined;
392
+ activities: AIGitActivity[];
393
+ }
394
+
395
+ export interface AIGitActivity {
396
+ eventTime: Date | undefined;
397
+ sourceSystem: string;
398
+ sessionId: string;
399
+ toolCallId: string;
400
+ action: AIGitAction;
401
+ outcome: AIGitOutcome;
402
+ ownerKey: string;
403
+ repositoryKey: string;
404
+ refName: string;
405
+ commitSha: string;
406
+ pullRequestNumber: number;
407
+ pullRequestUrl: string;
408
+ }
409
+
410
+ export interface AITokenUsage {
411
+ inputTokens: number;
412
+ outputTokens: number;
413
+ cacheReadTokens: number;
414
+ cacheWriteTokens: number;
415
+ providerCostUsdNano: number;
416
+ }
417
+
418
+ function createBaseListSessionsRequest(): ListSessionsRequest {
419
+ return { organizationId: "", projectId: "", filter: undefined, pageSize: 0, pageToken: "" };
420
+ }
421
+
422
+ export const ListSessionsRequest: MessageFns<ListSessionsRequest> = {
423
+ encode(message: ListSessionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
424
+ if (message.organizationId !== "") {
425
+ writer.uint32(10).string(message.organizationId);
426
+ }
427
+ if (message.projectId !== "") {
428
+ writer.uint32(18).string(message.projectId);
429
+ }
430
+ if (message.filter !== undefined) {
431
+ AISessionFilter.encode(message.filter, writer.uint32(26).fork()).join();
432
+ }
433
+ if (message.pageSize !== 0) {
434
+ writer.uint32(32).int32(message.pageSize);
435
+ }
436
+ if (message.pageToken !== "") {
437
+ writer.uint32(42).string(message.pageToken);
438
+ }
439
+ return writer;
440
+ },
441
+
442
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSessionsRequest {
443
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
444
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
445
+ if (previousRecursionDepth >= 100) {
446
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
447
+ }
448
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
449
+ try {
450
+ const end = length === undefined ? reader.len : reader.pos + length;
451
+ const message = createBaseListSessionsRequest();
452
+ while (reader.pos < end) {
453
+ const tag = reader.uint32();
454
+ switch (tag >>> 3) {
455
+ case 1: {
456
+ if (tag !== 10) {
457
+ break;
458
+ }
459
+
460
+ message.organizationId = reader.string();
461
+ continue;
462
+ }
463
+ case 2: {
464
+ if (tag !== 18) {
465
+ break;
466
+ }
467
+
468
+ message.projectId = reader.string();
469
+ continue;
470
+ }
471
+ case 3: {
472
+ if (tag !== 26) {
473
+ break;
474
+ }
475
+
476
+ message.filter = AISessionFilter.decode(reader, reader.uint32());
477
+ continue;
478
+ }
479
+ case 4: {
480
+ if (tag !== 32) {
481
+ break;
482
+ }
483
+
484
+ message.pageSize = reader.int32();
485
+ continue;
486
+ }
487
+ case 5: {
488
+ if (tag !== 42) {
489
+ break;
490
+ }
491
+
492
+ message.pageToken = reader.string();
493
+ continue;
494
+ }
495
+ }
496
+ if ((tag & 7) === 4 || tag === 0) {
497
+ break;
498
+ }
499
+ reader.skip(tag & 7);
500
+ }
501
+ return message;
502
+ } finally {
503
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
504
+ }
505
+ },
506
+
507
+ fromJSON(object: any): ListSessionsRequest {
508
+ return {
509
+ organizationId: isSet(object.organizationId)
510
+ ? globalThis.String(object.organizationId)
511
+ : isSet(object.organization_id)
512
+ ? globalThis.String(object.organization_id)
513
+ : "",
514
+ projectId: isSet(object.projectId)
515
+ ? globalThis.String(object.projectId)
516
+ : isSet(object.project_id)
517
+ ? globalThis.String(object.project_id)
518
+ : "",
519
+ filter: isSet(object.filter) ? AISessionFilter.fromJSON(object.filter) : undefined,
520
+ pageSize: isSet(object.pageSize)
521
+ ? globalThis.Number(object.pageSize)
522
+ : isSet(object.page_size)
523
+ ? globalThis.Number(object.page_size)
524
+ : 0,
525
+ pageToken: isSet(object.pageToken)
526
+ ? globalThis.String(object.pageToken)
527
+ : isSet(object.page_token)
528
+ ? globalThis.String(object.page_token)
529
+ : "",
530
+ };
531
+ },
532
+
533
+ toJSON(message: ListSessionsRequest): unknown {
534
+ const obj: any = {};
535
+ if (message.organizationId !== "") {
536
+ obj.organizationId = message.organizationId;
537
+ }
538
+ if (message.projectId !== "") {
539
+ obj.projectId = message.projectId;
540
+ }
541
+ if (message.filter !== undefined) {
542
+ obj.filter = AISessionFilter.toJSON(message.filter);
543
+ }
544
+ if (message.pageSize !== 0) {
545
+ obj.pageSize = Math.round(message.pageSize);
546
+ }
547
+ if (message.pageToken !== "") {
548
+ obj.pageToken = message.pageToken;
549
+ }
550
+ return obj;
551
+ },
552
+
553
+ create<I extends Exact<DeepPartial<ListSessionsRequest>, I>>(base?: I): ListSessionsRequest {
554
+ return ListSessionsRequest.fromPartial(base ?? ({} as any));
555
+ },
556
+ fromPartial<I extends Exact<DeepPartial<ListSessionsRequest>, I>>(object: I): ListSessionsRequest {
557
+ const message = createBaseListSessionsRequest();
558
+ message.organizationId = object.organizationId ?? "";
559
+ message.projectId = object.projectId ?? "";
560
+ message.filter = (object.filter !== undefined && object.filter !== null)
561
+ ? AISessionFilter.fromPartial(object.filter)
562
+ : undefined;
563
+ message.pageSize = object.pageSize ?? 0;
564
+ message.pageToken = object.pageToken ?? "";
565
+ return message;
566
+ },
567
+ };
568
+
569
+ function createBaseAISessionFilter(): AISessionFilter {
570
+ return { sourceSystem: [], userId: [], apiKeyId: [], model: [], startedAfter: undefined, startedBefore: undefined };
571
+ }
572
+
573
+ export const AISessionFilter: MessageFns<AISessionFilter> = {
574
+ encode(message: AISessionFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
575
+ for (const v of message.sourceSystem) {
576
+ writer.uint32(10).string(v!);
577
+ }
578
+ for (const v of message.userId) {
579
+ writer.uint32(18).string(v!);
580
+ }
581
+ for (const v of message.apiKeyId) {
582
+ writer.uint32(26).string(v!);
583
+ }
584
+ for (const v of message.model) {
585
+ writer.uint32(34).string(v!);
586
+ }
587
+ if (message.startedAfter !== undefined) {
588
+ Timestamp.encode(toTimestamp(message.startedAfter), writer.uint32(42).fork()).join();
589
+ }
590
+ if (message.startedBefore !== undefined) {
591
+ Timestamp.encode(toTimestamp(message.startedBefore), writer.uint32(50).fork()).join();
592
+ }
593
+ return writer;
594
+ },
595
+
596
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionFilter {
597
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
598
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
599
+ if (previousRecursionDepth >= 100) {
600
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
601
+ }
602
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
603
+ try {
604
+ const end = length === undefined ? reader.len : reader.pos + length;
605
+ const message = createBaseAISessionFilter();
606
+ while (reader.pos < end) {
607
+ const tag = reader.uint32();
608
+ switch (tag >>> 3) {
609
+ case 1: {
610
+ if (tag !== 10) {
611
+ break;
612
+ }
613
+
614
+ message.sourceSystem.push(reader.string());
615
+ continue;
616
+ }
617
+ case 2: {
618
+ if (tag !== 18) {
619
+ break;
620
+ }
621
+
622
+ message.userId.push(reader.string());
623
+ continue;
624
+ }
625
+ case 3: {
626
+ if (tag !== 26) {
627
+ break;
628
+ }
629
+
630
+ message.apiKeyId.push(reader.string());
631
+ continue;
632
+ }
633
+ case 4: {
634
+ if (tag !== 34) {
635
+ break;
636
+ }
637
+
638
+ message.model.push(reader.string());
639
+ continue;
640
+ }
641
+ case 5: {
642
+ if (tag !== 42) {
643
+ break;
644
+ }
645
+
646
+ message.startedAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
647
+ continue;
648
+ }
649
+ case 6: {
650
+ if (tag !== 50) {
651
+ break;
652
+ }
653
+
654
+ message.startedBefore = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
655
+ continue;
656
+ }
657
+ }
658
+ if ((tag & 7) === 4 || tag === 0) {
659
+ break;
660
+ }
661
+ reader.skip(tag & 7);
662
+ }
663
+ return message;
664
+ } finally {
665
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
666
+ }
667
+ },
668
+
669
+ fromJSON(object: any): AISessionFilter {
670
+ return {
671
+ sourceSystem: globalThis.Array.isArray(object?.sourceSystem)
672
+ ? object.sourceSystem.map((e: any) => globalThis.String(e))
673
+ : globalThis.Array.isArray(object?.source_system)
674
+ ? object.source_system.map((e: any) => globalThis.String(e))
675
+ : [],
676
+ userId: globalThis.Array.isArray(object?.userId)
677
+ ? object.userId.map((e: any) => globalThis.String(e))
678
+ : globalThis.Array.isArray(object?.user_id)
679
+ ? object.user_id.map((e: any) => globalThis.String(e))
680
+ : [],
681
+ apiKeyId: globalThis.Array.isArray(object?.apiKeyId)
682
+ ? object.apiKeyId.map((e: any) => globalThis.String(e))
683
+ : globalThis.Array.isArray(object?.api_key_id)
684
+ ? object.api_key_id.map((e: any) => globalThis.String(e))
685
+ : [],
686
+ model: globalThis.Array.isArray(object?.model) ? object.model.map((e: any) => globalThis.String(e)) : [],
687
+ startedAfter: isSet(object.startedAfter)
688
+ ? fromJsonTimestamp(object.startedAfter)
689
+ : isSet(object.started_after)
690
+ ? fromJsonTimestamp(object.started_after)
691
+ : undefined,
692
+ startedBefore: isSet(object.startedBefore)
693
+ ? fromJsonTimestamp(object.startedBefore)
694
+ : isSet(object.started_before)
695
+ ? fromJsonTimestamp(object.started_before)
696
+ : undefined,
697
+ };
698
+ },
699
+
700
+ toJSON(message: AISessionFilter): unknown {
701
+ const obj: any = {};
702
+ if (message.sourceSystem?.length) {
703
+ obj.sourceSystem = message.sourceSystem;
704
+ }
705
+ if (message.userId?.length) {
706
+ obj.userId = message.userId;
707
+ }
708
+ if (message.apiKeyId?.length) {
709
+ obj.apiKeyId = message.apiKeyId;
710
+ }
711
+ if (message.model?.length) {
712
+ obj.model = message.model;
713
+ }
714
+ if (message.startedAfter !== undefined) {
715
+ obj.startedAfter = message.startedAfter.toISOString();
716
+ }
717
+ if (message.startedBefore !== undefined) {
718
+ obj.startedBefore = message.startedBefore.toISOString();
719
+ }
720
+ return obj;
721
+ },
722
+
723
+ create<I extends Exact<DeepPartial<AISessionFilter>, I>>(base?: I): AISessionFilter {
724
+ return AISessionFilter.fromPartial(base ?? ({} as any));
725
+ },
726
+ fromPartial<I extends Exact<DeepPartial<AISessionFilter>, I>>(object: I): AISessionFilter {
727
+ const message = createBaseAISessionFilter();
728
+ message.sourceSystem = object.sourceSystem?.map((e) => e) || [];
729
+ message.userId = object.userId?.map((e) => e) || [];
730
+ message.apiKeyId = object.apiKeyId?.map((e) => e) || [];
731
+ message.model = object.model?.map((e) => e) || [];
732
+ message.startedAfter = object.startedAfter ?? undefined;
733
+ message.startedBefore = object.startedBefore ?? undefined;
734
+ return message;
735
+ },
736
+ };
737
+
738
+ function createBaseListSessionsResponse(): ListSessionsResponse {
739
+ return { status: undefined, sessions: [], nextPageToken: "", totalCount: undefined };
740
+ }
741
+
742
+ export const ListSessionsResponse: MessageFns<ListSessionsResponse> = {
743
+ encode(message: ListSessionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
744
+ if (message.status !== undefined) {
745
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
746
+ }
747
+ for (const v of message.sessions) {
748
+ AISession.encode(v!, writer.uint32(18).fork()).join();
749
+ }
750
+ if (message.nextPageToken !== "") {
751
+ writer.uint32(26).string(message.nextPageToken);
752
+ }
753
+ if (message.totalCount !== undefined) {
754
+ writer.uint32(32).int64(message.totalCount);
755
+ }
756
+ return writer;
757
+ },
758
+
759
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSessionsResponse {
760
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
761
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
762
+ if (previousRecursionDepth >= 100) {
763
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
764
+ }
765
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
766
+ try {
767
+ const end = length === undefined ? reader.len : reader.pos + length;
768
+ const message = createBaseListSessionsResponse();
769
+ while (reader.pos < end) {
770
+ const tag = reader.uint32();
771
+ switch (tag >>> 3) {
772
+ case 1: {
773
+ if (tag !== 10) {
774
+ break;
775
+ }
776
+
777
+ message.status = ResponseStatus.decode(reader, reader.uint32());
778
+ continue;
779
+ }
780
+ case 2: {
781
+ if (tag !== 18) {
782
+ break;
783
+ }
784
+
785
+ message.sessions.push(AISession.decode(reader, reader.uint32()));
786
+ continue;
787
+ }
788
+ case 3: {
789
+ if (tag !== 26) {
790
+ break;
791
+ }
792
+
793
+ message.nextPageToken = reader.string();
794
+ continue;
795
+ }
796
+ case 4: {
797
+ if (tag !== 32) {
798
+ break;
799
+ }
800
+
801
+ message.totalCount = longToNumber(reader.int64());
802
+ continue;
803
+ }
804
+ }
805
+ if ((tag & 7) === 4 || tag === 0) {
806
+ break;
807
+ }
808
+ reader.skip(tag & 7);
809
+ }
810
+ return message;
811
+ } finally {
812
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
813
+ }
814
+ },
815
+
816
+ fromJSON(object: any): ListSessionsResponse {
817
+ return {
818
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
819
+ sessions: globalThis.Array.isArray(object?.sessions)
820
+ ? object.sessions.map((e: any) => AISession.fromJSON(e))
821
+ : [],
822
+ nextPageToken: isSet(object.nextPageToken)
823
+ ? globalThis.String(object.nextPageToken)
824
+ : isSet(object.next_page_token)
825
+ ? globalThis.String(object.next_page_token)
826
+ : "",
827
+ totalCount: isSet(object.totalCount)
828
+ ? globalThis.Number(object.totalCount)
829
+ : isSet(object.total_count)
830
+ ? globalThis.Number(object.total_count)
831
+ : undefined,
832
+ };
833
+ },
834
+
835
+ toJSON(message: ListSessionsResponse): unknown {
836
+ const obj: any = {};
837
+ if (message.status !== undefined) {
838
+ obj.status = ResponseStatus.toJSON(message.status);
839
+ }
840
+ if (message.sessions?.length) {
841
+ obj.sessions = message.sessions.map((e) => AISession.toJSON(e));
842
+ }
843
+ if (message.nextPageToken !== "") {
844
+ obj.nextPageToken = message.nextPageToken;
845
+ }
846
+ if (message.totalCount !== undefined) {
847
+ obj.totalCount = Math.round(message.totalCount);
848
+ }
849
+ return obj;
850
+ },
851
+
852
+ create<I extends Exact<DeepPartial<ListSessionsResponse>, I>>(base?: I): ListSessionsResponse {
853
+ return ListSessionsResponse.fromPartial(base ?? ({} as any));
854
+ },
855
+ fromPartial<I extends Exact<DeepPartial<ListSessionsResponse>, I>>(object: I): ListSessionsResponse {
856
+ const message = createBaseListSessionsResponse();
857
+ message.status = (object.status !== undefined && object.status !== null)
858
+ ? ResponseStatus.fromPartial(object.status)
859
+ : undefined;
860
+ message.sessions = object.sessions?.map((e) => AISession.fromPartial(e)) || [];
861
+ message.nextPageToken = object.nextPageToken ?? "";
862
+ message.totalCount = object.totalCount ?? undefined;
863
+ return message;
864
+ },
865
+ };
866
+
867
+ function createBaseAISession(): AISession {
868
+ return {
869
+ routingKey: "",
870
+ sourceSystem: "",
871
+ sessionId: "",
872
+ userId: "",
873
+ apiKeyId: "",
874
+ subjectOrganizationId: "",
875
+ firstSessionTime: undefined,
876
+ lastActivityAt: undefined,
877
+ turns: 0,
878
+ modelCalls: 0,
879
+ toolCalls: 0,
880
+ userMessages: 0,
881
+ usage: undefined,
882
+ models: [],
883
+ providers: [],
884
+ branchesCreated: 0,
885
+ commits: 0,
886
+ gitPushes: 0,
887
+ pullRequestsCreated: 0,
888
+ pullRequestsMerged: 0,
889
+ gitOrgs: [],
890
+ repositories: [],
891
+ filesTouched: 0,
892
+ };
893
+ }
894
+
895
+ export const AISession: MessageFns<AISession> = {
896
+ encode(message: AISession, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
897
+ if (message.routingKey !== "") {
898
+ writer.uint32(10).string(message.routingKey);
899
+ }
900
+ if (message.sourceSystem !== "") {
901
+ writer.uint32(18).string(message.sourceSystem);
902
+ }
903
+ if (message.sessionId !== "") {
904
+ writer.uint32(26).string(message.sessionId);
905
+ }
906
+ if (message.userId !== "") {
907
+ writer.uint32(34).string(message.userId);
908
+ }
909
+ if (message.apiKeyId !== "") {
910
+ writer.uint32(42).string(message.apiKeyId);
911
+ }
912
+ if (message.subjectOrganizationId !== "") {
913
+ writer.uint32(50).string(message.subjectOrganizationId);
914
+ }
915
+ if (message.firstSessionTime !== undefined) {
916
+ Timestamp.encode(toTimestamp(message.firstSessionTime), writer.uint32(58).fork()).join();
917
+ }
918
+ if (message.lastActivityAt !== undefined) {
919
+ Timestamp.encode(toTimestamp(message.lastActivityAt), writer.uint32(66).fork()).join();
920
+ }
921
+ if (message.turns !== 0) {
922
+ writer.uint32(72).uint64(message.turns);
923
+ }
924
+ if (message.modelCalls !== 0) {
925
+ writer.uint32(80).uint64(message.modelCalls);
926
+ }
927
+ if (message.toolCalls !== 0) {
928
+ writer.uint32(88).uint64(message.toolCalls);
929
+ }
930
+ if (message.userMessages !== 0) {
931
+ writer.uint32(96).uint64(message.userMessages);
932
+ }
933
+ if (message.usage !== undefined) {
934
+ AITokenUsage.encode(message.usage, writer.uint32(106).fork()).join();
935
+ }
936
+ for (const v of message.models) {
937
+ writer.uint32(114).string(v!);
938
+ }
939
+ for (const v of message.providers) {
940
+ writer.uint32(122).string(v!);
941
+ }
942
+ if (message.branchesCreated !== 0) {
943
+ writer.uint32(128).uint64(message.branchesCreated);
944
+ }
945
+ if (message.commits !== 0) {
946
+ writer.uint32(136).uint64(message.commits);
947
+ }
948
+ if (message.gitPushes !== 0) {
949
+ writer.uint32(144).uint64(message.gitPushes);
950
+ }
951
+ if (message.pullRequestsCreated !== 0) {
952
+ writer.uint32(152).uint64(message.pullRequestsCreated);
953
+ }
954
+ if (message.pullRequestsMerged !== 0) {
955
+ writer.uint32(160).uint64(message.pullRequestsMerged);
956
+ }
957
+ for (const v of message.gitOrgs) {
958
+ writer.uint32(170).string(v!);
959
+ }
960
+ for (const v of message.repositories) {
961
+ writer.uint32(178).string(v!);
962
+ }
963
+ if (message.filesTouched !== 0) {
964
+ writer.uint32(184).uint64(message.filesTouched);
965
+ }
966
+ return writer;
967
+ },
968
+
969
+ decode(input: BinaryReader | Uint8Array, length?: number): AISession {
970
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
971
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
972
+ if (previousRecursionDepth >= 100) {
973
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
974
+ }
975
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
976
+ try {
977
+ const end = length === undefined ? reader.len : reader.pos + length;
978
+ const message = createBaseAISession();
979
+ while (reader.pos < end) {
980
+ const tag = reader.uint32();
981
+ switch (tag >>> 3) {
982
+ case 1: {
983
+ if (tag !== 10) {
984
+ break;
985
+ }
986
+
987
+ message.routingKey = reader.string();
988
+ continue;
989
+ }
990
+ case 2: {
991
+ if (tag !== 18) {
992
+ break;
993
+ }
994
+
995
+ message.sourceSystem = reader.string();
996
+ continue;
997
+ }
998
+ case 3: {
999
+ if (tag !== 26) {
1000
+ break;
1001
+ }
1002
+
1003
+ message.sessionId = reader.string();
1004
+ continue;
1005
+ }
1006
+ case 4: {
1007
+ if (tag !== 34) {
1008
+ break;
1009
+ }
1010
+
1011
+ message.userId = reader.string();
1012
+ continue;
1013
+ }
1014
+ case 5: {
1015
+ if (tag !== 42) {
1016
+ break;
1017
+ }
1018
+
1019
+ message.apiKeyId = reader.string();
1020
+ continue;
1021
+ }
1022
+ case 6: {
1023
+ if (tag !== 50) {
1024
+ break;
1025
+ }
1026
+
1027
+ message.subjectOrganizationId = reader.string();
1028
+ continue;
1029
+ }
1030
+ case 7: {
1031
+ if (tag !== 58) {
1032
+ break;
1033
+ }
1034
+
1035
+ message.firstSessionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1036
+ continue;
1037
+ }
1038
+ case 8: {
1039
+ if (tag !== 66) {
1040
+ break;
1041
+ }
1042
+
1043
+ message.lastActivityAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1044
+ continue;
1045
+ }
1046
+ case 9: {
1047
+ if (tag !== 72) {
1048
+ break;
1049
+ }
1050
+
1051
+ message.turns = longToNumber(reader.uint64());
1052
+ continue;
1053
+ }
1054
+ case 10: {
1055
+ if (tag !== 80) {
1056
+ break;
1057
+ }
1058
+
1059
+ message.modelCalls = longToNumber(reader.uint64());
1060
+ continue;
1061
+ }
1062
+ case 11: {
1063
+ if (tag !== 88) {
1064
+ break;
1065
+ }
1066
+
1067
+ message.toolCalls = longToNumber(reader.uint64());
1068
+ continue;
1069
+ }
1070
+ case 12: {
1071
+ if (tag !== 96) {
1072
+ break;
1073
+ }
1074
+
1075
+ message.userMessages = longToNumber(reader.uint64());
1076
+ continue;
1077
+ }
1078
+ case 13: {
1079
+ if (tag !== 106) {
1080
+ break;
1081
+ }
1082
+
1083
+ message.usage = AITokenUsage.decode(reader, reader.uint32());
1084
+ continue;
1085
+ }
1086
+ case 14: {
1087
+ if (tag !== 114) {
1088
+ break;
1089
+ }
1090
+
1091
+ message.models.push(reader.string());
1092
+ continue;
1093
+ }
1094
+ case 15: {
1095
+ if (tag !== 122) {
1096
+ break;
1097
+ }
1098
+
1099
+ message.providers.push(reader.string());
1100
+ continue;
1101
+ }
1102
+ case 16: {
1103
+ if (tag !== 128) {
1104
+ break;
1105
+ }
1106
+
1107
+ message.branchesCreated = longToNumber(reader.uint64());
1108
+ continue;
1109
+ }
1110
+ case 17: {
1111
+ if (tag !== 136) {
1112
+ break;
1113
+ }
1114
+
1115
+ message.commits = longToNumber(reader.uint64());
1116
+ continue;
1117
+ }
1118
+ case 18: {
1119
+ if (tag !== 144) {
1120
+ break;
1121
+ }
1122
+
1123
+ message.gitPushes = longToNumber(reader.uint64());
1124
+ continue;
1125
+ }
1126
+ case 19: {
1127
+ if (tag !== 152) {
1128
+ break;
1129
+ }
1130
+
1131
+ message.pullRequestsCreated = longToNumber(reader.uint64());
1132
+ continue;
1133
+ }
1134
+ case 20: {
1135
+ if (tag !== 160) {
1136
+ break;
1137
+ }
1138
+
1139
+ message.pullRequestsMerged = longToNumber(reader.uint64());
1140
+ continue;
1141
+ }
1142
+ case 21: {
1143
+ if (tag !== 170) {
1144
+ break;
1145
+ }
1146
+
1147
+ message.gitOrgs.push(reader.string());
1148
+ continue;
1149
+ }
1150
+ case 22: {
1151
+ if (tag !== 178) {
1152
+ break;
1153
+ }
1154
+
1155
+ message.repositories.push(reader.string());
1156
+ continue;
1157
+ }
1158
+ case 23: {
1159
+ if (tag !== 184) {
1160
+ break;
1161
+ }
1162
+
1163
+ message.filesTouched = longToNumber(reader.uint64());
1164
+ continue;
1165
+ }
1166
+ }
1167
+ if ((tag & 7) === 4 || tag === 0) {
1168
+ break;
1169
+ }
1170
+ reader.skip(tag & 7);
1171
+ }
1172
+ return message;
1173
+ } finally {
1174
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1175
+ }
1176
+ },
1177
+
1178
+ fromJSON(object: any): AISession {
1179
+ return {
1180
+ routingKey: isSet(object.routingKey)
1181
+ ? globalThis.String(object.routingKey)
1182
+ : isSet(object.routing_key)
1183
+ ? globalThis.String(object.routing_key)
1184
+ : "",
1185
+ sourceSystem: isSet(object.sourceSystem)
1186
+ ? globalThis.String(object.sourceSystem)
1187
+ : isSet(object.source_system)
1188
+ ? globalThis.String(object.source_system)
1189
+ : "",
1190
+ sessionId: isSet(object.sessionId)
1191
+ ? globalThis.String(object.sessionId)
1192
+ : isSet(object.session_id)
1193
+ ? globalThis.String(object.session_id)
1194
+ : "",
1195
+ userId: isSet(object.userId)
1196
+ ? globalThis.String(object.userId)
1197
+ : isSet(object.user_id)
1198
+ ? globalThis.String(object.user_id)
1199
+ : "",
1200
+ apiKeyId: isSet(object.apiKeyId)
1201
+ ? globalThis.String(object.apiKeyId)
1202
+ : isSet(object.api_key_id)
1203
+ ? globalThis.String(object.api_key_id)
1204
+ : "",
1205
+ subjectOrganizationId: isSet(object.subjectOrganizationId)
1206
+ ? globalThis.String(object.subjectOrganizationId)
1207
+ : isSet(object.subject_organization_id)
1208
+ ? globalThis.String(object.subject_organization_id)
1209
+ : "",
1210
+ firstSessionTime: isSet(object.firstSessionTime)
1211
+ ? fromJsonTimestamp(object.firstSessionTime)
1212
+ : isSet(object.first_session_time)
1213
+ ? fromJsonTimestamp(object.first_session_time)
1214
+ : undefined,
1215
+ lastActivityAt: isSet(object.lastActivityAt)
1216
+ ? fromJsonTimestamp(object.lastActivityAt)
1217
+ : isSet(object.last_activity_at)
1218
+ ? fromJsonTimestamp(object.last_activity_at)
1219
+ : undefined,
1220
+ turns: isSet(object.turns) ? globalThis.Number(object.turns) : 0,
1221
+ modelCalls: isSet(object.modelCalls)
1222
+ ? globalThis.Number(object.modelCalls)
1223
+ : isSet(object.model_calls)
1224
+ ? globalThis.Number(object.model_calls)
1225
+ : 0,
1226
+ toolCalls: isSet(object.toolCalls)
1227
+ ? globalThis.Number(object.toolCalls)
1228
+ : isSet(object.tool_calls)
1229
+ ? globalThis.Number(object.tool_calls)
1230
+ : 0,
1231
+ userMessages: isSet(object.userMessages)
1232
+ ? globalThis.Number(object.userMessages)
1233
+ : isSet(object.user_messages)
1234
+ ? globalThis.Number(object.user_messages)
1235
+ : 0,
1236
+ usage: isSet(object.usage) ? AITokenUsage.fromJSON(object.usage) : undefined,
1237
+ models: globalThis.Array.isArray(object?.models)
1238
+ ? object.models.map((e: any) => globalThis.String(e))
1239
+ : [],
1240
+ providers: globalThis.Array.isArray(object?.providers)
1241
+ ? object.providers.map((e: any) => globalThis.String(e))
1242
+ : [],
1243
+ branchesCreated: isSet(object.branchesCreated)
1244
+ ? globalThis.Number(object.branchesCreated)
1245
+ : isSet(object.branches_created)
1246
+ ? globalThis.Number(object.branches_created)
1247
+ : 0,
1248
+ commits: isSet(object.commits) ? globalThis.Number(object.commits) : 0,
1249
+ gitPushes: isSet(object.gitPushes)
1250
+ ? globalThis.Number(object.gitPushes)
1251
+ : isSet(object.git_pushes)
1252
+ ? globalThis.Number(object.git_pushes)
1253
+ : 0,
1254
+ pullRequestsCreated: isSet(object.pullRequestsCreated)
1255
+ ? globalThis.Number(object.pullRequestsCreated)
1256
+ : isSet(object.pull_requests_created)
1257
+ ? globalThis.Number(object.pull_requests_created)
1258
+ : 0,
1259
+ pullRequestsMerged: isSet(object.pullRequestsMerged)
1260
+ ? globalThis.Number(object.pullRequestsMerged)
1261
+ : isSet(object.pull_requests_merged)
1262
+ ? globalThis.Number(object.pull_requests_merged)
1263
+ : 0,
1264
+ gitOrgs: globalThis.Array.isArray(object?.gitOrgs)
1265
+ ? object.gitOrgs.map((e: any) => globalThis.String(e))
1266
+ : globalThis.Array.isArray(object?.git_orgs)
1267
+ ? object.git_orgs.map((e: any) => globalThis.String(e))
1268
+ : [],
1269
+ repositories: globalThis.Array.isArray(object?.repositories)
1270
+ ? object.repositories.map((e: any) => globalThis.String(e))
1271
+ : [],
1272
+ filesTouched: isSet(object.filesTouched)
1273
+ ? globalThis.Number(object.filesTouched)
1274
+ : isSet(object.files_touched)
1275
+ ? globalThis.Number(object.files_touched)
1276
+ : 0,
1277
+ };
1278
+ },
1279
+
1280
+ toJSON(message: AISession): unknown {
1281
+ const obj: any = {};
1282
+ if (message.routingKey !== "") {
1283
+ obj.routingKey = message.routingKey;
1284
+ }
1285
+ if (message.sourceSystem !== "") {
1286
+ obj.sourceSystem = message.sourceSystem;
1287
+ }
1288
+ if (message.sessionId !== "") {
1289
+ obj.sessionId = message.sessionId;
1290
+ }
1291
+ if (message.userId !== "") {
1292
+ obj.userId = message.userId;
1293
+ }
1294
+ if (message.apiKeyId !== "") {
1295
+ obj.apiKeyId = message.apiKeyId;
1296
+ }
1297
+ if (message.subjectOrganizationId !== "") {
1298
+ obj.subjectOrganizationId = message.subjectOrganizationId;
1299
+ }
1300
+ if (message.firstSessionTime !== undefined) {
1301
+ obj.firstSessionTime = message.firstSessionTime.toISOString();
1302
+ }
1303
+ if (message.lastActivityAt !== undefined) {
1304
+ obj.lastActivityAt = message.lastActivityAt.toISOString();
1305
+ }
1306
+ if (message.turns !== 0) {
1307
+ obj.turns = Math.round(message.turns);
1308
+ }
1309
+ if (message.modelCalls !== 0) {
1310
+ obj.modelCalls = Math.round(message.modelCalls);
1311
+ }
1312
+ if (message.toolCalls !== 0) {
1313
+ obj.toolCalls = Math.round(message.toolCalls);
1314
+ }
1315
+ if (message.userMessages !== 0) {
1316
+ obj.userMessages = Math.round(message.userMessages);
1317
+ }
1318
+ if (message.usage !== undefined) {
1319
+ obj.usage = AITokenUsage.toJSON(message.usage);
1320
+ }
1321
+ if (message.models?.length) {
1322
+ obj.models = message.models;
1323
+ }
1324
+ if (message.providers?.length) {
1325
+ obj.providers = message.providers;
1326
+ }
1327
+ if (message.branchesCreated !== 0) {
1328
+ obj.branchesCreated = Math.round(message.branchesCreated);
1329
+ }
1330
+ if (message.commits !== 0) {
1331
+ obj.commits = Math.round(message.commits);
1332
+ }
1333
+ if (message.gitPushes !== 0) {
1334
+ obj.gitPushes = Math.round(message.gitPushes);
1335
+ }
1336
+ if (message.pullRequestsCreated !== 0) {
1337
+ obj.pullRequestsCreated = Math.round(message.pullRequestsCreated);
1338
+ }
1339
+ if (message.pullRequestsMerged !== 0) {
1340
+ obj.pullRequestsMerged = Math.round(message.pullRequestsMerged);
1341
+ }
1342
+ if (message.gitOrgs?.length) {
1343
+ obj.gitOrgs = message.gitOrgs;
1344
+ }
1345
+ if (message.repositories?.length) {
1346
+ obj.repositories = message.repositories;
1347
+ }
1348
+ if (message.filesTouched !== 0) {
1349
+ obj.filesTouched = Math.round(message.filesTouched);
1350
+ }
1351
+ return obj;
1352
+ },
1353
+
1354
+ create<I extends Exact<DeepPartial<AISession>, I>>(base?: I): AISession {
1355
+ return AISession.fromPartial(base ?? ({} as any));
1356
+ },
1357
+ fromPartial<I extends Exact<DeepPartial<AISession>, I>>(object: I): AISession {
1358
+ const message = createBaseAISession();
1359
+ message.routingKey = object.routingKey ?? "";
1360
+ message.sourceSystem = object.sourceSystem ?? "";
1361
+ message.sessionId = object.sessionId ?? "";
1362
+ message.userId = object.userId ?? "";
1363
+ message.apiKeyId = object.apiKeyId ?? "";
1364
+ message.subjectOrganizationId = object.subjectOrganizationId ?? "";
1365
+ message.firstSessionTime = object.firstSessionTime ?? undefined;
1366
+ message.lastActivityAt = object.lastActivityAt ?? undefined;
1367
+ message.turns = object.turns ?? 0;
1368
+ message.modelCalls = object.modelCalls ?? 0;
1369
+ message.toolCalls = object.toolCalls ?? 0;
1370
+ message.userMessages = object.userMessages ?? 0;
1371
+ message.usage = (object.usage !== undefined && object.usage !== null)
1372
+ ? AITokenUsage.fromPartial(object.usage)
1373
+ : undefined;
1374
+ message.models = object.models?.map((e) => e) || [];
1375
+ message.providers = object.providers?.map((e) => e) || [];
1376
+ message.branchesCreated = object.branchesCreated ?? 0;
1377
+ message.commits = object.commits ?? 0;
1378
+ message.gitPushes = object.gitPushes ?? 0;
1379
+ message.pullRequestsCreated = object.pullRequestsCreated ?? 0;
1380
+ message.pullRequestsMerged = object.pullRequestsMerged ?? 0;
1381
+ message.gitOrgs = object.gitOrgs?.map((e) => e) || [];
1382
+ message.repositories = object.repositories?.map((e) => e) || [];
1383
+ message.filesTouched = object.filesTouched ?? 0;
1384
+ return message;
1385
+ },
1386
+ };
1387
+
1388
+ function createBaseStreamSessionRequest(): StreamSessionRequest {
1389
+ return { organizationId: "", projectId: "", routingKey: "", sourceSystem: "" };
1390
+ }
1391
+
1392
+ export const StreamSessionRequest: MessageFns<StreamSessionRequest> = {
1393
+ encode(message: StreamSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1394
+ if (message.organizationId !== "") {
1395
+ writer.uint32(10).string(message.organizationId);
1396
+ }
1397
+ if (message.projectId !== "") {
1398
+ writer.uint32(18).string(message.projectId);
1399
+ }
1400
+ if (message.routingKey !== "") {
1401
+ writer.uint32(26).string(message.routingKey);
1402
+ }
1403
+ if (message.sourceSystem !== "") {
1404
+ writer.uint32(34).string(message.sourceSystem);
1405
+ }
1406
+ return writer;
1407
+ },
1408
+
1409
+ decode(input: BinaryReader | Uint8Array, length?: number): StreamSessionRequest {
1410
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1411
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1412
+ if (previousRecursionDepth >= 100) {
1413
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1414
+ }
1415
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1416
+ try {
1417
+ const end = length === undefined ? reader.len : reader.pos + length;
1418
+ const message = createBaseStreamSessionRequest();
1419
+ while (reader.pos < end) {
1420
+ const tag = reader.uint32();
1421
+ switch (tag >>> 3) {
1422
+ case 1: {
1423
+ if (tag !== 10) {
1424
+ break;
1425
+ }
1426
+
1427
+ message.organizationId = reader.string();
1428
+ continue;
1429
+ }
1430
+ case 2: {
1431
+ if (tag !== 18) {
1432
+ break;
1433
+ }
1434
+
1435
+ message.projectId = reader.string();
1436
+ continue;
1437
+ }
1438
+ case 3: {
1439
+ if (tag !== 26) {
1440
+ break;
1441
+ }
1442
+
1443
+ message.routingKey = reader.string();
1444
+ continue;
1445
+ }
1446
+ case 4: {
1447
+ if (tag !== 34) {
1448
+ break;
1449
+ }
1450
+
1451
+ message.sourceSystem = reader.string();
1452
+ continue;
1453
+ }
1454
+ }
1455
+ if ((tag & 7) === 4 || tag === 0) {
1456
+ break;
1457
+ }
1458
+ reader.skip(tag & 7);
1459
+ }
1460
+ return message;
1461
+ } finally {
1462
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1463
+ }
1464
+ },
1465
+
1466
+ fromJSON(object: any): StreamSessionRequest {
1467
+ return {
1468
+ organizationId: isSet(object.organizationId)
1469
+ ? globalThis.String(object.organizationId)
1470
+ : isSet(object.organization_id)
1471
+ ? globalThis.String(object.organization_id)
1472
+ : "",
1473
+ projectId: isSet(object.projectId)
1474
+ ? globalThis.String(object.projectId)
1475
+ : isSet(object.project_id)
1476
+ ? globalThis.String(object.project_id)
1477
+ : "",
1478
+ routingKey: isSet(object.routingKey)
1479
+ ? globalThis.String(object.routingKey)
1480
+ : isSet(object.routing_key)
1481
+ ? globalThis.String(object.routing_key)
1482
+ : "",
1483
+ sourceSystem: isSet(object.sourceSystem)
1484
+ ? globalThis.String(object.sourceSystem)
1485
+ : isSet(object.source_system)
1486
+ ? globalThis.String(object.source_system)
1487
+ : "",
1488
+ };
1489
+ },
1490
+
1491
+ toJSON(message: StreamSessionRequest): unknown {
1492
+ const obj: any = {};
1493
+ if (message.organizationId !== "") {
1494
+ obj.organizationId = message.organizationId;
1495
+ }
1496
+ if (message.projectId !== "") {
1497
+ obj.projectId = message.projectId;
1498
+ }
1499
+ if (message.routingKey !== "") {
1500
+ obj.routingKey = message.routingKey;
1501
+ }
1502
+ if (message.sourceSystem !== "") {
1503
+ obj.sourceSystem = message.sourceSystem;
1504
+ }
1505
+ return obj;
1506
+ },
1507
+
1508
+ create<I extends Exact<DeepPartial<StreamSessionRequest>, I>>(base?: I): StreamSessionRequest {
1509
+ return StreamSessionRequest.fromPartial(base ?? ({} as any));
1510
+ },
1511
+ fromPartial<I extends Exact<DeepPartial<StreamSessionRequest>, I>>(object: I): StreamSessionRequest {
1512
+ const message = createBaseStreamSessionRequest();
1513
+ message.organizationId = object.organizationId ?? "";
1514
+ message.projectId = object.projectId ?? "";
1515
+ message.routingKey = object.routingKey ?? "";
1516
+ message.sourceSystem = object.sourceSystem ?? "";
1517
+ return message;
1518
+ },
1519
+ };
1520
+
1521
+ function createBaseAISessionEventEnvelope(): AISessionEventEnvelope {
1522
+ return { event: undefined, completed: undefined };
1523
+ }
1524
+
1525
+ export const AISessionEventEnvelope: MessageFns<AISessionEventEnvelope> = {
1526
+ encode(message: AISessionEventEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1527
+ if (message.event !== undefined) {
1528
+ AISessionEvent.encode(message.event, writer.uint32(10).fork()).join();
1529
+ }
1530
+ if (message.completed !== undefined) {
1531
+ ReplayCompleted.encode(message.completed, writer.uint32(18).fork()).join();
1532
+ }
1533
+ return writer;
1534
+ },
1535
+
1536
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionEventEnvelope {
1537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1538
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1539
+ if (previousRecursionDepth >= 100) {
1540
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1541
+ }
1542
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1543
+ try {
1544
+ const end = length === undefined ? reader.len : reader.pos + length;
1545
+ const message = createBaseAISessionEventEnvelope();
1546
+ while (reader.pos < end) {
1547
+ const tag = reader.uint32();
1548
+ switch (tag >>> 3) {
1549
+ case 1: {
1550
+ if (tag !== 10) {
1551
+ break;
1552
+ }
1553
+
1554
+ message.event = AISessionEvent.decode(reader, reader.uint32());
1555
+ continue;
1556
+ }
1557
+ case 2: {
1558
+ if (tag !== 18) {
1559
+ break;
1560
+ }
1561
+
1562
+ message.completed = ReplayCompleted.decode(reader, reader.uint32());
1563
+ continue;
1564
+ }
1565
+ }
1566
+ if ((tag & 7) === 4 || tag === 0) {
1567
+ break;
1568
+ }
1569
+ reader.skip(tag & 7);
1570
+ }
1571
+ return message;
1572
+ } finally {
1573
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1574
+ }
1575
+ },
1576
+
1577
+ fromJSON(object: any): AISessionEventEnvelope {
1578
+ return {
1579
+ event: isSet(object.event) ? AISessionEvent.fromJSON(object.event) : undefined,
1580
+ completed: isSet(object.completed) ? ReplayCompleted.fromJSON(object.completed) : undefined,
1581
+ };
1582
+ },
1583
+
1584
+ toJSON(message: AISessionEventEnvelope): unknown {
1585
+ const obj: any = {};
1586
+ if (message.event !== undefined) {
1587
+ obj.event = AISessionEvent.toJSON(message.event);
1588
+ }
1589
+ if (message.completed !== undefined) {
1590
+ obj.completed = ReplayCompleted.toJSON(message.completed);
1591
+ }
1592
+ return obj;
1593
+ },
1594
+
1595
+ create<I extends Exact<DeepPartial<AISessionEventEnvelope>, I>>(base?: I): AISessionEventEnvelope {
1596
+ return AISessionEventEnvelope.fromPartial(base ?? ({} as any));
1597
+ },
1598
+ fromPartial<I extends Exact<DeepPartial<AISessionEventEnvelope>, I>>(object: I): AISessionEventEnvelope {
1599
+ const message = createBaseAISessionEventEnvelope();
1600
+ message.event = (object.event !== undefined && object.event !== null)
1601
+ ? AISessionEvent.fromPartial(object.event)
1602
+ : undefined;
1603
+ message.completed = (object.completed !== undefined && object.completed !== null)
1604
+ ? ReplayCompleted.fromPartial(object.completed)
1605
+ : undefined;
1606
+ return message;
1607
+ },
1608
+ };
1609
+
1610
+ function createBaseReplayCompleted(): ReplayCompleted {
1611
+ return {};
1612
+ }
1613
+
1614
+ export const ReplayCompleted: MessageFns<ReplayCompleted> = {
1615
+ encode(_: ReplayCompleted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1616
+ return writer;
1617
+ },
1618
+
1619
+ decode(input: BinaryReader | Uint8Array, length?: number): ReplayCompleted {
1620
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1621
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1622
+ if (previousRecursionDepth >= 100) {
1623
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1624
+ }
1625
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1626
+ try {
1627
+ const end = length === undefined ? reader.len : reader.pos + length;
1628
+ const message = createBaseReplayCompleted();
1629
+ while (reader.pos < end) {
1630
+ const tag = reader.uint32();
1631
+ switch (tag >>> 3) {
1632
+ }
1633
+ if ((tag & 7) === 4 || tag === 0) {
1634
+ break;
1635
+ }
1636
+ reader.skip(tag & 7);
1637
+ }
1638
+ return message;
1639
+ } finally {
1640
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1641
+ }
1642
+ },
1643
+
1644
+ fromJSON(_: any): ReplayCompleted {
1645
+ return {};
1646
+ },
1647
+
1648
+ toJSON(_: ReplayCompleted): unknown {
1649
+ const obj: any = {};
1650
+ return obj;
1651
+ },
1652
+
1653
+ create<I extends Exact<DeepPartial<ReplayCompleted>, I>>(base?: I): ReplayCompleted {
1654
+ return ReplayCompleted.fromPartial(base ?? ({} as any));
1655
+ },
1656
+ fromPartial<I extends Exact<DeepPartial<ReplayCompleted>, I>>(_: I): ReplayCompleted {
1657
+ const message = createBaseReplayCompleted();
1658
+ return message;
1659
+ },
1660
+ };
1661
+
1662
+ function createBaseAISessionEvent(): AISessionEvent {
1663
+ return {
1664
+ kind: 0,
1665
+ sequence: undefined,
1666
+ eventTime: undefined,
1667
+ turnId: "",
1668
+ content: [],
1669
+ usage: undefined,
1670
+ model: "",
1671
+ provider: "",
1672
+ toolName: "",
1673
+ status: "",
1674
+ finishReason: "",
1675
+ durationMs: undefined,
1676
+ ttftMs: undefined,
1677
+ modelCallId: "",
1678
+ toolCallId: "",
1679
+ };
1680
+ }
1681
+
1682
+ export const AISessionEvent: MessageFns<AISessionEvent> = {
1683
+ encode(message: AISessionEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1684
+ if (message.kind !== 0) {
1685
+ writer.uint32(8).int32(message.kind);
1686
+ }
1687
+ if (message.sequence !== undefined) {
1688
+ writer.uint32(16).int64(message.sequence);
1689
+ }
1690
+ if (message.eventTime !== undefined) {
1691
+ Timestamp.encode(toTimestamp(message.eventTime), writer.uint32(26).fork()).join();
1692
+ }
1693
+ if (message.turnId !== "") {
1694
+ writer.uint32(34).string(message.turnId);
1695
+ }
1696
+ for (const v of message.content) {
1697
+ AIContentPart.encode(v!, writer.uint32(42).fork()).join();
1698
+ }
1699
+ if (message.usage !== undefined) {
1700
+ AITokenUsage.encode(message.usage, writer.uint32(50).fork()).join();
1701
+ }
1702
+ if (message.model !== "") {
1703
+ writer.uint32(58).string(message.model);
1704
+ }
1705
+ if (message.provider !== "") {
1706
+ writer.uint32(66).string(message.provider);
1707
+ }
1708
+ if (message.toolName !== "") {
1709
+ writer.uint32(74).string(message.toolName);
1710
+ }
1711
+ if (message.status !== "") {
1712
+ writer.uint32(82).string(message.status);
1713
+ }
1714
+ if (message.finishReason !== "") {
1715
+ writer.uint32(90).string(message.finishReason);
1716
+ }
1717
+ if (message.durationMs !== undefined) {
1718
+ writer.uint32(96).int64(message.durationMs);
1719
+ }
1720
+ if (message.ttftMs !== undefined) {
1721
+ writer.uint32(104).uint64(message.ttftMs);
1722
+ }
1723
+ if (message.modelCallId !== "") {
1724
+ writer.uint32(114).string(message.modelCallId);
1725
+ }
1726
+ if (message.toolCallId !== "") {
1727
+ writer.uint32(122).string(message.toolCallId);
1728
+ }
1729
+ return writer;
1730
+ },
1731
+
1732
+ decode(input: BinaryReader | Uint8Array, length?: number): AISessionEvent {
1733
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1734
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1735
+ if (previousRecursionDepth >= 100) {
1736
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1737
+ }
1738
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1739
+ try {
1740
+ const end = length === undefined ? reader.len : reader.pos + length;
1741
+ const message = createBaseAISessionEvent();
1742
+ while (reader.pos < end) {
1743
+ const tag = reader.uint32();
1744
+ switch (tag >>> 3) {
1745
+ case 1: {
1746
+ if (tag !== 8) {
1747
+ break;
1748
+ }
1749
+
1750
+ message.kind = reader.int32() as any;
1751
+ continue;
1752
+ }
1753
+ case 2: {
1754
+ if (tag !== 16) {
1755
+ break;
1756
+ }
1757
+
1758
+ message.sequence = longToNumber(reader.int64());
1759
+ continue;
1760
+ }
1761
+ case 3: {
1762
+ if (tag !== 26) {
1763
+ break;
1764
+ }
1765
+
1766
+ message.eventTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1767
+ continue;
1768
+ }
1769
+ case 4: {
1770
+ if (tag !== 34) {
1771
+ break;
1772
+ }
1773
+
1774
+ message.turnId = reader.string();
1775
+ continue;
1776
+ }
1777
+ case 5: {
1778
+ if (tag !== 42) {
1779
+ break;
1780
+ }
1781
+
1782
+ message.content.push(AIContentPart.decode(reader, reader.uint32()));
1783
+ continue;
1784
+ }
1785
+ case 6: {
1786
+ if (tag !== 50) {
1787
+ break;
1788
+ }
1789
+
1790
+ message.usage = AITokenUsage.decode(reader, reader.uint32());
1791
+ continue;
1792
+ }
1793
+ case 7: {
1794
+ if (tag !== 58) {
1795
+ break;
1796
+ }
1797
+
1798
+ message.model = reader.string();
1799
+ continue;
1800
+ }
1801
+ case 8: {
1802
+ if (tag !== 66) {
1803
+ break;
1804
+ }
1805
+
1806
+ message.provider = reader.string();
1807
+ continue;
1808
+ }
1809
+ case 9: {
1810
+ if (tag !== 74) {
1811
+ break;
1812
+ }
1813
+
1814
+ message.toolName = reader.string();
1815
+ continue;
1816
+ }
1817
+ case 10: {
1818
+ if (tag !== 82) {
1819
+ break;
1820
+ }
1821
+
1822
+ message.status = reader.string();
1823
+ continue;
1824
+ }
1825
+ case 11: {
1826
+ if (tag !== 90) {
1827
+ break;
1828
+ }
1829
+
1830
+ message.finishReason = reader.string();
1831
+ continue;
1832
+ }
1833
+ case 12: {
1834
+ if (tag !== 96) {
1835
+ break;
1836
+ }
1837
+
1838
+ message.durationMs = longToNumber(reader.int64());
1839
+ continue;
1840
+ }
1841
+ case 13: {
1842
+ if (tag !== 104) {
1843
+ break;
1844
+ }
1845
+
1846
+ message.ttftMs = longToNumber(reader.uint64());
1847
+ continue;
1848
+ }
1849
+ case 14: {
1850
+ if (tag !== 114) {
1851
+ break;
1852
+ }
1853
+
1854
+ message.modelCallId = reader.string();
1855
+ continue;
1856
+ }
1857
+ case 15: {
1858
+ if (tag !== 122) {
1859
+ break;
1860
+ }
1861
+
1862
+ message.toolCallId = reader.string();
1863
+ continue;
1864
+ }
1865
+ }
1866
+ if ((tag & 7) === 4 || tag === 0) {
1867
+ break;
1868
+ }
1869
+ reader.skip(tag & 7);
1870
+ }
1871
+ return message;
1872
+ } finally {
1873
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1874
+ }
1875
+ },
1876
+
1877
+ fromJSON(object: any): AISessionEvent {
1878
+ return {
1879
+ kind: isSet(object.kind) ? aISessionEventKindFromJSON(object.kind) : 0,
1880
+ sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : undefined,
1881
+ eventTime: isSet(object.eventTime)
1882
+ ? fromJsonTimestamp(object.eventTime)
1883
+ : isSet(object.event_time)
1884
+ ? fromJsonTimestamp(object.event_time)
1885
+ : undefined,
1886
+ turnId: isSet(object.turnId)
1887
+ ? globalThis.String(object.turnId)
1888
+ : isSet(object.turn_id)
1889
+ ? globalThis.String(object.turn_id)
1890
+ : "",
1891
+ content: globalThis.Array.isArray(object?.content)
1892
+ ? object.content.map((e: any) => AIContentPart.fromJSON(e))
1893
+ : [],
1894
+ usage: isSet(object.usage) ? AITokenUsage.fromJSON(object.usage) : undefined,
1895
+ model: isSet(object.model) ? globalThis.String(object.model) : "",
1896
+ provider: isSet(object.provider) ? globalThis.String(object.provider) : "",
1897
+ toolName: isSet(object.toolName)
1898
+ ? globalThis.String(object.toolName)
1899
+ : isSet(object.tool_name)
1900
+ ? globalThis.String(object.tool_name)
1901
+ : "",
1902
+ status: isSet(object.status) ? globalThis.String(object.status) : "",
1903
+ finishReason: isSet(object.finishReason)
1904
+ ? globalThis.String(object.finishReason)
1905
+ : isSet(object.finish_reason)
1906
+ ? globalThis.String(object.finish_reason)
1907
+ : "",
1908
+ durationMs: isSet(object.durationMs)
1909
+ ? globalThis.Number(object.durationMs)
1910
+ : isSet(object.duration_ms)
1911
+ ? globalThis.Number(object.duration_ms)
1912
+ : undefined,
1913
+ ttftMs: isSet(object.ttftMs)
1914
+ ? globalThis.Number(object.ttftMs)
1915
+ : isSet(object.ttft_ms)
1916
+ ? globalThis.Number(object.ttft_ms)
1917
+ : undefined,
1918
+ modelCallId: isSet(object.modelCallId)
1919
+ ? globalThis.String(object.modelCallId)
1920
+ : isSet(object.model_call_id)
1921
+ ? globalThis.String(object.model_call_id)
1922
+ : "",
1923
+ toolCallId: isSet(object.toolCallId)
1924
+ ? globalThis.String(object.toolCallId)
1925
+ : isSet(object.tool_call_id)
1926
+ ? globalThis.String(object.tool_call_id)
1927
+ : "",
1928
+ };
1929
+ },
1930
+
1931
+ toJSON(message: AISessionEvent): unknown {
1932
+ const obj: any = {};
1933
+ if (message.kind !== 0) {
1934
+ obj.kind = aISessionEventKindToJSON(message.kind);
1935
+ }
1936
+ if (message.sequence !== undefined) {
1937
+ obj.sequence = Math.round(message.sequence);
1938
+ }
1939
+ if (message.eventTime !== undefined) {
1940
+ obj.eventTime = message.eventTime.toISOString();
1941
+ }
1942
+ if (message.turnId !== "") {
1943
+ obj.turnId = message.turnId;
1944
+ }
1945
+ if (message.content?.length) {
1946
+ obj.content = message.content.map((e) => AIContentPart.toJSON(e));
1947
+ }
1948
+ if (message.usage !== undefined) {
1949
+ obj.usage = AITokenUsage.toJSON(message.usage);
1950
+ }
1951
+ if (message.model !== "") {
1952
+ obj.model = message.model;
1953
+ }
1954
+ if (message.provider !== "") {
1955
+ obj.provider = message.provider;
1956
+ }
1957
+ if (message.toolName !== "") {
1958
+ obj.toolName = message.toolName;
1959
+ }
1960
+ if (message.status !== "") {
1961
+ obj.status = message.status;
1962
+ }
1963
+ if (message.finishReason !== "") {
1964
+ obj.finishReason = message.finishReason;
1965
+ }
1966
+ if (message.durationMs !== undefined) {
1967
+ obj.durationMs = Math.round(message.durationMs);
1968
+ }
1969
+ if (message.ttftMs !== undefined) {
1970
+ obj.ttftMs = Math.round(message.ttftMs);
1971
+ }
1972
+ if (message.modelCallId !== "") {
1973
+ obj.modelCallId = message.modelCallId;
1974
+ }
1975
+ if (message.toolCallId !== "") {
1976
+ obj.toolCallId = message.toolCallId;
1977
+ }
1978
+ return obj;
1979
+ },
1980
+
1981
+ create<I extends Exact<DeepPartial<AISessionEvent>, I>>(base?: I): AISessionEvent {
1982
+ return AISessionEvent.fromPartial(base ?? ({} as any));
1983
+ },
1984
+ fromPartial<I extends Exact<DeepPartial<AISessionEvent>, I>>(object: I): AISessionEvent {
1985
+ const message = createBaseAISessionEvent();
1986
+ message.kind = object.kind ?? 0;
1987
+ message.sequence = object.sequence ?? undefined;
1988
+ message.eventTime = object.eventTime ?? undefined;
1989
+ message.turnId = object.turnId ?? "";
1990
+ message.content = object.content?.map((e) => AIContentPart.fromPartial(e)) || [];
1991
+ message.usage = (object.usage !== undefined && object.usage !== null)
1992
+ ? AITokenUsage.fromPartial(object.usage)
1993
+ : undefined;
1994
+ message.model = object.model ?? "";
1995
+ message.provider = object.provider ?? "";
1996
+ message.toolName = object.toolName ?? "";
1997
+ message.status = object.status ?? "";
1998
+ message.finishReason = object.finishReason ?? "";
1999
+ message.durationMs = object.durationMs ?? undefined;
2000
+ message.ttftMs = object.ttftMs ?? undefined;
2001
+ message.modelCallId = object.modelCallId ?? "";
2002
+ message.toolCallId = object.toolCallId ?? "";
2003
+ return message;
2004
+ },
2005
+ };
2006
+
2007
+ function createBaseAIContentPart(): AIContentPart {
2008
+ return { partIndex: 0, contentType: "", content: "" };
2009
+ }
2010
+
2011
+ export const AIContentPart: MessageFns<AIContentPart> = {
2012
+ encode(message: AIContentPart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2013
+ if (message.partIndex !== 0) {
2014
+ writer.uint32(8).uint32(message.partIndex);
2015
+ }
2016
+ if (message.contentType !== "") {
2017
+ writer.uint32(18).string(message.contentType);
2018
+ }
2019
+ if (message.content !== "") {
2020
+ writer.uint32(26).string(message.content);
2021
+ }
2022
+ return writer;
2023
+ },
2024
+
2025
+ decode(input: BinaryReader | Uint8Array, length?: number): AIContentPart {
2026
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2027
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2028
+ if (previousRecursionDepth >= 100) {
2029
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2030
+ }
2031
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2032
+ try {
2033
+ const end = length === undefined ? reader.len : reader.pos + length;
2034
+ const message = createBaseAIContentPart();
2035
+ while (reader.pos < end) {
2036
+ const tag = reader.uint32();
2037
+ switch (tag >>> 3) {
2038
+ case 1: {
2039
+ if (tag !== 8) {
2040
+ break;
2041
+ }
2042
+
2043
+ message.partIndex = reader.uint32();
2044
+ continue;
2045
+ }
2046
+ case 2: {
2047
+ if (tag !== 18) {
2048
+ break;
2049
+ }
2050
+
2051
+ message.contentType = reader.string();
2052
+ continue;
2053
+ }
2054
+ case 3: {
2055
+ if (tag !== 26) {
2056
+ break;
2057
+ }
2058
+
2059
+ message.content = reader.string();
2060
+ continue;
2061
+ }
2062
+ }
2063
+ if ((tag & 7) === 4 || tag === 0) {
2064
+ break;
2065
+ }
2066
+ reader.skip(tag & 7);
2067
+ }
2068
+ return message;
2069
+ } finally {
2070
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2071
+ }
2072
+ },
2073
+
2074
+ fromJSON(object: any): AIContentPart {
2075
+ return {
2076
+ partIndex: isSet(object.partIndex)
2077
+ ? globalThis.Number(object.partIndex)
2078
+ : isSet(object.part_index)
2079
+ ? globalThis.Number(object.part_index)
2080
+ : 0,
2081
+ contentType: isSet(object.contentType)
2082
+ ? globalThis.String(object.contentType)
2083
+ : isSet(object.content_type)
2084
+ ? globalThis.String(object.content_type)
2085
+ : "",
2086
+ content: isSet(object.content) ? globalThis.String(object.content) : "",
2087
+ };
2088
+ },
2089
+
2090
+ toJSON(message: AIContentPart): unknown {
2091
+ const obj: any = {};
2092
+ if (message.partIndex !== 0) {
2093
+ obj.partIndex = Math.round(message.partIndex);
2094
+ }
2095
+ if (message.contentType !== "") {
2096
+ obj.contentType = message.contentType;
2097
+ }
2098
+ if (message.content !== "") {
2099
+ obj.content = message.content;
2100
+ }
2101
+ return obj;
2102
+ },
2103
+
2104
+ create<I extends Exact<DeepPartial<AIContentPart>, I>>(base?: I): AIContentPart {
2105
+ return AIContentPart.fromPartial(base ?? ({} as any));
2106
+ },
2107
+ fromPartial<I extends Exact<DeepPartial<AIContentPart>, I>>(object: I): AIContentPart {
2108
+ const message = createBaseAIContentPart();
2109
+ message.partIndex = object.partIndex ?? 0;
2110
+ message.contentType = object.contentType ?? "";
2111
+ message.content = object.content ?? "";
2112
+ return message;
2113
+ },
2114
+ };
2115
+
2116
+ function createBaseListPrincipalsRequest(): ListPrincipalsRequest {
2117
+ return { organizationId: "", projectId: "", kind: undefined, sourceSystem: "", pageSize: 0, pageToken: "" };
2118
+ }
2119
+
2120
+ export const ListPrincipalsRequest: MessageFns<ListPrincipalsRequest> = {
2121
+ encode(message: ListPrincipalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2122
+ if (message.organizationId !== "") {
2123
+ writer.uint32(10).string(message.organizationId);
2124
+ }
2125
+ if (message.projectId !== "") {
2126
+ writer.uint32(18).string(message.projectId);
2127
+ }
2128
+ if (message.kind !== undefined) {
2129
+ writer.uint32(24).int32(message.kind);
2130
+ }
2131
+ if (message.sourceSystem !== "") {
2132
+ writer.uint32(34).string(message.sourceSystem);
2133
+ }
2134
+ if (message.pageSize !== 0) {
2135
+ writer.uint32(40).int32(message.pageSize);
2136
+ }
2137
+ if (message.pageToken !== "") {
2138
+ writer.uint32(50).string(message.pageToken);
2139
+ }
2140
+ return writer;
2141
+ },
2142
+
2143
+ decode(input: BinaryReader | Uint8Array, length?: number): ListPrincipalsRequest {
2144
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2145
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2146
+ if (previousRecursionDepth >= 100) {
2147
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2148
+ }
2149
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2150
+ try {
2151
+ const end = length === undefined ? reader.len : reader.pos + length;
2152
+ const message = createBaseListPrincipalsRequest();
2153
+ while (reader.pos < end) {
2154
+ const tag = reader.uint32();
2155
+ switch (tag >>> 3) {
2156
+ case 1: {
2157
+ if (tag !== 10) {
2158
+ break;
2159
+ }
2160
+
2161
+ message.organizationId = reader.string();
2162
+ continue;
2163
+ }
2164
+ case 2: {
2165
+ if (tag !== 18) {
2166
+ break;
2167
+ }
2168
+
2169
+ message.projectId = reader.string();
2170
+ continue;
2171
+ }
2172
+ case 3: {
2173
+ if (tag !== 24) {
2174
+ break;
2175
+ }
2176
+
2177
+ message.kind = reader.int32() as any;
2178
+ continue;
2179
+ }
2180
+ case 4: {
2181
+ if (tag !== 34) {
2182
+ break;
2183
+ }
2184
+
2185
+ message.sourceSystem = reader.string();
2186
+ continue;
2187
+ }
2188
+ case 5: {
2189
+ if (tag !== 40) {
2190
+ break;
2191
+ }
2192
+
2193
+ message.pageSize = reader.int32();
2194
+ continue;
2195
+ }
2196
+ case 6: {
2197
+ if (tag !== 50) {
2198
+ break;
2199
+ }
2200
+
2201
+ message.pageToken = reader.string();
2202
+ continue;
2203
+ }
2204
+ }
2205
+ if ((tag & 7) === 4 || tag === 0) {
2206
+ break;
2207
+ }
2208
+ reader.skip(tag & 7);
2209
+ }
2210
+ return message;
2211
+ } finally {
2212
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2213
+ }
2214
+ },
2215
+
2216
+ fromJSON(object: any): ListPrincipalsRequest {
2217
+ return {
2218
+ organizationId: isSet(object.organizationId)
2219
+ ? globalThis.String(object.organizationId)
2220
+ : isSet(object.organization_id)
2221
+ ? globalThis.String(object.organization_id)
2222
+ : "",
2223
+ projectId: isSet(object.projectId)
2224
+ ? globalThis.String(object.projectId)
2225
+ : isSet(object.project_id)
2226
+ ? globalThis.String(object.project_id)
2227
+ : "",
2228
+ kind: isSet(object.kind) ? aIPrincipalKindFromJSON(object.kind) : undefined,
2229
+ sourceSystem: isSet(object.sourceSystem)
2230
+ ? globalThis.String(object.sourceSystem)
2231
+ : isSet(object.source_system)
2232
+ ? globalThis.String(object.source_system)
2233
+ : "",
2234
+ pageSize: isSet(object.pageSize)
2235
+ ? globalThis.Number(object.pageSize)
2236
+ : isSet(object.page_size)
2237
+ ? globalThis.Number(object.page_size)
2238
+ : 0,
2239
+ pageToken: isSet(object.pageToken)
2240
+ ? globalThis.String(object.pageToken)
2241
+ : isSet(object.page_token)
2242
+ ? globalThis.String(object.page_token)
2243
+ : "",
2244
+ };
2245
+ },
2246
+
2247
+ toJSON(message: ListPrincipalsRequest): unknown {
2248
+ const obj: any = {};
2249
+ if (message.organizationId !== "") {
2250
+ obj.organizationId = message.organizationId;
2251
+ }
2252
+ if (message.projectId !== "") {
2253
+ obj.projectId = message.projectId;
2254
+ }
2255
+ if (message.kind !== undefined) {
2256
+ obj.kind = aIPrincipalKindToJSON(message.kind);
2257
+ }
2258
+ if (message.sourceSystem !== "") {
2259
+ obj.sourceSystem = message.sourceSystem;
2260
+ }
2261
+ if (message.pageSize !== 0) {
2262
+ obj.pageSize = Math.round(message.pageSize);
2263
+ }
2264
+ if (message.pageToken !== "") {
2265
+ obj.pageToken = message.pageToken;
2266
+ }
2267
+ return obj;
2268
+ },
2269
+
2270
+ create<I extends Exact<DeepPartial<ListPrincipalsRequest>, I>>(base?: I): ListPrincipalsRequest {
2271
+ return ListPrincipalsRequest.fromPartial(base ?? ({} as any));
2272
+ },
2273
+ fromPartial<I extends Exact<DeepPartial<ListPrincipalsRequest>, I>>(object: I): ListPrincipalsRequest {
2274
+ const message = createBaseListPrincipalsRequest();
2275
+ message.organizationId = object.organizationId ?? "";
2276
+ message.projectId = object.projectId ?? "";
2277
+ message.kind = object.kind ?? undefined;
2278
+ message.sourceSystem = object.sourceSystem ?? "";
2279
+ message.pageSize = object.pageSize ?? 0;
2280
+ message.pageToken = object.pageToken ?? "";
2281
+ return message;
2282
+ },
2283
+ };
2284
+
2285
+ function createBaseListPrincipalsResponse(): ListPrincipalsResponse {
2286
+ return { status: undefined, principals: [], nextPageToken: "" };
2287
+ }
2288
+
2289
+ export const ListPrincipalsResponse: MessageFns<ListPrincipalsResponse> = {
2290
+ encode(message: ListPrincipalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2291
+ if (message.status !== undefined) {
2292
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2293
+ }
2294
+ for (const v of message.principals) {
2295
+ AIPrincipal.encode(v!, writer.uint32(18).fork()).join();
2296
+ }
2297
+ if (message.nextPageToken !== "") {
2298
+ writer.uint32(26).string(message.nextPageToken);
2299
+ }
2300
+ return writer;
2301
+ },
2302
+
2303
+ decode(input: BinaryReader | Uint8Array, length?: number): ListPrincipalsResponse {
2304
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2305
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2306
+ if (previousRecursionDepth >= 100) {
2307
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2308
+ }
2309
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2310
+ try {
2311
+ const end = length === undefined ? reader.len : reader.pos + length;
2312
+ const message = createBaseListPrincipalsResponse();
2313
+ while (reader.pos < end) {
2314
+ const tag = reader.uint32();
2315
+ switch (tag >>> 3) {
2316
+ case 1: {
2317
+ if (tag !== 10) {
2318
+ break;
2319
+ }
2320
+
2321
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2322
+ continue;
2323
+ }
2324
+ case 2: {
2325
+ if (tag !== 18) {
2326
+ break;
2327
+ }
2328
+
2329
+ message.principals.push(AIPrincipal.decode(reader, reader.uint32()));
2330
+ continue;
2331
+ }
2332
+ case 3: {
2333
+ if (tag !== 26) {
2334
+ break;
2335
+ }
2336
+
2337
+ message.nextPageToken = reader.string();
2338
+ continue;
2339
+ }
2340
+ }
2341
+ if ((tag & 7) === 4 || tag === 0) {
2342
+ break;
2343
+ }
2344
+ reader.skip(tag & 7);
2345
+ }
2346
+ return message;
2347
+ } finally {
2348
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2349
+ }
2350
+ },
2351
+
2352
+ fromJSON(object: any): ListPrincipalsResponse {
2353
+ return {
2354
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2355
+ principals: globalThis.Array.isArray(object?.principals)
2356
+ ? object.principals.map((e: any) => AIPrincipal.fromJSON(e))
2357
+ : [],
2358
+ nextPageToken: isSet(object.nextPageToken)
2359
+ ? globalThis.String(object.nextPageToken)
2360
+ : isSet(object.next_page_token)
2361
+ ? globalThis.String(object.next_page_token)
2362
+ : "",
2363
+ };
2364
+ },
2365
+
2366
+ toJSON(message: ListPrincipalsResponse): unknown {
2367
+ const obj: any = {};
2368
+ if (message.status !== undefined) {
2369
+ obj.status = ResponseStatus.toJSON(message.status);
2370
+ }
2371
+ if (message.principals?.length) {
2372
+ obj.principals = message.principals.map((e) => AIPrincipal.toJSON(e));
2373
+ }
2374
+ if (message.nextPageToken !== "") {
2375
+ obj.nextPageToken = message.nextPageToken;
2376
+ }
2377
+ return obj;
2378
+ },
2379
+
2380
+ create<I extends Exact<DeepPartial<ListPrincipalsResponse>, I>>(base?: I): ListPrincipalsResponse {
2381
+ return ListPrincipalsResponse.fromPartial(base ?? ({} as any));
2382
+ },
2383
+ fromPartial<I extends Exact<DeepPartial<ListPrincipalsResponse>, I>>(object: I): ListPrincipalsResponse {
2384
+ const message = createBaseListPrincipalsResponse();
2385
+ message.status = (object.status !== undefined && object.status !== null)
2386
+ ? ResponseStatus.fromPartial(object.status)
2387
+ : undefined;
2388
+ message.principals = object.principals?.map((e) => AIPrincipal.fromPartial(e)) || [];
2389
+ message.nextPageToken = object.nextPageToken ?? "";
2390
+ return message;
2391
+ },
2392
+ };
2393
+
2394
+ function createBaseAIPrincipal(): AIPrincipal {
2395
+ return { kind: 0, id: "", name: "", sourceSystem: "", alias: "" };
2396
+ }
2397
+
2398
+ export const AIPrincipal: MessageFns<AIPrincipal> = {
2399
+ encode(message: AIPrincipal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2400
+ if (message.kind !== 0) {
2401
+ writer.uint32(8).int32(message.kind);
2402
+ }
2403
+ if (message.id !== "") {
2404
+ writer.uint32(18).string(message.id);
2405
+ }
2406
+ if (message.name !== "") {
2407
+ writer.uint32(26).string(message.name);
2408
+ }
2409
+ if (message.sourceSystem !== "") {
2410
+ writer.uint32(34).string(message.sourceSystem);
2411
+ }
2412
+ if (message.alias !== "") {
2413
+ writer.uint32(42).string(message.alias);
2414
+ }
2415
+ return writer;
2416
+ },
2417
+
2418
+ decode(input: BinaryReader | Uint8Array, length?: number): AIPrincipal {
2419
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2420
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2421
+ if (previousRecursionDepth >= 100) {
2422
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2423
+ }
2424
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2425
+ try {
2426
+ const end = length === undefined ? reader.len : reader.pos + length;
2427
+ const message = createBaseAIPrincipal();
2428
+ while (reader.pos < end) {
2429
+ const tag = reader.uint32();
2430
+ switch (tag >>> 3) {
2431
+ case 1: {
2432
+ if (tag !== 8) {
2433
+ break;
2434
+ }
2435
+
2436
+ message.kind = reader.int32() as any;
2437
+ continue;
2438
+ }
2439
+ case 2: {
2440
+ if (tag !== 18) {
2441
+ break;
2442
+ }
2443
+
2444
+ message.id = reader.string();
2445
+ continue;
2446
+ }
2447
+ case 3: {
2448
+ if (tag !== 26) {
2449
+ break;
2450
+ }
2451
+
2452
+ message.name = reader.string();
2453
+ continue;
2454
+ }
2455
+ case 4: {
2456
+ if (tag !== 34) {
2457
+ break;
2458
+ }
2459
+
2460
+ message.sourceSystem = reader.string();
2461
+ continue;
2462
+ }
2463
+ case 5: {
2464
+ if (tag !== 42) {
2465
+ break;
2466
+ }
2467
+
2468
+ message.alias = reader.string();
2469
+ continue;
2470
+ }
2471
+ }
2472
+ if ((tag & 7) === 4 || tag === 0) {
2473
+ break;
2474
+ }
2475
+ reader.skip(tag & 7);
2476
+ }
2477
+ return message;
2478
+ } finally {
2479
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2480
+ }
2481
+ },
2482
+
2483
+ fromJSON(object: any): AIPrincipal {
2484
+ return {
2485
+ kind: isSet(object.kind) ? aIPrincipalKindFromJSON(object.kind) : 0,
2486
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
2487
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2488
+ sourceSystem: isSet(object.sourceSystem)
2489
+ ? globalThis.String(object.sourceSystem)
2490
+ : isSet(object.source_system)
2491
+ ? globalThis.String(object.source_system)
2492
+ : "",
2493
+ alias: isSet(object.alias) ? globalThis.String(object.alias) : "",
2494
+ };
2495
+ },
2496
+
2497
+ toJSON(message: AIPrincipal): unknown {
2498
+ const obj: any = {};
2499
+ if (message.kind !== 0) {
2500
+ obj.kind = aIPrincipalKindToJSON(message.kind);
2501
+ }
2502
+ if (message.id !== "") {
2503
+ obj.id = message.id;
2504
+ }
2505
+ if (message.name !== "") {
2506
+ obj.name = message.name;
2507
+ }
2508
+ if (message.sourceSystem !== "") {
2509
+ obj.sourceSystem = message.sourceSystem;
2510
+ }
2511
+ if (message.alias !== "") {
2512
+ obj.alias = message.alias;
2513
+ }
2514
+ return obj;
2515
+ },
2516
+
2517
+ create<I extends Exact<DeepPartial<AIPrincipal>, I>>(base?: I): AIPrincipal {
2518
+ return AIPrincipal.fromPartial(base ?? ({} as any));
2519
+ },
2520
+ fromPartial<I extends Exact<DeepPartial<AIPrincipal>, I>>(object: I): AIPrincipal {
2521
+ const message = createBaseAIPrincipal();
2522
+ message.kind = object.kind ?? 0;
2523
+ message.id = object.id ?? "";
2524
+ message.name = object.name ?? "";
2525
+ message.sourceSystem = object.sourceSystem ?? "";
2526
+ message.alias = object.alias ?? "";
2527
+ return message;
2528
+ },
2529
+ };
2530
+
2531
+ function createBaseUpdatePrincipalRequest(): UpdatePrincipalRequest {
2532
+ return { organizationId: "", projectId: "", kind: 0, id: "", sourceSystem: "", alias: "" };
2533
+ }
2534
+
2535
+ export const UpdatePrincipalRequest: MessageFns<UpdatePrincipalRequest> = {
2536
+ encode(message: UpdatePrincipalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2537
+ if (message.organizationId !== "") {
2538
+ writer.uint32(10).string(message.organizationId);
2539
+ }
2540
+ if (message.projectId !== "") {
2541
+ writer.uint32(18).string(message.projectId);
2542
+ }
2543
+ if (message.kind !== 0) {
2544
+ writer.uint32(24).int32(message.kind);
2545
+ }
2546
+ if (message.id !== "") {
2547
+ writer.uint32(34).string(message.id);
2548
+ }
2549
+ if (message.sourceSystem !== "") {
2550
+ writer.uint32(42).string(message.sourceSystem);
2551
+ }
2552
+ if (message.alias !== "") {
2553
+ writer.uint32(50).string(message.alias);
2554
+ }
2555
+ return writer;
2556
+ },
2557
+
2558
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdatePrincipalRequest {
2559
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2560
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2561
+ if (previousRecursionDepth >= 100) {
2562
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2563
+ }
2564
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2565
+ try {
2566
+ const end = length === undefined ? reader.len : reader.pos + length;
2567
+ const message = createBaseUpdatePrincipalRequest();
2568
+ while (reader.pos < end) {
2569
+ const tag = reader.uint32();
2570
+ switch (tag >>> 3) {
2571
+ case 1: {
2572
+ if (tag !== 10) {
2573
+ break;
2574
+ }
2575
+
2576
+ message.organizationId = reader.string();
2577
+ continue;
2578
+ }
2579
+ case 2: {
2580
+ if (tag !== 18) {
2581
+ break;
2582
+ }
2583
+
2584
+ message.projectId = reader.string();
2585
+ continue;
2586
+ }
2587
+ case 3: {
2588
+ if (tag !== 24) {
2589
+ break;
2590
+ }
2591
+
2592
+ message.kind = reader.int32() as any;
2593
+ continue;
2594
+ }
2595
+ case 4: {
2596
+ if (tag !== 34) {
2597
+ break;
2598
+ }
2599
+
2600
+ message.id = reader.string();
2601
+ continue;
2602
+ }
2603
+ case 5: {
2604
+ if (tag !== 42) {
2605
+ break;
2606
+ }
2607
+
2608
+ message.sourceSystem = reader.string();
2609
+ continue;
2610
+ }
2611
+ case 6: {
2612
+ if (tag !== 50) {
2613
+ break;
2614
+ }
2615
+
2616
+ message.alias = reader.string();
2617
+ continue;
2618
+ }
2619
+ }
2620
+ if ((tag & 7) === 4 || tag === 0) {
2621
+ break;
2622
+ }
2623
+ reader.skip(tag & 7);
2624
+ }
2625
+ return message;
2626
+ } finally {
2627
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2628
+ }
2629
+ },
2630
+
2631
+ fromJSON(object: any): UpdatePrincipalRequest {
2632
+ return {
2633
+ organizationId: isSet(object.organizationId)
2634
+ ? globalThis.String(object.organizationId)
2635
+ : isSet(object.organization_id)
2636
+ ? globalThis.String(object.organization_id)
2637
+ : "",
2638
+ projectId: isSet(object.projectId)
2639
+ ? globalThis.String(object.projectId)
2640
+ : isSet(object.project_id)
2641
+ ? globalThis.String(object.project_id)
2642
+ : "",
2643
+ kind: isSet(object.kind) ? aIPrincipalKindFromJSON(object.kind) : 0,
2644
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
2645
+ sourceSystem: isSet(object.sourceSystem)
2646
+ ? globalThis.String(object.sourceSystem)
2647
+ : isSet(object.source_system)
2648
+ ? globalThis.String(object.source_system)
2649
+ : "",
2650
+ alias: isSet(object.alias) ? globalThis.String(object.alias) : "",
2651
+ };
2652
+ },
2653
+
2654
+ toJSON(message: UpdatePrincipalRequest): unknown {
2655
+ const obj: any = {};
2656
+ if (message.organizationId !== "") {
2657
+ obj.organizationId = message.organizationId;
2658
+ }
2659
+ if (message.projectId !== "") {
2660
+ obj.projectId = message.projectId;
2661
+ }
2662
+ if (message.kind !== 0) {
2663
+ obj.kind = aIPrincipalKindToJSON(message.kind);
2664
+ }
2665
+ if (message.id !== "") {
2666
+ obj.id = message.id;
2667
+ }
2668
+ if (message.sourceSystem !== "") {
2669
+ obj.sourceSystem = message.sourceSystem;
2670
+ }
2671
+ if (message.alias !== "") {
2672
+ obj.alias = message.alias;
2673
+ }
2674
+ return obj;
2675
+ },
2676
+
2677
+ create<I extends Exact<DeepPartial<UpdatePrincipalRequest>, I>>(base?: I): UpdatePrincipalRequest {
2678
+ return UpdatePrincipalRequest.fromPartial(base ?? ({} as any));
2679
+ },
2680
+ fromPartial<I extends Exact<DeepPartial<UpdatePrincipalRequest>, I>>(object: I): UpdatePrincipalRequest {
2681
+ const message = createBaseUpdatePrincipalRequest();
2682
+ message.organizationId = object.organizationId ?? "";
2683
+ message.projectId = object.projectId ?? "";
2684
+ message.kind = object.kind ?? 0;
2685
+ message.id = object.id ?? "";
2686
+ message.sourceSystem = object.sourceSystem ?? "";
2687
+ message.alias = object.alias ?? "";
2688
+ return message;
2689
+ },
2690
+ };
2691
+
2692
+ function createBaseUpdatePrincipalResponse(): UpdatePrincipalResponse {
2693
+ return { status: undefined, principal: undefined };
2694
+ }
2695
+
2696
+ export const UpdatePrincipalResponse: MessageFns<UpdatePrincipalResponse> = {
2697
+ encode(message: UpdatePrincipalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2698
+ if (message.status !== undefined) {
2699
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2700
+ }
2701
+ if (message.principal !== undefined) {
2702
+ AIPrincipal.encode(message.principal, writer.uint32(18).fork()).join();
2703
+ }
2704
+ return writer;
2705
+ },
2706
+
2707
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdatePrincipalResponse {
2708
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2709
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2710
+ if (previousRecursionDepth >= 100) {
2711
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2712
+ }
2713
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2714
+ try {
2715
+ const end = length === undefined ? reader.len : reader.pos + length;
2716
+ const message = createBaseUpdatePrincipalResponse();
2717
+ while (reader.pos < end) {
2718
+ const tag = reader.uint32();
2719
+ switch (tag >>> 3) {
2720
+ case 1: {
2721
+ if (tag !== 10) {
2722
+ break;
2723
+ }
2724
+
2725
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2726
+ continue;
2727
+ }
2728
+ case 2: {
2729
+ if (tag !== 18) {
2730
+ break;
2731
+ }
2732
+
2733
+ message.principal = AIPrincipal.decode(reader, reader.uint32());
2734
+ continue;
2735
+ }
2736
+ }
2737
+ if ((tag & 7) === 4 || tag === 0) {
2738
+ break;
2739
+ }
2740
+ reader.skip(tag & 7);
2741
+ }
2742
+ return message;
2743
+ } finally {
2744
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2745
+ }
2746
+ },
2747
+
2748
+ fromJSON(object: any): UpdatePrincipalResponse {
2749
+ return {
2750
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2751
+ principal: isSet(object.principal) ? AIPrincipal.fromJSON(object.principal) : undefined,
2752
+ };
2753
+ },
2754
+
2755
+ toJSON(message: UpdatePrincipalResponse): unknown {
2756
+ const obj: any = {};
2757
+ if (message.status !== undefined) {
2758
+ obj.status = ResponseStatus.toJSON(message.status);
2759
+ }
2760
+ if (message.principal !== undefined) {
2761
+ obj.principal = AIPrincipal.toJSON(message.principal);
2762
+ }
2763
+ return obj;
2764
+ },
2765
+
2766
+ create<I extends Exact<DeepPartial<UpdatePrincipalResponse>, I>>(base?: I): UpdatePrincipalResponse {
2767
+ return UpdatePrincipalResponse.fromPartial(base ?? ({} as any));
2768
+ },
2769
+ fromPartial<I extends Exact<DeepPartial<UpdatePrincipalResponse>, I>>(object: I): UpdatePrincipalResponse {
2770
+ const message = createBaseUpdatePrincipalResponse();
2771
+ message.status = (object.status !== undefined && object.status !== null)
2772
+ ? ResponseStatus.fromPartial(object.status)
2773
+ : undefined;
2774
+ message.principal = (object.principal !== undefined && object.principal !== null)
2775
+ ? AIPrincipal.fromPartial(object.principal)
2776
+ : undefined;
2777
+ return message;
2778
+ },
2779
+ };
2780
+
2781
+ function createBaseListGitActivitiesRequest(): ListGitActivitiesRequest {
2782
+ return { organizationId: "", projectId: "", routingKey: "", sourceSystem: "" };
2783
+ }
2784
+
2785
+ export const ListGitActivitiesRequest: MessageFns<ListGitActivitiesRequest> = {
2786
+ encode(message: ListGitActivitiesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2787
+ if (message.organizationId !== "") {
2788
+ writer.uint32(10).string(message.organizationId);
2789
+ }
2790
+ if (message.projectId !== "") {
2791
+ writer.uint32(18).string(message.projectId);
2792
+ }
2793
+ if (message.routingKey !== "") {
2794
+ writer.uint32(26).string(message.routingKey);
2795
+ }
2796
+ if (message.sourceSystem !== "") {
2797
+ writer.uint32(34).string(message.sourceSystem);
2798
+ }
2799
+ return writer;
2800
+ },
2801
+
2802
+ decode(input: BinaryReader | Uint8Array, length?: number): ListGitActivitiesRequest {
2803
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2804
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2805
+ if (previousRecursionDepth >= 100) {
2806
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2807
+ }
2808
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2809
+ try {
2810
+ const end = length === undefined ? reader.len : reader.pos + length;
2811
+ const message = createBaseListGitActivitiesRequest();
2812
+ while (reader.pos < end) {
2813
+ const tag = reader.uint32();
2814
+ switch (tag >>> 3) {
2815
+ case 1: {
2816
+ if (tag !== 10) {
2817
+ break;
2818
+ }
2819
+
2820
+ message.organizationId = reader.string();
2821
+ continue;
2822
+ }
2823
+ case 2: {
2824
+ if (tag !== 18) {
2825
+ break;
2826
+ }
2827
+
2828
+ message.projectId = reader.string();
2829
+ continue;
2830
+ }
2831
+ case 3: {
2832
+ if (tag !== 26) {
2833
+ break;
2834
+ }
2835
+
2836
+ message.routingKey = reader.string();
2837
+ continue;
2838
+ }
2839
+ case 4: {
2840
+ if (tag !== 34) {
2841
+ break;
2842
+ }
2843
+
2844
+ message.sourceSystem = reader.string();
2845
+ continue;
2846
+ }
2847
+ }
2848
+ if ((tag & 7) === 4 || tag === 0) {
2849
+ break;
2850
+ }
2851
+ reader.skip(tag & 7);
2852
+ }
2853
+ return message;
2854
+ } finally {
2855
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2856
+ }
2857
+ },
2858
+
2859
+ fromJSON(object: any): ListGitActivitiesRequest {
2860
+ return {
2861
+ organizationId: isSet(object.organizationId)
2862
+ ? globalThis.String(object.organizationId)
2863
+ : isSet(object.organization_id)
2864
+ ? globalThis.String(object.organization_id)
2865
+ : "",
2866
+ projectId: isSet(object.projectId)
2867
+ ? globalThis.String(object.projectId)
2868
+ : isSet(object.project_id)
2869
+ ? globalThis.String(object.project_id)
2870
+ : "",
2871
+ routingKey: isSet(object.routingKey)
2872
+ ? globalThis.String(object.routingKey)
2873
+ : isSet(object.routing_key)
2874
+ ? globalThis.String(object.routing_key)
2875
+ : "",
2876
+ sourceSystem: isSet(object.sourceSystem)
2877
+ ? globalThis.String(object.sourceSystem)
2878
+ : isSet(object.source_system)
2879
+ ? globalThis.String(object.source_system)
2880
+ : "",
2881
+ };
2882
+ },
2883
+
2884
+ toJSON(message: ListGitActivitiesRequest): unknown {
2885
+ const obj: any = {};
2886
+ if (message.organizationId !== "") {
2887
+ obj.organizationId = message.organizationId;
2888
+ }
2889
+ if (message.projectId !== "") {
2890
+ obj.projectId = message.projectId;
2891
+ }
2892
+ if (message.routingKey !== "") {
2893
+ obj.routingKey = message.routingKey;
2894
+ }
2895
+ if (message.sourceSystem !== "") {
2896
+ obj.sourceSystem = message.sourceSystem;
2897
+ }
2898
+ return obj;
2899
+ },
2900
+
2901
+ create<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(base?: I): ListGitActivitiesRequest {
2902
+ return ListGitActivitiesRequest.fromPartial(base ?? ({} as any));
2903
+ },
2904
+ fromPartial<I extends Exact<DeepPartial<ListGitActivitiesRequest>, I>>(object: I): ListGitActivitiesRequest {
2905
+ const message = createBaseListGitActivitiesRequest();
2906
+ message.organizationId = object.organizationId ?? "";
2907
+ message.projectId = object.projectId ?? "";
2908
+ message.routingKey = object.routingKey ?? "";
2909
+ message.sourceSystem = object.sourceSystem ?? "";
2910
+ return message;
2911
+ },
2912
+ };
2913
+
2914
+ function createBaseListGitActivitiesResponse(): ListGitActivitiesResponse {
2915
+ return { status: undefined, activities: [] };
2916
+ }
2917
+
2918
+ export const ListGitActivitiesResponse: MessageFns<ListGitActivitiesResponse> = {
2919
+ encode(message: ListGitActivitiesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2920
+ if (message.status !== undefined) {
2921
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2922
+ }
2923
+ for (const v of message.activities) {
2924
+ AIGitActivity.encode(v!, writer.uint32(18).fork()).join();
2925
+ }
2926
+ return writer;
2927
+ },
2928
+
2929
+ decode(input: BinaryReader | Uint8Array, length?: number): ListGitActivitiesResponse {
2930
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2931
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2932
+ if (previousRecursionDepth >= 100) {
2933
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2934
+ }
2935
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2936
+ try {
2937
+ const end = length === undefined ? reader.len : reader.pos + length;
2938
+ const message = createBaseListGitActivitiesResponse();
2939
+ while (reader.pos < end) {
2940
+ const tag = reader.uint32();
2941
+ switch (tag >>> 3) {
2942
+ case 1: {
2943
+ if (tag !== 10) {
2944
+ break;
2945
+ }
2946
+
2947
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2948
+ continue;
2949
+ }
2950
+ case 2: {
2951
+ if (tag !== 18) {
2952
+ break;
2953
+ }
2954
+
2955
+ message.activities.push(AIGitActivity.decode(reader, reader.uint32()));
2956
+ continue;
2957
+ }
2958
+ }
2959
+ if ((tag & 7) === 4 || tag === 0) {
2960
+ break;
2961
+ }
2962
+ reader.skip(tag & 7);
2963
+ }
2964
+ return message;
2965
+ } finally {
2966
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2967
+ }
2968
+ },
2969
+
2970
+ fromJSON(object: any): ListGitActivitiesResponse {
2971
+ return {
2972
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2973
+ activities: globalThis.Array.isArray(object?.activities)
2974
+ ? object.activities.map((e: any) => AIGitActivity.fromJSON(e))
2975
+ : [],
2976
+ };
2977
+ },
2978
+
2979
+ toJSON(message: ListGitActivitiesResponse): unknown {
2980
+ const obj: any = {};
2981
+ if (message.status !== undefined) {
2982
+ obj.status = ResponseStatus.toJSON(message.status);
2983
+ }
2984
+ if (message.activities?.length) {
2985
+ obj.activities = message.activities.map((e) => AIGitActivity.toJSON(e));
2986
+ }
2987
+ return obj;
2988
+ },
2989
+
2990
+ create<I extends Exact<DeepPartial<ListGitActivitiesResponse>, I>>(base?: I): ListGitActivitiesResponse {
2991
+ return ListGitActivitiesResponse.fromPartial(base ?? ({} as any));
2992
+ },
2993
+ fromPartial<I extends Exact<DeepPartial<ListGitActivitiesResponse>, I>>(object: I): ListGitActivitiesResponse {
2994
+ const message = createBaseListGitActivitiesResponse();
2995
+ message.status = (object.status !== undefined && object.status !== null)
2996
+ ? ResponseStatus.fromPartial(object.status)
2997
+ : undefined;
2998
+ message.activities = object.activities?.map((e) => AIGitActivity.fromPartial(e)) || [];
2999
+ return message;
3000
+ },
3001
+ };
3002
+
3003
+ function createBaseAIGitActivity(): AIGitActivity {
3004
+ return {
3005
+ eventTime: undefined,
3006
+ sourceSystem: "",
3007
+ sessionId: "",
3008
+ toolCallId: "",
3009
+ action: 0,
3010
+ outcome: 0,
3011
+ ownerKey: "",
3012
+ repositoryKey: "",
3013
+ refName: "",
3014
+ commitSha: "",
3015
+ pullRequestNumber: 0,
3016
+ pullRequestUrl: "",
3017
+ };
3018
+ }
3019
+
3020
+ export const AIGitActivity: MessageFns<AIGitActivity> = {
3021
+ encode(message: AIGitActivity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3022
+ if (message.eventTime !== undefined) {
3023
+ Timestamp.encode(toTimestamp(message.eventTime), writer.uint32(10).fork()).join();
3024
+ }
3025
+ if (message.sourceSystem !== "") {
3026
+ writer.uint32(18).string(message.sourceSystem);
3027
+ }
3028
+ if (message.sessionId !== "") {
3029
+ writer.uint32(26).string(message.sessionId);
3030
+ }
3031
+ if (message.toolCallId !== "") {
3032
+ writer.uint32(34).string(message.toolCallId);
3033
+ }
3034
+ if (message.action !== 0) {
3035
+ writer.uint32(40).int32(message.action);
3036
+ }
3037
+ if (message.outcome !== 0) {
3038
+ writer.uint32(48).int32(message.outcome);
3039
+ }
3040
+ if (message.ownerKey !== "") {
3041
+ writer.uint32(58).string(message.ownerKey);
3042
+ }
3043
+ if (message.repositoryKey !== "") {
3044
+ writer.uint32(66).string(message.repositoryKey);
3045
+ }
3046
+ if (message.refName !== "") {
3047
+ writer.uint32(74).string(message.refName);
3048
+ }
3049
+ if (message.commitSha !== "") {
3050
+ writer.uint32(82).string(message.commitSha);
3051
+ }
3052
+ if (message.pullRequestNumber !== 0) {
3053
+ writer.uint32(88).uint32(message.pullRequestNumber);
3054
+ }
3055
+ if (message.pullRequestUrl !== "") {
3056
+ writer.uint32(98).string(message.pullRequestUrl);
3057
+ }
3058
+ return writer;
3059
+ },
3060
+
3061
+ decode(input: BinaryReader | Uint8Array, length?: number): AIGitActivity {
3062
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3063
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
3064
+ if (previousRecursionDepth >= 100) {
3065
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3066
+ }
3067
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
3068
+ try {
3069
+ const end = length === undefined ? reader.len : reader.pos + length;
3070
+ const message = createBaseAIGitActivity();
3071
+ while (reader.pos < end) {
3072
+ const tag = reader.uint32();
3073
+ switch (tag >>> 3) {
3074
+ case 1: {
3075
+ if (tag !== 10) {
3076
+ break;
3077
+ }
3078
+
3079
+ message.eventTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3080
+ continue;
3081
+ }
3082
+ case 2: {
3083
+ if (tag !== 18) {
3084
+ break;
3085
+ }
3086
+
3087
+ message.sourceSystem = reader.string();
3088
+ continue;
3089
+ }
3090
+ case 3: {
3091
+ if (tag !== 26) {
3092
+ break;
3093
+ }
3094
+
3095
+ message.sessionId = reader.string();
3096
+ continue;
3097
+ }
3098
+ case 4: {
3099
+ if (tag !== 34) {
3100
+ break;
3101
+ }
3102
+
3103
+ message.toolCallId = reader.string();
3104
+ continue;
3105
+ }
3106
+ case 5: {
3107
+ if (tag !== 40) {
3108
+ break;
3109
+ }
3110
+
3111
+ message.action = reader.int32() as any;
3112
+ continue;
3113
+ }
3114
+ case 6: {
3115
+ if (tag !== 48) {
3116
+ break;
3117
+ }
3118
+
3119
+ message.outcome = reader.int32() as any;
3120
+ continue;
3121
+ }
3122
+ case 7: {
3123
+ if (tag !== 58) {
3124
+ break;
3125
+ }
3126
+
3127
+ message.ownerKey = reader.string();
3128
+ continue;
3129
+ }
3130
+ case 8: {
3131
+ if (tag !== 66) {
3132
+ break;
3133
+ }
3134
+
3135
+ message.repositoryKey = reader.string();
3136
+ continue;
3137
+ }
3138
+ case 9: {
3139
+ if (tag !== 74) {
3140
+ break;
3141
+ }
3142
+
3143
+ message.refName = reader.string();
3144
+ continue;
3145
+ }
3146
+ case 10: {
3147
+ if (tag !== 82) {
3148
+ break;
3149
+ }
3150
+
3151
+ message.commitSha = reader.string();
3152
+ continue;
3153
+ }
3154
+ case 11: {
3155
+ if (tag !== 88) {
3156
+ break;
3157
+ }
3158
+
3159
+ message.pullRequestNumber = reader.uint32();
3160
+ continue;
3161
+ }
3162
+ case 12: {
3163
+ if (tag !== 98) {
3164
+ break;
3165
+ }
3166
+
3167
+ message.pullRequestUrl = reader.string();
3168
+ continue;
3169
+ }
3170
+ }
3171
+ if ((tag & 7) === 4 || tag === 0) {
3172
+ break;
3173
+ }
3174
+ reader.skip(tag & 7);
3175
+ }
3176
+ return message;
3177
+ } finally {
3178
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
3179
+ }
3180
+ },
3181
+
3182
+ fromJSON(object: any): AIGitActivity {
3183
+ return {
3184
+ eventTime: isSet(object.eventTime)
3185
+ ? fromJsonTimestamp(object.eventTime)
3186
+ : isSet(object.event_time)
3187
+ ? fromJsonTimestamp(object.event_time)
3188
+ : undefined,
3189
+ sourceSystem: isSet(object.sourceSystem)
3190
+ ? globalThis.String(object.sourceSystem)
3191
+ : isSet(object.source_system)
3192
+ ? globalThis.String(object.source_system)
3193
+ : "",
3194
+ sessionId: isSet(object.sessionId)
3195
+ ? globalThis.String(object.sessionId)
3196
+ : isSet(object.session_id)
3197
+ ? globalThis.String(object.session_id)
3198
+ : "",
3199
+ toolCallId: isSet(object.toolCallId)
3200
+ ? globalThis.String(object.toolCallId)
3201
+ : isSet(object.tool_call_id)
3202
+ ? globalThis.String(object.tool_call_id)
3203
+ : "",
3204
+ action: isSet(object.action) ? aIGitActionFromJSON(object.action) : 0,
3205
+ outcome: isSet(object.outcome) ? aIGitOutcomeFromJSON(object.outcome) : 0,
3206
+ ownerKey: isSet(object.ownerKey)
3207
+ ? globalThis.String(object.ownerKey)
3208
+ : isSet(object.owner_key)
3209
+ ? globalThis.String(object.owner_key)
3210
+ : "",
3211
+ repositoryKey: isSet(object.repositoryKey)
3212
+ ? globalThis.String(object.repositoryKey)
3213
+ : isSet(object.repository_key)
3214
+ ? globalThis.String(object.repository_key)
3215
+ : "",
3216
+ refName: isSet(object.refName)
3217
+ ? globalThis.String(object.refName)
3218
+ : isSet(object.ref_name)
3219
+ ? globalThis.String(object.ref_name)
3220
+ : "",
3221
+ commitSha: isSet(object.commitSha)
3222
+ ? globalThis.String(object.commitSha)
3223
+ : isSet(object.commit_sha)
3224
+ ? globalThis.String(object.commit_sha)
3225
+ : "",
3226
+ pullRequestNumber: isSet(object.pullRequestNumber)
3227
+ ? globalThis.Number(object.pullRequestNumber)
3228
+ : isSet(object.pull_request_number)
3229
+ ? globalThis.Number(object.pull_request_number)
3230
+ : 0,
3231
+ pullRequestUrl: isSet(object.pullRequestUrl)
3232
+ ? globalThis.String(object.pullRequestUrl)
3233
+ : isSet(object.pull_request_url)
3234
+ ? globalThis.String(object.pull_request_url)
3235
+ : "",
3236
+ };
3237
+ },
3238
+
3239
+ toJSON(message: AIGitActivity): unknown {
3240
+ const obj: any = {};
3241
+ if (message.eventTime !== undefined) {
3242
+ obj.eventTime = message.eventTime.toISOString();
3243
+ }
3244
+ if (message.sourceSystem !== "") {
3245
+ obj.sourceSystem = message.sourceSystem;
3246
+ }
3247
+ if (message.sessionId !== "") {
3248
+ obj.sessionId = message.sessionId;
3249
+ }
3250
+ if (message.toolCallId !== "") {
3251
+ obj.toolCallId = message.toolCallId;
3252
+ }
3253
+ if (message.action !== 0) {
3254
+ obj.action = aIGitActionToJSON(message.action);
3255
+ }
3256
+ if (message.outcome !== 0) {
3257
+ obj.outcome = aIGitOutcomeToJSON(message.outcome);
3258
+ }
3259
+ if (message.ownerKey !== "") {
3260
+ obj.ownerKey = message.ownerKey;
3261
+ }
3262
+ if (message.repositoryKey !== "") {
3263
+ obj.repositoryKey = message.repositoryKey;
3264
+ }
3265
+ if (message.refName !== "") {
3266
+ obj.refName = message.refName;
3267
+ }
3268
+ if (message.commitSha !== "") {
3269
+ obj.commitSha = message.commitSha;
3270
+ }
3271
+ if (message.pullRequestNumber !== 0) {
3272
+ obj.pullRequestNumber = Math.round(message.pullRequestNumber);
3273
+ }
3274
+ if (message.pullRequestUrl !== "") {
3275
+ obj.pullRequestUrl = message.pullRequestUrl;
3276
+ }
3277
+ return obj;
3278
+ },
3279
+
3280
+ create<I extends Exact<DeepPartial<AIGitActivity>, I>>(base?: I): AIGitActivity {
3281
+ return AIGitActivity.fromPartial(base ?? ({} as any));
3282
+ },
3283
+ fromPartial<I extends Exact<DeepPartial<AIGitActivity>, I>>(object: I): AIGitActivity {
3284
+ const message = createBaseAIGitActivity();
3285
+ message.eventTime = object.eventTime ?? undefined;
3286
+ message.sourceSystem = object.sourceSystem ?? "";
3287
+ message.sessionId = object.sessionId ?? "";
3288
+ message.toolCallId = object.toolCallId ?? "";
3289
+ message.action = object.action ?? 0;
3290
+ message.outcome = object.outcome ?? 0;
3291
+ message.ownerKey = object.ownerKey ?? "";
3292
+ message.repositoryKey = object.repositoryKey ?? "";
3293
+ message.refName = object.refName ?? "";
3294
+ message.commitSha = object.commitSha ?? "";
3295
+ message.pullRequestNumber = object.pullRequestNumber ?? 0;
3296
+ message.pullRequestUrl = object.pullRequestUrl ?? "";
3297
+ return message;
3298
+ },
3299
+ };
3300
+
3301
+ function createBaseAITokenUsage(): AITokenUsage {
3302
+ return { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, providerCostUsdNano: 0 };
3303
+ }
3304
+
3305
+ export const AITokenUsage: MessageFns<AITokenUsage> = {
3306
+ encode(message: AITokenUsage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
3307
+ if (message.inputTokens !== 0) {
3308
+ writer.uint32(8).uint64(message.inputTokens);
3309
+ }
3310
+ if (message.outputTokens !== 0) {
3311
+ writer.uint32(16).uint64(message.outputTokens);
3312
+ }
3313
+ if (message.cacheReadTokens !== 0) {
3314
+ writer.uint32(24).uint64(message.cacheReadTokens);
3315
+ }
3316
+ if (message.cacheWriteTokens !== 0) {
3317
+ writer.uint32(32).uint64(message.cacheWriteTokens);
3318
+ }
3319
+ if (message.providerCostUsdNano !== 0) {
3320
+ writer.uint32(40).int64(message.providerCostUsdNano);
3321
+ }
3322
+ return writer;
3323
+ },
3324
+
3325
+ decode(input: BinaryReader | Uint8Array, length?: number): AITokenUsage {
3326
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
3327
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
3328
+ if (previousRecursionDepth >= 100) {
3329
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
3330
+ }
3331
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
3332
+ try {
3333
+ const end = length === undefined ? reader.len : reader.pos + length;
3334
+ const message = createBaseAITokenUsage();
3335
+ while (reader.pos < end) {
3336
+ const tag = reader.uint32();
3337
+ switch (tag >>> 3) {
3338
+ case 1: {
3339
+ if (tag !== 8) {
3340
+ break;
3341
+ }
3342
+
3343
+ message.inputTokens = longToNumber(reader.uint64());
3344
+ continue;
3345
+ }
3346
+ case 2: {
3347
+ if (tag !== 16) {
3348
+ break;
3349
+ }
3350
+
3351
+ message.outputTokens = longToNumber(reader.uint64());
3352
+ continue;
3353
+ }
3354
+ case 3: {
3355
+ if (tag !== 24) {
3356
+ break;
3357
+ }
3358
+
3359
+ message.cacheReadTokens = longToNumber(reader.uint64());
3360
+ continue;
3361
+ }
3362
+ case 4: {
3363
+ if (tag !== 32) {
3364
+ break;
3365
+ }
3366
+
3367
+ message.cacheWriteTokens = longToNumber(reader.uint64());
3368
+ continue;
3369
+ }
3370
+ case 5: {
3371
+ if (tag !== 40) {
3372
+ break;
3373
+ }
3374
+
3375
+ message.providerCostUsdNano = longToNumber(reader.int64());
3376
+ continue;
3377
+ }
3378
+ }
3379
+ if ((tag & 7) === 4 || tag === 0) {
3380
+ break;
3381
+ }
3382
+ reader.skip(tag & 7);
3383
+ }
3384
+ return message;
3385
+ } finally {
3386
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
3387
+ }
3388
+ },
3389
+
3390
+ fromJSON(object: any): AITokenUsage {
3391
+ return {
3392
+ inputTokens: isSet(object.inputTokens)
3393
+ ? globalThis.Number(object.inputTokens)
3394
+ : isSet(object.input_tokens)
3395
+ ? globalThis.Number(object.input_tokens)
3396
+ : 0,
3397
+ outputTokens: isSet(object.outputTokens)
3398
+ ? globalThis.Number(object.outputTokens)
3399
+ : isSet(object.output_tokens)
3400
+ ? globalThis.Number(object.output_tokens)
3401
+ : 0,
3402
+ cacheReadTokens: isSet(object.cacheReadTokens)
3403
+ ? globalThis.Number(object.cacheReadTokens)
3404
+ : isSet(object.cache_read_tokens)
3405
+ ? globalThis.Number(object.cache_read_tokens)
3406
+ : 0,
3407
+ cacheWriteTokens: isSet(object.cacheWriteTokens)
3408
+ ? globalThis.Number(object.cacheWriteTokens)
3409
+ : isSet(object.cache_write_tokens)
3410
+ ? globalThis.Number(object.cache_write_tokens)
3411
+ : 0,
3412
+ providerCostUsdNano: isSet(object.providerCostUsdNano)
3413
+ ? globalThis.Number(object.providerCostUsdNano)
3414
+ : isSet(object.provider_cost_usd_nano)
3415
+ ? globalThis.Number(object.provider_cost_usd_nano)
3416
+ : 0,
3417
+ };
3418
+ },
3419
+
3420
+ toJSON(message: AITokenUsage): unknown {
3421
+ const obj: any = {};
3422
+ if (message.inputTokens !== 0) {
3423
+ obj.inputTokens = Math.round(message.inputTokens);
3424
+ }
3425
+ if (message.outputTokens !== 0) {
3426
+ obj.outputTokens = Math.round(message.outputTokens);
3427
+ }
3428
+ if (message.cacheReadTokens !== 0) {
3429
+ obj.cacheReadTokens = Math.round(message.cacheReadTokens);
3430
+ }
3431
+ if (message.cacheWriteTokens !== 0) {
3432
+ obj.cacheWriteTokens = Math.round(message.cacheWriteTokens);
3433
+ }
3434
+ if (message.providerCostUsdNano !== 0) {
3435
+ obj.providerCostUsdNano = Math.round(message.providerCostUsdNano);
3436
+ }
3437
+ return obj;
3438
+ },
3439
+
3440
+ create<I extends Exact<DeepPartial<AITokenUsage>, I>>(base?: I): AITokenUsage {
3441
+ return AITokenUsage.fromPartial(base ?? ({} as any));
3442
+ },
3443
+ fromPartial<I extends Exact<DeepPartial<AITokenUsage>, I>>(object: I): AITokenUsage {
3444
+ const message = createBaseAITokenUsage();
3445
+ message.inputTokens = object.inputTokens ?? 0;
3446
+ message.outputTokens = object.outputTokens ?? 0;
3447
+ message.cacheReadTokens = object.cacheReadTokens ?? 0;
3448
+ message.cacheWriteTokens = object.cacheWriteTokens ?? 0;
3449
+ message.providerCostUsdNano = object.providerCostUsdNano ?? 0;
3450
+ return message;
3451
+ },
3452
+ };
3453
+
3454
+ /**
3455
+ * AIGatewayService is the frontend-facing proxy over telemetry.api.v1.AIService:
3456
+ * the AI session catalog, one session's conversational replay, and the principal
3457
+ * id->name catalog (read + alias write). A thin proxy — it resolves the caller's
3458
+ * identity, stamps the authorized organization/project, and forwards. Messages
3459
+ * duplicate the telemetry-api shape (proto domain isolation); unary responses
3460
+ * carry ResponseStatus, streams do not.
3461
+ */
3462
+ export interface AIGatewayService {
3463
+ ListSessions(request: ListSessionsRequest, metadata?: Metadata): Promise<ListSessionsResponse>;
3464
+ StreamSession(request: StreamSessionRequest, metadata?: Metadata): Observable<AISessionEventEnvelope>;
3465
+ ListPrincipals(request: ListPrincipalsRequest, metadata?: Metadata): Promise<ListPrincipalsResponse>;
3466
+ UpdatePrincipal(request: UpdatePrincipalRequest, metadata?: Metadata): Promise<UpdatePrincipalResponse>;
3467
+ ListGitActivities(request: ListGitActivitiesRequest, metadata?: Metadata): Promise<ListGitActivitiesResponse>;
3468
+ }
3469
+
3470
+ export const AIGatewayServiceServiceName = "gateway.web.v1.AIGatewayService";
3471
+ export class AIGatewayServiceClientImpl implements AIGatewayService {
3472
+ private readonly rpc: Rpc;
3473
+ private readonly service: string;
3474
+ constructor(rpc: Rpc, opts?: { service?: string }) {
3475
+ this.service = opts?.service || AIGatewayServiceServiceName;
3476
+ this.rpc = rpc;
3477
+ this.ListSessions = this.ListSessions.bind(this);
3478
+ this.StreamSession = this.StreamSession.bind(this);
3479
+ this.ListPrincipals = this.ListPrincipals.bind(this);
3480
+ this.UpdatePrincipal = this.UpdatePrincipal.bind(this);
3481
+ this.ListGitActivities = this.ListGitActivities.bind(this);
3482
+ }
3483
+ ListSessions(request: ListSessionsRequest, metadata?: Metadata): Promise<ListSessionsResponse> {
3484
+ const data = ListSessionsRequest.encode(request).finish();
3485
+ const promise = this.rpc.request(this.service, "ListSessions", data, metadata);
3486
+ return promise.then((data) => ListSessionsResponse.decode(new BinaryReader(data)));
3487
+ }
3488
+
3489
+ StreamSession(request: StreamSessionRequest, metadata?: Metadata): Observable<AISessionEventEnvelope> {
3490
+ const data = StreamSessionRequest.encode(request).finish();
3491
+ const result = this.rpc.serverStreamingRequest(this.service, "StreamSession", data, metadata);
3492
+ return result.pipe(map((data) => AISessionEventEnvelope.decode(new BinaryReader(data))));
3493
+ }
3494
+
3495
+ ListPrincipals(request: ListPrincipalsRequest, metadata?: Metadata): Promise<ListPrincipalsResponse> {
3496
+ const data = ListPrincipalsRequest.encode(request).finish();
3497
+ const promise = this.rpc.request(this.service, "ListPrincipals", data, metadata);
3498
+ return promise.then((data) => ListPrincipalsResponse.decode(new BinaryReader(data)));
3499
+ }
3500
+
3501
+ UpdatePrincipal(request: UpdatePrincipalRequest, metadata?: Metadata): Promise<UpdatePrincipalResponse> {
3502
+ const data = UpdatePrincipalRequest.encode(request).finish();
3503
+ const promise = this.rpc.request(this.service, "UpdatePrincipal", data, metadata);
3504
+ return promise.then((data) => UpdatePrincipalResponse.decode(new BinaryReader(data)));
3505
+ }
3506
+
3507
+ ListGitActivities(request: ListGitActivitiesRequest, metadata?: Metadata): Promise<ListGitActivitiesResponse> {
3508
+ const data = ListGitActivitiesRequest.encode(request).finish();
3509
+ const promise = this.rpc.request(this.service, "ListGitActivities", data, metadata);
3510
+ return promise.then((data) => ListGitActivitiesResponse.decode(new BinaryReader(data)));
3511
+ }
3512
+ }
3513
+
3514
+ interface Rpc {
3515
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
3516
+ clientStreamingRequest(
3517
+ service: string,
3518
+ method: string,
3519
+ data: Observable<Uint8Array>,
3520
+ metadata?: Metadata,
3521
+ ): Promise<Uint8Array>;
3522
+ serverStreamingRequest(
3523
+ service: string,
3524
+ method: string,
3525
+ data: Uint8Array,
3526
+ metadata?: Metadata,
3527
+ ): Observable<Uint8Array>;
3528
+ bidirectionalStreamingRequest(
3529
+ service: string,
3530
+ method: string,
3531
+ data: Observable<Uint8Array>,
3532
+ metadata?: Metadata,
3533
+ ): Observable<Uint8Array>;
3534
+ }
3535
+
3536
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
3537
+
3538
+ export type DeepPartial<T> = T extends Builtin ? T
3539
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
3540
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
3541
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
3542
+ : Partial<T>;
3543
+
3544
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
3545
+ export type Exact<P, I extends P> = P extends Builtin ? P
3546
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
3547
+
3548
+ function toTimestamp(date: Date): Timestamp {
3549
+ const seconds = Math.trunc(date.getTime() / 1_000);
3550
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
3551
+ return { seconds, nanos };
3552
+ }
3553
+
3554
+ function fromTimestamp(t: Timestamp): Date {
3555
+ let millis = (t.seconds || 0) * 1_000;
3556
+ millis += (t.nanos || 0) / 1_000_000;
3557
+ return new globalThis.Date(millis);
3558
+ }
3559
+
3560
+ function fromJsonTimestamp(o: any): Date {
3561
+ if (o instanceof globalThis.Date) {
3562
+ return o;
3563
+ } else if (typeof o === "string") {
3564
+ return new globalThis.Date(o);
3565
+ } else {
3566
+ return fromTimestamp(Timestamp.fromJSON(o));
3567
+ }
3568
+ }
3569
+
3570
+ function longToNumber(int64: { toString(): string }): number {
3571
+ const num = globalThis.Number(int64.toString());
3572
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
3573
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
3574
+ }
3575
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
3576
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
3577
+ }
3578
+ return num;
3579
+ }
3580
+
3581
+ function isSet(value: any): boolean {
3582
+ return value !== null && value !== undefined;
3583
+ }
3584
+
3585
+ export interface MessageFns<T> {
3586
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
3587
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
3588
+ fromJSON(object: any): T;
3589
+ toJSON(message: T): unknown;
3590
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
3591
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
3592
+ }