@miradorlabs/web-grpc 4.33.0 → 4.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2692 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.22.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/ai_insights_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
11
+ import { ResponseStatus } from "../../common/v1/status";
12
+ import { AISessionEventRef, AISessionInsight, AISkillSuggestion } from "./ai_gateway";
13
+
14
+ export const protobufPackage = "gateway.web.v1";
15
+
16
+ export const protobufFileName = "proto/gateway/web/v1/ai_insights_gateway.proto";
17
+
18
+ /** SessionInsightSort orders a page of insights. */
19
+ export enum SessionInsightSort {
20
+ SESSION_INSIGHT_SORT_UNSPECIFIED = 0,
21
+ /** SESSION_INSIGHT_SORT_RECENT - Newest analysis first; within one session, the model's order (most costly first); then source system and session id. */
22
+ SESSION_INSIGHT_SORT_RECENT = 1,
23
+ UNRECOGNIZED = -1,
24
+ }
25
+
26
+ export function sessionInsightSortFromJSON(object: any): SessionInsightSort {
27
+ switch (object) {
28
+ case 0:
29
+ case "SESSION_INSIGHT_SORT_UNSPECIFIED":
30
+ return SessionInsightSort.SESSION_INSIGHT_SORT_UNSPECIFIED;
31
+ case 1:
32
+ case "SESSION_INSIGHT_SORT_RECENT":
33
+ return SessionInsightSort.SESSION_INSIGHT_SORT_RECENT;
34
+ case -1:
35
+ case "UNRECOGNIZED":
36
+ default:
37
+ return SessionInsightSort.UNRECOGNIZED;
38
+ }
39
+ }
40
+
41
+ export function sessionInsightSortToJSON(object: SessionInsightSort): string {
42
+ switch (object) {
43
+ case SessionInsightSort.SESSION_INSIGHT_SORT_UNSPECIFIED:
44
+ return "SESSION_INSIGHT_SORT_UNSPECIFIED";
45
+ case SessionInsightSort.SESSION_INSIGHT_SORT_RECENT:
46
+ return "SESSION_INSIGHT_SORT_RECENT";
47
+ case SessionInsightSort.UNRECOGNIZED:
48
+ default:
49
+ return "UNRECOGNIZED";
50
+ }
51
+ }
52
+
53
+ /** AIProjectInsightKind is what a card recommends, for display. */
54
+ export enum AIProjectInsightKind {
55
+ AI_PROJECT_INSIGHT_KIND_UNSPECIFIED = 0,
56
+ /** AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW - A repeated workflow worth turning into a new reusable skill. */
57
+ AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW = 1,
58
+ AI_PROJECT_INSIGHT_KIND_REPOSITORY_STRUCTURE = 2,
59
+ /** AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW - An observed concern to investigate, never a confirmed vulnerability. */
60
+ AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW = 3,
61
+ AI_PROJECT_INSIGHT_KIND_TOOLING_MCP = 4,
62
+ /** AI_PROJECT_INSIGHT_KIND_COORDINATION - Members duplicating work, or needing to coordinate it. */
63
+ AI_PROJECT_INSIGHT_KIND_COORDINATION = 5,
64
+ /** AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS - Members working on the same product, feature or area, who would gain from knowing it. */
65
+ AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS = 6,
66
+ /** AI_PROJECT_INSIGHT_KIND_SKILL_SHARING - A practice, skill or know-how one member shows that others working nearby would benefit from. */
67
+ AI_PROJECT_INSIGHT_KIND_SKILL_SHARING = 7,
68
+ /** AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE - How members get on with their agents: models or tools they favour, and where work flowed or stalled. */
69
+ AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE = 8,
70
+ UNRECOGNIZED = -1,
71
+ }
72
+
73
+ export function aIProjectInsightKindFromJSON(object: any): AIProjectInsightKind {
74
+ switch (object) {
75
+ case 0:
76
+ case "AI_PROJECT_INSIGHT_KIND_UNSPECIFIED":
77
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_UNSPECIFIED;
78
+ case 1:
79
+ case "AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW":
80
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW;
81
+ case 2:
82
+ case "AI_PROJECT_INSIGHT_KIND_REPOSITORY_STRUCTURE":
83
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_REPOSITORY_STRUCTURE;
84
+ case 3:
85
+ case "AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW":
86
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW;
87
+ case 4:
88
+ case "AI_PROJECT_INSIGHT_KIND_TOOLING_MCP":
89
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_TOOLING_MCP;
90
+ case 5:
91
+ case "AI_PROJECT_INSIGHT_KIND_COORDINATION":
92
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_COORDINATION;
93
+ case 6:
94
+ case "AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS":
95
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS;
96
+ case 7:
97
+ case "AI_PROJECT_INSIGHT_KIND_SKILL_SHARING":
98
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SKILL_SHARING;
99
+ case 8:
100
+ case "AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE":
101
+ return AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE;
102
+ case -1:
103
+ case "UNRECOGNIZED":
104
+ default:
105
+ return AIProjectInsightKind.UNRECOGNIZED;
106
+ }
107
+ }
108
+
109
+ export function aIProjectInsightKindToJSON(object: AIProjectInsightKind): string {
110
+ switch (object) {
111
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_UNSPECIFIED:
112
+ return "AI_PROJECT_INSIGHT_KIND_UNSPECIFIED";
113
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW:
114
+ return "AI_PROJECT_INSIGHT_KIND_REUSABLE_WORKFLOW";
115
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_REPOSITORY_STRUCTURE:
116
+ return "AI_PROJECT_INSIGHT_KIND_REPOSITORY_STRUCTURE";
117
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW:
118
+ return "AI_PROJECT_INSIGHT_KIND_SECURITY_REVIEW";
119
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_TOOLING_MCP:
120
+ return "AI_PROJECT_INSIGHT_KIND_TOOLING_MCP";
121
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_COORDINATION:
122
+ return "AI_PROJECT_INSIGHT_KIND_COORDINATION";
123
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS:
124
+ return "AI_PROJECT_INSIGHT_KIND_SHARED_FOCUS";
125
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_SKILL_SHARING:
126
+ return "AI_PROJECT_INSIGHT_KIND_SKILL_SHARING";
127
+ case AIProjectInsightKind.AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE:
128
+ return "AI_PROJECT_INSIGHT_KIND_AGENT_EXPERIENCE";
129
+ case AIProjectInsightKind.UNRECOGNIZED:
130
+ default:
131
+ return "UNRECOGNIZED";
132
+ }
133
+ }
134
+
135
+ /** AIInsightRating is how helpful a person found an insight or score card (ai.common.v1.AIInsightRating, same numbers). */
136
+ export enum AIInsightRating {
137
+ AI_INSIGHT_RATING_UNSPECIFIED = 0,
138
+ AI_INSIGHT_RATING_NOT_HELPFUL = 1,
139
+ AI_INSIGHT_RATING_HELPFUL = 2,
140
+ AI_INSIGHT_RATING_VERY_HELPFUL = 3,
141
+ UNRECOGNIZED = -1,
142
+ }
143
+
144
+ export function aIInsightRatingFromJSON(object: any): AIInsightRating {
145
+ switch (object) {
146
+ case 0:
147
+ case "AI_INSIGHT_RATING_UNSPECIFIED":
148
+ return AIInsightRating.AI_INSIGHT_RATING_UNSPECIFIED;
149
+ case 1:
150
+ case "AI_INSIGHT_RATING_NOT_HELPFUL":
151
+ return AIInsightRating.AI_INSIGHT_RATING_NOT_HELPFUL;
152
+ case 2:
153
+ case "AI_INSIGHT_RATING_HELPFUL":
154
+ return AIInsightRating.AI_INSIGHT_RATING_HELPFUL;
155
+ case 3:
156
+ case "AI_INSIGHT_RATING_VERY_HELPFUL":
157
+ return AIInsightRating.AI_INSIGHT_RATING_VERY_HELPFUL;
158
+ case -1:
159
+ case "UNRECOGNIZED":
160
+ default:
161
+ return AIInsightRating.UNRECOGNIZED;
162
+ }
163
+ }
164
+
165
+ export function aIInsightRatingToJSON(object: AIInsightRating): string {
166
+ switch (object) {
167
+ case AIInsightRating.AI_INSIGHT_RATING_UNSPECIFIED:
168
+ return "AI_INSIGHT_RATING_UNSPECIFIED";
169
+ case AIInsightRating.AI_INSIGHT_RATING_NOT_HELPFUL:
170
+ return "AI_INSIGHT_RATING_NOT_HELPFUL";
171
+ case AIInsightRating.AI_INSIGHT_RATING_HELPFUL:
172
+ return "AI_INSIGHT_RATING_HELPFUL";
173
+ case AIInsightRating.AI_INSIGHT_RATING_VERY_HELPFUL:
174
+ return "AI_INSIGHT_RATING_VERY_HELPFUL";
175
+ case AIInsightRating.UNRECOGNIZED:
176
+ default:
177
+ return "UNRECOGNIZED";
178
+ }
179
+ }
180
+
181
+ /** ListSessionInsightsRequest pages a project's insights one insight at a time, newest analysis first. */
182
+ export interface ListSessionInsightsRequest {
183
+ organizationId: string;
184
+ projectId: string;
185
+ /** Narrows the insights; unset reads the whole team's. */
186
+ filter:
187
+ | SessionInsightFilter
188
+ | undefined;
189
+ /** Unspecified is SESSION_INSIGHT_SORT_RECENT. */
190
+ sort: SessionInsightSort;
191
+ /** Insights per page, 1 to 50; 0 is the default, 15. Negative is INVALID_ARGUMENT. */
192
+ pageSize: number;
193
+ /**
194
+ * A next_page_token from the same request; empty reads the first page. A token used with another filter or sort
195
+ * reads on from its position under the new one.
196
+ */
197
+ pageToken: string;
198
+ }
199
+
200
+ /**
201
+ * SessionInsightFilter narrows a project's insights. Fields AND; a repeated field matches any of its values; an unset
202
+ * or empty field does not filter.
203
+ */
204
+ export interface SessionInsightFilter {
205
+ /**
206
+ * The session's user (ai_sessions.UserId when the insights were written). Any reader of the project may list any of
207
+ * its people's insights.
208
+ */
209
+ userIds: string[];
210
+ sourceSystems: string[];
211
+ /** The topics file's keys; a topic the model named has no key and matches none. */
212
+ topicKeys: string[];
213
+ }
214
+
215
+ export interface ListSessionInsightsResponse {
216
+ status:
217
+ | ResponseStatus
218
+ | undefined;
219
+ /** The page's insights in sort order; empty when the project has none that match. */
220
+ insights: SessionInsightEntry[];
221
+ /** Empty on the last page. */
222
+ nextPageToken: string;
223
+ }
224
+
225
+ /** SessionInsightEntry is one insight with the session it is about. */
226
+ export interface SessionInsightEntry {
227
+ /** source_system with session_id is the session's identity. */
228
+ sourceSystem: string;
229
+ sessionId: string;
230
+ /** When the insights run that wrote it selected the session. */
231
+ analyzedAt: Date | undefined;
232
+ insight: AISessionInsight | undefined;
233
+ }
234
+
235
+ export interface ListProjectInsightCardsRequest {
236
+ organizationId: string;
237
+ projectId: string;
238
+ /** Cards per page, 1 to 50; 0 is the default, 15. Negative is a validation error. */
239
+ pageSize: number;
240
+ /** A prior response's next_page_token: resumes after its card's local day and rank. Empty reads the newest cards. */
241
+ pageToken: string;
242
+ }
243
+
244
+ export interface ListProjectInsightCardsResponse {
245
+ status:
246
+ | ResponseStatus
247
+ | undefined;
248
+ /**
249
+ * Newest local day first, rank order within a day; empty when the project has no READY day. A page can be shorter
250
+ * than page_size while next_page_token is set.
251
+ */
252
+ cards: AIProjectInsightCard[];
253
+ /** Empty on the last page. */
254
+ nextPageToken: string;
255
+ }
256
+
257
+ /**
258
+ * AIProjectInsightCard is one card with the run that served it: label it with its day and analysis ("Nov 3 (final)",
259
+ * "Today until 14:00, analyzed 14:06").
260
+ */
261
+ export interface AIProjectInsightCard {
262
+ insight: AIProjectInsight | undefined;
263
+ runId: string;
264
+ /** The day the run analyzed, YYYY-MM-DD in time_zone. */
265
+ localDate: string;
266
+ /** The IANA timezone the day is in: the organization's, or "UTC" when it had none. */
267
+ timeZone: string;
268
+ /** True when the run covered the whole local day, final for that day; false while the day is still running. */
269
+ windowClosed: boolean;
270
+ /** When the run analyzed the window. */
271
+ analyzedAt: Date | undefined;
272
+ }
273
+
274
+ /**
275
+ * AIProjectInsight is one recommendation about the project's work, grounded in sessions of at least two linked people.
276
+ * title, pattern, explanation, action and limitations are model-written text; the counts and spend come from
277
+ * SQL, never from the model. Cards are new on every run: id names this run's card, not a pattern across runs.
278
+ */
279
+ export interface AIProjectInsight {
280
+ id: string;
281
+ /** 1 is the model's highest priority; unique within the run. */
282
+ rank: number;
283
+ /** For display only; not evidence. */
284
+ kind: AIProjectInsightKind;
285
+ title: string;
286
+ /** The observed pattern. */
287
+ pattern: string;
288
+ /** How the cited sessions connect, and why the action follows. */
289
+ explanation: string;
290
+ /** The proposed action. Nothing is done automatically. */
291
+ action: string;
292
+ /** What is still uncertain. */
293
+ limitations: string;
294
+ /** Distinct supporting sessions (at most 50) and their linked people (at least 2). */
295
+ sessionCount: number;
296
+ personCount: number;
297
+ /**
298
+ * Recorded spend in the supporting sessions during the window, in USD, as an exact decimal string ("12.5"). It is a
299
+ * sum of Decimal(18,9) amounts, so it can exceed a double's precision or int64 nanodollars. Absent when it could
300
+ * not be measured, never "0" for unknown. Cards' sessions overlap: never add amounts across cards.
301
+ */
302
+ spendUsd?:
303
+ | string
304
+ | undefined;
305
+ /** The events the card cites, in the model's order; each names a session of the project. */
306
+ citations: AIProjectInsightCitation[];
307
+ /**
308
+ * Absent when this card has no catalog suggestion. The model chose it from its run's shortlist of public skills no
309
+ * session of the project used in the window; its metadata is public reference text, not instructions.
310
+ */
311
+ skillSuggestion: AISkillSuggestion | undefined;
312
+ }
313
+
314
+ /**
315
+ * AIProjectInsightCitation is one cited event: its session's identity (source_system with session_id) and the
316
+ * event's stored identity in that session.
317
+ */
318
+ export interface AIProjectInsightCitation {
319
+ sourceSystem: string;
320
+ sessionId: string;
321
+ eventRef: AISessionEventRef | undefined;
322
+ }
323
+
324
+ /** InsightRef names one card a person rates: a session insight, a project insight card or a session's score card. */
325
+ export interface InsightRef {
326
+ /** An AISessionInsight.id. */
327
+ sessionInsightId?:
328
+ | string
329
+ | undefined;
330
+ /** An AIProjectInsight.id. */
331
+ projectInsightId?:
332
+ | string
333
+ | undefined;
334
+ /** An AISessionScore.id. */
335
+ sessionScoreId?: string | undefined;
336
+ }
337
+
338
+ /** InsightRating is the caller's rating of one insight. */
339
+ export interface InsightRating {
340
+ /** As the request named it. */
341
+ insight: InsightRef | undefined;
342
+ rating: AIInsightRating;
343
+ /** When the caller last set it. */
344
+ ratedAt: Date | undefined;
345
+ }
346
+
347
+ export interface BatchGetInsightRatingsRequest {
348
+ organizationId: string;
349
+ projectId: string;
350
+ /** 1 to 100 insights; more, an empty ref or a malformed id is a validation error. */
351
+ insights: InsightRef[];
352
+ }
353
+
354
+ export interface BatchGetInsightRatingsResponse {
355
+ status:
356
+ | ResponseStatus
357
+ | undefined;
358
+ /** The caller's ratings of the requested insights they rated, in no particular order. */
359
+ ratings: InsightRating[];
360
+ }
361
+
362
+ export interface SetInsightRatingRequest {
363
+ organizationId: string;
364
+ projectId: string;
365
+ insight:
366
+ | InsightRef
367
+ | undefined;
368
+ /** UNSPECIFIED is a validation error. */
369
+ rating: AIInsightRating;
370
+ }
371
+
372
+ export interface SetInsightRatingResponse {
373
+ status: ResponseStatus | undefined;
374
+ rating: InsightRating | undefined;
375
+ }
376
+
377
+ export interface DeleteInsightRatingRequest {
378
+ organizationId: string;
379
+ projectId: string;
380
+ insight: InsightRef | undefined;
381
+ }
382
+
383
+ export interface DeleteInsightRatingResponse {
384
+ status: ResponseStatus | undefined;
385
+ }
386
+
387
+ function createBaseListSessionInsightsRequest(): ListSessionInsightsRequest {
388
+ return { organizationId: "", projectId: "", filter: undefined, sort: 0, pageSize: 0, pageToken: "" };
389
+ }
390
+
391
+ export const ListSessionInsightsRequest: MessageFns<ListSessionInsightsRequest> = {
392
+ encode(message: ListSessionInsightsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
393
+ if (message.organizationId !== "") {
394
+ writer.uint32(10).string(message.organizationId);
395
+ }
396
+ if (message.projectId !== "") {
397
+ writer.uint32(18).string(message.projectId);
398
+ }
399
+ if (message.filter !== undefined) {
400
+ SessionInsightFilter.encode(message.filter, writer.uint32(26).fork()).join();
401
+ }
402
+ if (message.sort !== 0) {
403
+ writer.uint32(32).int32(message.sort);
404
+ }
405
+ if (message.pageSize !== 0) {
406
+ writer.uint32(40).int32(message.pageSize);
407
+ }
408
+ if (message.pageToken !== "") {
409
+ writer.uint32(50).string(message.pageToken);
410
+ }
411
+ return writer;
412
+ },
413
+
414
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSessionInsightsRequest {
415
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
416
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
417
+ if (previousRecursionDepth >= 100) {
418
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
419
+ }
420
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
421
+ try {
422
+ const end = length === undefined ? reader.len : reader.pos + length;
423
+ const message = createBaseListSessionInsightsRequest();
424
+ while (reader.pos < end) {
425
+ const tag = reader.uint32();
426
+ switch (tag >>> 3) {
427
+ case 1: {
428
+ if (tag !== 10) {
429
+ break;
430
+ }
431
+
432
+ message.organizationId = reader.string();
433
+ continue;
434
+ }
435
+ case 2: {
436
+ if (tag !== 18) {
437
+ break;
438
+ }
439
+
440
+ message.projectId = reader.string();
441
+ continue;
442
+ }
443
+ case 3: {
444
+ if (tag !== 26) {
445
+ break;
446
+ }
447
+
448
+ message.filter = SessionInsightFilter.decode(reader, reader.uint32());
449
+ continue;
450
+ }
451
+ case 4: {
452
+ if (tag !== 32) {
453
+ break;
454
+ }
455
+
456
+ message.sort = reader.int32() as any;
457
+ continue;
458
+ }
459
+ case 5: {
460
+ if (tag !== 40) {
461
+ break;
462
+ }
463
+
464
+ message.pageSize = reader.int32();
465
+ continue;
466
+ }
467
+ case 6: {
468
+ if (tag !== 50) {
469
+ break;
470
+ }
471
+
472
+ message.pageToken = reader.string();
473
+ continue;
474
+ }
475
+ }
476
+ if ((tag & 7) === 4 || tag === 0) {
477
+ break;
478
+ }
479
+ reader.skip(tag & 7);
480
+ }
481
+ return message;
482
+ } finally {
483
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
484
+ }
485
+ },
486
+
487
+ fromJSON(object: any): ListSessionInsightsRequest {
488
+ return {
489
+ organizationId: isSet(object.organizationId)
490
+ ? globalThis.String(object.organizationId)
491
+ : isSet(object.organization_id)
492
+ ? globalThis.String(object.organization_id)
493
+ : "",
494
+ projectId: isSet(object.projectId)
495
+ ? globalThis.String(object.projectId)
496
+ : isSet(object.project_id)
497
+ ? globalThis.String(object.project_id)
498
+ : "",
499
+ filter: isSet(object.filter) ? SessionInsightFilter.fromJSON(object.filter) : undefined,
500
+ sort: isSet(object.sort) ? sessionInsightSortFromJSON(object.sort) : 0,
501
+ pageSize: isSet(object.pageSize)
502
+ ? globalThis.Number(object.pageSize)
503
+ : isSet(object.page_size)
504
+ ? globalThis.Number(object.page_size)
505
+ : 0,
506
+ pageToken: isSet(object.pageToken)
507
+ ? globalThis.String(object.pageToken)
508
+ : isSet(object.page_token)
509
+ ? globalThis.String(object.page_token)
510
+ : "",
511
+ };
512
+ },
513
+
514
+ toJSON(message: ListSessionInsightsRequest): unknown {
515
+ const obj: any = {};
516
+ if (message.organizationId !== "") {
517
+ obj.organizationId = message.organizationId;
518
+ }
519
+ if (message.projectId !== "") {
520
+ obj.projectId = message.projectId;
521
+ }
522
+ if (message.filter !== undefined) {
523
+ obj.filter = SessionInsightFilter.toJSON(message.filter);
524
+ }
525
+ if (message.sort !== 0) {
526
+ obj.sort = sessionInsightSortToJSON(message.sort);
527
+ }
528
+ if (message.pageSize !== 0) {
529
+ obj.pageSize = Math.round(message.pageSize);
530
+ }
531
+ if (message.pageToken !== "") {
532
+ obj.pageToken = message.pageToken;
533
+ }
534
+ return obj;
535
+ },
536
+
537
+ create<I extends Exact<DeepPartial<ListSessionInsightsRequest>, I>>(base?: I): ListSessionInsightsRequest {
538
+ return ListSessionInsightsRequest.fromPartial(base ?? ({} as any));
539
+ },
540
+ fromPartial<I extends Exact<DeepPartial<ListSessionInsightsRequest>, I>>(object: I): ListSessionInsightsRequest {
541
+ const message = createBaseListSessionInsightsRequest();
542
+ message.organizationId = object.organizationId ?? "";
543
+ message.projectId = object.projectId ?? "";
544
+ message.filter = (object.filter !== undefined && object.filter !== null)
545
+ ? SessionInsightFilter.fromPartial(object.filter)
546
+ : undefined;
547
+ message.sort = object.sort ?? 0;
548
+ message.pageSize = object.pageSize ?? 0;
549
+ message.pageToken = object.pageToken ?? "";
550
+ return message;
551
+ },
552
+ };
553
+
554
+ function createBaseSessionInsightFilter(): SessionInsightFilter {
555
+ return { userIds: [], sourceSystems: [], topicKeys: [] };
556
+ }
557
+
558
+ export const SessionInsightFilter: MessageFns<SessionInsightFilter> = {
559
+ encode(message: SessionInsightFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
560
+ for (const v of message.userIds) {
561
+ writer.uint32(10).string(v!);
562
+ }
563
+ for (const v of message.sourceSystems) {
564
+ writer.uint32(18).string(v!);
565
+ }
566
+ for (const v of message.topicKeys) {
567
+ writer.uint32(26).string(v!);
568
+ }
569
+ return writer;
570
+ },
571
+
572
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionInsightFilter {
573
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
574
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
575
+ if (previousRecursionDepth >= 100) {
576
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
577
+ }
578
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
579
+ try {
580
+ const end = length === undefined ? reader.len : reader.pos + length;
581
+ const message = createBaseSessionInsightFilter();
582
+ while (reader.pos < end) {
583
+ const tag = reader.uint32();
584
+ switch (tag >>> 3) {
585
+ case 1: {
586
+ if (tag !== 10) {
587
+ break;
588
+ }
589
+
590
+ message.userIds.push(reader.string());
591
+ continue;
592
+ }
593
+ case 2: {
594
+ if (tag !== 18) {
595
+ break;
596
+ }
597
+
598
+ message.sourceSystems.push(reader.string());
599
+ continue;
600
+ }
601
+ case 3: {
602
+ if (tag !== 26) {
603
+ break;
604
+ }
605
+
606
+ message.topicKeys.push(reader.string());
607
+ continue;
608
+ }
609
+ }
610
+ if ((tag & 7) === 4 || tag === 0) {
611
+ break;
612
+ }
613
+ reader.skip(tag & 7);
614
+ }
615
+ return message;
616
+ } finally {
617
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
618
+ }
619
+ },
620
+
621
+ fromJSON(object: any): SessionInsightFilter {
622
+ return {
623
+ userIds: globalThis.Array.isArray(object?.userIds)
624
+ ? object.userIds.map((e: any) => globalThis.String(e))
625
+ : globalThis.Array.isArray(object?.user_ids)
626
+ ? object.user_ids.map((e: any) => globalThis.String(e))
627
+ : [],
628
+ sourceSystems: globalThis.Array.isArray(object?.sourceSystems)
629
+ ? object.sourceSystems.map((e: any) => globalThis.String(e))
630
+ : globalThis.Array.isArray(object?.source_systems)
631
+ ? object.source_systems.map((e: any) => globalThis.String(e))
632
+ : [],
633
+ topicKeys: globalThis.Array.isArray(object?.topicKeys)
634
+ ? object.topicKeys.map((e: any) => globalThis.String(e))
635
+ : globalThis.Array.isArray(object?.topic_keys)
636
+ ? object.topic_keys.map((e: any) => globalThis.String(e))
637
+ : [],
638
+ };
639
+ },
640
+
641
+ toJSON(message: SessionInsightFilter): unknown {
642
+ const obj: any = {};
643
+ if (message.userIds?.length) {
644
+ obj.userIds = message.userIds;
645
+ }
646
+ if (message.sourceSystems?.length) {
647
+ obj.sourceSystems = message.sourceSystems;
648
+ }
649
+ if (message.topicKeys?.length) {
650
+ obj.topicKeys = message.topicKeys;
651
+ }
652
+ return obj;
653
+ },
654
+
655
+ create<I extends Exact<DeepPartial<SessionInsightFilter>, I>>(base?: I): SessionInsightFilter {
656
+ return SessionInsightFilter.fromPartial(base ?? ({} as any));
657
+ },
658
+ fromPartial<I extends Exact<DeepPartial<SessionInsightFilter>, I>>(object: I): SessionInsightFilter {
659
+ const message = createBaseSessionInsightFilter();
660
+ message.userIds = object.userIds?.map((e) => e) || [];
661
+ message.sourceSystems = object.sourceSystems?.map((e) => e) || [];
662
+ message.topicKeys = object.topicKeys?.map((e) => e) || [];
663
+ return message;
664
+ },
665
+ };
666
+
667
+ function createBaseListSessionInsightsResponse(): ListSessionInsightsResponse {
668
+ return { status: undefined, insights: [], nextPageToken: "" };
669
+ }
670
+
671
+ export const ListSessionInsightsResponse: MessageFns<ListSessionInsightsResponse> = {
672
+ encode(message: ListSessionInsightsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
673
+ if (message.status !== undefined) {
674
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
675
+ }
676
+ for (const v of message.insights) {
677
+ SessionInsightEntry.encode(v!, writer.uint32(18).fork()).join();
678
+ }
679
+ if (message.nextPageToken !== "") {
680
+ writer.uint32(26).string(message.nextPageToken);
681
+ }
682
+ return writer;
683
+ },
684
+
685
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSessionInsightsResponse {
686
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
687
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
688
+ if (previousRecursionDepth >= 100) {
689
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
690
+ }
691
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
692
+ try {
693
+ const end = length === undefined ? reader.len : reader.pos + length;
694
+ const message = createBaseListSessionInsightsResponse();
695
+ while (reader.pos < end) {
696
+ const tag = reader.uint32();
697
+ switch (tag >>> 3) {
698
+ case 1: {
699
+ if (tag !== 10) {
700
+ break;
701
+ }
702
+
703
+ message.status = ResponseStatus.decode(reader, reader.uint32());
704
+ continue;
705
+ }
706
+ case 2: {
707
+ if (tag !== 18) {
708
+ break;
709
+ }
710
+
711
+ message.insights.push(SessionInsightEntry.decode(reader, reader.uint32()));
712
+ continue;
713
+ }
714
+ case 3: {
715
+ if (tag !== 26) {
716
+ break;
717
+ }
718
+
719
+ message.nextPageToken = reader.string();
720
+ continue;
721
+ }
722
+ }
723
+ if ((tag & 7) === 4 || tag === 0) {
724
+ break;
725
+ }
726
+ reader.skip(tag & 7);
727
+ }
728
+ return message;
729
+ } finally {
730
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
731
+ }
732
+ },
733
+
734
+ fromJSON(object: any): ListSessionInsightsResponse {
735
+ return {
736
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
737
+ insights: globalThis.Array.isArray(object?.insights)
738
+ ? object.insights.map((e: any) => SessionInsightEntry.fromJSON(e))
739
+ : [],
740
+ nextPageToken: isSet(object.nextPageToken)
741
+ ? globalThis.String(object.nextPageToken)
742
+ : isSet(object.next_page_token)
743
+ ? globalThis.String(object.next_page_token)
744
+ : "",
745
+ };
746
+ },
747
+
748
+ toJSON(message: ListSessionInsightsResponse): unknown {
749
+ const obj: any = {};
750
+ if (message.status !== undefined) {
751
+ obj.status = ResponseStatus.toJSON(message.status);
752
+ }
753
+ if (message.insights?.length) {
754
+ obj.insights = message.insights.map((e) => SessionInsightEntry.toJSON(e));
755
+ }
756
+ if (message.nextPageToken !== "") {
757
+ obj.nextPageToken = message.nextPageToken;
758
+ }
759
+ return obj;
760
+ },
761
+
762
+ create<I extends Exact<DeepPartial<ListSessionInsightsResponse>, I>>(base?: I): ListSessionInsightsResponse {
763
+ return ListSessionInsightsResponse.fromPartial(base ?? ({} as any));
764
+ },
765
+ fromPartial<I extends Exact<DeepPartial<ListSessionInsightsResponse>, I>>(object: I): ListSessionInsightsResponse {
766
+ const message = createBaseListSessionInsightsResponse();
767
+ message.status = (object.status !== undefined && object.status !== null)
768
+ ? ResponseStatus.fromPartial(object.status)
769
+ : undefined;
770
+ message.insights = object.insights?.map((e) => SessionInsightEntry.fromPartial(e)) || [];
771
+ message.nextPageToken = object.nextPageToken ?? "";
772
+ return message;
773
+ },
774
+ };
775
+
776
+ function createBaseSessionInsightEntry(): SessionInsightEntry {
777
+ return { sourceSystem: "", sessionId: "", analyzedAt: undefined, insight: undefined };
778
+ }
779
+
780
+ export const SessionInsightEntry: MessageFns<SessionInsightEntry> = {
781
+ encode(message: SessionInsightEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
782
+ if (message.sourceSystem !== "") {
783
+ writer.uint32(10).string(message.sourceSystem);
784
+ }
785
+ if (message.sessionId !== "") {
786
+ writer.uint32(18).string(message.sessionId);
787
+ }
788
+ if (message.analyzedAt !== undefined) {
789
+ Timestamp.encode(toTimestamp(message.analyzedAt), writer.uint32(26).fork()).join();
790
+ }
791
+ if (message.insight !== undefined) {
792
+ AISessionInsight.encode(message.insight, writer.uint32(34).fork()).join();
793
+ }
794
+ return writer;
795
+ },
796
+
797
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionInsightEntry {
798
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
799
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
800
+ if (previousRecursionDepth >= 100) {
801
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
802
+ }
803
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
804
+ try {
805
+ const end = length === undefined ? reader.len : reader.pos + length;
806
+ const message = createBaseSessionInsightEntry();
807
+ while (reader.pos < end) {
808
+ const tag = reader.uint32();
809
+ switch (tag >>> 3) {
810
+ case 1: {
811
+ if (tag !== 10) {
812
+ break;
813
+ }
814
+
815
+ message.sourceSystem = reader.string();
816
+ continue;
817
+ }
818
+ case 2: {
819
+ if (tag !== 18) {
820
+ break;
821
+ }
822
+
823
+ message.sessionId = reader.string();
824
+ continue;
825
+ }
826
+ case 3: {
827
+ if (tag !== 26) {
828
+ break;
829
+ }
830
+
831
+ message.analyzedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
832
+ continue;
833
+ }
834
+ case 4: {
835
+ if (tag !== 34) {
836
+ break;
837
+ }
838
+
839
+ message.insight = AISessionInsight.decode(reader, reader.uint32());
840
+ continue;
841
+ }
842
+ }
843
+ if ((tag & 7) === 4 || tag === 0) {
844
+ break;
845
+ }
846
+ reader.skip(tag & 7);
847
+ }
848
+ return message;
849
+ } finally {
850
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
851
+ }
852
+ },
853
+
854
+ fromJSON(object: any): SessionInsightEntry {
855
+ return {
856
+ sourceSystem: isSet(object.sourceSystem)
857
+ ? globalThis.String(object.sourceSystem)
858
+ : isSet(object.source_system)
859
+ ? globalThis.String(object.source_system)
860
+ : "",
861
+ sessionId: isSet(object.sessionId)
862
+ ? globalThis.String(object.sessionId)
863
+ : isSet(object.session_id)
864
+ ? globalThis.String(object.session_id)
865
+ : "",
866
+ analyzedAt: isSet(object.analyzedAt)
867
+ ? fromJsonTimestamp(object.analyzedAt)
868
+ : isSet(object.analyzed_at)
869
+ ? fromJsonTimestamp(object.analyzed_at)
870
+ : undefined,
871
+ insight: isSet(object.insight) ? AISessionInsight.fromJSON(object.insight) : undefined,
872
+ };
873
+ },
874
+
875
+ toJSON(message: SessionInsightEntry): unknown {
876
+ const obj: any = {};
877
+ if (message.sourceSystem !== "") {
878
+ obj.sourceSystem = message.sourceSystem;
879
+ }
880
+ if (message.sessionId !== "") {
881
+ obj.sessionId = message.sessionId;
882
+ }
883
+ if (message.analyzedAt !== undefined) {
884
+ obj.analyzedAt = message.analyzedAt.toISOString();
885
+ }
886
+ if (message.insight !== undefined) {
887
+ obj.insight = AISessionInsight.toJSON(message.insight);
888
+ }
889
+ return obj;
890
+ },
891
+
892
+ create<I extends Exact<DeepPartial<SessionInsightEntry>, I>>(base?: I): SessionInsightEntry {
893
+ return SessionInsightEntry.fromPartial(base ?? ({} as any));
894
+ },
895
+ fromPartial<I extends Exact<DeepPartial<SessionInsightEntry>, I>>(object: I): SessionInsightEntry {
896
+ const message = createBaseSessionInsightEntry();
897
+ message.sourceSystem = object.sourceSystem ?? "";
898
+ message.sessionId = object.sessionId ?? "";
899
+ message.analyzedAt = object.analyzedAt ?? undefined;
900
+ message.insight = (object.insight !== undefined && object.insight !== null)
901
+ ? AISessionInsight.fromPartial(object.insight)
902
+ : undefined;
903
+ return message;
904
+ },
905
+ };
906
+
907
+ function createBaseListProjectInsightCardsRequest(): ListProjectInsightCardsRequest {
908
+ return { organizationId: "", projectId: "", pageSize: 0, pageToken: "" };
909
+ }
910
+
911
+ export const ListProjectInsightCardsRequest: MessageFns<ListProjectInsightCardsRequest> = {
912
+ encode(message: ListProjectInsightCardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
913
+ if (message.organizationId !== "") {
914
+ writer.uint32(10).string(message.organizationId);
915
+ }
916
+ if (message.projectId !== "") {
917
+ writer.uint32(18).string(message.projectId);
918
+ }
919
+ if (message.pageSize !== 0) {
920
+ writer.uint32(24).int32(message.pageSize);
921
+ }
922
+ if (message.pageToken !== "") {
923
+ writer.uint32(34).string(message.pageToken);
924
+ }
925
+ return writer;
926
+ },
927
+
928
+ decode(input: BinaryReader | Uint8Array, length?: number): ListProjectInsightCardsRequest {
929
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
930
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
931
+ if (previousRecursionDepth >= 100) {
932
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
933
+ }
934
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
935
+ try {
936
+ const end = length === undefined ? reader.len : reader.pos + length;
937
+ const message = createBaseListProjectInsightCardsRequest();
938
+ while (reader.pos < end) {
939
+ const tag = reader.uint32();
940
+ switch (tag >>> 3) {
941
+ case 1: {
942
+ if (tag !== 10) {
943
+ break;
944
+ }
945
+
946
+ message.organizationId = reader.string();
947
+ continue;
948
+ }
949
+ case 2: {
950
+ if (tag !== 18) {
951
+ break;
952
+ }
953
+
954
+ message.projectId = reader.string();
955
+ continue;
956
+ }
957
+ case 3: {
958
+ if (tag !== 24) {
959
+ break;
960
+ }
961
+
962
+ message.pageSize = reader.int32();
963
+ continue;
964
+ }
965
+ case 4: {
966
+ if (tag !== 34) {
967
+ break;
968
+ }
969
+
970
+ message.pageToken = reader.string();
971
+ continue;
972
+ }
973
+ }
974
+ if ((tag & 7) === 4 || tag === 0) {
975
+ break;
976
+ }
977
+ reader.skip(tag & 7);
978
+ }
979
+ return message;
980
+ } finally {
981
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
982
+ }
983
+ },
984
+
985
+ fromJSON(object: any): ListProjectInsightCardsRequest {
986
+ return {
987
+ organizationId: isSet(object.organizationId)
988
+ ? globalThis.String(object.organizationId)
989
+ : isSet(object.organization_id)
990
+ ? globalThis.String(object.organization_id)
991
+ : "",
992
+ projectId: isSet(object.projectId)
993
+ ? globalThis.String(object.projectId)
994
+ : isSet(object.project_id)
995
+ ? globalThis.String(object.project_id)
996
+ : "",
997
+ pageSize: isSet(object.pageSize)
998
+ ? globalThis.Number(object.pageSize)
999
+ : isSet(object.page_size)
1000
+ ? globalThis.Number(object.page_size)
1001
+ : 0,
1002
+ pageToken: isSet(object.pageToken)
1003
+ ? globalThis.String(object.pageToken)
1004
+ : isSet(object.page_token)
1005
+ ? globalThis.String(object.page_token)
1006
+ : "",
1007
+ };
1008
+ },
1009
+
1010
+ toJSON(message: ListProjectInsightCardsRequest): unknown {
1011
+ const obj: any = {};
1012
+ if (message.organizationId !== "") {
1013
+ obj.organizationId = message.organizationId;
1014
+ }
1015
+ if (message.projectId !== "") {
1016
+ obj.projectId = message.projectId;
1017
+ }
1018
+ if (message.pageSize !== 0) {
1019
+ obj.pageSize = Math.round(message.pageSize);
1020
+ }
1021
+ if (message.pageToken !== "") {
1022
+ obj.pageToken = message.pageToken;
1023
+ }
1024
+ return obj;
1025
+ },
1026
+
1027
+ create<I extends Exact<DeepPartial<ListProjectInsightCardsRequest>, I>>(base?: I): ListProjectInsightCardsRequest {
1028
+ return ListProjectInsightCardsRequest.fromPartial(base ?? ({} as any));
1029
+ },
1030
+ fromPartial<I extends Exact<DeepPartial<ListProjectInsightCardsRequest>, I>>(
1031
+ object: I,
1032
+ ): ListProjectInsightCardsRequest {
1033
+ const message = createBaseListProjectInsightCardsRequest();
1034
+ message.organizationId = object.organizationId ?? "";
1035
+ message.projectId = object.projectId ?? "";
1036
+ message.pageSize = object.pageSize ?? 0;
1037
+ message.pageToken = object.pageToken ?? "";
1038
+ return message;
1039
+ },
1040
+ };
1041
+
1042
+ function createBaseListProjectInsightCardsResponse(): ListProjectInsightCardsResponse {
1043
+ return { status: undefined, cards: [], nextPageToken: "" };
1044
+ }
1045
+
1046
+ export const ListProjectInsightCardsResponse: MessageFns<ListProjectInsightCardsResponse> = {
1047
+ encode(message: ListProjectInsightCardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1048
+ if (message.status !== undefined) {
1049
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1050
+ }
1051
+ for (const v of message.cards) {
1052
+ AIProjectInsightCard.encode(v!, writer.uint32(18).fork()).join();
1053
+ }
1054
+ if (message.nextPageToken !== "") {
1055
+ writer.uint32(26).string(message.nextPageToken);
1056
+ }
1057
+ return writer;
1058
+ },
1059
+
1060
+ decode(input: BinaryReader | Uint8Array, length?: number): ListProjectInsightCardsResponse {
1061
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1062
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1063
+ if (previousRecursionDepth >= 100) {
1064
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1065
+ }
1066
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1067
+ try {
1068
+ const end = length === undefined ? reader.len : reader.pos + length;
1069
+ const message = createBaseListProjectInsightCardsResponse();
1070
+ while (reader.pos < end) {
1071
+ const tag = reader.uint32();
1072
+ switch (tag >>> 3) {
1073
+ case 1: {
1074
+ if (tag !== 10) {
1075
+ break;
1076
+ }
1077
+
1078
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1079
+ continue;
1080
+ }
1081
+ case 2: {
1082
+ if (tag !== 18) {
1083
+ break;
1084
+ }
1085
+
1086
+ message.cards.push(AIProjectInsightCard.decode(reader, reader.uint32()));
1087
+ continue;
1088
+ }
1089
+ case 3: {
1090
+ if (tag !== 26) {
1091
+ break;
1092
+ }
1093
+
1094
+ message.nextPageToken = reader.string();
1095
+ continue;
1096
+ }
1097
+ }
1098
+ if ((tag & 7) === 4 || tag === 0) {
1099
+ break;
1100
+ }
1101
+ reader.skip(tag & 7);
1102
+ }
1103
+ return message;
1104
+ } finally {
1105
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1106
+ }
1107
+ },
1108
+
1109
+ fromJSON(object: any): ListProjectInsightCardsResponse {
1110
+ return {
1111
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1112
+ cards: globalThis.Array.isArray(object?.cards)
1113
+ ? object.cards.map((e: any) => AIProjectInsightCard.fromJSON(e))
1114
+ : [],
1115
+ nextPageToken: isSet(object.nextPageToken)
1116
+ ? globalThis.String(object.nextPageToken)
1117
+ : isSet(object.next_page_token)
1118
+ ? globalThis.String(object.next_page_token)
1119
+ : "",
1120
+ };
1121
+ },
1122
+
1123
+ toJSON(message: ListProjectInsightCardsResponse): unknown {
1124
+ const obj: any = {};
1125
+ if (message.status !== undefined) {
1126
+ obj.status = ResponseStatus.toJSON(message.status);
1127
+ }
1128
+ if (message.cards?.length) {
1129
+ obj.cards = message.cards.map((e) => AIProjectInsightCard.toJSON(e));
1130
+ }
1131
+ if (message.nextPageToken !== "") {
1132
+ obj.nextPageToken = message.nextPageToken;
1133
+ }
1134
+ return obj;
1135
+ },
1136
+
1137
+ create<I extends Exact<DeepPartial<ListProjectInsightCardsResponse>, I>>(base?: I): ListProjectInsightCardsResponse {
1138
+ return ListProjectInsightCardsResponse.fromPartial(base ?? ({} as any));
1139
+ },
1140
+ fromPartial<I extends Exact<DeepPartial<ListProjectInsightCardsResponse>, I>>(
1141
+ object: I,
1142
+ ): ListProjectInsightCardsResponse {
1143
+ const message = createBaseListProjectInsightCardsResponse();
1144
+ message.status = (object.status !== undefined && object.status !== null)
1145
+ ? ResponseStatus.fromPartial(object.status)
1146
+ : undefined;
1147
+ message.cards = object.cards?.map((e) => AIProjectInsightCard.fromPartial(e)) || [];
1148
+ message.nextPageToken = object.nextPageToken ?? "";
1149
+ return message;
1150
+ },
1151
+ };
1152
+
1153
+ function createBaseAIProjectInsightCard(): AIProjectInsightCard {
1154
+ return { insight: undefined, runId: "", localDate: "", timeZone: "", windowClosed: false, analyzedAt: undefined };
1155
+ }
1156
+
1157
+ export const AIProjectInsightCard: MessageFns<AIProjectInsightCard> = {
1158
+ encode(message: AIProjectInsightCard, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1159
+ if (message.insight !== undefined) {
1160
+ AIProjectInsight.encode(message.insight, writer.uint32(10).fork()).join();
1161
+ }
1162
+ if (message.runId !== "") {
1163
+ writer.uint32(18).string(message.runId);
1164
+ }
1165
+ if (message.localDate !== "") {
1166
+ writer.uint32(26).string(message.localDate);
1167
+ }
1168
+ if (message.timeZone !== "") {
1169
+ writer.uint32(34).string(message.timeZone);
1170
+ }
1171
+ if (message.windowClosed !== false) {
1172
+ writer.uint32(40).bool(message.windowClosed);
1173
+ }
1174
+ if (message.analyzedAt !== undefined) {
1175
+ Timestamp.encode(toTimestamp(message.analyzedAt), writer.uint32(50).fork()).join();
1176
+ }
1177
+ return writer;
1178
+ },
1179
+
1180
+ decode(input: BinaryReader | Uint8Array, length?: number): AIProjectInsightCard {
1181
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1182
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1183
+ if (previousRecursionDepth >= 100) {
1184
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1185
+ }
1186
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1187
+ try {
1188
+ const end = length === undefined ? reader.len : reader.pos + length;
1189
+ const message = createBaseAIProjectInsightCard();
1190
+ while (reader.pos < end) {
1191
+ const tag = reader.uint32();
1192
+ switch (tag >>> 3) {
1193
+ case 1: {
1194
+ if (tag !== 10) {
1195
+ break;
1196
+ }
1197
+
1198
+ message.insight = AIProjectInsight.decode(reader, reader.uint32());
1199
+ continue;
1200
+ }
1201
+ case 2: {
1202
+ if (tag !== 18) {
1203
+ break;
1204
+ }
1205
+
1206
+ message.runId = reader.string();
1207
+ continue;
1208
+ }
1209
+ case 3: {
1210
+ if (tag !== 26) {
1211
+ break;
1212
+ }
1213
+
1214
+ message.localDate = reader.string();
1215
+ continue;
1216
+ }
1217
+ case 4: {
1218
+ if (tag !== 34) {
1219
+ break;
1220
+ }
1221
+
1222
+ message.timeZone = reader.string();
1223
+ continue;
1224
+ }
1225
+ case 5: {
1226
+ if (tag !== 40) {
1227
+ break;
1228
+ }
1229
+
1230
+ message.windowClosed = reader.bool();
1231
+ continue;
1232
+ }
1233
+ case 6: {
1234
+ if (tag !== 50) {
1235
+ break;
1236
+ }
1237
+
1238
+ message.analyzedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1239
+ continue;
1240
+ }
1241
+ }
1242
+ if ((tag & 7) === 4 || tag === 0) {
1243
+ break;
1244
+ }
1245
+ reader.skip(tag & 7);
1246
+ }
1247
+ return message;
1248
+ } finally {
1249
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1250
+ }
1251
+ },
1252
+
1253
+ fromJSON(object: any): AIProjectInsightCard {
1254
+ return {
1255
+ insight: isSet(object.insight) ? AIProjectInsight.fromJSON(object.insight) : undefined,
1256
+ runId: isSet(object.runId)
1257
+ ? globalThis.String(object.runId)
1258
+ : isSet(object.run_id)
1259
+ ? globalThis.String(object.run_id)
1260
+ : "",
1261
+ localDate: isSet(object.localDate)
1262
+ ? globalThis.String(object.localDate)
1263
+ : isSet(object.local_date)
1264
+ ? globalThis.String(object.local_date)
1265
+ : "",
1266
+ timeZone: isSet(object.timeZone)
1267
+ ? globalThis.String(object.timeZone)
1268
+ : isSet(object.time_zone)
1269
+ ? globalThis.String(object.time_zone)
1270
+ : "",
1271
+ windowClosed: isSet(object.windowClosed)
1272
+ ? globalThis.Boolean(object.windowClosed)
1273
+ : isSet(object.window_closed)
1274
+ ? globalThis.Boolean(object.window_closed)
1275
+ : false,
1276
+ analyzedAt: isSet(object.analyzedAt)
1277
+ ? fromJsonTimestamp(object.analyzedAt)
1278
+ : isSet(object.analyzed_at)
1279
+ ? fromJsonTimestamp(object.analyzed_at)
1280
+ : undefined,
1281
+ };
1282
+ },
1283
+
1284
+ toJSON(message: AIProjectInsightCard): unknown {
1285
+ const obj: any = {};
1286
+ if (message.insight !== undefined) {
1287
+ obj.insight = AIProjectInsight.toJSON(message.insight);
1288
+ }
1289
+ if (message.runId !== "") {
1290
+ obj.runId = message.runId;
1291
+ }
1292
+ if (message.localDate !== "") {
1293
+ obj.localDate = message.localDate;
1294
+ }
1295
+ if (message.timeZone !== "") {
1296
+ obj.timeZone = message.timeZone;
1297
+ }
1298
+ if (message.windowClosed !== false) {
1299
+ obj.windowClosed = message.windowClosed;
1300
+ }
1301
+ if (message.analyzedAt !== undefined) {
1302
+ obj.analyzedAt = message.analyzedAt.toISOString();
1303
+ }
1304
+ return obj;
1305
+ },
1306
+
1307
+ create<I extends Exact<DeepPartial<AIProjectInsightCard>, I>>(base?: I): AIProjectInsightCard {
1308
+ return AIProjectInsightCard.fromPartial(base ?? ({} as any));
1309
+ },
1310
+ fromPartial<I extends Exact<DeepPartial<AIProjectInsightCard>, I>>(object: I): AIProjectInsightCard {
1311
+ const message = createBaseAIProjectInsightCard();
1312
+ message.insight = (object.insight !== undefined && object.insight !== null)
1313
+ ? AIProjectInsight.fromPartial(object.insight)
1314
+ : undefined;
1315
+ message.runId = object.runId ?? "";
1316
+ message.localDate = object.localDate ?? "";
1317
+ message.timeZone = object.timeZone ?? "";
1318
+ message.windowClosed = object.windowClosed ?? false;
1319
+ message.analyzedAt = object.analyzedAt ?? undefined;
1320
+ return message;
1321
+ },
1322
+ };
1323
+
1324
+ function createBaseAIProjectInsight(): AIProjectInsight {
1325
+ return {
1326
+ id: "",
1327
+ rank: 0,
1328
+ kind: 0,
1329
+ title: "",
1330
+ pattern: "",
1331
+ explanation: "",
1332
+ action: "",
1333
+ limitations: "",
1334
+ sessionCount: 0,
1335
+ personCount: 0,
1336
+ spendUsd: undefined,
1337
+ citations: [],
1338
+ skillSuggestion: undefined,
1339
+ };
1340
+ }
1341
+
1342
+ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1343
+ encode(message: AIProjectInsight, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1344
+ if (message.id !== "") {
1345
+ writer.uint32(10).string(message.id);
1346
+ }
1347
+ if (message.rank !== 0) {
1348
+ writer.uint32(16).uint32(message.rank);
1349
+ }
1350
+ if (message.kind !== 0) {
1351
+ writer.uint32(24).int32(message.kind);
1352
+ }
1353
+ if (message.title !== "") {
1354
+ writer.uint32(34).string(message.title);
1355
+ }
1356
+ if (message.pattern !== "") {
1357
+ writer.uint32(42).string(message.pattern);
1358
+ }
1359
+ if (message.explanation !== "") {
1360
+ writer.uint32(50).string(message.explanation);
1361
+ }
1362
+ if (message.action !== "") {
1363
+ writer.uint32(58).string(message.action);
1364
+ }
1365
+ if (message.limitations !== "") {
1366
+ writer.uint32(66).string(message.limitations);
1367
+ }
1368
+ if (message.sessionCount !== 0) {
1369
+ writer.uint32(72).uint32(message.sessionCount);
1370
+ }
1371
+ if (message.personCount !== 0) {
1372
+ writer.uint32(80).uint32(message.personCount);
1373
+ }
1374
+ if (message.spendUsd !== undefined) {
1375
+ writer.uint32(90).string(message.spendUsd);
1376
+ }
1377
+ for (const v of message.citations) {
1378
+ AIProjectInsightCitation.encode(v!, writer.uint32(98).fork()).join();
1379
+ }
1380
+ if (message.skillSuggestion !== undefined) {
1381
+ AISkillSuggestion.encode(message.skillSuggestion, writer.uint32(106).fork()).join();
1382
+ }
1383
+ return writer;
1384
+ },
1385
+
1386
+ decode(input: BinaryReader | Uint8Array, length?: number): AIProjectInsight {
1387
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1388
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1389
+ if (previousRecursionDepth >= 100) {
1390
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1391
+ }
1392
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1393
+ try {
1394
+ const end = length === undefined ? reader.len : reader.pos + length;
1395
+ const message = createBaseAIProjectInsight();
1396
+ while (reader.pos < end) {
1397
+ const tag = reader.uint32();
1398
+ switch (tag >>> 3) {
1399
+ case 1: {
1400
+ if (tag !== 10) {
1401
+ break;
1402
+ }
1403
+
1404
+ message.id = reader.string();
1405
+ continue;
1406
+ }
1407
+ case 2: {
1408
+ if (tag !== 16) {
1409
+ break;
1410
+ }
1411
+
1412
+ message.rank = reader.uint32();
1413
+ continue;
1414
+ }
1415
+ case 3: {
1416
+ if (tag !== 24) {
1417
+ break;
1418
+ }
1419
+
1420
+ message.kind = reader.int32() as any;
1421
+ continue;
1422
+ }
1423
+ case 4: {
1424
+ if (tag !== 34) {
1425
+ break;
1426
+ }
1427
+
1428
+ message.title = reader.string();
1429
+ continue;
1430
+ }
1431
+ case 5: {
1432
+ if (tag !== 42) {
1433
+ break;
1434
+ }
1435
+
1436
+ message.pattern = reader.string();
1437
+ continue;
1438
+ }
1439
+ case 6: {
1440
+ if (tag !== 50) {
1441
+ break;
1442
+ }
1443
+
1444
+ message.explanation = reader.string();
1445
+ continue;
1446
+ }
1447
+ case 7: {
1448
+ if (tag !== 58) {
1449
+ break;
1450
+ }
1451
+
1452
+ message.action = reader.string();
1453
+ continue;
1454
+ }
1455
+ case 8: {
1456
+ if (tag !== 66) {
1457
+ break;
1458
+ }
1459
+
1460
+ message.limitations = reader.string();
1461
+ continue;
1462
+ }
1463
+ case 9: {
1464
+ if (tag !== 72) {
1465
+ break;
1466
+ }
1467
+
1468
+ message.sessionCount = reader.uint32();
1469
+ continue;
1470
+ }
1471
+ case 10: {
1472
+ if (tag !== 80) {
1473
+ break;
1474
+ }
1475
+
1476
+ message.personCount = reader.uint32();
1477
+ continue;
1478
+ }
1479
+ case 11: {
1480
+ if (tag !== 90) {
1481
+ break;
1482
+ }
1483
+
1484
+ message.spendUsd = reader.string();
1485
+ continue;
1486
+ }
1487
+ case 12: {
1488
+ if (tag !== 98) {
1489
+ break;
1490
+ }
1491
+
1492
+ message.citations.push(AIProjectInsightCitation.decode(reader, reader.uint32()));
1493
+ continue;
1494
+ }
1495
+ case 13: {
1496
+ if (tag !== 106) {
1497
+ break;
1498
+ }
1499
+
1500
+ message.skillSuggestion = AISkillSuggestion.decode(reader, reader.uint32());
1501
+ continue;
1502
+ }
1503
+ }
1504
+ if ((tag & 7) === 4 || tag === 0) {
1505
+ break;
1506
+ }
1507
+ reader.skip(tag & 7);
1508
+ }
1509
+ return message;
1510
+ } finally {
1511
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1512
+ }
1513
+ },
1514
+
1515
+ fromJSON(object: any): AIProjectInsight {
1516
+ return {
1517
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
1518
+ rank: isSet(object.rank) ? globalThis.Number(object.rank) : 0,
1519
+ kind: isSet(object.kind) ? aIProjectInsightKindFromJSON(object.kind) : 0,
1520
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
1521
+ pattern: isSet(object.pattern) ? globalThis.String(object.pattern) : "",
1522
+ explanation: isSet(object.explanation) ? globalThis.String(object.explanation) : "",
1523
+ action: isSet(object.action) ? globalThis.String(object.action) : "",
1524
+ limitations: isSet(object.limitations) ? globalThis.String(object.limitations) : "",
1525
+ sessionCount: isSet(object.sessionCount)
1526
+ ? globalThis.Number(object.sessionCount)
1527
+ : isSet(object.session_count)
1528
+ ? globalThis.Number(object.session_count)
1529
+ : 0,
1530
+ personCount: isSet(object.personCount)
1531
+ ? globalThis.Number(object.personCount)
1532
+ : isSet(object.person_count)
1533
+ ? globalThis.Number(object.person_count)
1534
+ : 0,
1535
+ spendUsd: isSet(object.spendUsd)
1536
+ ? globalThis.String(object.spendUsd)
1537
+ : isSet(object.spend_usd)
1538
+ ? globalThis.String(object.spend_usd)
1539
+ : undefined,
1540
+ citations: globalThis.Array.isArray(object?.citations)
1541
+ ? object.citations.map((e: any) => AIProjectInsightCitation.fromJSON(e))
1542
+ : [],
1543
+ skillSuggestion: isSet(object.skillSuggestion)
1544
+ ? AISkillSuggestion.fromJSON(object.skillSuggestion)
1545
+ : isSet(object.skill_suggestion)
1546
+ ? AISkillSuggestion.fromJSON(object.skill_suggestion)
1547
+ : undefined,
1548
+ };
1549
+ },
1550
+
1551
+ toJSON(message: AIProjectInsight): unknown {
1552
+ const obj: any = {};
1553
+ if (message.id !== "") {
1554
+ obj.id = message.id;
1555
+ }
1556
+ if (message.rank !== 0) {
1557
+ obj.rank = Math.round(message.rank);
1558
+ }
1559
+ if (message.kind !== 0) {
1560
+ obj.kind = aIProjectInsightKindToJSON(message.kind);
1561
+ }
1562
+ if (message.title !== "") {
1563
+ obj.title = message.title;
1564
+ }
1565
+ if (message.pattern !== "") {
1566
+ obj.pattern = message.pattern;
1567
+ }
1568
+ if (message.explanation !== "") {
1569
+ obj.explanation = message.explanation;
1570
+ }
1571
+ if (message.action !== "") {
1572
+ obj.action = message.action;
1573
+ }
1574
+ if (message.limitations !== "") {
1575
+ obj.limitations = message.limitations;
1576
+ }
1577
+ if (message.sessionCount !== 0) {
1578
+ obj.sessionCount = Math.round(message.sessionCount);
1579
+ }
1580
+ if (message.personCount !== 0) {
1581
+ obj.personCount = Math.round(message.personCount);
1582
+ }
1583
+ if (message.spendUsd !== undefined) {
1584
+ obj.spendUsd = message.spendUsd;
1585
+ }
1586
+ if (message.citations?.length) {
1587
+ obj.citations = message.citations.map((e) => AIProjectInsightCitation.toJSON(e));
1588
+ }
1589
+ if (message.skillSuggestion !== undefined) {
1590
+ obj.skillSuggestion = AISkillSuggestion.toJSON(message.skillSuggestion);
1591
+ }
1592
+ return obj;
1593
+ },
1594
+
1595
+ create<I extends Exact<DeepPartial<AIProjectInsight>, I>>(base?: I): AIProjectInsight {
1596
+ return AIProjectInsight.fromPartial(base ?? ({} as any));
1597
+ },
1598
+ fromPartial<I extends Exact<DeepPartial<AIProjectInsight>, I>>(object: I): AIProjectInsight {
1599
+ const message = createBaseAIProjectInsight();
1600
+ message.id = object.id ?? "";
1601
+ message.rank = object.rank ?? 0;
1602
+ message.kind = object.kind ?? 0;
1603
+ message.title = object.title ?? "";
1604
+ message.pattern = object.pattern ?? "";
1605
+ message.explanation = object.explanation ?? "";
1606
+ message.action = object.action ?? "";
1607
+ message.limitations = object.limitations ?? "";
1608
+ message.sessionCount = object.sessionCount ?? 0;
1609
+ message.personCount = object.personCount ?? 0;
1610
+ message.spendUsd = object.spendUsd ?? undefined;
1611
+ message.citations = object.citations?.map((e) => AIProjectInsightCitation.fromPartial(e)) || [];
1612
+ message.skillSuggestion = (object.skillSuggestion !== undefined && object.skillSuggestion !== null)
1613
+ ? AISkillSuggestion.fromPartial(object.skillSuggestion)
1614
+ : undefined;
1615
+ return message;
1616
+ },
1617
+ };
1618
+
1619
+ function createBaseAIProjectInsightCitation(): AIProjectInsightCitation {
1620
+ return { sourceSystem: "", sessionId: "", eventRef: undefined };
1621
+ }
1622
+
1623
+ export const AIProjectInsightCitation: MessageFns<AIProjectInsightCitation> = {
1624
+ encode(message: AIProjectInsightCitation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1625
+ if (message.sourceSystem !== "") {
1626
+ writer.uint32(10).string(message.sourceSystem);
1627
+ }
1628
+ if (message.sessionId !== "") {
1629
+ writer.uint32(18).string(message.sessionId);
1630
+ }
1631
+ if (message.eventRef !== undefined) {
1632
+ AISessionEventRef.encode(message.eventRef, writer.uint32(26).fork()).join();
1633
+ }
1634
+ return writer;
1635
+ },
1636
+
1637
+ decode(input: BinaryReader | Uint8Array, length?: number): AIProjectInsightCitation {
1638
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1639
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1640
+ if (previousRecursionDepth >= 100) {
1641
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1642
+ }
1643
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1644
+ try {
1645
+ const end = length === undefined ? reader.len : reader.pos + length;
1646
+ const message = createBaseAIProjectInsightCitation();
1647
+ while (reader.pos < end) {
1648
+ const tag = reader.uint32();
1649
+ switch (tag >>> 3) {
1650
+ case 1: {
1651
+ if (tag !== 10) {
1652
+ break;
1653
+ }
1654
+
1655
+ message.sourceSystem = reader.string();
1656
+ continue;
1657
+ }
1658
+ case 2: {
1659
+ if (tag !== 18) {
1660
+ break;
1661
+ }
1662
+
1663
+ message.sessionId = reader.string();
1664
+ continue;
1665
+ }
1666
+ case 3: {
1667
+ if (tag !== 26) {
1668
+ break;
1669
+ }
1670
+
1671
+ message.eventRef = AISessionEventRef.decode(reader, reader.uint32());
1672
+ continue;
1673
+ }
1674
+ }
1675
+ if ((tag & 7) === 4 || tag === 0) {
1676
+ break;
1677
+ }
1678
+ reader.skip(tag & 7);
1679
+ }
1680
+ return message;
1681
+ } finally {
1682
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1683
+ }
1684
+ },
1685
+
1686
+ fromJSON(object: any): AIProjectInsightCitation {
1687
+ return {
1688
+ sourceSystem: isSet(object.sourceSystem)
1689
+ ? globalThis.String(object.sourceSystem)
1690
+ : isSet(object.source_system)
1691
+ ? globalThis.String(object.source_system)
1692
+ : "",
1693
+ sessionId: isSet(object.sessionId)
1694
+ ? globalThis.String(object.sessionId)
1695
+ : isSet(object.session_id)
1696
+ ? globalThis.String(object.session_id)
1697
+ : "",
1698
+ eventRef: isSet(object.eventRef)
1699
+ ? AISessionEventRef.fromJSON(object.eventRef)
1700
+ : isSet(object.event_ref)
1701
+ ? AISessionEventRef.fromJSON(object.event_ref)
1702
+ : undefined,
1703
+ };
1704
+ },
1705
+
1706
+ toJSON(message: AIProjectInsightCitation): unknown {
1707
+ const obj: any = {};
1708
+ if (message.sourceSystem !== "") {
1709
+ obj.sourceSystem = message.sourceSystem;
1710
+ }
1711
+ if (message.sessionId !== "") {
1712
+ obj.sessionId = message.sessionId;
1713
+ }
1714
+ if (message.eventRef !== undefined) {
1715
+ obj.eventRef = AISessionEventRef.toJSON(message.eventRef);
1716
+ }
1717
+ return obj;
1718
+ },
1719
+
1720
+ create<I extends Exact<DeepPartial<AIProjectInsightCitation>, I>>(base?: I): AIProjectInsightCitation {
1721
+ return AIProjectInsightCitation.fromPartial(base ?? ({} as any));
1722
+ },
1723
+ fromPartial<I extends Exact<DeepPartial<AIProjectInsightCitation>, I>>(object: I): AIProjectInsightCitation {
1724
+ const message = createBaseAIProjectInsightCitation();
1725
+ message.sourceSystem = object.sourceSystem ?? "";
1726
+ message.sessionId = object.sessionId ?? "";
1727
+ message.eventRef = (object.eventRef !== undefined && object.eventRef !== null)
1728
+ ? AISessionEventRef.fromPartial(object.eventRef)
1729
+ : undefined;
1730
+ return message;
1731
+ },
1732
+ };
1733
+
1734
+ function createBaseInsightRef(): InsightRef {
1735
+ return { sessionInsightId: undefined, projectInsightId: undefined, sessionScoreId: undefined };
1736
+ }
1737
+
1738
+ export const InsightRef: MessageFns<InsightRef> = {
1739
+ encode(message: InsightRef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1740
+ if (message.sessionInsightId !== undefined) {
1741
+ writer.uint32(10).string(message.sessionInsightId);
1742
+ }
1743
+ if (message.projectInsightId !== undefined) {
1744
+ writer.uint32(18).string(message.projectInsightId);
1745
+ }
1746
+ if (message.sessionScoreId !== undefined) {
1747
+ writer.uint32(26).string(message.sessionScoreId);
1748
+ }
1749
+ return writer;
1750
+ },
1751
+
1752
+ decode(input: BinaryReader | Uint8Array, length?: number): InsightRef {
1753
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1754
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1755
+ if (previousRecursionDepth >= 100) {
1756
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1757
+ }
1758
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1759
+ try {
1760
+ const end = length === undefined ? reader.len : reader.pos + length;
1761
+ const message = createBaseInsightRef();
1762
+ while (reader.pos < end) {
1763
+ const tag = reader.uint32();
1764
+ switch (tag >>> 3) {
1765
+ case 1: {
1766
+ if (tag !== 10) {
1767
+ break;
1768
+ }
1769
+
1770
+ message.sessionInsightId = reader.string();
1771
+ continue;
1772
+ }
1773
+ case 2: {
1774
+ if (tag !== 18) {
1775
+ break;
1776
+ }
1777
+
1778
+ message.projectInsightId = reader.string();
1779
+ continue;
1780
+ }
1781
+ case 3: {
1782
+ if (tag !== 26) {
1783
+ break;
1784
+ }
1785
+
1786
+ message.sessionScoreId = reader.string();
1787
+ continue;
1788
+ }
1789
+ }
1790
+ if ((tag & 7) === 4 || tag === 0) {
1791
+ break;
1792
+ }
1793
+ reader.skip(tag & 7);
1794
+ }
1795
+ return message;
1796
+ } finally {
1797
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1798
+ }
1799
+ },
1800
+
1801
+ fromJSON(object: any): InsightRef {
1802
+ return {
1803
+ sessionInsightId: isSet(object.sessionInsightId)
1804
+ ? globalThis.String(object.sessionInsightId)
1805
+ : isSet(object.session_insight_id)
1806
+ ? globalThis.String(object.session_insight_id)
1807
+ : undefined,
1808
+ projectInsightId: isSet(object.projectInsightId)
1809
+ ? globalThis.String(object.projectInsightId)
1810
+ : isSet(object.project_insight_id)
1811
+ ? globalThis.String(object.project_insight_id)
1812
+ : undefined,
1813
+ sessionScoreId: isSet(object.sessionScoreId)
1814
+ ? globalThis.String(object.sessionScoreId)
1815
+ : isSet(object.session_score_id)
1816
+ ? globalThis.String(object.session_score_id)
1817
+ : undefined,
1818
+ };
1819
+ },
1820
+
1821
+ toJSON(message: InsightRef): unknown {
1822
+ const obj: any = {};
1823
+ if (message.sessionInsightId !== undefined) {
1824
+ obj.sessionInsightId = message.sessionInsightId;
1825
+ }
1826
+ if (message.projectInsightId !== undefined) {
1827
+ obj.projectInsightId = message.projectInsightId;
1828
+ }
1829
+ if (message.sessionScoreId !== undefined) {
1830
+ obj.sessionScoreId = message.sessionScoreId;
1831
+ }
1832
+ return obj;
1833
+ },
1834
+
1835
+ create<I extends Exact<DeepPartial<InsightRef>, I>>(base?: I): InsightRef {
1836
+ return InsightRef.fromPartial(base ?? ({} as any));
1837
+ },
1838
+ fromPartial<I extends Exact<DeepPartial<InsightRef>, I>>(object: I): InsightRef {
1839
+ const message = createBaseInsightRef();
1840
+ message.sessionInsightId = object.sessionInsightId ?? undefined;
1841
+ message.projectInsightId = object.projectInsightId ?? undefined;
1842
+ message.sessionScoreId = object.sessionScoreId ?? undefined;
1843
+ return message;
1844
+ },
1845
+ };
1846
+
1847
+ function createBaseInsightRating(): InsightRating {
1848
+ return { insight: undefined, rating: 0, ratedAt: undefined };
1849
+ }
1850
+
1851
+ export const InsightRating: MessageFns<InsightRating> = {
1852
+ encode(message: InsightRating, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1853
+ if (message.insight !== undefined) {
1854
+ InsightRef.encode(message.insight, writer.uint32(10).fork()).join();
1855
+ }
1856
+ if (message.rating !== 0) {
1857
+ writer.uint32(16).int32(message.rating);
1858
+ }
1859
+ if (message.ratedAt !== undefined) {
1860
+ Timestamp.encode(toTimestamp(message.ratedAt), writer.uint32(26).fork()).join();
1861
+ }
1862
+ return writer;
1863
+ },
1864
+
1865
+ decode(input: BinaryReader | Uint8Array, length?: number): InsightRating {
1866
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1867
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1868
+ if (previousRecursionDepth >= 100) {
1869
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1870
+ }
1871
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1872
+ try {
1873
+ const end = length === undefined ? reader.len : reader.pos + length;
1874
+ const message = createBaseInsightRating();
1875
+ while (reader.pos < end) {
1876
+ const tag = reader.uint32();
1877
+ switch (tag >>> 3) {
1878
+ case 1: {
1879
+ if (tag !== 10) {
1880
+ break;
1881
+ }
1882
+
1883
+ message.insight = InsightRef.decode(reader, reader.uint32());
1884
+ continue;
1885
+ }
1886
+ case 2: {
1887
+ if (tag !== 16) {
1888
+ break;
1889
+ }
1890
+
1891
+ message.rating = reader.int32() as any;
1892
+ continue;
1893
+ }
1894
+ case 3: {
1895
+ if (tag !== 26) {
1896
+ break;
1897
+ }
1898
+
1899
+ message.ratedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1900
+ continue;
1901
+ }
1902
+ }
1903
+ if ((tag & 7) === 4 || tag === 0) {
1904
+ break;
1905
+ }
1906
+ reader.skip(tag & 7);
1907
+ }
1908
+ return message;
1909
+ } finally {
1910
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1911
+ }
1912
+ },
1913
+
1914
+ fromJSON(object: any): InsightRating {
1915
+ return {
1916
+ insight: isSet(object.insight) ? InsightRef.fromJSON(object.insight) : undefined,
1917
+ rating: isSet(object.rating) ? aIInsightRatingFromJSON(object.rating) : 0,
1918
+ ratedAt: isSet(object.ratedAt)
1919
+ ? fromJsonTimestamp(object.ratedAt)
1920
+ : isSet(object.rated_at)
1921
+ ? fromJsonTimestamp(object.rated_at)
1922
+ : undefined,
1923
+ };
1924
+ },
1925
+
1926
+ toJSON(message: InsightRating): unknown {
1927
+ const obj: any = {};
1928
+ if (message.insight !== undefined) {
1929
+ obj.insight = InsightRef.toJSON(message.insight);
1930
+ }
1931
+ if (message.rating !== 0) {
1932
+ obj.rating = aIInsightRatingToJSON(message.rating);
1933
+ }
1934
+ if (message.ratedAt !== undefined) {
1935
+ obj.ratedAt = message.ratedAt.toISOString();
1936
+ }
1937
+ return obj;
1938
+ },
1939
+
1940
+ create<I extends Exact<DeepPartial<InsightRating>, I>>(base?: I): InsightRating {
1941
+ return InsightRating.fromPartial(base ?? ({} as any));
1942
+ },
1943
+ fromPartial<I extends Exact<DeepPartial<InsightRating>, I>>(object: I): InsightRating {
1944
+ const message = createBaseInsightRating();
1945
+ message.insight = (object.insight !== undefined && object.insight !== null)
1946
+ ? InsightRef.fromPartial(object.insight)
1947
+ : undefined;
1948
+ message.rating = object.rating ?? 0;
1949
+ message.ratedAt = object.ratedAt ?? undefined;
1950
+ return message;
1951
+ },
1952
+ };
1953
+
1954
+ function createBaseBatchGetInsightRatingsRequest(): BatchGetInsightRatingsRequest {
1955
+ return { organizationId: "", projectId: "", insights: [] };
1956
+ }
1957
+
1958
+ export const BatchGetInsightRatingsRequest: MessageFns<BatchGetInsightRatingsRequest> = {
1959
+ encode(message: BatchGetInsightRatingsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1960
+ if (message.organizationId !== "") {
1961
+ writer.uint32(10).string(message.organizationId);
1962
+ }
1963
+ if (message.projectId !== "") {
1964
+ writer.uint32(18).string(message.projectId);
1965
+ }
1966
+ for (const v of message.insights) {
1967
+ InsightRef.encode(v!, writer.uint32(26).fork()).join();
1968
+ }
1969
+ return writer;
1970
+ },
1971
+
1972
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchGetInsightRatingsRequest {
1973
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1974
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1975
+ if (previousRecursionDepth >= 100) {
1976
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1977
+ }
1978
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1979
+ try {
1980
+ const end = length === undefined ? reader.len : reader.pos + length;
1981
+ const message = createBaseBatchGetInsightRatingsRequest();
1982
+ while (reader.pos < end) {
1983
+ const tag = reader.uint32();
1984
+ switch (tag >>> 3) {
1985
+ case 1: {
1986
+ if (tag !== 10) {
1987
+ break;
1988
+ }
1989
+
1990
+ message.organizationId = reader.string();
1991
+ continue;
1992
+ }
1993
+ case 2: {
1994
+ if (tag !== 18) {
1995
+ break;
1996
+ }
1997
+
1998
+ message.projectId = reader.string();
1999
+ continue;
2000
+ }
2001
+ case 3: {
2002
+ if (tag !== 26) {
2003
+ break;
2004
+ }
2005
+
2006
+ message.insights.push(InsightRef.decode(reader, reader.uint32()));
2007
+ continue;
2008
+ }
2009
+ }
2010
+ if ((tag & 7) === 4 || tag === 0) {
2011
+ break;
2012
+ }
2013
+ reader.skip(tag & 7);
2014
+ }
2015
+ return message;
2016
+ } finally {
2017
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2018
+ }
2019
+ },
2020
+
2021
+ fromJSON(object: any): BatchGetInsightRatingsRequest {
2022
+ return {
2023
+ organizationId: isSet(object.organizationId)
2024
+ ? globalThis.String(object.organizationId)
2025
+ : isSet(object.organization_id)
2026
+ ? globalThis.String(object.organization_id)
2027
+ : "",
2028
+ projectId: isSet(object.projectId)
2029
+ ? globalThis.String(object.projectId)
2030
+ : isSet(object.project_id)
2031
+ ? globalThis.String(object.project_id)
2032
+ : "",
2033
+ insights: globalThis.Array.isArray(object?.insights)
2034
+ ? object.insights.map((e: any) => InsightRef.fromJSON(e))
2035
+ : [],
2036
+ };
2037
+ },
2038
+
2039
+ toJSON(message: BatchGetInsightRatingsRequest): unknown {
2040
+ const obj: any = {};
2041
+ if (message.organizationId !== "") {
2042
+ obj.organizationId = message.organizationId;
2043
+ }
2044
+ if (message.projectId !== "") {
2045
+ obj.projectId = message.projectId;
2046
+ }
2047
+ if (message.insights?.length) {
2048
+ obj.insights = message.insights.map((e) => InsightRef.toJSON(e));
2049
+ }
2050
+ return obj;
2051
+ },
2052
+
2053
+ create<I extends Exact<DeepPartial<BatchGetInsightRatingsRequest>, I>>(base?: I): BatchGetInsightRatingsRequest {
2054
+ return BatchGetInsightRatingsRequest.fromPartial(base ?? ({} as any));
2055
+ },
2056
+ fromPartial<I extends Exact<DeepPartial<BatchGetInsightRatingsRequest>, I>>(
2057
+ object: I,
2058
+ ): BatchGetInsightRatingsRequest {
2059
+ const message = createBaseBatchGetInsightRatingsRequest();
2060
+ message.organizationId = object.organizationId ?? "";
2061
+ message.projectId = object.projectId ?? "";
2062
+ message.insights = object.insights?.map((e) => InsightRef.fromPartial(e)) || [];
2063
+ return message;
2064
+ },
2065
+ };
2066
+
2067
+ function createBaseBatchGetInsightRatingsResponse(): BatchGetInsightRatingsResponse {
2068
+ return { status: undefined, ratings: [] };
2069
+ }
2070
+
2071
+ export const BatchGetInsightRatingsResponse: MessageFns<BatchGetInsightRatingsResponse> = {
2072
+ encode(message: BatchGetInsightRatingsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2073
+ if (message.status !== undefined) {
2074
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2075
+ }
2076
+ for (const v of message.ratings) {
2077
+ InsightRating.encode(v!, writer.uint32(18).fork()).join();
2078
+ }
2079
+ return writer;
2080
+ },
2081
+
2082
+ decode(input: BinaryReader | Uint8Array, length?: number): BatchGetInsightRatingsResponse {
2083
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2084
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2085
+ if (previousRecursionDepth >= 100) {
2086
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2087
+ }
2088
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2089
+ try {
2090
+ const end = length === undefined ? reader.len : reader.pos + length;
2091
+ const message = createBaseBatchGetInsightRatingsResponse();
2092
+ while (reader.pos < end) {
2093
+ const tag = reader.uint32();
2094
+ switch (tag >>> 3) {
2095
+ case 1: {
2096
+ if (tag !== 10) {
2097
+ break;
2098
+ }
2099
+
2100
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2101
+ continue;
2102
+ }
2103
+ case 2: {
2104
+ if (tag !== 18) {
2105
+ break;
2106
+ }
2107
+
2108
+ message.ratings.push(InsightRating.decode(reader, reader.uint32()));
2109
+ continue;
2110
+ }
2111
+ }
2112
+ if ((tag & 7) === 4 || tag === 0) {
2113
+ break;
2114
+ }
2115
+ reader.skip(tag & 7);
2116
+ }
2117
+ return message;
2118
+ } finally {
2119
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2120
+ }
2121
+ },
2122
+
2123
+ fromJSON(object: any): BatchGetInsightRatingsResponse {
2124
+ return {
2125
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2126
+ ratings: globalThis.Array.isArray(object?.ratings)
2127
+ ? object.ratings.map((e: any) => InsightRating.fromJSON(e))
2128
+ : [],
2129
+ };
2130
+ },
2131
+
2132
+ toJSON(message: BatchGetInsightRatingsResponse): unknown {
2133
+ const obj: any = {};
2134
+ if (message.status !== undefined) {
2135
+ obj.status = ResponseStatus.toJSON(message.status);
2136
+ }
2137
+ if (message.ratings?.length) {
2138
+ obj.ratings = message.ratings.map((e) => InsightRating.toJSON(e));
2139
+ }
2140
+ return obj;
2141
+ },
2142
+
2143
+ create<I extends Exact<DeepPartial<BatchGetInsightRatingsResponse>, I>>(base?: I): BatchGetInsightRatingsResponse {
2144
+ return BatchGetInsightRatingsResponse.fromPartial(base ?? ({} as any));
2145
+ },
2146
+ fromPartial<I extends Exact<DeepPartial<BatchGetInsightRatingsResponse>, I>>(
2147
+ object: I,
2148
+ ): BatchGetInsightRatingsResponse {
2149
+ const message = createBaseBatchGetInsightRatingsResponse();
2150
+ message.status = (object.status !== undefined && object.status !== null)
2151
+ ? ResponseStatus.fromPartial(object.status)
2152
+ : undefined;
2153
+ message.ratings = object.ratings?.map((e) => InsightRating.fromPartial(e)) || [];
2154
+ return message;
2155
+ },
2156
+ };
2157
+
2158
+ function createBaseSetInsightRatingRequest(): SetInsightRatingRequest {
2159
+ return { organizationId: "", projectId: "", insight: undefined, rating: 0 };
2160
+ }
2161
+
2162
+ export const SetInsightRatingRequest: MessageFns<SetInsightRatingRequest> = {
2163
+ encode(message: SetInsightRatingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2164
+ if (message.organizationId !== "") {
2165
+ writer.uint32(10).string(message.organizationId);
2166
+ }
2167
+ if (message.projectId !== "") {
2168
+ writer.uint32(18).string(message.projectId);
2169
+ }
2170
+ if (message.insight !== undefined) {
2171
+ InsightRef.encode(message.insight, writer.uint32(26).fork()).join();
2172
+ }
2173
+ if (message.rating !== 0) {
2174
+ writer.uint32(32).int32(message.rating);
2175
+ }
2176
+ return writer;
2177
+ },
2178
+
2179
+ decode(input: BinaryReader | Uint8Array, length?: number): SetInsightRatingRequest {
2180
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2181
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2182
+ if (previousRecursionDepth >= 100) {
2183
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2184
+ }
2185
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2186
+ try {
2187
+ const end = length === undefined ? reader.len : reader.pos + length;
2188
+ const message = createBaseSetInsightRatingRequest();
2189
+ while (reader.pos < end) {
2190
+ const tag = reader.uint32();
2191
+ switch (tag >>> 3) {
2192
+ case 1: {
2193
+ if (tag !== 10) {
2194
+ break;
2195
+ }
2196
+
2197
+ message.organizationId = reader.string();
2198
+ continue;
2199
+ }
2200
+ case 2: {
2201
+ if (tag !== 18) {
2202
+ break;
2203
+ }
2204
+
2205
+ message.projectId = reader.string();
2206
+ continue;
2207
+ }
2208
+ case 3: {
2209
+ if (tag !== 26) {
2210
+ break;
2211
+ }
2212
+
2213
+ message.insight = InsightRef.decode(reader, reader.uint32());
2214
+ continue;
2215
+ }
2216
+ case 4: {
2217
+ if (tag !== 32) {
2218
+ break;
2219
+ }
2220
+
2221
+ message.rating = reader.int32() as any;
2222
+ continue;
2223
+ }
2224
+ }
2225
+ if ((tag & 7) === 4 || tag === 0) {
2226
+ break;
2227
+ }
2228
+ reader.skip(tag & 7);
2229
+ }
2230
+ return message;
2231
+ } finally {
2232
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2233
+ }
2234
+ },
2235
+
2236
+ fromJSON(object: any): SetInsightRatingRequest {
2237
+ return {
2238
+ organizationId: isSet(object.organizationId)
2239
+ ? globalThis.String(object.organizationId)
2240
+ : isSet(object.organization_id)
2241
+ ? globalThis.String(object.organization_id)
2242
+ : "",
2243
+ projectId: isSet(object.projectId)
2244
+ ? globalThis.String(object.projectId)
2245
+ : isSet(object.project_id)
2246
+ ? globalThis.String(object.project_id)
2247
+ : "",
2248
+ insight: isSet(object.insight) ? InsightRef.fromJSON(object.insight) : undefined,
2249
+ rating: isSet(object.rating) ? aIInsightRatingFromJSON(object.rating) : 0,
2250
+ };
2251
+ },
2252
+
2253
+ toJSON(message: SetInsightRatingRequest): unknown {
2254
+ const obj: any = {};
2255
+ if (message.organizationId !== "") {
2256
+ obj.organizationId = message.organizationId;
2257
+ }
2258
+ if (message.projectId !== "") {
2259
+ obj.projectId = message.projectId;
2260
+ }
2261
+ if (message.insight !== undefined) {
2262
+ obj.insight = InsightRef.toJSON(message.insight);
2263
+ }
2264
+ if (message.rating !== 0) {
2265
+ obj.rating = aIInsightRatingToJSON(message.rating);
2266
+ }
2267
+ return obj;
2268
+ },
2269
+
2270
+ create<I extends Exact<DeepPartial<SetInsightRatingRequest>, I>>(base?: I): SetInsightRatingRequest {
2271
+ return SetInsightRatingRequest.fromPartial(base ?? ({} as any));
2272
+ },
2273
+ fromPartial<I extends Exact<DeepPartial<SetInsightRatingRequest>, I>>(object: I): SetInsightRatingRequest {
2274
+ const message = createBaseSetInsightRatingRequest();
2275
+ message.organizationId = object.organizationId ?? "";
2276
+ message.projectId = object.projectId ?? "";
2277
+ message.insight = (object.insight !== undefined && object.insight !== null)
2278
+ ? InsightRef.fromPartial(object.insight)
2279
+ : undefined;
2280
+ message.rating = object.rating ?? 0;
2281
+ return message;
2282
+ },
2283
+ };
2284
+
2285
+ function createBaseSetInsightRatingResponse(): SetInsightRatingResponse {
2286
+ return { status: undefined, rating: undefined };
2287
+ }
2288
+
2289
+ export const SetInsightRatingResponse: MessageFns<SetInsightRatingResponse> = {
2290
+ encode(message: SetInsightRatingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2291
+ if (message.status !== undefined) {
2292
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2293
+ }
2294
+ if (message.rating !== undefined) {
2295
+ InsightRating.encode(message.rating, writer.uint32(18).fork()).join();
2296
+ }
2297
+ return writer;
2298
+ },
2299
+
2300
+ decode(input: BinaryReader | Uint8Array, length?: number): SetInsightRatingResponse {
2301
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2302
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2303
+ if (previousRecursionDepth >= 100) {
2304
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2305
+ }
2306
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2307
+ try {
2308
+ const end = length === undefined ? reader.len : reader.pos + length;
2309
+ const message = createBaseSetInsightRatingResponse();
2310
+ while (reader.pos < end) {
2311
+ const tag = reader.uint32();
2312
+ switch (tag >>> 3) {
2313
+ case 1: {
2314
+ if (tag !== 10) {
2315
+ break;
2316
+ }
2317
+
2318
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2319
+ continue;
2320
+ }
2321
+ case 2: {
2322
+ if (tag !== 18) {
2323
+ break;
2324
+ }
2325
+
2326
+ message.rating = InsightRating.decode(reader, reader.uint32());
2327
+ continue;
2328
+ }
2329
+ }
2330
+ if ((tag & 7) === 4 || tag === 0) {
2331
+ break;
2332
+ }
2333
+ reader.skip(tag & 7);
2334
+ }
2335
+ return message;
2336
+ } finally {
2337
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2338
+ }
2339
+ },
2340
+
2341
+ fromJSON(object: any): SetInsightRatingResponse {
2342
+ return {
2343
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2344
+ rating: isSet(object.rating) ? InsightRating.fromJSON(object.rating) : undefined,
2345
+ };
2346
+ },
2347
+
2348
+ toJSON(message: SetInsightRatingResponse): unknown {
2349
+ const obj: any = {};
2350
+ if (message.status !== undefined) {
2351
+ obj.status = ResponseStatus.toJSON(message.status);
2352
+ }
2353
+ if (message.rating !== undefined) {
2354
+ obj.rating = InsightRating.toJSON(message.rating);
2355
+ }
2356
+ return obj;
2357
+ },
2358
+
2359
+ create<I extends Exact<DeepPartial<SetInsightRatingResponse>, I>>(base?: I): SetInsightRatingResponse {
2360
+ return SetInsightRatingResponse.fromPartial(base ?? ({} as any));
2361
+ },
2362
+ fromPartial<I extends Exact<DeepPartial<SetInsightRatingResponse>, I>>(object: I): SetInsightRatingResponse {
2363
+ const message = createBaseSetInsightRatingResponse();
2364
+ message.status = (object.status !== undefined && object.status !== null)
2365
+ ? ResponseStatus.fromPartial(object.status)
2366
+ : undefined;
2367
+ message.rating = (object.rating !== undefined && object.rating !== null)
2368
+ ? InsightRating.fromPartial(object.rating)
2369
+ : undefined;
2370
+ return message;
2371
+ },
2372
+ };
2373
+
2374
+ function createBaseDeleteInsightRatingRequest(): DeleteInsightRatingRequest {
2375
+ return { organizationId: "", projectId: "", insight: undefined };
2376
+ }
2377
+
2378
+ export const DeleteInsightRatingRequest: MessageFns<DeleteInsightRatingRequest> = {
2379
+ encode(message: DeleteInsightRatingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2380
+ if (message.organizationId !== "") {
2381
+ writer.uint32(10).string(message.organizationId);
2382
+ }
2383
+ if (message.projectId !== "") {
2384
+ writer.uint32(18).string(message.projectId);
2385
+ }
2386
+ if (message.insight !== undefined) {
2387
+ InsightRef.encode(message.insight, writer.uint32(26).fork()).join();
2388
+ }
2389
+ return writer;
2390
+ },
2391
+
2392
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteInsightRatingRequest {
2393
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2394
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2395
+ if (previousRecursionDepth >= 100) {
2396
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2397
+ }
2398
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2399
+ try {
2400
+ const end = length === undefined ? reader.len : reader.pos + length;
2401
+ const message = createBaseDeleteInsightRatingRequest();
2402
+ while (reader.pos < end) {
2403
+ const tag = reader.uint32();
2404
+ switch (tag >>> 3) {
2405
+ case 1: {
2406
+ if (tag !== 10) {
2407
+ break;
2408
+ }
2409
+
2410
+ message.organizationId = reader.string();
2411
+ continue;
2412
+ }
2413
+ case 2: {
2414
+ if (tag !== 18) {
2415
+ break;
2416
+ }
2417
+
2418
+ message.projectId = reader.string();
2419
+ continue;
2420
+ }
2421
+ case 3: {
2422
+ if (tag !== 26) {
2423
+ break;
2424
+ }
2425
+
2426
+ message.insight = InsightRef.decode(reader, reader.uint32());
2427
+ continue;
2428
+ }
2429
+ }
2430
+ if ((tag & 7) === 4 || tag === 0) {
2431
+ break;
2432
+ }
2433
+ reader.skip(tag & 7);
2434
+ }
2435
+ return message;
2436
+ } finally {
2437
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2438
+ }
2439
+ },
2440
+
2441
+ fromJSON(object: any): DeleteInsightRatingRequest {
2442
+ return {
2443
+ organizationId: isSet(object.organizationId)
2444
+ ? globalThis.String(object.organizationId)
2445
+ : isSet(object.organization_id)
2446
+ ? globalThis.String(object.organization_id)
2447
+ : "",
2448
+ projectId: isSet(object.projectId)
2449
+ ? globalThis.String(object.projectId)
2450
+ : isSet(object.project_id)
2451
+ ? globalThis.String(object.project_id)
2452
+ : "",
2453
+ insight: isSet(object.insight) ? InsightRef.fromJSON(object.insight) : undefined,
2454
+ };
2455
+ },
2456
+
2457
+ toJSON(message: DeleteInsightRatingRequest): unknown {
2458
+ const obj: any = {};
2459
+ if (message.organizationId !== "") {
2460
+ obj.organizationId = message.organizationId;
2461
+ }
2462
+ if (message.projectId !== "") {
2463
+ obj.projectId = message.projectId;
2464
+ }
2465
+ if (message.insight !== undefined) {
2466
+ obj.insight = InsightRef.toJSON(message.insight);
2467
+ }
2468
+ return obj;
2469
+ },
2470
+
2471
+ create<I extends Exact<DeepPartial<DeleteInsightRatingRequest>, I>>(base?: I): DeleteInsightRatingRequest {
2472
+ return DeleteInsightRatingRequest.fromPartial(base ?? ({} as any));
2473
+ },
2474
+ fromPartial<I extends Exact<DeepPartial<DeleteInsightRatingRequest>, I>>(object: I): DeleteInsightRatingRequest {
2475
+ const message = createBaseDeleteInsightRatingRequest();
2476
+ message.organizationId = object.organizationId ?? "";
2477
+ message.projectId = object.projectId ?? "";
2478
+ message.insight = (object.insight !== undefined && object.insight !== null)
2479
+ ? InsightRef.fromPartial(object.insight)
2480
+ : undefined;
2481
+ return message;
2482
+ },
2483
+ };
2484
+
2485
+ function createBaseDeleteInsightRatingResponse(): DeleteInsightRatingResponse {
2486
+ return { status: undefined };
2487
+ }
2488
+
2489
+ export const DeleteInsightRatingResponse: MessageFns<DeleteInsightRatingResponse> = {
2490
+ encode(message: DeleteInsightRatingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2491
+ if (message.status !== undefined) {
2492
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2493
+ }
2494
+ return writer;
2495
+ },
2496
+
2497
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteInsightRatingResponse {
2498
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2499
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2500
+ if (previousRecursionDepth >= 100) {
2501
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2502
+ }
2503
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2504
+ try {
2505
+ const end = length === undefined ? reader.len : reader.pos + length;
2506
+ const message = createBaseDeleteInsightRatingResponse();
2507
+ while (reader.pos < end) {
2508
+ const tag = reader.uint32();
2509
+ switch (tag >>> 3) {
2510
+ case 1: {
2511
+ if (tag !== 10) {
2512
+ break;
2513
+ }
2514
+
2515
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2516
+ continue;
2517
+ }
2518
+ }
2519
+ if ((tag & 7) === 4 || tag === 0) {
2520
+ break;
2521
+ }
2522
+ reader.skip(tag & 7);
2523
+ }
2524
+ return message;
2525
+ } finally {
2526
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2527
+ }
2528
+ },
2529
+
2530
+ fromJSON(object: any): DeleteInsightRatingResponse {
2531
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
2532
+ },
2533
+
2534
+ toJSON(message: DeleteInsightRatingResponse): unknown {
2535
+ const obj: any = {};
2536
+ if (message.status !== undefined) {
2537
+ obj.status = ResponseStatus.toJSON(message.status);
2538
+ }
2539
+ return obj;
2540
+ },
2541
+
2542
+ create<I extends Exact<DeepPartial<DeleteInsightRatingResponse>, I>>(base?: I): DeleteInsightRatingResponse {
2543
+ return DeleteInsightRatingResponse.fromPartial(base ?? ({} as any));
2544
+ },
2545
+ fromPartial<I extends Exact<DeepPartial<DeleteInsightRatingResponse>, I>>(object: I): DeleteInsightRatingResponse {
2546
+ const message = createBaseDeleteInsightRatingResponse();
2547
+ message.status = (object.status !== undefined && object.status !== null)
2548
+ ? ResponseStatus.fromPartial(object.status)
2549
+ : undefined;
2550
+ return message;
2551
+ },
2552
+ };
2553
+
2554
+ /**
2555
+ * AIInsightsGatewayService serves a project's insight cards: session insights and project insight cards. Mirrors
2556
+ * ai.api.v1.AIInsightsService. AIGatewayService.GetSessionAnalysis still serves one session's insights with its score.
2557
+ * A person rates any card they can read with the ratings RPCs, and reads and changes only their own ratings.
2558
+ */
2559
+ export interface AIInsightsGatewayService {
2560
+ /**
2561
+ * A project's insights one at a time, newest analysis first: a person's most recent insights with filter.user_ids,
2562
+ * the team's without. Mirrors ai.api.v1.
2563
+ */
2564
+ ListSessionInsights(request: ListSessionInsightsRequest, metadata?: Metadata): Promise<ListSessionInsightsResponse>;
2565
+ /**
2566
+ * The project's cards across local days, newest local day first and rank order within a day: each day's latest run,
2567
+ * only when it is READY, with the run context each card is labelled with. Token pages. Mirrors ai.api.v1.
2568
+ */
2569
+ ListProjectInsightCards(
2570
+ request: ListProjectInsightCardsRequest,
2571
+ metadata?: Metadata,
2572
+ ): Promise<ListProjectInsightCardsResponse>;
2573
+ /**
2574
+ * The caller's ratings of up to 100 of the project's insights; an insight they have not rated is left out rather
2575
+ * than an error (unlike AIP-231). Mirrors ai.api.v1.
2576
+ */
2577
+ BatchGetInsightRatings(
2578
+ request: BatchGetInsightRatingsRequest,
2579
+ metadata?: Metadata,
2580
+ ): Promise<BatchGetInsightRatingsResponse>;
2581
+ /**
2582
+ * Records the caller's rating of one of their organization's project's insights, replacing any earlier one. An
2583
+ * insight or score a re-analysis or regrade replaced, or one the project does not have, is a NOT_FOUND status. Mirrors ai.api.v1.
2584
+ */
2585
+ SetInsightRating(request: SetInsightRatingRequest, metadata?: Metadata): Promise<SetInsightRatingResponse>;
2586
+ /** Removes the caller's rating of one insight; removing one that does not exist succeeds. Mirrors ai.api.v1. */
2587
+ DeleteInsightRating(request: DeleteInsightRatingRequest, metadata?: Metadata): Promise<DeleteInsightRatingResponse>;
2588
+ }
2589
+
2590
+ export const AIInsightsGatewayServiceServiceName = "gateway.web.v1.AIInsightsGatewayService";
2591
+ export class AIInsightsGatewayServiceClientImpl implements AIInsightsGatewayService {
2592
+ private readonly rpc: Rpc;
2593
+ private readonly service: string;
2594
+ constructor(rpc: Rpc, opts?: { service?: string }) {
2595
+ this.service = opts?.service || AIInsightsGatewayServiceServiceName;
2596
+ this.rpc = rpc;
2597
+ this.ListSessionInsights = this.ListSessionInsights.bind(this);
2598
+ this.ListProjectInsightCards = this.ListProjectInsightCards.bind(this);
2599
+ this.BatchGetInsightRatings = this.BatchGetInsightRatings.bind(this);
2600
+ this.SetInsightRating = this.SetInsightRating.bind(this);
2601
+ this.DeleteInsightRating = this.DeleteInsightRating.bind(this);
2602
+ }
2603
+ ListSessionInsights(request: ListSessionInsightsRequest, metadata?: Metadata): Promise<ListSessionInsightsResponse> {
2604
+ const data = ListSessionInsightsRequest.encode(request).finish();
2605
+ const promise = this.rpc.request(this.service, "ListSessionInsights", data, metadata);
2606
+ return promise.then((data) => ListSessionInsightsResponse.decode(new BinaryReader(data)));
2607
+ }
2608
+
2609
+ ListProjectInsightCards(
2610
+ request: ListProjectInsightCardsRequest,
2611
+ metadata?: Metadata,
2612
+ ): Promise<ListProjectInsightCardsResponse> {
2613
+ const data = ListProjectInsightCardsRequest.encode(request).finish();
2614
+ const promise = this.rpc.request(this.service, "ListProjectInsightCards", data, metadata);
2615
+ return promise.then((data) => ListProjectInsightCardsResponse.decode(new BinaryReader(data)));
2616
+ }
2617
+
2618
+ BatchGetInsightRatings(
2619
+ request: BatchGetInsightRatingsRequest,
2620
+ metadata?: Metadata,
2621
+ ): Promise<BatchGetInsightRatingsResponse> {
2622
+ const data = BatchGetInsightRatingsRequest.encode(request).finish();
2623
+ const promise = this.rpc.request(this.service, "BatchGetInsightRatings", data, metadata);
2624
+ return promise.then((data) => BatchGetInsightRatingsResponse.decode(new BinaryReader(data)));
2625
+ }
2626
+
2627
+ SetInsightRating(request: SetInsightRatingRequest, metadata?: Metadata): Promise<SetInsightRatingResponse> {
2628
+ const data = SetInsightRatingRequest.encode(request).finish();
2629
+ const promise = this.rpc.request(this.service, "SetInsightRating", data, metadata);
2630
+ return promise.then((data) => SetInsightRatingResponse.decode(new BinaryReader(data)));
2631
+ }
2632
+
2633
+ DeleteInsightRating(request: DeleteInsightRatingRequest, metadata?: Metadata): Promise<DeleteInsightRatingResponse> {
2634
+ const data = DeleteInsightRatingRequest.encode(request).finish();
2635
+ const promise = this.rpc.request(this.service, "DeleteInsightRating", data, metadata);
2636
+ return promise.then((data) => DeleteInsightRatingResponse.decode(new BinaryReader(data)));
2637
+ }
2638
+ }
2639
+
2640
+ interface Rpc {
2641
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
2642
+ }
2643
+
2644
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
2645
+
2646
+ export type DeepPartial<T> = T extends Builtin ? T
2647
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
2648
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
2649
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
2650
+ : Partial<T>;
2651
+
2652
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
2653
+ export type Exact<P, I> = P extends Builtin ? P
2654
+ :
2655
+ & P
2656
+ & { [K in keyof P as Extract<K, keyof I>]: Exact<P[K], I[K & keyof I]> }
2657
+ & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
2658
+
2659
+ function toTimestamp(date: Date): Timestamp {
2660
+ const seconds = Math.trunc(date.getTime() / 1_000);
2661
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
2662
+ return { seconds, nanos };
2663
+ }
2664
+
2665
+ function fromTimestamp(t: Timestamp): Date {
2666
+ let millis = (t.seconds || 0) * 1_000;
2667
+ millis += (t.nanos || 0) / 1_000_000;
2668
+ return new globalThis.Date(millis);
2669
+ }
2670
+
2671
+ function fromJsonTimestamp(o: any): Date {
2672
+ if (o instanceof globalThis.Date) {
2673
+ return o;
2674
+ } else if (typeof o === "string") {
2675
+ return new globalThis.Date(o);
2676
+ } else {
2677
+ return fromTimestamp(Timestamp.fromJSON(o));
2678
+ }
2679
+ }
2680
+
2681
+ function isSet(value: any): boolean {
2682
+ return value !== null && value !== undefined;
2683
+ }
2684
+
2685
+ export interface MessageFns<T> {
2686
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
2687
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
2688
+ fromJSON(object: any): T;
2689
+ toJSON(message: T): unknown;
2690
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
2691
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
2692
+ }