@miradorlabs/web-grpc 4.35.0 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
9
  import type { Metadata } from "@grpc/grpc-js";
10
10
  import { Timestamp } from "../../../../google/protobuf/timestamp";
11
11
  import { ResponseStatus } from "../../common/v1/status";
12
- import { AISessionEventRef, AISessionInsight, AISkillSuggestion } from "./ai_gateway";
12
+ import { AISessionEventRef, AISessionInsight, AISessionInsightTopic, AISkillSuggestion } from "./ai_gateway";
13
13
 
14
14
  export const protobufPackage = "gateway.web.v1";
15
15
 
@@ -50,88 +50,6 @@ export function sessionInsightSortToJSON(object: SessionInsightSort): string {
50
50
  }
51
51
  }
52
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
53
  /** AIInsightRating is how helpful a person found an insight or score card (ai.common.v1.AIInsightRating, same numbers). */
136
54
  export enum AIInsightRating {
137
55
  AI_INSIGHT_RATING_UNSPECIFIED = 0,
@@ -254,6 +172,57 @@ export interface ListProjectInsightCardsResponse {
254
172
  nextPageToken: string;
255
173
  }
256
174
 
175
+ export interface GetInsightsOverviewRequest {
176
+ organizationId: string;
177
+ projectId: string;
178
+ /**
179
+ * The window's start, which is scope: the insights and cards whose analyzed_at is at or after it. At most 35 days
180
+ * before the server's clock, else a validation error; a start in the future answers an empty overview.
181
+ */
182
+ analyzedAfter: Date | undefined;
183
+ }
184
+
185
+ export interface GetInsightsOverviewResponse {
186
+ status:
187
+ | ResponseStatus
188
+ | undefined;
189
+ /**
190
+ * The insights ListSessionInsights serves (no filter) whose SessionInsightEntry.analyzed_at is at or after
191
+ * analyzed_after, one row per topic with at least one, ordered by topic key, then name; insights without a topic
192
+ * are one row with topic unset, first. The rows add up to those insights.
193
+ */
194
+ sessionInsightTopicCounts: SessionInsightTopicCount[];
195
+ /**
196
+ * The cards ListProjectInsightCards serves (each local day's latest run, only when READY) whose
197
+ * AIProjectInsightCard.analyzed_at is at or after analyzed_after, one row per topic with at least one card, ordered
198
+ * by topic key, then name. A card counts by when its run analyzed the day, not by the day: a day that closed before analyzed_after
199
+ * but whose served run analyzed it after counts, and a day whose served run analyzed it before does not.
200
+ * A rerun of a day replaces its served run, so it can move that day's cards into the window between reads.
201
+ */
202
+ projectInsightTopicCounts: ProjectInsightTopicCount[];
203
+ }
204
+
205
+ /** SessionInsightTopicCount is how many insights are filed under one topic (AISessionInsight.topic). */
206
+ export interface SessionInsightTopicCount {
207
+ /**
208
+ * As AISessionInsight.topic: key and name for a topics file topic (the name as the newest insight carries it), an
209
+ * empty key and the model's name for a model-named topic, one row per exact name (case and spacing kept, so two
210
+ * spellings are two rows); unset for insights without a topic.
211
+ */
212
+ topic: AISessionInsightTopic | undefined;
213
+ insights: number;
214
+ }
215
+
216
+ /**
217
+ * ProjectInsightTopicCount is how many served cards are filed under one topic (AIProjectInsight.topic): one row per
218
+ * topics file key, and one per exact name the model wrote for a topic of its own.
219
+ */
220
+ export interface ProjectInsightTopicCount {
221
+ /** Unset for cards stored without a topic. */
222
+ topic: AIProjectInsightTopic | undefined;
223
+ cards: number;
224
+ }
225
+
257
226
  /**
258
227
  * AIProjectInsightCard is one card with the run that served it: label it with its day and analysis ("Nov 3 (final)",
259
228
  * "Today until 14:00, analyzed 14:06").
@@ -280,8 +249,8 @@ export interface AIProjectInsight {
280
249
  id: string;
281
250
  /** 1 is the model's highest priority; unique within the run. */
282
251
  rank: number;
283
- /** For display only; not evidence. */
284
- kind: AIProjectInsightKind;
252
+ /** What the card is filed under, for display only; not evidence. */
253
+ topic: AIProjectInsightTopic | undefined;
285
254
  title: string;
286
255
  /** The observed pattern. */
287
256
  pattern: string;
@@ -311,6 +280,17 @@ export interface AIProjectInsight {
311
280
  skillSuggestion: AISkillSuggestion | undefined;
312
281
  }
313
282
 
283
+ /**
284
+ * AIProjectInsightTopic is what a card is filed under: a topic from the project insights job's topics file, or one the model
285
+ * named for a cross-member pattern none of them fits.
286
+ */
287
+ export interface AIProjectInsightTopic {
288
+ /** The topics file's key (e.g. duplicate_work); empty for a topic the model named. */
289
+ key: string;
290
+ /** The topic's name: the topics file's, or 2 to 4 words the model wrote. */
291
+ name: string;
292
+ }
293
+
314
294
  /**
315
295
  * AIProjectInsightCitation is one cited event: its session's identity (source_system with session_id) and the
316
296
  * event's stored identity in that session.
@@ -1150,6 +1130,406 @@ export const ListProjectInsightCardsResponse: MessageFns<ListProjectInsightCards
1150
1130
  },
1151
1131
  };
1152
1132
 
1133
+ function createBaseGetInsightsOverviewRequest(): GetInsightsOverviewRequest {
1134
+ return { organizationId: "", projectId: "", analyzedAfter: undefined };
1135
+ }
1136
+
1137
+ export const GetInsightsOverviewRequest: MessageFns<GetInsightsOverviewRequest> = {
1138
+ encode(message: GetInsightsOverviewRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1139
+ if (message.organizationId !== "") {
1140
+ writer.uint32(10).string(message.organizationId);
1141
+ }
1142
+ if (message.projectId !== "") {
1143
+ writer.uint32(18).string(message.projectId);
1144
+ }
1145
+ if (message.analyzedAfter !== undefined) {
1146
+ Timestamp.encode(toTimestamp(message.analyzedAfter), writer.uint32(26).fork()).join();
1147
+ }
1148
+ return writer;
1149
+ },
1150
+
1151
+ decode(input: BinaryReader | Uint8Array, length?: number): GetInsightsOverviewRequest {
1152
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1153
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1154
+ if (previousRecursionDepth >= 100) {
1155
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1156
+ }
1157
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1158
+ try {
1159
+ const end = length === undefined ? reader.len : reader.pos + length;
1160
+ const message = createBaseGetInsightsOverviewRequest();
1161
+ while (reader.pos < end) {
1162
+ const tag = reader.uint32();
1163
+ switch (tag >>> 3) {
1164
+ case 1: {
1165
+ if (tag !== 10) {
1166
+ break;
1167
+ }
1168
+
1169
+ message.organizationId = reader.string();
1170
+ continue;
1171
+ }
1172
+ case 2: {
1173
+ if (tag !== 18) {
1174
+ break;
1175
+ }
1176
+
1177
+ message.projectId = reader.string();
1178
+ continue;
1179
+ }
1180
+ case 3: {
1181
+ if (tag !== 26) {
1182
+ break;
1183
+ }
1184
+
1185
+ message.analyzedAfter = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1186
+ continue;
1187
+ }
1188
+ }
1189
+ if ((tag & 7) === 4 || tag === 0) {
1190
+ break;
1191
+ }
1192
+ reader.skip(tag & 7);
1193
+ }
1194
+ return message;
1195
+ } finally {
1196
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1197
+ }
1198
+ },
1199
+
1200
+ fromJSON(object: any): GetInsightsOverviewRequest {
1201
+ return {
1202
+ organizationId: isSet(object.organizationId)
1203
+ ? globalThis.String(object.organizationId)
1204
+ : isSet(object.organization_id)
1205
+ ? globalThis.String(object.organization_id)
1206
+ : "",
1207
+ projectId: isSet(object.projectId)
1208
+ ? globalThis.String(object.projectId)
1209
+ : isSet(object.project_id)
1210
+ ? globalThis.String(object.project_id)
1211
+ : "",
1212
+ analyzedAfter: isSet(object.analyzedAfter)
1213
+ ? fromJsonTimestamp(object.analyzedAfter)
1214
+ : isSet(object.analyzed_after)
1215
+ ? fromJsonTimestamp(object.analyzed_after)
1216
+ : undefined,
1217
+ };
1218
+ },
1219
+
1220
+ toJSON(message: GetInsightsOverviewRequest): unknown {
1221
+ const obj: any = {};
1222
+ if (message.organizationId !== "") {
1223
+ obj.organizationId = message.organizationId;
1224
+ }
1225
+ if (message.projectId !== "") {
1226
+ obj.projectId = message.projectId;
1227
+ }
1228
+ if (message.analyzedAfter !== undefined) {
1229
+ obj.analyzedAfter = message.analyzedAfter.toISOString();
1230
+ }
1231
+ return obj;
1232
+ },
1233
+
1234
+ create<I extends Exact<DeepPartial<GetInsightsOverviewRequest>, I>>(base?: I): GetInsightsOverviewRequest {
1235
+ return GetInsightsOverviewRequest.fromPartial(base ?? ({} as any));
1236
+ },
1237
+ fromPartial<I extends Exact<DeepPartial<GetInsightsOverviewRequest>, I>>(object: I): GetInsightsOverviewRequest {
1238
+ const message = createBaseGetInsightsOverviewRequest();
1239
+ message.organizationId = object.organizationId ?? "";
1240
+ message.projectId = object.projectId ?? "";
1241
+ message.analyzedAfter = object.analyzedAfter ?? undefined;
1242
+ return message;
1243
+ },
1244
+ };
1245
+
1246
+ function createBaseGetInsightsOverviewResponse(): GetInsightsOverviewResponse {
1247
+ return { status: undefined, sessionInsightTopicCounts: [], projectInsightTopicCounts: [] };
1248
+ }
1249
+
1250
+ export const GetInsightsOverviewResponse: MessageFns<GetInsightsOverviewResponse> = {
1251
+ encode(message: GetInsightsOverviewResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1252
+ if (message.status !== undefined) {
1253
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1254
+ }
1255
+ for (const v of message.sessionInsightTopicCounts) {
1256
+ SessionInsightTopicCount.encode(v!, writer.uint32(18).fork()).join();
1257
+ }
1258
+ for (const v of message.projectInsightTopicCounts) {
1259
+ ProjectInsightTopicCount.encode(v!, writer.uint32(26).fork()).join();
1260
+ }
1261
+ return writer;
1262
+ },
1263
+
1264
+ decode(input: BinaryReader | Uint8Array, length?: number): GetInsightsOverviewResponse {
1265
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1266
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1267
+ if (previousRecursionDepth >= 100) {
1268
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1269
+ }
1270
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1271
+ try {
1272
+ const end = length === undefined ? reader.len : reader.pos + length;
1273
+ const message = createBaseGetInsightsOverviewResponse();
1274
+ while (reader.pos < end) {
1275
+ const tag = reader.uint32();
1276
+ switch (tag >>> 3) {
1277
+ case 1: {
1278
+ if (tag !== 10) {
1279
+ break;
1280
+ }
1281
+
1282
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1283
+ continue;
1284
+ }
1285
+ case 2: {
1286
+ if (tag !== 18) {
1287
+ break;
1288
+ }
1289
+
1290
+ message.sessionInsightTopicCounts.push(SessionInsightTopicCount.decode(reader, reader.uint32()));
1291
+ continue;
1292
+ }
1293
+ case 3: {
1294
+ if (tag !== 26) {
1295
+ break;
1296
+ }
1297
+
1298
+ message.projectInsightTopicCounts.push(ProjectInsightTopicCount.decode(reader, reader.uint32()));
1299
+ continue;
1300
+ }
1301
+ }
1302
+ if ((tag & 7) === 4 || tag === 0) {
1303
+ break;
1304
+ }
1305
+ reader.skip(tag & 7);
1306
+ }
1307
+ return message;
1308
+ } finally {
1309
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1310
+ }
1311
+ },
1312
+
1313
+ fromJSON(object: any): GetInsightsOverviewResponse {
1314
+ return {
1315
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1316
+ sessionInsightTopicCounts: globalThis.Array.isArray(object?.sessionInsightTopicCounts)
1317
+ ? object.sessionInsightTopicCounts.map((e: any) => SessionInsightTopicCount.fromJSON(e))
1318
+ : globalThis.Array.isArray(object?.session_insight_topic_counts)
1319
+ ? object.session_insight_topic_counts.map((e: any) => SessionInsightTopicCount.fromJSON(e))
1320
+ : [],
1321
+ projectInsightTopicCounts: globalThis.Array.isArray(object?.projectInsightTopicCounts)
1322
+ ? object.projectInsightTopicCounts.map((e: any) => ProjectInsightTopicCount.fromJSON(e))
1323
+ : globalThis.Array.isArray(object?.project_insight_topic_counts)
1324
+ ? object.project_insight_topic_counts.map((e: any) => ProjectInsightTopicCount.fromJSON(e))
1325
+ : [],
1326
+ };
1327
+ },
1328
+
1329
+ toJSON(message: GetInsightsOverviewResponse): unknown {
1330
+ const obj: any = {};
1331
+ if (message.status !== undefined) {
1332
+ obj.status = ResponseStatus.toJSON(message.status);
1333
+ }
1334
+ if (message.sessionInsightTopicCounts?.length) {
1335
+ obj.sessionInsightTopicCounts = message.sessionInsightTopicCounts.map((e) => SessionInsightTopicCount.toJSON(e));
1336
+ }
1337
+ if (message.projectInsightTopicCounts?.length) {
1338
+ obj.projectInsightTopicCounts = message.projectInsightTopicCounts.map((e) => ProjectInsightTopicCount.toJSON(e));
1339
+ }
1340
+ return obj;
1341
+ },
1342
+
1343
+ create<I extends Exact<DeepPartial<GetInsightsOverviewResponse>, I>>(base?: I): GetInsightsOverviewResponse {
1344
+ return GetInsightsOverviewResponse.fromPartial(base ?? ({} as any));
1345
+ },
1346
+ fromPartial<I extends Exact<DeepPartial<GetInsightsOverviewResponse>, I>>(object: I): GetInsightsOverviewResponse {
1347
+ const message = createBaseGetInsightsOverviewResponse();
1348
+ message.status = (object.status !== undefined && object.status !== null)
1349
+ ? ResponseStatus.fromPartial(object.status)
1350
+ : undefined;
1351
+ message.sessionInsightTopicCounts =
1352
+ object.sessionInsightTopicCounts?.map((e) => SessionInsightTopicCount.fromPartial(e)) || [];
1353
+ message.projectInsightTopicCounts =
1354
+ object.projectInsightTopicCounts?.map((e) => ProjectInsightTopicCount.fromPartial(e)) || [];
1355
+ return message;
1356
+ },
1357
+ };
1358
+
1359
+ function createBaseSessionInsightTopicCount(): SessionInsightTopicCount {
1360
+ return { topic: undefined, insights: 0 };
1361
+ }
1362
+
1363
+ export const SessionInsightTopicCount: MessageFns<SessionInsightTopicCount> = {
1364
+ encode(message: SessionInsightTopicCount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1365
+ if (message.topic !== undefined) {
1366
+ AISessionInsightTopic.encode(message.topic, writer.uint32(10).fork()).join();
1367
+ }
1368
+ if (message.insights !== 0) {
1369
+ writer.uint32(16).uint64(message.insights);
1370
+ }
1371
+ return writer;
1372
+ },
1373
+
1374
+ decode(input: BinaryReader | Uint8Array, length?: number): SessionInsightTopicCount {
1375
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1376
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1377
+ if (previousRecursionDepth >= 100) {
1378
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1379
+ }
1380
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1381
+ try {
1382
+ const end = length === undefined ? reader.len : reader.pos + length;
1383
+ const message = createBaseSessionInsightTopicCount();
1384
+ while (reader.pos < end) {
1385
+ const tag = reader.uint32();
1386
+ switch (tag >>> 3) {
1387
+ case 1: {
1388
+ if (tag !== 10) {
1389
+ break;
1390
+ }
1391
+
1392
+ message.topic = AISessionInsightTopic.decode(reader, reader.uint32());
1393
+ continue;
1394
+ }
1395
+ case 2: {
1396
+ if (tag !== 16) {
1397
+ break;
1398
+ }
1399
+
1400
+ message.insights = longToNumber(reader.uint64());
1401
+ continue;
1402
+ }
1403
+ }
1404
+ if ((tag & 7) === 4 || tag === 0) {
1405
+ break;
1406
+ }
1407
+ reader.skip(tag & 7);
1408
+ }
1409
+ return message;
1410
+ } finally {
1411
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1412
+ }
1413
+ },
1414
+
1415
+ fromJSON(object: any): SessionInsightTopicCount {
1416
+ return {
1417
+ topic: isSet(object.topic) ? AISessionInsightTopic.fromJSON(object.topic) : undefined,
1418
+ insights: isSet(object.insights) ? globalThis.Number(object.insights) : 0,
1419
+ };
1420
+ },
1421
+
1422
+ toJSON(message: SessionInsightTopicCount): unknown {
1423
+ const obj: any = {};
1424
+ if (message.topic !== undefined) {
1425
+ obj.topic = AISessionInsightTopic.toJSON(message.topic);
1426
+ }
1427
+ if (message.insights !== 0) {
1428
+ obj.insights = Math.round(message.insights);
1429
+ }
1430
+ return obj;
1431
+ },
1432
+
1433
+ create<I extends Exact<DeepPartial<SessionInsightTopicCount>, I>>(base?: I): SessionInsightTopicCount {
1434
+ return SessionInsightTopicCount.fromPartial(base ?? ({} as any));
1435
+ },
1436
+ fromPartial<I extends Exact<DeepPartial<SessionInsightTopicCount>, I>>(object: I): SessionInsightTopicCount {
1437
+ const message = createBaseSessionInsightTopicCount();
1438
+ message.topic = (object.topic !== undefined && object.topic !== null)
1439
+ ? AISessionInsightTopic.fromPartial(object.topic)
1440
+ : undefined;
1441
+ message.insights = object.insights ?? 0;
1442
+ return message;
1443
+ },
1444
+ };
1445
+
1446
+ function createBaseProjectInsightTopicCount(): ProjectInsightTopicCount {
1447
+ return { topic: undefined, cards: 0 };
1448
+ }
1449
+
1450
+ export const ProjectInsightTopicCount: MessageFns<ProjectInsightTopicCount> = {
1451
+ encode(message: ProjectInsightTopicCount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1452
+ if (message.topic !== undefined) {
1453
+ AIProjectInsightTopic.encode(message.topic, writer.uint32(10).fork()).join();
1454
+ }
1455
+ if (message.cards !== 0) {
1456
+ writer.uint32(16).uint64(message.cards);
1457
+ }
1458
+ return writer;
1459
+ },
1460
+
1461
+ decode(input: BinaryReader | Uint8Array, length?: number): ProjectInsightTopicCount {
1462
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1463
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
1464
+ if (previousRecursionDepth >= 100) {
1465
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
1466
+ }
1467
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
1468
+ try {
1469
+ const end = length === undefined ? reader.len : reader.pos + length;
1470
+ const message = createBaseProjectInsightTopicCount();
1471
+ while (reader.pos < end) {
1472
+ const tag = reader.uint32();
1473
+ switch (tag >>> 3) {
1474
+ case 1: {
1475
+ if (tag !== 10) {
1476
+ break;
1477
+ }
1478
+
1479
+ message.topic = AIProjectInsightTopic.decode(reader, reader.uint32());
1480
+ continue;
1481
+ }
1482
+ case 2: {
1483
+ if (tag !== 16) {
1484
+ break;
1485
+ }
1486
+
1487
+ message.cards = longToNumber(reader.uint64());
1488
+ continue;
1489
+ }
1490
+ }
1491
+ if ((tag & 7) === 4 || tag === 0) {
1492
+ break;
1493
+ }
1494
+ reader.skip(tag & 7);
1495
+ }
1496
+ return message;
1497
+ } finally {
1498
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
1499
+ }
1500
+ },
1501
+
1502
+ fromJSON(object: any): ProjectInsightTopicCount {
1503
+ return {
1504
+ topic: isSet(object.topic) ? AIProjectInsightTopic.fromJSON(object.topic) : undefined,
1505
+ cards: isSet(object.cards) ? globalThis.Number(object.cards) : 0,
1506
+ };
1507
+ },
1508
+
1509
+ toJSON(message: ProjectInsightTopicCount): unknown {
1510
+ const obj: any = {};
1511
+ if (message.topic !== undefined) {
1512
+ obj.topic = AIProjectInsightTopic.toJSON(message.topic);
1513
+ }
1514
+ if (message.cards !== 0) {
1515
+ obj.cards = Math.round(message.cards);
1516
+ }
1517
+ return obj;
1518
+ },
1519
+
1520
+ create<I extends Exact<DeepPartial<ProjectInsightTopicCount>, I>>(base?: I): ProjectInsightTopicCount {
1521
+ return ProjectInsightTopicCount.fromPartial(base ?? ({} as any));
1522
+ },
1523
+ fromPartial<I extends Exact<DeepPartial<ProjectInsightTopicCount>, I>>(object: I): ProjectInsightTopicCount {
1524
+ const message = createBaseProjectInsightTopicCount();
1525
+ message.topic = (object.topic !== undefined && object.topic !== null)
1526
+ ? AIProjectInsightTopic.fromPartial(object.topic)
1527
+ : undefined;
1528
+ message.cards = object.cards ?? 0;
1529
+ return message;
1530
+ },
1531
+ };
1532
+
1153
1533
  function createBaseAIProjectInsightCard(): AIProjectInsightCard {
1154
1534
  return { insight: undefined, runId: "", localDate: "", timeZone: "", windowClosed: false, analyzedAt: undefined };
1155
1535
  }
@@ -1325,7 +1705,7 @@ function createBaseAIProjectInsight(): AIProjectInsight {
1325
1705
  return {
1326
1706
  id: "",
1327
1707
  rank: 0,
1328
- kind: 0,
1708
+ topic: undefined,
1329
1709
  title: "",
1330
1710
  pattern: "",
1331
1711
  explanation: "",
@@ -1347,8 +1727,8 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1347
1727
  if (message.rank !== 0) {
1348
1728
  writer.uint32(16).uint32(message.rank);
1349
1729
  }
1350
- if (message.kind !== 0) {
1351
- writer.uint32(24).int32(message.kind);
1730
+ if (message.topic !== undefined) {
1731
+ AIProjectInsightTopic.encode(message.topic, writer.uint32(26).fork()).join();
1352
1732
  }
1353
1733
  if (message.title !== "") {
1354
1734
  writer.uint32(34).string(message.title);
@@ -1413,11 +1793,11 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1413
1793
  continue;
1414
1794
  }
1415
1795
  case 3: {
1416
- if (tag !== 24) {
1796
+ if (tag !== 26) {
1417
1797
  break;
1418
1798
  }
1419
1799
 
1420
- message.kind = reader.int32() as any;
1800
+ message.topic = AIProjectInsightTopic.decode(reader, reader.uint32());
1421
1801
  continue;
1422
1802
  }
1423
1803
  case 4: {
@@ -1516,7 +1896,7 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1516
1896
  return {
1517
1897
  id: isSet(object.id) ? globalThis.String(object.id) : "",
1518
1898
  rank: isSet(object.rank) ? globalThis.Number(object.rank) : 0,
1519
- kind: isSet(object.kind) ? aIProjectInsightKindFromJSON(object.kind) : 0,
1899
+ topic: isSet(object.topic) ? AIProjectInsightTopic.fromJSON(object.topic) : undefined,
1520
1900
  title: isSet(object.title) ? globalThis.String(object.title) : "",
1521
1901
  pattern: isSet(object.pattern) ? globalThis.String(object.pattern) : "",
1522
1902
  explanation: isSet(object.explanation) ? globalThis.String(object.explanation) : "",
@@ -1556,8 +1936,8 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1556
1936
  if (message.rank !== 0) {
1557
1937
  obj.rank = Math.round(message.rank);
1558
1938
  }
1559
- if (message.kind !== 0) {
1560
- obj.kind = aIProjectInsightKindToJSON(message.kind);
1939
+ if (message.topic !== undefined) {
1940
+ obj.topic = AIProjectInsightTopic.toJSON(message.topic);
1561
1941
  }
1562
1942
  if (message.title !== "") {
1563
1943
  obj.title = message.title;
@@ -1599,7 +1979,9 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1599
1979
  const message = createBaseAIProjectInsight();
1600
1980
  message.id = object.id ?? "";
1601
1981
  message.rank = object.rank ?? 0;
1602
- message.kind = object.kind ?? 0;
1982
+ message.topic = (object.topic !== undefined && object.topic !== null)
1983
+ ? AIProjectInsightTopic.fromPartial(object.topic)
1984
+ : undefined;
1603
1985
  message.title = object.title ?? "";
1604
1986
  message.pattern = object.pattern ?? "";
1605
1987
  message.explanation = object.explanation ?? "";
@@ -1616,6 +1998,91 @@ export const AIProjectInsight: MessageFns<AIProjectInsight> = {
1616
1998
  },
1617
1999
  };
1618
2000
 
2001
+ function createBaseAIProjectInsightTopic(): AIProjectInsightTopic {
2002
+ return { key: "", name: "" };
2003
+ }
2004
+
2005
+ export const AIProjectInsightTopic: MessageFns<AIProjectInsightTopic> = {
2006
+ encode(message: AIProjectInsightTopic, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2007
+ if (message.key !== "") {
2008
+ writer.uint32(10).string(message.key);
2009
+ }
2010
+ if (message.name !== "") {
2011
+ writer.uint32(18).string(message.name);
2012
+ }
2013
+ return writer;
2014
+ },
2015
+
2016
+ decode(input: BinaryReader | Uint8Array, length?: number): AIProjectInsightTopic {
2017
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2018
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2019
+ if (previousRecursionDepth >= 100) {
2020
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2021
+ }
2022
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2023
+ try {
2024
+ const end = length === undefined ? reader.len : reader.pos + length;
2025
+ const message = createBaseAIProjectInsightTopic();
2026
+ while (reader.pos < end) {
2027
+ const tag = reader.uint32();
2028
+ switch (tag >>> 3) {
2029
+ case 1: {
2030
+ if (tag !== 10) {
2031
+ break;
2032
+ }
2033
+
2034
+ message.key = reader.string();
2035
+ continue;
2036
+ }
2037
+ case 2: {
2038
+ if (tag !== 18) {
2039
+ break;
2040
+ }
2041
+
2042
+ message.name = reader.string();
2043
+ continue;
2044
+ }
2045
+ }
2046
+ if ((tag & 7) === 4 || tag === 0) {
2047
+ break;
2048
+ }
2049
+ reader.skip(tag & 7);
2050
+ }
2051
+ return message;
2052
+ } finally {
2053
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2054
+ }
2055
+ },
2056
+
2057
+ fromJSON(object: any): AIProjectInsightTopic {
2058
+ return {
2059
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2060
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2061
+ };
2062
+ },
2063
+
2064
+ toJSON(message: AIProjectInsightTopic): unknown {
2065
+ const obj: any = {};
2066
+ if (message.key !== "") {
2067
+ obj.key = message.key;
2068
+ }
2069
+ if (message.name !== "") {
2070
+ obj.name = message.name;
2071
+ }
2072
+ return obj;
2073
+ },
2074
+
2075
+ create<I extends Exact<DeepPartial<AIProjectInsightTopic>, I>>(base?: I): AIProjectInsightTopic {
2076
+ return AIProjectInsightTopic.fromPartial(base ?? ({} as any));
2077
+ },
2078
+ fromPartial<I extends Exact<DeepPartial<AIProjectInsightTopic>, I>>(object: I): AIProjectInsightTopic {
2079
+ const message = createBaseAIProjectInsightTopic();
2080
+ message.key = object.key ?? "";
2081
+ message.name = object.name ?? "";
2082
+ return message;
2083
+ },
2084
+ };
2085
+
1619
2086
  function createBaseAIProjectInsightCitation(): AIProjectInsightCitation {
1620
2087
  return { sourceSystem: "", sessionId: "", eventRef: undefined };
1621
2088
  }
@@ -2570,6 +3037,12 @@ export interface AIInsightsGatewayService {
2570
3037
  request: ListProjectInsightCardsRequest,
2571
3038
  metadata?: Metadata,
2572
3039
  ): Promise<ListProjectInsightCardsResponse>;
3040
+ /**
3041
+ * The project's insights in one window counted without listing them: ListSessionInsights' insights by topic and
3042
+ * ListProjectInsightCards' cards by topic, from the same rows those RPCs serve. A part that cannot be read fails the
3043
+ * call, so a zero is a count of none. Mirrors ai.api.v1.
3044
+ */
3045
+ GetInsightsOverview(request: GetInsightsOverviewRequest, metadata?: Metadata): Promise<GetInsightsOverviewResponse>;
2573
3046
  /**
2574
3047
  * The caller's ratings of up to 100 of the project's insights; an insight they have not rated is left out rather
2575
3048
  * than an error (unlike AIP-231). Mirrors ai.api.v1.
@@ -2596,6 +3069,7 @@ export class AIInsightsGatewayServiceClientImpl implements AIInsightsGatewayServ
2596
3069
  this.rpc = rpc;
2597
3070
  this.ListSessionInsights = this.ListSessionInsights.bind(this);
2598
3071
  this.ListProjectInsightCards = this.ListProjectInsightCards.bind(this);
3072
+ this.GetInsightsOverview = this.GetInsightsOverview.bind(this);
2599
3073
  this.BatchGetInsightRatings = this.BatchGetInsightRatings.bind(this);
2600
3074
  this.SetInsightRating = this.SetInsightRating.bind(this);
2601
3075
  this.DeleteInsightRating = this.DeleteInsightRating.bind(this);
@@ -2615,6 +3089,12 @@ export class AIInsightsGatewayServiceClientImpl implements AIInsightsGatewayServ
2615
3089
  return promise.then((data) => ListProjectInsightCardsResponse.decode(new BinaryReader(data)));
2616
3090
  }
2617
3091
 
3092
+ GetInsightsOverview(request: GetInsightsOverviewRequest, metadata?: Metadata): Promise<GetInsightsOverviewResponse> {
3093
+ const data = GetInsightsOverviewRequest.encode(request).finish();
3094
+ const promise = this.rpc.request(this.service, "GetInsightsOverview", data, metadata);
3095
+ return promise.then((data) => GetInsightsOverviewResponse.decode(new BinaryReader(data)));
3096
+ }
3097
+
2618
3098
  BatchGetInsightRatings(
2619
3099
  request: BatchGetInsightRatingsRequest,
2620
3100
  metadata?: Metadata,
@@ -2678,6 +3158,17 @@ function fromJsonTimestamp(o: any): Date {
2678
3158
  }
2679
3159
  }
2680
3160
 
3161
+ function longToNumber(int64: { toString(): string }): number {
3162
+ const num = globalThis.Number(int64.toString());
3163
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
3164
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
3165
+ }
3166
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
3167
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
3168
+ }
3169
+ return num;
3170
+ }
3171
+
2681
3172
  function isSet(value: any): boolean {
2682
3173
  return value !== null && value !== undefined;
2683
3174
  }