weave-typescript 0.21.0 → 0.23.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,2363 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc unknown
6
+ // source: weaveapi/chat/v1/chat.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ChatStreamFrame_MessageError = exports.ChatStreamFrame_MessageComplete = exports.ChatStreamFrame_ArtifactUpdated = exports.ChatStreamFrame_ArtifactCreated = exports.ChatStreamFrame_ToolCallRejected = exports.ChatStreamFrame_ToolCallResult = exports.ChatStreamFrame_ToolCallExecuting = exports.ChatStreamFrame_ToolCallProposed = exports.ChatStreamFrame_MessageDelta = exports.ChatStreamFrame_MessageStarted = exports.ChatStreamFrame = exports.ChatEphemeralAttachment = exports.ChatArtifactVersion = exports.ChatArtifact = exports.ChatMessage = exports.ChatSession = exports.ChatArtifactKind = exports.ChatStreamState = exports.ChatToolCallState = exports.ChatMessageRole = exports.protobufPackage = void 0;
9
+ exports.chatMessageRoleFromJSON = chatMessageRoleFromJSON;
10
+ exports.chatMessageRoleToJSON = chatMessageRoleToJSON;
11
+ exports.chatToolCallStateFromJSON = chatToolCallStateFromJSON;
12
+ exports.chatToolCallStateToJSON = chatToolCallStateToJSON;
13
+ exports.chatStreamStateFromJSON = chatStreamStateFromJSON;
14
+ exports.chatStreamStateToJSON = chatStreamStateToJSON;
15
+ exports.chatArtifactKindFromJSON = chatArtifactKindFromJSON;
16
+ exports.chatArtifactKindToJSON = chatArtifactKindToJSON;
17
+ /* eslint-disable */
18
+ const wire_1 = require("@bufbuild/protobuf/wire");
19
+ const struct_pb_1 = require("../../../google/protobuf/struct.pb");
20
+ const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
21
+ exports.protobufPackage = "weaveapi.chat.v1";
22
+ var ChatMessageRole;
23
+ (function (ChatMessageRole) {
24
+ ChatMessageRole[ChatMessageRole["CHAT_MESSAGE_ROLE_UNSPECIFIED"] = 0] = "CHAT_MESSAGE_ROLE_UNSPECIFIED";
25
+ ChatMessageRole[ChatMessageRole["CHAT_MESSAGE_ROLE_USER"] = 1] = "CHAT_MESSAGE_ROLE_USER";
26
+ ChatMessageRole[ChatMessageRole["CHAT_MESSAGE_ROLE_ASSISTANT"] = 2] = "CHAT_MESSAGE_ROLE_ASSISTANT";
27
+ ChatMessageRole[ChatMessageRole["CHAT_MESSAGE_ROLE_TOOL"] = 3] = "CHAT_MESSAGE_ROLE_TOOL";
28
+ ChatMessageRole[ChatMessageRole["CHAT_MESSAGE_ROLE_SYSTEM"] = 4] = "CHAT_MESSAGE_ROLE_SYSTEM";
29
+ ChatMessageRole[ChatMessageRole["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
30
+ })(ChatMessageRole || (exports.ChatMessageRole = ChatMessageRole = {}));
31
+ function chatMessageRoleFromJSON(object) {
32
+ switch (object) {
33
+ case 0:
34
+ case "CHAT_MESSAGE_ROLE_UNSPECIFIED":
35
+ return ChatMessageRole.CHAT_MESSAGE_ROLE_UNSPECIFIED;
36
+ case 1:
37
+ case "CHAT_MESSAGE_ROLE_USER":
38
+ return ChatMessageRole.CHAT_MESSAGE_ROLE_USER;
39
+ case 2:
40
+ case "CHAT_MESSAGE_ROLE_ASSISTANT":
41
+ return ChatMessageRole.CHAT_MESSAGE_ROLE_ASSISTANT;
42
+ case 3:
43
+ case "CHAT_MESSAGE_ROLE_TOOL":
44
+ return ChatMessageRole.CHAT_MESSAGE_ROLE_TOOL;
45
+ case 4:
46
+ case "CHAT_MESSAGE_ROLE_SYSTEM":
47
+ return ChatMessageRole.CHAT_MESSAGE_ROLE_SYSTEM;
48
+ case -1:
49
+ case "UNRECOGNIZED":
50
+ default:
51
+ return ChatMessageRole.UNRECOGNIZED;
52
+ }
53
+ }
54
+ function chatMessageRoleToJSON(object) {
55
+ switch (object) {
56
+ case ChatMessageRole.CHAT_MESSAGE_ROLE_UNSPECIFIED:
57
+ return "CHAT_MESSAGE_ROLE_UNSPECIFIED";
58
+ case ChatMessageRole.CHAT_MESSAGE_ROLE_USER:
59
+ return "CHAT_MESSAGE_ROLE_USER";
60
+ case ChatMessageRole.CHAT_MESSAGE_ROLE_ASSISTANT:
61
+ return "CHAT_MESSAGE_ROLE_ASSISTANT";
62
+ case ChatMessageRole.CHAT_MESSAGE_ROLE_TOOL:
63
+ return "CHAT_MESSAGE_ROLE_TOOL";
64
+ case ChatMessageRole.CHAT_MESSAGE_ROLE_SYSTEM:
65
+ return "CHAT_MESSAGE_ROLE_SYSTEM";
66
+ case ChatMessageRole.UNRECOGNIZED:
67
+ default:
68
+ return "UNRECOGNIZED";
69
+ }
70
+ }
71
+ var ChatToolCallState;
72
+ (function (ChatToolCallState) {
73
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_UNSPECIFIED"] = 0] = "CHAT_TOOL_CALL_STATE_UNSPECIFIED";
74
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_NONE"] = 1] = "CHAT_TOOL_CALL_STATE_NONE";
75
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_PROPOSED"] = 2] = "CHAT_TOOL_CALL_STATE_PROPOSED";
76
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_APPROVED"] = 3] = "CHAT_TOOL_CALL_STATE_APPROVED";
77
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_REJECTED"] = 4] = "CHAT_TOOL_CALL_STATE_REJECTED";
78
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_EXECUTED"] = 5] = "CHAT_TOOL_CALL_STATE_EXECUTED";
79
+ ChatToolCallState[ChatToolCallState["CHAT_TOOL_CALL_STATE_FAILED"] = 6] = "CHAT_TOOL_CALL_STATE_FAILED";
80
+ ChatToolCallState[ChatToolCallState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
81
+ })(ChatToolCallState || (exports.ChatToolCallState = ChatToolCallState = {}));
82
+ function chatToolCallStateFromJSON(object) {
83
+ switch (object) {
84
+ case 0:
85
+ case "CHAT_TOOL_CALL_STATE_UNSPECIFIED":
86
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_UNSPECIFIED;
87
+ case 1:
88
+ case "CHAT_TOOL_CALL_STATE_NONE":
89
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_NONE;
90
+ case 2:
91
+ case "CHAT_TOOL_CALL_STATE_PROPOSED":
92
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_PROPOSED;
93
+ case 3:
94
+ case "CHAT_TOOL_CALL_STATE_APPROVED":
95
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_APPROVED;
96
+ case 4:
97
+ case "CHAT_TOOL_CALL_STATE_REJECTED":
98
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_REJECTED;
99
+ case 5:
100
+ case "CHAT_TOOL_CALL_STATE_EXECUTED":
101
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_EXECUTED;
102
+ case 6:
103
+ case "CHAT_TOOL_CALL_STATE_FAILED":
104
+ return ChatToolCallState.CHAT_TOOL_CALL_STATE_FAILED;
105
+ case -1:
106
+ case "UNRECOGNIZED":
107
+ default:
108
+ return ChatToolCallState.UNRECOGNIZED;
109
+ }
110
+ }
111
+ function chatToolCallStateToJSON(object) {
112
+ switch (object) {
113
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_UNSPECIFIED:
114
+ return "CHAT_TOOL_CALL_STATE_UNSPECIFIED";
115
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_NONE:
116
+ return "CHAT_TOOL_CALL_STATE_NONE";
117
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_PROPOSED:
118
+ return "CHAT_TOOL_CALL_STATE_PROPOSED";
119
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_APPROVED:
120
+ return "CHAT_TOOL_CALL_STATE_APPROVED";
121
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_REJECTED:
122
+ return "CHAT_TOOL_CALL_STATE_REJECTED";
123
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_EXECUTED:
124
+ return "CHAT_TOOL_CALL_STATE_EXECUTED";
125
+ case ChatToolCallState.CHAT_TOOL_CALL_STATE_FAILED:
126
+ return "CHAT_TOOL_CALL_STATE_FAILED";
127
+ case ChatToolCallState.UNRECOGNIZED:
128
+ default:
129
+ return "UNRECOGNIZED";
130
+ }
131
+ }
132
+ var ChatStreamState;
133
+ (function (ChatStreamState) {
134
+ ChatStreamState[ChatStreamState["CHAT_STREAM_STATE_UNSPECIFIED"] = 0] = "CHAT_STREAM_STATE_UNSPECIFIED";
135
+ ChatStreamState[ChatStreamState["CHAT_STREAM_STATE_STREAMING"] = 1] = "CHAT_STREAM_STATE_STREAMING";
136
+ ChatStreamState[ChatStreamState["CHAT_STREAM_STATE_COMPLETE"] = 2] = "CHAT_STREAM_STATE_COMPLETE";
137
+ ChatStreamState[ChatStreamState["CHAT_STREAM_STATE_ERROR"] = 3] = "CHAT_STREAM_STATE_ERROR";
138
+ ChatStreamState[ChatStreamState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
139
+ })(ChatStreamState || (exports.ChatStreamState = ChatStreamState = {}));
140
+ function chatStreamStateFromJSON(object) {
141
+ switch (object) {
142
+ case 0:
143
+ case "CHAT_STREAM_STATE_UNSPECIFIED":
144
+ return ChatStreamState.CHAT_STREAM_STATE_UNSPECIFIED;
145
+ case 1:
146
+ case "CHAT_STREAM_STATE_STREAMING":
147
+ return ChatStreamState.CHAT_STREAM_STATE_STREAMING;
148
+ case 2:
149
+ case "CHAT_STREAM_STATE_COMPLETE":
150
+ return ChatStreamState.CHAT_STREAM_STATE_COMPLETE;
151
+ case 3:
152
+ case "CHAT_STREAM_STATE_ERROR":
153
+ return ChatStreamState.CHAT_STREAM_STATE_ERROR;
154
+ case -1:
155
+ case "UNRECOGNIZED":
156
+ default:
157
+ return ChatStreamState.UNRECOGNIZED;
158
+ }
159
+ }
160
+ function chatStreamStateToJSON(object) {
161
+ switch (object) {
162
+ case ChatStreamState.CHAT_STREAM_STATE_UNSPECIFIED:
163
+ return "CHAT_STREAM_STATE_UNSPECIFIED";
164
+ case ChatStreamState.CHAT_STREAM_STATE_STREAMING:
165
+ return "CHAT_STREAM_STATE_STREAMING";
166
+ case ChatStreamState.CHAT_STREAM_STATE_COMPLETE:
167
+ return "CHAT_STREAM_STATE_COMPLETE";
168
+ case ChatStreamState.CHAT_STREAM_STATE_ERROR:
169
+ return "CHAT_STREAM_STATE_ERROR";
170
+ case ChatStreamState.UNRECOGNIZED:
171
+ default:
172
+ return "UNRECOGNIZED";
173
+ }
174
+ }
175
+ var ChatArtifactKind;
176
+ (function (ChatArtifactKind) {
177
+ ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_UNSPECIFIED"] = 0] = "CHAT_ARTIFACT_KIND_UNSPECIFIED";
178
+ ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_MARKDOWN"] = 1] = "CHAT_ARTIFACT_KIND_MARKDOWN";
179
+ ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_HTML"] = 2] = "CHAT_ARTIFACT_KIND_HTML";
180
+ ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_PLAINTEXT"] = 3] = "CHAT_ARTIFACT_KIND_PLAINTEXT";
181
+ ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_CODE"] = 4] = "CHAT_ARTIFACT_KIND_CODE";
182
+ ChatArtifactKind[ChatArtifactKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
183
+ })(ChatArtifactKind || (exports.ChatArtifactKind = ChatArtifactKind = {}));
184
+ function chatArtifactKindFromJSON(object) {
185
+ switch (object) {
186
+ case 0:
187
+ case "CHAT_ARTIFACT_KIND_UNSPECIFIED":
188
+ return ChatArtifactKind.CHAT_ARTIFACT_KIND_UNSPECIFIED;
189
+ case 1:
190
+ case "CHAT_ARTIFACT_KIND_MARKDOWN":
191
+ return ChatArtifactKind.CHAT_ARTIFACT_KIND_MARKDOWN;
192
+ case 2:
193
+ case "CHAT_ARTIFACT_KIND_HTML":
194
+ return ChatArtifactKind.CHAT_ARTIFACT_KIND_HTML;
195
+ case 3:
196
+ case "CHAT_ARTIFACT_KIND_PLAINTEXT":
197
+ return ChatArtifactKind.CHAT_ARTIFACT_KIND_PLAINTEXT;
198
+ case 4:
199
+ case "CHAT_ARTIFACT_KIND_CODE":
200
+ return ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE;
201
+ case -1:
202
+ case "UNRECOGNIZED":
203
+ default:
204
+ return ChatArtifactKind.UNRECOGNIZED;
205
+ }
206
+ }
207
+ function chatArtifactKindToJSON(object) {
208
+ switch (object) {
209
+ case ChatArtifactKind.CHAT_ARTIFACT_KIND_UNSPECIFIED:
210
+ return "CHAT_ARTIFACT_KIND_UNSPECIFIED";
211
+ case ChatArtifactKind.CHAT_ARTIFACT_KIND_MARKDOWN:
212
+ return "CHAT_ARTIFACT_KIND_MARKDOWN";
213
+ case ChatArtifactKind.CHAT_ARTIFACT_KIND_HTML:
214
+ return "CHAT_ARTIFACT_KIND_HTML";
215
+ case ChatArtifactKind.CHAT_ARTIFACT_KIND_PLAINTEXT:
216
+ return "CHAT_ARTIFACT_KIND_PLAINTEXT";
217
+ case ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE:
218
+ return "CHAT_ARTIFACT_KIND_CODE";
219
+ case ChatArtifactKind.UNRECOGNIZED:
220
+ default:
221
+ return "UNRECOGNIZED";
222
+ }
223
+ }
224
+ function createBaseChatSession() {
225
+ return {
226
+ id: "",
227
+ organizationId: "",
228
+ createdByUserId: "",
229
+ title: "",
230
+ modelId: "",
231
+ providerConfigurationId: "",
232
+ createdAt: undefined,
233
+ updatedAt: undefined,
234
+ lastMessageAt: undefined,
235
+ attachedProjectIds: [],
236
+ };
237
+ }
238
+ exports.ChatSession = {
239
+ encode(message, writer = new wire_1.BinaryWriter()) {
240
+ if (message.id !== "") {
241
+ writer.uint32(10).string(message.id);
242
+ }
243
+ if (message.organizationId !== "") {
244
+ writer.uint32(18).string(message.organizationId);
245
+ }
246
+ if (message.createdByUserId !== "") {
247
+ writer.uint32(26).string(message.createdByUserId);
248
+ }
249
+ if (message.title !== "") {
250
+ writer.uint32(34).string(message.title);
251
+ }
252
+ if (message.modelId !== "") {
253
+ writer.uint32(42).string(message.modelId);
254
+ }
255
+ if (message.providerConfigurationId !== "") {
256
+ writer.uint32(50).string(message.providerConfigurationId);
257
+ }
258
+ if (message.createdAt !== undefined) {
259
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
260
+ }
261
+ if (message.updatedAt !== undefined) {
262
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
263
+ }
264
+ if (message.lastMessageAt !== undefined) {
265
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.lastMessageAt), writer.uint32(74).fork()).join();
266
+ }
267
+ for (const v of message.attachedProjectIds) {
268
+ writer.uint32(82).string(v);
269
+ }
270
+ return writer;
271
+ },
272
+ decode(input, length) {
273
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
274
+ const end = length === undefined ? reader.len : reader.pos + length;
275
+ const message = createBaseChatSession();
276
+ while (reader.pos < end) {
277
+ const tag = reader.uint32();
278
+ switch (tag >>> 3) {
279
+ case 1: {
280
+ if (tag !== 10) {
281
+ break;
282
+ }
283
+ message.id = reader.string();
284
+ continue;
285
+ }
286
+ case 2: {
287
+ if (tag !== 18) {
288
+ break;
289
+ }
290
+ message.organizationId = reader.string();
291
+ continue;
292
+ }
293
+ case 3: {
294
+ if (tag !== 26) {
295
+ break;
296
+ }
297
+ message.createdByUserId = reader.string();
298
+ continue;
299
+ }
300
+ case 4: {
301
+ if (tag !== 34) {
302
+ break;
303
+ }
304
+ message.title = reader.string();
305
+ continue;
306
+ }
307
+ case 5: {
308
+ if (tag !== 42) {
309
+ break;
310
+ }
311
+ message.modelId = reader.string();
312
+ continue;
313
+ }
314
+ case 6: {
315
+ if (tag !== 50) {
316
+ break;
317
+ }
318
+ message.providerConfigurationId = reader.string();
319
+ continue;
320
+ }
321
+ case 7: {
322
+ if (tag !== 58) {
323
+ break;
324
+ }
325
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
326
+ continue;
327
+ }
328
+ case 8: {
329
+ if (tag !== 66) {
330
+ break;
331
+ }
332
+ message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
333
+ continue;
334
+ }
335
+ case 9: {
336
+ if (tag !== 74) {
337
+ break;
338
+ }
339
+ message.lastMessageAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
340
+ continue;
341
+ }
342
+ case 10: {
343
+ if (tag !== 82) {
344
+ break;
345
+ }
346
+ message.attachedProjectIds.push(reader.string());
347
+ continue;
348
+ }
349
+ }
350
+ if ((tag & 7) === 4 || tag === 0) {
351
+ break;
352
+ }
353
+ reader.skip(tag & 7);
354
+ }
355
+ return message;
356
+ },
357
+ fromJSON(object) {
358
+ return {
359
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
360
+ organizationId: isSet(object.organizationId)
361
+ ? globalThis.String(object.organizationId)
362
+ : isSet(object.organization_id)
363
+ ? globalThis.String(object.organization_id)
364
+ : "",
365
+ createdByUserId: isSet(object.createdByUserId)
366
+ ? globalThis.String(object.createdByUserId)
367
+ : isSet(object.created_by_user_id)
368
+ ? globalThis.String(object.created_by_user_id)
369
+ : "",
370
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
371
+ modelId: isSet(object.modelId)
372
+ ? globalThis.String(object.modelId)
373
+ : isSet(object.model_id)
374
+ ? globalThis.String(object.model_id)
375
+ : "",
376
+ providerConfigurationId: isSet(object.providerConfigurationId)
377
+ ? globalThis.String(object.providerConfigurationId)
378
+ : isSet(object.provider_configuration_id)
379
+ ? globalThis.String(object.provider_configuration_id)
380
+ : "",
381
+ createdAt: isSet(object.createdAt)
382
+ ? fromJsonTimestamp(object.createdAt)
383
+ : isSet(object.created_at)
384
+ ? fromJsonTimestamp(object.created_at)
385
+ : undefined,
386
+ updatedAt: isSet(object.updatedAt)
387
+ ? fromJsonTimestamp(object.updatedAt)
388
+ : isSet(object.updated_at)
389
+ ? fromJsonTimestamp(object.updated_at)
390
+ : undefined,
391
+ lastMessageAt: isSet(object.lastMessageAt)
392
+ ? fromJsonTimestamp(object.lastMessageAt)
393
+ : isSet(object.last_message_at)
394
+ ? fromJsonTimestamp(object.last_message_at)
395
+ : undefined,
396
+ attachedProjectIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.attachedProjectIds)
397
+ ? object.attachedProjectIds.map((e) => globalThis.String(e))
398
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.attached_project_ids)
399
+ ? object.attached_project_ids.map((e) => globalThis.String(e))
400
+ : [],
401
+ };
402
+ },
403
+ toJSON(message) {
404
+ var _a;
405
+ const obj = {};
406
+ if (message.id !== "") {
407
+ obj.id = message.id;
408
+ }
409
+ if (message.organizationId !== "") {
410
+ obj.organizationId = message.organizationId;
411
+ }
412
+ if (message.createdByUserId !== "") {
413
+ obj.createdByUserId = message.createdByUserId;
414
+ }
415
+ if (message.title !== "") {
416
+ obj.title = message.title;
417
+ }
418
+ if (message.modelId !== "") {
419
+ obj.modelId = message.modelId;
420
+ }
421
+ if (message.providerConfigurationId !== "") {
422
+ obj.providerConfigurationId = message.providerConfigurationId;
423
+ }
424
+ if (message.createdAt !== undefined) {
425
+ obj.createdAt = message.createdAt.toISOString();
426
+ }
427
+ if (message.updatedAt !== undefined) {
428
+ obj.updatedAt = message.updatedAt.toISOString();
429
+ }
430
+ if (message.lastMessageAt !== undefined) {
431
+ obj.lastMessageAt = message.lastMessageAt.toISOString();
432
+ }
433
+ if ((_a = message.attachedProjectIds) === null || _a === void 0 ? void 0 : _a.length) {
434
+ obj.attachedProjectIds = message.attachedProjectIds;
435
+ }
436
+ return obj;
437
+ },
438
+ create(base) {
439
+ return exports.ChatSession.fromPartial(base !== null && base !== void 0 ? base : {});
440
+ },
441
+ fromPartial(object) {
442
+ var _a;
443
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
444
+ const message = createBaseChatSession();
445
+ message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
446
+ message.organizationId = (_c = object.organizationId) !== null && _c !== void 0 ? _c : "";
447
+ message.createdByUserId = (_d = object.createdByUserId) !== null && _d !== void 0 ? _d : "";
448
+ message.title = (_e = object.title) !== null && _e !== void 0 ? _e : "";
449
+ message.modelId = (_f = object.modelId) !== null && _f !== void 0 ? _f : "";
450
+ message.providerConfigurationId = (_g = object.providerConfigurationId) !== null && _g !== void 0 ? _g : "";
451
+ message.createdAt = (_h = object.createdAt) !== null && _h !== void 0 ? _h : undefined;
452
+ message.updatedAt = (_j = object.updatedAt) !== null && _j !== void 0 ? _j : undefined;
453
+ message.lastMessageAt = (_k = object.lastMessageAt) !== null && _k !== void 0 ? _k : undefined;
454
+ message.attachedProjectIds = ((_a = object.attachedProjectIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
455
+ return message;
456
+ },
457
+ };
458
+ function createBaseChatMessage() {
459
+ return {
460
+ id: "",
461
+ sessionId: "",
462
+ role: 0,
463
+ content: "",
464
+ parentMessageId: "",
465
+ toolCallId: "",
466
+ toolCallState: 0,
467
+ modelId: "",
468
+ ephemeralAttachmentCount: 0,
469
+ ephemeralAttachmentMimeTypes: [],
470
+ tokenUsage: undefined,
471
+ streamState: 0,
472
+ createdAt: undefined,
473
+ completedAt: undefined,
474
+ };
475
+ }
476
+ exports.ChatMessage = {
477
+ encode(message, writer = new wire_1.BinaryWriter()) {
478
+ if (message.id !== "") {
479
+ writer.uint32(10).string(message.id);
480
+ }
481
+ if (message.sessionId !== "") {
482
+ writer.uint32(18).string(message.sessionId);
483
+ }
484
+ if (message.role !== 0) {
485
+ writer.uint32(24).int32(message.role);
486
+ }
487
+ if (message.content !== "") {
488
+ writer.uint32(34).string(message.content);
489
+ }
490
+ if (message.parentMessageId !== "") {
491
+ writer.uint32(42).string(message.parentMessageId);
492
+ }
493
+ if (message.toolCallId !== "") {
494
+ writer.uint32(50).string(message.toolCallId);
495
+ }
496
+ if (message.toolCallState !== 0) {
497
+ writer.uint32(56).int32(message.toolCallState);
498
+ }
499
+ if (message.modelId !== "") {
500
+ writer.uint32(66).string(message.modelId);
501
+ }
502
+ if (message.ephemeralAttachmentCount !== 0) {
503
+ writer.uint32(72).int32(message.ephemeralAttachmentCount);
504
+ }
505
+ for (const v of message.ephemeralAttachmentMimeTypes) {
506
+ writer.uint32(82).string(v);
507
+ }
508
+ if (message.tokenUsage !== undefined) {
509
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.tokenUsage), writer.uint32(90).fork()).join();
510
+ }
511
+ if (message.streamState !== 0) {
512
+ writer.uint32(96).int32(message.streamState);
513
+ }
514
+ if (message.createdAt !== undefined) {
515
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(106).fork()).join();
516
+ }
517
+ if (message.completedAt !== undefined) {
518
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.completedAt), writer.uint32(114).fork()).join();
519
+ }
520
+ return writer;
521
+ },
522
+ decode(input, length) {
523
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
524
+ const end = length === undefined ? reader.len : reader.pos + length;
525
+ const message = createBaseChatMessage();
526
+ while (reader.pos < end) {
527
+ const tag = reader.uint32();
528
+ switch (tag >>> 3) {
529
+ case 1: {
530
+ if (tag !== 10) {
531
+ break;
532
+ }
533
+ message.id = reader.string();
534
+ continue;
535
+ }
536
+ case 2: {
537
+ if (tag !== 18) {
538
+ break;
539
+ }
540
+ message.sessionId = reader.string();
541
+ continue;
542
+ }
543
+ case 3: {
544
+ if (tag !== 24) {
545
+ break;
546
+ }
547
+ message.role = reader.int32();
548
+ continue;
549
+ }
550
+ case 4: {
551
+ if (tag !== 34) {
552
+ break;
553
+ }
554
+ message.content = reader.string();
555
+ continue;
556
+ }
557
+ case 5: {
558
+ if (tag !== 42) {
559
+ break;
560
+ }
561
+ message.parentMessageId = reader.string();
562
+ continue;
563
+ }
564
+ case 6: {
565
+ if (tag !== 50) {
566
+ break;
567
+ }
568
+ message.toolCallId = reader.string();
569
+ continue;
570
+ }
571
+ case 7: {
572
+ if (tag !== 56) {
573
+ break;
574
+ }
575
+ message.toolCallState = reader.int32();
576
+ continue;
577
+ }
578
+ case 8: {
579
+ if (tag !== 66) {
580
+ break;
581
+ }
582
+ message.modelId = reader.string();
583
+ continue;
584
+ }
585
+ case 9: {
586
+ if (tag !== 72) {
587
+ break;
588
+ }
589
+ message.ephemeralAttachmentCount = reader.int32();
590
+ continue;
591
+ }
592
+ case 10: {
593
+ if (tag !== 82) {
594
+ break;
595
+ }
596
+ message.ephemeralAttachmentMimeTypes.push(reader.string());
597
+ continue;
598
+ }
599
+ case 11: {
600
+ if (tag !== 90) {
601
+ break;
602
+ }
603
+ message.tokenUsage = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
604
+ continue;
605
+ }
606
+ case 12: {
607
+ if (tag !== 96) {
608
+ break;
609
+ }
610
+ message.streamState = reader.int32();
611
+ continue;
612
+ }
613
+ case 13: {
614
+ if (tag !== 106) {
615
+ break;
616
+ }
617
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
618
+ continue;
619
+ }
620
+ case 14: {
621
+ if (tag !== 114) {
622
+ break;
623
+ }
624
+ message.completedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
625
+ continue;
626
+ }
627
+ }
628
+ if ((tag & 7) === 4 || tag === 0) {
629
+ break;
630
+ }
631
+ reader.skip(tag & 7);
632
+ }
633
+ return message;
634
+ },
635
+ fromJSON(object) {
636
+ return {
637
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
638
+ sessionId: isSet(object.sessionId)
639
+ ? globalThis.String(object.sessionId)
640
+ : isSet(object.session_id)
641
+ ? globalThis.String(object.session_id)
642
+ : "",
643
+ role: isSet(object.role) ? chatMessageRoleFromJSON(object.role) : 0,
644
+ content: isSet(object.content) ? globalThis.String(object.content) : "",
645
+ parentMessageId: isSet(object.parentMessageId)
646
+ ? globalThis.String(object.parentMessageId)
647
+ : isSet(object.parent_message_id)
648
+ ? globalThis.String(object.parent_message_id)
649
+ : "",
650
+ toolCallId: isSet(object.toolCallId)
651
+ ? globalThis.String(object.toolCallId)
652
+ : isSet(object.tool_call_id)
653
+ ? globalThis.String(object.tool_call_id)
654
+ : "",
655
+ toolCallState: isSet(object.toolCallState)
656
+ ? chatToolCallStateFromJSON(object.toolCallState)
657
+ : isSet(object.tool_call_state)
658
+ ? chatToolCallStateFromJSON(object.tool_call_state)
659
+ : 0,
660
+ modelId: isSet(object.modelId)
661
+ ? globalThis.String(object.modelId)
662
+ : isSet(object.model_id)
663
+ ? globalThis.String(object.model_id)
664
+ : "",
665
+ ephemeralAttachmentCount: isSet(object.ephemeralAttachmentCount)
666
+ ? globalThis.Number(object.ephemeralAttachmentCount)
667
+ : isSet(object.ephemeral_attachment_count)
668
+ ? globalThis.Number(object.ephemeral_attachment_count)
669
+ : 0,
670
+ ephemeralAttachmentMimeTypes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.ephemeralAttachmentMimeTypes)
671
+ ? object.ephemeralAttachmentMimeTypes.map((e) => globalThis.String(e))
672
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.ephemeral_attachment_mime_types)
673
+ ? object.ephemeral_attachment_mime_types.map((e) => globalThis.String(e))
674
+ : [],
675
+ tokenUsage: isObject(object.tokenUsage)
676
+ ? object.tokenUsage
677
+ : isObject(object.token_usage)
678
+ ? object.token_usage
679
+ : undefined,
680
+ streamState: isSet(object.streamState)
681
+ ? chatStreamStateFromJSON(object.streamState)
682
+ : isSet(object.stream_state)
683
+ ? chatStreamStateFromJSON(object.stream_state)
684
+ : 0,
685
+ createdAt: isSet(object.createdAt)
686
+ ? fromJsonTimestamp(object.createdAt)
687
+ : isSet(object.created_at)
688
+ ? fromJsonTimestamp(object.created_at)
689
+ : undefined,
690
+ completedAt: isSet(object.completedAt)
691
+ ? fromJsonTimestamp(object.completedAt)
692
+ : isSet(object.completed_at)
693
+ ? fromJsonTimestamp(object.completed_at)
694
+ : undefined,
695
+ };
696
+ },
697
+ toJSON(message) {
698
+ var _a;
699
+ const obj = {};
700
+ if (message.id !== "") {
701
+ obj.id = message.id;
702
+ }
703
+ if (message.sessionId !== "") {
704
+ obj.sessionId = message.sessionId;
705
+ }
706
+ if (message.role !== 0) {
707
+ obj.role = chatMessageRoleToJSON(message.role);
708
+ }
709
+ if (message.content !== "") {
710
+ obj.content = message.content;
711
+ }
712
+ if (message.parentMessageId !== "") {
713
+ obj.parentMessageId = message.parentMessageId;
714
+ }
715
+ if (message.toolCallId !== "") {
716
+ obj.toolCallId = message.toolCallId;
717
+ }
718
+ if (message.toolCallState !== 0) {
719
+ obj.toolCallState = chatToolCallStateToJSON(message.toolCallState);
720
+ }
721
+ if (message.modelId !== "") {
722
+ obj.modelId = message.modelId;
723
+ }
724
+ if (message.ephemeralAttachmentCount !== 0) {
725
+ obj.ephemeralAttachmentCount = Math.round(message.ephemeralAttachmentCount);
726
+ }
727
+ if ((_a = message.ephemeralAttachmentMimeTypes) === null || _a === void 0 ? void 0 : _a.length) {
728
+ obj.ephemeralAttachmentMimeTypes = message.ephemeralAttachmentMimeTypes;
729
+ }
730
+ if (message.tokenUsage !== undefined) {
731
+ obj.tokenUsage = message.tokenUsage;
732
+ }
733
+ if (message.streamState !== 0) {
734
+ obj.streamState = chatStreamStateToJSON(message.streamState);
735
+ }
736
+ if (message.createdAt !== undefined) {
737
+ obj.createdAt = message.createdAt.toISOString();
738
+ }
739
+ if (message.completedAt !== undefined) {
740
+ obj.completedAt = message.completedAt.toISOString();
741
+ }
742
+ return obj;
743
+ },
744
+ create(base) {
745
+ return exports.ChatMessage.fromPartial(base !== null && base !== void 0 ? base : {});
746
+ },
747
+ fromPartial(object) {
748
+ var _a;
749
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
750
+ const message = createBaseChatMessage();
751
+ message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
752
+ message.sessionId = (_c = object.sessionId) !== null && _c !== void 0 ? _c : "";
753
+ message.role = (_d = object.role) !== null && _d !== void 0 ? _d : 0;
754
+ message.content = (_e = object.content) !== null && _e !== void 0 ? _e : "";
755
+ message.parentMessageId = (_f = object.parentMessageId) !== null && _f !== void 0 ? _f : "";
756
+ message.toolCallId = (_g = object.toolCallId) !== null && _g !== void 0 ? _g : "";
757
+ message.toolCallState = (_h = object.toolCallState) !== null && _h !== void 0 ? _h : 0;
758
+ message.modelId = (_j = object.modelId) !== null && _j !== void 0 ? _j : "";
759
+ message.ephemeralAttachmentCount = (_k = object.ephemeralAttachmentCount) !== null && _k !== void 0 ? _k : 0;
760
+ message.ephemeralAttachmentMimeTypes = ((_a = object.ephemeralAttachmentMimeTypes) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
761
+ message.tokenUsage = (_l = object.tokenUsage) !== null && _l !== void 0 ? _l : undefined;
762
+ message.streamState = (_m = object.streamState) !== null && _m !== void 0 ? _m : 0;
763
+ message.createdAt = (_o = object.createdAt) !== null && _o !== void 0 ? _o : undefined;
764
+ message.completedAt = (_p = object.completedAt) !== null && _p !== void 0 ? _p : undefined;
765
+ return message;
766
+ },
767
+ };
768
+ function createBaseChatArtifact() {
769
+ return {
770
+ id: "",
771
+ sessionId: "",
772
+ title: "",
773
+ kind: 0,
774
+ language: "",
775
+ currentVersion: 0,
776
+ createdAt: undefined,
777
+ updatedAt: undefined,
778
+ };
779
+ }
780
+ exports.ChatArtifact = {
781
+ encode(message, writer = new wire_1.BinaryWriter()) {
782
+ if (message.id !== "") {
783
+ writer.uint32(10).string(message.id);
784
+ }
785
+ if (message.sessionId !== "") {
786
+ writer.uint32(18).string(message.sessionId);
787
+ }
788
+ if (message.title !== "") {
789
+ writer.uint32(26).string(message.title);
790
+ }
791
+ if (message.kind !== 0) {
792
+ writer.uint32(32).int32(message.kind);
793
+ }
794
+ if (message.language !== "") {
795
+ writer.uint32(42).string(message.language);
796
+ }
797
+ if (message.currentVersion !== 0) {
798
+ writer.uint32(48).int32(message.currentVersion);
799
+ }
800
+ if (message.createdAt !== undefined) {
801
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
802
+ }
803
+ if (message.updatedAt !== undefined) {
804
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
805
+ }
806
+ return writer;
807
+ },
808
+ decode(input, length) {
809
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
810
+ const end = length === undefined ? reader.len : reader.pos + length;
811
+ const message = createBaseChatArtifact();
812
+ while (reader.pos < end) {
813
+ const tag = reader.uint32();
814
+ switch (tag >>> 3) {
815
+ case 1: {
816
+ if (tag !== 10) {
817
+ break;
818
+ }
819
+ message.id = reader.string();
820
+ continue;
821
+ }
822
+ case 2: {
823
+ if (tag !== 18) {
824
+ break;
825
+ }
826
+ message.sessionId = reader.string();
827
+ continue;
828
+ }
829
+ case 3: {
830
+ if (tag !== 26) {
831
+ break;
832
+ }
833
+ message.title = reader.string();
834
+ continue;
835
+ }
836
+ case 4: {
837
+ if (tag !== 32) {
838
+ break;
839
+ }
840
+ message.kind = reader.int32();
841
+ continue;
842
+ }
843
+ case 5: {
844
+ if (tag !== 42) {
845
+ break;
846
+ }
847
+ message.language = reader.string();
848
+ continue;
849
+ }
850
+ case 6: {
851
+ if (tag !== 48) {
852
+ break;
853
+ }
854
+ message.currentVersion = reader.int32();
855
+ continue;
856
+ }
857
+ case 7: {
858
+ if (tag !== 58) {
859
+ break;
860
+ }
861
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
862
+ continue;
863
+ }
864
+ case 8: {
865
+ if (tag !== 66) {
866
+ break;
867
+ }
868
+ message.updatedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
869
+ continue;
870
+ }
871
+ }
872
+ if ((tag & 7) === 4 || tag === 0) {
873
+ break;
874
+ }
875
+ reader.skip(tag & 7);
876
+ }
877
+ return message;
878
+ },
879
+ fromJSON(object) {
880
+ return {
881
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
882
+ sessionId: isSet(object.sessionId)
883
+ ? globalThis.String(object.sessionId)
884
+ : isSet(object.session_id)
885
+ ? globalThis.String(object.session_id)
886
+ : "",
887
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
888
+ kind: isSet(object.kind) ? chatArtifactKindFromJSON(object.kind) : 0,
889
+ language: isSet(object.language) ? globalThis.String(object.language) : "",
890
+ currentVersion: isSet(object.currentVersion)
891
+ ? globalThis.Number(object.currentVersion)
892
+ : isSet(object.current_version)
893
+ ? globalThis.Number(object.current_version)
894
+ : 0,
895
+ createdAt: isSet(object.createdAt)
896
+ ? fromJsonTimestamp(object.createdAt)
897
+ : isSet(object.created_at)
898
+ ? fromJsonTimestamp(object.created_at)
899
+ : undefined,
900
+ updatedAt: isSet(object.updatedAt)
901
+ ? fromJsonTimestamp(object.updatedAt)
902
+ : isSet(object.updated_at)
903
+ ? fromJsonTimestamp(object.updated_at)
904
+ : undefined,
905
+ };
906
+ },
907
+ toJSON(message) {
908
+ const obj = {};
909
+ if (message.id !== "") {
910
+ obj.id = message.id;
911
+ }
912
+ if (message.sessionId !== "") {
913
+ obj.sessionId = message.sessionId;
914
+ }
915
+ if (message.title !== "") {
916
+ obj.title = message.title;
917
+ }
918
+ if (message.kind !== 0) {
919
+ obj.kind = chatArtifactKindToJSON(message.kind);
920
+ }
921
+ if (message.language !== "") {
922
+ obj.language = message.language;
923
+ }
924
+ if (message.currentVersion !== 0) {
925
+ obj.currentVersion = Math.round(message.currentVersion);
926
+ }
927
+ if (message.createdAt !== undefined) {
928
+ obj.createdAt = message.createdAt.toISOString();
929
+ }
930
+ if (message.updatedAt !== undefined) {
931
+ obj.updatedAt = message.updatedAt.toISOString();
932
+ }
933
+ return obj;
934
+ },
935
+ create(base) {
936
+ return exports.ChatArtifact.fromPartial(base !== null && base !== void 0 ? base : {});
937
+ },
938
+ fromPartial(object) {
939
+ var _a, _b, _c, _d, _e, _f, _g, _h;
940
+ const message = createBaseChatArtifact();
941
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
942
+ message.sessionId = (_b = object.sessionId) !== null && _b !== void 0 ? _b : "";
943
+ message.title = (_c = object.title) !== null && _c !== void 0 ? _c : "";
944
+ message.kind = (_d = object.kind) !== null && _d !== void 0 ? _d : 0;
945
+ message.language = (_e = object.language) !== null && _e !== void 0 ? _e : "";
946
+ message.currentVersion = (_f = object.currentVersion) !== null && _f !== void 0 ? _f : 0;
947
+ message.createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
948
+ message.updatedAt = (_h = object.updatedAt) !== null && _h !== void 0 ? _h : undefined;
949
+ return message;
950
+ },
951
+ };
952
+ function createBaseChatArtifactVersion() {
953
+ return { id: "", artifactId: "", version: 0, content: "", createdByMessageId: "", createdAt: undefined };
954
+ }
955
+ exports.ChatArtifactVersion = {
956
+ encode(message, writer = new wire_1.BinaryWriter()) {
957
+ if (message.id !== "") {
958
+ writer.uint32(10).string(message.id);
959
+ }
960
+ if (message.artifactId !== "") {
961
+ writer.uint32(18).string(message.artifactId);
962
+ }
963
+ if (message.version !== 0) {
964
+ writer.uint32(24).int32(message.version);
965
+ }
966
+ if (message.content !== "") {
967
+ writer.uint32(34).string(message.content);
968
+ }
969
+ if (message.createdByMessageId !== "") {
970
+ writer.uint32(42).string(message.createdByMessageId);
971
+ }
972
+ if (message.createdAt !== undefined) {
973
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join();
974
+ }
975
+ return writer;
976
+ },
977
+ decode(input, length) {
978
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
979
+ const end = length === undefined ? reader.len : reader.pos + length;
980
+ const message = createBaseChatArtifactVersion();
981
+ while (reader.pos < end) {
982
+ const tag = reader.uint32();
983
+ switch (tag >>> 3) {
984
+ case 1: {
985
+ if (tag !== 10) {
986
+ break;
987
+ }
988
+ message.id = reader.string();
989
+ continue;
990
+ }
991
+ case 2: {
992
+ if (tag !== 18) {
993
+ break;
994
+ }
995
+ message.artifactId = reader.string();
996
+ continue;
997
+ }
998
+ case 3: {
999
+ if (tag !== 24) {
1000
+ break;
1001
+ }
1002
+ message.version = reader.int32();
1003
+ continue;
1004
+ }
1005
+ case 4: {
1006
+ if (tag !== 34) {
1007
+ break;
1008
+ }
1009
+ message.content = reader.string();
1010
+ continue;
1011
+ }
1012
+ case 5: {
1013
+ if (tag !== 42) {
1014
+ break;
1015
+ }
1016
+ message.createdByMessageId = reader.string();
1017
+ continue;
1018
+ }
1019
+ case 6: {
1020
+ if (tag !== 50) {
1021
+ break;
1022
+ }
1023
+ message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1024
+ continue;
1025
+ }
1026
+ }
1027
+ if ((tag & 7) === 4 || tag === 0) {
1028
+ break;
1029
+ }
1030
+ reader.skip(tag & 7);
1031
+ }
1032
+ return message;
1033
+ },
1034
+ fromJSON(object) {
1035
+ return {
1036
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
1037
+ artifactId: isSet(object.artifactId)
1038
+ ? globalThis.String(object.artifactId)
1039
+ : isSet(object.artifact_id)
1040
+ ? globalThis.String(object.artifact_id)
1041
+ : "",
1042
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
1043
+ content: isSet(object.content) ? globalThis.String(object.content) : "",
1044
+ createdByMessageId: isSet(object.createdByMessageId)
1045
+ ? globalThis.String(object.createdByMessageId)
1046
+ : isSet(object.created_by_message_id)
1047
+ ? globalThis.String(object.created_by_message_id)
1048
+ : "",
1049
+ createdAt: isSet(object.createdAt)
1050
+ ? fromJsonTimestamp(object.createdAt)
1051
+ : isSet(object.created_at)
1052
+ ? fromJsonTimestamp(object.created_at)
1053
+ : undefined,
1054
+ };
1055
+ },
1056
+ toJSON(message) {
1057
+ const obj = {};
1058
+ if (message.id !== "") {
1059
+ obj.id = message.id;
1060
+ }
1061
+ if (message.artifactId !== "") {
1062
+ obj.artifactId = message.artifactId;
1063
+ }
1064
+ if (message.version !== 0) {
1065
+ obj.version = Math.round(message.version);
1066
+ }
1067
+ if (message.content !== "") {
1068
+ obj.content = message.content;
1069
+ }
1070
+ if (message.createdByMessageId !== "") {
1071
+ obj.createdByMessageId = message.createdByMessageId;
1072
+ }
1073
+ if (message.createdAt !== undefined) {
1074
+ obj.createdAt = message.createdAt.toISOString();
1075
+ }
1076
+ return obj;
1077
+ },
1078
+ create(base) {
1079
+ return exports.ChatArtifactVersion.fromPartial(base !== null && base !== void 0 ? base : {});
1080
+ },
1081
+ fromPartial(object) {
1082
+ var _a, _b, _c, _d, _e, _f;
1083
+ const message = createBaseChatArtifactVersion();
1084
+ message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
1085
+ message.artifactId = (_b = object.artifactId) !== null && _b !== void 0 ? _b : "";
1086
+ message.version = (_c = object.version) !== null && _c !== void 0 ? _c : 0;
1087
+ message.content = (_d = object.content) !== null && _d !== void 0 ? _d : "";
1088
+ message.createdByMessageId = (_e = object.createdByMessageId) !== null && _e !== void 0 ? _e : "";
1089
+ message.createdAt = (_f = object.createdAt) !== null && _f !== void 0 ? _f : undefined;
1090
+ return message;
1091
+ },
1092
+ };
1093
+ function createBaseChatEphemeralAttachment() {
1094
+ return { mimeType: "", data: new Uint8Array(0) };
1095
+ }
1096
+ exports.ChatEphemeralAttachment = {
1097
+ encode(message, writer = new wire_1.BinaryWriter()) {
1098
+ if (message.mimeType !== "") {
1099
+ writer.uint32(10).string(message.mimeType);
1100
+ }
1101
+ if (message.data.length !== 0) {
1102
+ writer.uint32(18).bytes(message.data);
1103
+ }
1104
+ return writer;
1105
+ },
1106
+ decode(input, length) {
1107
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1108
+ const end = length === undefined ? reader.len : reader.pos + length;
1109
+ const message = createBaseChatEphemeralAttachment();
1110
+ while (reader.pos < end) {
1111
+ const tag = reader.uint32();
1112
+ switch (tag >>> 3) {
1113
+ case 1: {
1114
+ if (tag !== 10) {
1115
+ break;
1116
+ }
1117
+ message.mimeType = reader.string();
1118
+ continue;
1119
+ }
1120
+ case 2: {
1121
+ if (tag !== 18) {
1122
+ break;
1123
+ }
1124
+ message.data = reader.bytes();
1125
+ continue;
1126
+ }
1127
+ }
1128
+ if ((tag & 7) === 4 || tag === 0) {
1129
+ break;
1130
+ }
1131
+ reader.skip(tag & 7);
1132
+ }
1133
+ return message;
1134
+ },
1135
+ fromJSON(object) {
1136
+ return {
1137
+ mimeType: isSet(object.mimeType)
1138
+ ? globalThis.String(object.mimeType)
1139
+ : isSet(object.mime_type)
1140
+ ? globalThis.String(object.mime_type)
1141
+ : "",
1142
+ data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
1143
+ };
1144
+ },
1145
+ toJSON(message) {
1146
+ const obj = {};
1147
+ if (message.mimeType !== "") {
1148
+ obj.mimeType = message.mimeType;
1149
+ }
1150
+ if (message.data.length !== 0) {
1151
+ obj.data = base64FromBytes(message.data);
1152
+ }
1153
+ return obj;
1154
+ },
1155
+ create(base) {
1156
+ return exports.ChatEphemeralAttachment.fromPartial(base !== null && base !== void 0 ? base : {});
1157
+ },
1158
+ fromPartial(object) {
1159
+ var _a, _b;
1160
+ const message = createBaseChatEphemeralAttachment();
1161
+ message.mimeType = (_a = object.mimeType) !== null && _a !== void 0 ? _a : "";
1162
+ message.data = (_b = object.data) !== null && _b !== void 0 ? _b : new Uint8Array(0);
1163
+ return message;
1164
+ },
1165
+ };
1166
+ function createBaseChatStreamFrame() {
1167
+ return {
1168
+ eventId: "",
1169
+ messageStarted: undefined,
1170
+ messageDelta: undefined,
1171
+ toolCallProposed: undefined,
1172
+ toolCallExecuting: undefined,
1173
+ toolCallResult: undefined,
1174
+ toolCallRejected: undefined,
1175
+ artifactCreated: undefined,
1176
+ artifactUpdated: undefined,
1177
+ messageComplete: undefined,
1178
+ messageError: undefined,
1179
+ };
1180
+ }
1181
+ exports.ChatStreamFrame = {
1182
+ encode(message, writer = new wire_1.BinaryWriter()) {
1183
+ if (message.eventId !== "") {
1184
+ writer.uint32(90).string(message.eventId);
1185
+ }
1186
+ if (message.messageStarted !== undefined) {
1187
+ exports.ChatStreamFrame_MessageStarted.encode(message.messageStarted, writer.uint32(10).fork()).join();
1188
+ }
1189
+ if (message.messageDelta !== undefined) {
1190
+ exports.ChatStreamFrame_MessageDelta.encode(message.messageDelta, writer.uint32(18).fork()).join();
1191
+ }
1192
+ if (message.toolCallProposed !== undefined) {
1193
+ exports.ChatStreamFrame_ToolCallProposed.encode(message.toolCallProposed, writer.uint32(26).fork()).join();
1194
+ }
1195
+ if (message.toolCallExecuting !== undefined) {
1196
+ exports.ChatStreamFrame_ToolCallExecuting.encode(message.toolCallExecuting, writer.uint32(34).fork()).join();
1197
+ }
1198
+ if (message.toolCallResult !== undefined) {
1199
+ exports.ChatStreamFrame_ToolCallResult.encode(message.toolCallResult, writer.uint32(42).fork()).join();
1200
+ }
1201
+ if (message.toolCallRejected !== undefined) {
1202
+ exports.ChatStreamFrame_ToolCallRejected.encode(message.toolCallRejected, writer.uint32(50).fork()).join();
1203
+ }
1204
+ if (message.artifactCreated !== undefined) {
1205
+ exports.ChatStreamFrame_ArtifactCreated.encode(message.artifactCreated, writer.uint32(58).fork()).join();
1206
+ }
1207
+ if (message.artifactUpdated !== undefined) {
1208
+ exports.ChatStreamFrame_ArtifactUpdated.encode(message.artifactUpdated, writer.uint32(66).fork()).join();
1209
+ }
1210
+ if (message.messageComplete !== undefined) {
1211
+ exports.ChatStreamFrame_MessageComplete.encode(message.messageComplete, writer.uint32(74).fork()).join();
1212
+ }
1213
+ if (message.messageError !== undefined) {
1214
+ exports.ChatStreamFrame_MessageError.encode(message.messageError, writer.uint32(82).fork()).join();
1215
+ }
1216
+ return writer;
1217
+ },
1218
+ decode(input, length) {
1219
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1220
+ const end = length === undefined ? reader.len : reader.pos + length;
1221
+ const message = createBaseChatStreamFrame();
1222
+ while (reader.pos < end) {
1223
+ const tag = reader.uint32();
1224
+ switch (tag >>> 3) {
1225
+ case 11: {
1226
+ if (tag !== 90) {
1227
+ break;
1228
+ }
1229
+ message.eventId = reader.string();
1230
+ continue;
1231
+ }
1232
+ case 1: {
1233
+ if (tag !== 10) {
1234
+ break;
1235
+ }
1236
+ message.messageStarted = exports.ChatStreamFrame_MessageStarted.decode(reader, reader.uint32());
1237
+ continue;
1238
+ }
1239
+ case 2: {
1240
+ if (tag !== 18) {
1241
+ break;
1242
+ }
1243
+ message.messageDelta = exports.ChatStreamFrame_MessageDelta.decode(reader, reader.uint32());
1244
+ continue;
1245
+ }
1246
+ case 3: {
1247
+ if (tag !== 26) {
1248
+ break;
1249
+ }
1250
+ message.toolCallProposed = exports.ChatStreamFrame_ToolCallProposed.decode(reader, reader.uint32());
1251
+ continue;
1252
+ }
1253
+ case 4: {
1254
+ if (tag !== 34) {
1255
+ break;
1256
+ }
1257
+ message.toolCallExecuting = exports.ChatStreamFrame_ToolCallExecuting.decode(reader, reader.uint32());
1258
+ continue;
1259
+ }
1260
+ case 5: {
1261
+ if (tag !== 42) {
1262
+ break;
1263
+ }
1264
+ message.toolCallResult = exports.ChatStreamFrame_ToolCallResult.decode(reader, reader.uint32());
1265
+ continue;
1266
+ }
1267
+ case 6: {
1268
+ if (tag !== 50) {
1269
+ break;
1270
+ }
1271
+ message.toolCallRejected = exports.ChatStreamFrame_ToolCallRejected.decode(reader, reader.uint32());
1272
+ continue;
1273
+ }
1274
+ case 7: {
1275
+ if (tag !== 58) {
1276
+ break;
1277
+ }
1278
+ message.artifactCreated = exports.ChatStreamFrame_ArtifactCreated.decode(reader, reader.uint32());
1279
+ continue;
1280
+ }
1281
+ case 8: {
1282
+ if (tag !== 66) {
1283
+ break;
1284
+ }
1285
+ message.artifactUpdated = exports.ChatStreamFrame_ArtifactUpdated.decode(reader, reader.uint32());
1286
+ continue;
1287
+ }
1288
+ case 9: {
1289
+ if (tag !== 74) {
1290
+ break;
1291
+ }
1292
+ message.messageComplete = exports.ChatStreamFrame_MessageComplete.decode(reader, reader.uint32());
1293
+ continue;
1294
+ }
1295
+ case 10: {
1296
+ if (tag !== 82) {
1297
+ break;
1298
+ }
1299
+ message.messageError = exports.ChatStreamFrame_MessageError.decode(reader, reader.uint32());
1300
+ continue;
1301
+ }
1302
+ }
1303
+ if ((tag & 7) === 4 || tag === 0) {
1304
+ break;
1305
+ }
1306
+ reader.skip(tag & 7);
1307
+ }
1308
+ return message;
1309
+ },
1310
+ fromJSON(object) {
1311
+ return {
1312
+ eventId: isSet(object.eventId)
1313
+ ? globalThis.String(object.eventId)
1314
+ : isSet(object.event_id)
1315
+ ? globalThis.String(object.event_id)
1316
+ : "",
1317
+ messageStarted: isSet(object.messageStarted)
1318
+ ? exports.ChatStreamFrame_MessageStarted.fromJSON(object.messageStarted)
1319
+ : isSet(object.message_started)
1320
+ ? exports.ChatStreamFrame_MessageStarted.fromJSON(object.message_started)
1321
+ : undefined,
1322
+ messageDelta: isSet(object.messageDelta)
1323
+ ? exports.ChatStreamFrame_MessageDelta.fromJSON(object.messageDelta)
1324
+ : isSet(object.message_delta)
1325
+ ? exports.ChatStreamFrame_MessageDelta.fromJSON(object.message_delta)
1326
+ : undefined,
1327
+ toolCallProposed: isSet(object.toolCallProposed)
1328
+ ? exports.ChatStreamFrame_ToolCallProposed.fromJSON(object.toolCallProposed)
1329
+ : isSet(object.tool_call_proposed)
1330
+ ? exports.ChatStreamFrame_ToolCallProposed.fromJSON(object.tool_call_proposed)
1331
+ : undefined,
1332
+ toolCallExecuting: isSet(object.toolCallExecuting)
1333
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromJSON(object.toolCallExecuting)
1334
+ : isSet(object.tool_call_executing)
1335
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromJSON(object.tool_call_executing)
1336
+ : undefined,
1337
+ toolCallResult: isSet(object.toolCallResult)
1338
+ ? exports.ChatStreamFrame_ToolCallResult.fromJSON(object.toolCallResult)
1339
+ : isSet(object.tool_call_result)
1340
+ ? exports.ChatStreamFrame_ToolCallResult.fromJSON(object.tool_call_result)
1341
+ : undefined,
1342
+ toolCallRejected: isSet(object.toolCallRejected)
1343
+ ? exports.ChatStreamFrame_ToolCallRejected.fromJSON(object.toolCallRejected)
1344
+ : isSet(object.tool_call_rejected)
1345
+ ? exports.ChatStreamFrame_ToolCallRejected.fromJSON(object.tool_call_rejected)
1346
+ : undefined,
1347
+ artifactCreated: isSet(object.artifactCreated)
1348
+ ? exports.ChatStreamFrame_ArtifactCreated.fromJSON(object.artifactCreated)
1349
+ : isSet(object.artifact_created)
1350
+ ? exports.ChatStreamFrame_ArtifactCreated.fromJSON(object.artifact_created)
1351
+ : undefined,
1352
+ artifactUpdated: isSet(object.artifactUpdated)
1353
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromJSON(object.artifactUpdated)
1354
+ : isSet(object.artifact_updated)
1355
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromJSON(object.artifact_updated)
1356
+ : undefined,
1357
+ messageComplete: isSet(object.messageComplete)
1358
+ ? exports.ChatStreamFrame_MessageComplete.fromJSON(object.messageComplete)
1359
+ : isSet(object.message_complete)
1360
+ ? exports.ChatStreamFrame_MessageComplete.fromJSON(object.message_complete)
1361
+ : undefined,
1362
+ messageError: isSet(object.messageError)
1363
+ ? exports.ChatStreamFrame_MessageError.fromJSON(object.messageError)
1364
+ : isSet(object.message_error)
1365
+ ? exports.ChatStreamFrame_MessageError.fromJSON(object.message_error)
1366
+ : undefined,
1367
+ };
1368
+ },
1369
+ toJSON(message) {
1370
+ const obj = {};
1371
+ if (message.eventId !== "") {
1372
+ obj.eventId = message.eventId;
1373
+ }
1374
+ if (message.messageStarted !== undefined) {
1375
+ obj.messageStarted = exports.ChatStreamFrame_MessageStarted.toJSON(message.messageStarted);
1376
+ }
1377
+ if (message.messageDelta !== undefined) {
1378
+ obj.messageDelta = exports.ChatStreamFrame_MessageDelta.toJSON(message.messageDelta);
1379
+ }
1380
+ if (message.toolCallProposed !== undefined) {
1381
+ obj.toolCallProposed = exports.ChatStreamFrame_ToolCallProposed.toJSON(message.toolCallProposed);
1382
+ }
1383
+ if (message.toolCallExecuting !== undefined) {
1384
+ obj.toolCallExecuting = exports.ChatStreamFrame_ToolCallExecuting.toJSON(message.toolCallExecuting);
1385
+ }
1386
+ if (message.toolCallResult !== undefined) {
1387
+ obj.toolCallResult = exports.ChatStreamFrame_ToolCallResult.toJSON(message.toolCallResult);
1388
+ }
1389
+ if (message.toolCallRejected !== undefined) {
1390
+ obj.toolCallRejected = exports.ChatStreamFrame_ToolCallRejected.toJSON(message.toolCallRejected);
1391
+ }
1392
+ if (message.artifactCreated !== undefined) {
1393
+ obj.artifactCreated = exports.ChatStreamFrame_ArtifactCreated.toJSON(message.artifactCreated);
1394
+ }
1395
+ if (message.artifactUpdated !== undefined) {
1396
+ obj.artifactUpdated = exports.ChatStreamFrame_ArtifactUpdated.toJSON(message.artifactUpdated);
1397
+ }
1398
+ if (message.messageComplete !== undefined) {
1399
+ obj.messageComplete = exports.ChatStreamFrame_MessageComplete.toJSON(message.messageComplete);
1400
+ }
1401
+ if (message.messageError !== undefined) {
1402
+ obj.messageError = exports.ChatStreamFrame_MessageError.toJSON(message.messageError);
1403
+ }
1404
+ return obj;
1405
+ },
1406
+ create(base) {
1407
+ return exports.ChatStreamFrame.fromPartial(base !== null && base !== void 0 ? base : {});
1408
+ },
1409
+ fromPartial(object) {
1410
+ var _a;
1411
+ const message = createBaseChatStreamFrame();
1412
+ message.eventId = (_a = object.eventId) !== null && _a !== void 0 ? _a : "";
1413
+ message.messageStarted = (object.messageStarted !== undefined && object.messageStarted !== null)
1414
+ ? exports.ChatStreamFrame_MessageStarted.fromPartial(object.messageStarted)
1415
+ : undefined;
1416
+ message.messageDelta = (object.messageDelta !== undefined && object.messageDelta !== null)
1417
+ ? exports.ChatStreamFrame_MessageDelta.fromPartial(object.messageDelta)
1418
+ : undefined;
1419
+ message.toolCallProposed = (object.toolCallProposed !== undefined && object.toolCallProposed !== null)
1420
+ ? exports.ChatStreamFrame_ToolCallProposed.fromPartial(object.toolCallProposed)
1421
+ : undefined;
1422
+ message.toolCallExecuting = (object.toolCallExecuting !== undefined && object.toolCallExecuting !== null)
1423
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromPartial(object.toolCallExecuting)
1424
+ : undefined;
1425
+ message.toolCallResult = (object.toolCallResult !== undefined && object.toolCallResult !== null)
1426
+ ? exports.ChatStreamFrame_ToolCallResult.fromPartial(object.toolCallResult)
1427
+ : undefined;
1428
+ message.toolCallRejected = (object.toolCallRejected !== undefined && object.toolCallRejected !== null)
1429
+ ? exports.ChatStreamFrame_ToolCallRejected.fromPartial(object.toolCallRejected)
1430
+ : undefined;
1431
+ message.artifactCreated = (object.artifactCreated !== undefined && object.artifactCreated !== null)
1432
+ ? exports.ChatStreamFrame_ArtifactCreated.fromPartial(object.artifactCreated)
1433
+ : undefined;
1434
+ message.artifactUpdated = (object.artifactUpdated !== undefined && object.artifactUpdated !== null)
1435
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromPartial(object.artifactUpdated)
1436
+ : undefined;
1437
+ message.messageComplete = (object.messageComplete !== undefined && object.messageComplete !== null)
1438
+ ? exports.ChatStreamFrame_MessageComplete.fromPartial(object.messageComplete)
1439
+ : undefined;
1440
+ message.messageError = (object.messageError !== undefined && object.messageError !== null)
1441
+ ? exports.ChatStreamFrame_MessageError.fromPartial(object.messageError)
1442
+ : undefined;
1443
+ return message;
1444
+ },
1445
+ };
1446
+ function createBaseChatStreamFrame_MessageStarted() {
1447
+ return { messageId: "", role: 0 };
1448
+ }
1449
+ exports.ChatStreamFrame_MessageStarted = {
1450
+ encode(message, writer = new wire_1.BinaryWriter()) {
1451
+ if (message.messageId !== "") {
1452
+ writer.uint32(10).string(message.messageId);
1453
+ }
1454
+ if (message.role !== 0) {
1455
+ writer.uint32(16).int32(message.role);
1456
+ }
1457
+ return writer;
1458
+ },
1459
+ decode(input, length) {
1460
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1461
+ const end = length === undefined ? reader.len : reader.pos + length;
1462
+ const message = createBaseChatStreamFrame_MessageStarted();
1463
+ while (reader.pos < end) {
1464
+ const tag = reader.uint32();
1465
+ switch (tag >>> 3) {
1466
+ case 1: {
1467
+ if (tag !== 10) {
1468
+ break;
1469
+ }
1470
+ message.messageId = reader.string();
1471
+ continue;
1472
+ }
1473
+ case 2: {
1474
+ if (tag !== 16) {
1475
+ break;
1476
+ }
1477
+ message.role = reader.int32();
1478
+ continue;
1479
+ }
1480
+ }
1481
+ if ((tag & 7) === 4 || tag === 0) {
1482
+ break;
1483
+ }
1484
+ reader.skip(tag & 7);
1485
+ }
1486
+ return message;
1487
+ },
1488
+ fromJSON(object) {
1489
+ return {
1490
+ messageId: isSet(object.messageId)
1491
+ ? globalThis.String(object.messageId)
1492
+ : isSet(object.message_id)
1493
+ ? globalThis.String(object.message_id)
1494
+ : "",
1495
+ role: isSet(object.role) ? chatMessageRoleFromJSON(object.role) : 0,
1496
+ };
1497
+ },
1498
+ toJSON(message) {
1499
+ const obj = {};
1500
+ if (message.messageId !== "") {
1501
+ obj.messageId = message.messageId;
1502
+ }
1503
+ if (message.role !== 0) {
1504
+ obj.role = chatMessageRoleToJSON(message.role);
1505
+ }
1506
+ return obj;
1507
+ },
1508
+ create(base) {
1509
+ return exports.ChatStreamFrame_MessageStarted.fromPartial(base !== null && base !== void 0 ? base : {});
1510
+ },
1511
+ fromPartial(object) {
1512
+ var _a, _b;
1513
+ const message = createBaseChatStreamFrame_MessageStarted();
1514
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1515
+ message.role = (_b = object.role) !== null && _b !== void 0 ? _b : 0;
1516
+ return message;
1517
+ },
1518
+ };
1519
+ function createBaseChatStreamFrame_MessageDelta() {
1520
+ return { messageId: "", textDelta: "" };
1521
+ }
1522
+ exports.ChatStreamFrame_MessageDelta = {
1523
+ encode(message, writer = new wire_1.BinaryWriter()) {
1524
+ if (message.messageId !== "") {
1525
+ writer.uint32(10).string(message.messageId);
1526
+ }
1527
+ if (message.textDelta !== "") {
1528
+ writer.uint32(18).string(message.textDelta);
1529
+ }
1530
+ return writer;
1531
+ },
1532
+ decode(input, length) {
1533
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1534
+ const end = length === undefined ? reader.len : reader.pos + length;
1535
+ const message = createBaseChatStreamFrame_MessageDelta();
1536
+ while (reader.pos < end) {
1537
+ const tag = reader.uint32();
1538
+ switch (tag >>> 3) {
1539
+ case 1: {
1540
+ if (tag !== 10) {
1541
+ break;
1542
+ }
1543
+ message.messageId = reader.string();
1544
+ continue;
1545
+ }
1546
+ case 2: {
1547
+ if (tag !== 18) {
1548
+ break;
1549
+ }
1550
+ message.textDelta = reader.string();
1551
+ continue;
1552
+ }
1553
+ }
1554
+ if ((tag & 7) === 4 || tag === 0) {
1555
+ break;
1556
+ }
1557
+ reader.skip(tag & 7);
1558
+ }
1559
+ return message;
1560
+ },
1561
+ fromJSON(object) {
1562
+ return {
1563
+ messageId: isSet(object.messageId)
1564
+ ? globalThis.String(object.messageId)
1565
+ : isSet(object.message_id)
1566
+ ? globalThis.String(object.message_id)
1567
+ : "",
1568
+ textDelta: isSet(object.textDelta)
1569
+ ? globalThis.String(object.textDelta)
1570
+ : isSet(object.text_delta)
1571
+ ? globalThis.String(object.text_delta)
1572
+ : "",
1573
+ };
1574
+ },
1575
+ toJSON(message) {
1576
+ const obj = {};
1577
+ if (message.messageId !== "") {
1578
+ obj.messageId = message.messageId;
1579
+ }
1580
+ if (message.textDelta !== "") {
1581
+ obj.textDelta = message.textDelta;
1582
+ }
1583
+ return obj;
1584
+ },
1585
+ create(base) {
1586
+ return exports.ChatStreamFrame_MessageDelta.fromPartial(base !== null && base !== void 0 ? base : {});
1587
+ },
1588
+ fromPartial(object) {
1589
+ var _a, _b;
1590
+ const message = createBaseChatStreamFrame_MessageDelta();
1591
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1592
+ message.textDelta = (_b = object.textDelta) !== null && _b !== void 0 ? _b : "";
1593
+ return message;
1594
+ },
1595
+ };
1596
+ function createBaseChatStreamFrame_ToolCallProposed() {
1597
+ return { messageId: "", toolCallId: "", name: "", arguments: undefined, requiresApproval: false };
1598
+ }
1599
+ exports.ChatStreamFrame_ToolCallProposed = {
1600
+ encode(message, writer = new wire_1.BinaryWriter()) {
1601
+ if (message.messageId !== "") {
1602
+ writer.uint32(10).string(message.messageId);
1603
+ }
1604
+ if (message.toolCallId !== "") {
1605
+ writer.uint32(18).string(message.toolCallId);
1606
+ }
1607
+ if (message.name !== "") {
1608
+ writer.uint32(26).string(message.name);
1609
+ }
1610
+ if (message.arguments !== undefined) {
1611
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.arguments), writer.uint32(34).fork()).join();
1612
+ }
1613
+ if (message.requiresApproval !== false) {
1614
+ writer.uint32(40).bool(message.requiresApproval);
1615
+ }
1616
+ return writer;
1617
+ },
1618
+ decode(input, length) {
1619
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1620
+ const end = length === undefined ? reader.len : reader.pos + length;
1621
+ const message = createBaseChatStreamFrame_ToolCallProposed();
1622
+ while (reader.pos < end) {
1623
+ const tag = reader.uint32();
1624
+ switch (tag >>> 3) {
1625
+ case 1: {
1626
+ if (tag !== 10) {
1627
+ break;
1628
+ }
1629
+ message.messageId = reader.string();
1630
+ continue;
1631
+ }
1632
+ case 2: {
1633
+ if (tag !== 18) {
1634
+ break;
1635
+ }
1636
+ message.toolCallId = reader.string();
1637
+ continue;
1638
+ }
1639
+ case 3: {
1640
+ if (tag !== 26) {
1641
+ break;
1642
+ }
1643
+ message.name = reader.string();
1644
+ continue;
1645
+ }
1646
+ case 4: {
1647
+ if (tag !== 34) {
1648
+ break;
1649
+ }
1650
+ message.arguments = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
1651
+ continue;
1652
+ }
1653
+ case 5: {
1654
+ if (tag !== 40) {
1655
+ break;
1656
+ }
1657
+ message.requiresApproval = reader.bool();
1658
+ continue;
1659
+ }
1660
+ }
1661
+ if ((tag & 7) === 4 || tag === 0) {
1662
+ break;
1663
+ }
1664
+ reader.skip(tag & 7);
1665
+ }
1666
+ return message;
1667
+ },
1668
+ fromJSON(object) {
1669
+ return {
1670
+ messageId: isSet(object.messageId)
1671
+ ? globalThis.String(object.messageId)
1672
+ : isSet(object.message_id)
1673
+ ? globalThis.String(object.message_id)
1674
+ : "",
1675
+ toolCallId: isSet(object.toolCallId)
1676
+ ? globalThis.String(object.toolCallId)
1677
+ : isSet(object.tool_call_id)
1678
+ ? globalThis.String(object.tool_call_id)
1679
+ : "",
1680
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1681
+ arguments: isObject(object.arguments) ? object.arguments : undefined,
1682
+ requiresApproval: isSet(object.requiresApproval)
1683
+ ? globalThis.Boolean(object.requiresApproval)
1684
+ : isSet(object.requires_approval)
1685
+ ? globalThis.Boolean(object.requires_approval)
1686
+ : false,
1687
+ };
1688
+ },
1689
+ toJSON(message) {
1690
+ const obj = {};
1691
+ if (message.messageId !== "") {
1692
+ obj.messageId = message.messageId;
1693
+ }
1694
+ if (message.toolCallId !== "") {
1695
+ obj.toolCallId = message.toolCallId;
1696
+ }
1697
+ if (message.name !== "") {
1698
+ obj.name = message.name;
1699
+ }
1700
+ if (message.arguments !== undefined) {
1701
+ obj.arguments = message.arguments;
1702
+ }
1703
+ if (message.requiresApproval !== false) {
1704
+ obj.requiresApproval = message.requiresApproval;
1705
+ }
1706
+ return obj;
1707
+ },
1708
+ create(base) {
1709
+ return exports.ChatStreamFrame_ToolCallProposed.fromPartial(base !== null && base !== void 0 ? base : {});
1710
+ },
1711
+ fromPartial(object) {
1712
+ var _a, _b, _c, _d, _e;
1713
+ const message = createBaseChatStreamFrame_ToolCallProposed();
1714
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1715
+ message.toolCallId = (_b = object.toolCallId) !== null && _b !== void 0 ? _b : "";
1716
+ message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
1717
+ message.arguments = (_d = object.arguments) !== null && _d !== void 0 ? _d : undefined;
1718
+ message.requiresApproval = (_e = object.requiresApproval) !== null && _e !== void 0 ? _e : false;
1719
+ return message;
1720
+ },
1721
+ };
1722
+ function createBaseChatStreamFrame_ToolCallExecuting() {
1723
+ return { toolCallId: "", name: "", arguments: undefined };
1724
+ }
1725
+ exports.ChatStreamFrame_ToolCallExecuting = {
1726
+ encode(message, writer = new wire_1.BinaryWriter()) {
1727
+ if (message.toolCallId !== "") {
1728
+ writer.uint32(10).string(message.toolCallId);
1729
+ }
1730
+ if (message.name !== "") {
1731
+ writer.uint32(18).string(message.name);
1732
+ }
1733
+ if (message.arguments !== undefined) {
1734
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.arguments), writer.uint32(26).fork()).join();
1735
+ }
1736
+ return writer;
1737
+ },
1738
+ decode(input, length) {
1739
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1740
+ const end = length === undefined ? reader.len : reader.pos + length;
1741
+ const message = createBaseChatStreamFrame_ToolCallExecuting();
1742
+ while (reader.pos < end) {
1743
+ const tag = reader.uint32();
1744
+ switch (tag >>> 3) {
1745
+ case 1: {
1746
+ if (tag !== 10) {
1747
+ break;
1748
+ }
1749
+ message.toolCallId = reader.string();
1750
+ continue;
1751
+ }
1752
+ case 2: {
1753
+ if (tag !== 18) {
1754
+ break;
1755
+ }
1756
+ message.name = reader.string();
1757
+ continue;
1758
+ }
1759
+ case 3: {
1760
+ if (tag !== 26) {
1761
+ break;
1762
+ }
1763
+ message.arguments = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
1764
+ continue;
1765
+ }
1766
+ }
1767
+ if ((tag & 7) === 4 || tag === 0) {
1768
+ break;
1769
+ }
1770
+ reader.skip(tag & 7);
1771
+ }
1772
+ return message;
1773
+ },
1774
+ fromJSON(object) {
1775
+ return {
1776
+ toolCallId: isSet(object.toolCallId)
1777
+ ? globalThis.String(object.toolCallId)
1778
+ : isSet(object.tool_call_id)
1779
+ ? globalThis.String(object.tool_call_id)
1780
+ : "",
1781
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1782
+ arguments: isObject(object.arguments) ? object.arguments : undefined,
1783
+ };
1784
+ },
1785
+ toJSON(message) {
1786
+ const obj = {};
1787
+ if (message.toolCallId !== "") {
1788
+ obj.toolCallId = message.toolCallId;
1789
+ }
1790
+ if (message.name !== "") {
1791
+ obj.name = message.name;
1792
+ }
1793
+ if (message.arguments !== undefined) {
1794
+ obj.arguments = message.arguments;
1795
+ }
1796
+ return obj;
1797
+ },
1798
+ create(base) {
1799
+ return exports.ChatStreamFrame_ToolCallExecuting.fromPartial(base !== null && base !== void 0 ? base : {});
1800
+ },
1801
+ fromPartial(object) {
1802
+ var _a, _b, _c;
1803
+ const message = createBaseChatStreamFrame_ToolCallExecuting();
1804
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1805
+ message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
1806
+ message.arguments = (_c = object.arguments) !== null && _c !== void 0 ? _c : undefined;
1807
+ return message;
1808
+ },
1809
+ };
1810
+ function createBaseChatStreamFrame_ToolCallResult() {
1811
+ return { toolCallId: "", status: "", summary: "" };
1812
+ }
1813
+ exports.ChatStreamFrame_ToolCallResult = {
1814
+ encode(message, writer = new wire_1.BinaryWriter()) {
1815
+ if (message.toolCallId !== "") {
1816
+ writer.uint32(10).string(message.toolCallId);
1817
+ }
1818
+ if (message.status !== "") {
1819
+ writer.uint32(18).string(message.status);
1820
+ }
1821
+ if (message.summary !== "") {
1822
+ writer.uint32(26).string(message.summary);
1823
+ }
1824
+ return writer;
1825
+ },
1826
+ decode(input, length) {
1827
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1828
+ const end = length === undefined ? reader.len : reader.pos + length;
1829
+ const message = createBaseChatStreamFrame_ToolCallResult();
1830
+ while (reader.pos < end) {
1831
+ const tag = reader.uint32();
1832
+ switch (tag >>> 3) {
1833
+ case 1: {
1834
+ if (tag !== 10) {
1835
+ break;
1836
+ }
1837
+ message.toolCallId = reader.string();
1838
+ continue;
1839
+ }
1840
+ case 2: {
1841
+ if (tag !== 18) {
1842
+ break;
1843
+ }
1844
+ message.status = reader.string();
1845
+ continue;
1846
+ }
1847
+ case 3: {
1848
+ if (tag !== 26) {
1849
+ break;
1850
+ }
1851
+ message.summary = reader.string();
1852
+ continue;
1853
+ }
1854
+ }
1855
+ if ((tag & 7) === 4 || tag === 0) {
1856
+ break;
1857
+ }
1858
+ reader.skip(tag & 7);
1859
+ }
1860
+ return message;
1861
+ },
1862
+ fromJSON(object) {
1863
+ return {
1864
+ toolCallId: isSet(object.toolCallId)
1865
+ ? globalThis.String(object.toolCallId)
1866
+ : isSet(object.tool_call_id)
1867
+ ? globalThis.String(object.tool_call_id)
1868
+ : "",
1869
+ status: isSet(object.status) ? globalThis.String(object.status) : "",
1870
+ summary: isSet(object.summary) ? globalThis.String(object.summary) : "",
1871
+ };
1872
+ },
1873
+ toJSON(message) {
1874
+ const obj = {};
1875
+ if (message.toolCallId !== "") {
1876
+ obj.toolCallId = message.toolCallId;
1877
+ }
1878
+ if (message.status !== "") {
1879
+ obj.status = message.status;
1880
+ }
1881
+ if (message.summary !== "") {
1882
+ obj.summary = message.summary;
1883
+ }
1884
+ return obj;
1885
+ },
1886
+ create(base) {
1887
+ return exports.ChatStreamFrame_ToolCallResult.fromPartial(base !== null && base !== void 0 ? base : {});
1888
+ },
1889
+ fromPartial(object) {
1890
+ var _a, _b, _c;
1891
+ const message = createBaseChatStreamFrame_ToolCallResult();
1892
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1893
+ message.status = (_b = object.status) !== null && _b !== void 0 ? _b : "";
1894
+ message.summary = (_c = object.summary) !== null && _c !== void 0 ? _c : "";
1895
+ return message;
1896
+ },
1897
+ };
1898
+ function createBaseChatStreamFrame_ToolCallRejected() {
1899
+ return { toolCallId: "", reason: "" };
1900
+ }
1901
+ exports.ChatStreamFrame_ToolCallRejected = {
1902
+ encode(message, writer = new wire_1.BinaryWriter()) {
1903
+ if (message.toolCallId !== "") {
1904
+ writer.uint32(10).string(message.toolCallId);
1905
+ }
1906
+ if (message.reason !== "") {
1907
+ writer.uint32(18).string(message.reason);
1908
+ }
1909
+ return writer;
1910
+ },
1911
+ decode(input, length) {
1912
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1913
+ const end = length === undefined ? reader.len : reader.pos + length;
1914
+ const message = createBaseChatStreamFrame_ToolCallRejected();
1915
+ while (reader.pos < end) {
1916
+ const tag = reader.uint32();
1917
+ switch (tag >>> 3) {
1918
+ case 1: {
1919
+ if (tag !== 10) {
1920
+ break;
1921
+ }
1922
+ message.toolCallId = reader.string();
1923
+ continue;
1924
+ }
1925
+ case 2: {
1926
+ if (tag !== 18) {
1927
+ break;
1928
+ }
1929
+ message.reason = reader.string();
1930
+ continue;
1931
+ }
1932
+ }
1933
+ if ((tag & 7) === 4 || tag === 0) {
1934
+ break;
1935
+ }
1936
+ reader.skip(tag & 7);
1937
+ }
1938
+ return message;
1939
+ },
1940
+ fromJSON(object) {
1941
+ return {
1942
+ toolCallId: isSet(object.toolCallId)
1943
+ ? globalThis.String(object.toolCallId)
1944
+ : isSet(object.tool_call_id)
1945
+ ? globalThis.String(object.tool_call_id)
1946
+ : "",
1947
+ reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
1948
+ };
1949
+ },
1950
+ toJSON(message) {
1951
+ const obj = {};
1952
+ if (message.toolCallId !== "") {
1953
+ obj.toolCallId = message.toolCallId;
1954
+ }
1955
+ if (message.reason !== "") {
1956
+ obj.reason = message.reason;
1957
+ }
1958
+ return obj;
1959
+ },
1960
+ create(base) {
1961
+ return exports.ChatStreamFrame_ToolCallRejected.fromPartial(base !== null && base !== void 0 ? base : {});
1962
+ },
1963
+ fromPartial(object) {
1964
+ var _a, _b;
1965
+ const message = createBaseChatStreamFrame_ToolCallRejected();
1966
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1967
+ message.reason = (_b = object.reason) !== null && _b !== void 0 ? _b : "";
1968
+ return message;
1969
+ },
1970
+ };
1971
+ function createBaseChatStreamFrame_ArtifactCreated() {
1972
+ return { artifactId: "", title: "", kind: 0, version: 0 };
1973
+ }
1974
+ exports.ChatStreamFrame_ArtifactCreated = {
1975
+ encode(message, writer = new wire_1.BinaryWriter()) {
1976
+ if (message.artifactId !== "") {
1977
+ writer.uint32(10).string(message.artifactId);
1978
+ }
1979
+ if (message.title !== "") {
1980
+ writer.uint32(18).string(message.title);
1981
+ }
1982
+ if (message.kind !== 0) {
1983
+ writer.uint32(24).int32(message.kind);
1984
+ }
1985
+ if (message.version !== 0) {
1986
+ writer.uint32(32).int32(message.version);
1987
+ }
1988
+ return writer;
1989
+ },
1990
+ decode(input, length) {
1991
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1992
+ const end = length === undefined ? reader.len : reader.pos + length;
1993
+ const message = createBaseChatStreamFrame_ArtifactCreated();
1994
+ while (reader.pos < end) {
1995
+ const tag = reader.uint32();
1996
+ switch (tag >>> 3) {
1997
+ case 1: {
1998
+ if (tag !== 10) {
1999
+ break;
2000
+ }
2001
+ message.artifactId = reader.string();
2002
+ continue;
2003
+ }
2004
+ case 2: {
2005
+ if (tag !== 18) {
2006
+ break;
2007
+ }
2008
+ message.title = reader.string();
2009
+ continue;
2010
+ }
2011
+ case 3: {
2012
+ if (tag !== 24) {
2013
+ break;
2014
+ }
2015
+ message.kind = reader.int32();
2016
+ continue;
2017
+ }
2018
+ case 4: {
2019
+ if (tag !== 32) {
2020
+ break;
2021
+ }
2022
+ message.version = reader.int32();
2023
+ continue;
2024
+ }
2025
+ }
2026
+ if ((tag & 7) === 4 || tag === 0) {
2027
+ break;
2028
+ }
2029
+ reader.skip(tag & 7);
2030
+ }
2031
+ return message;
2032
+ },
2033
+ fromJSON(object) {
2034
+ return {
2035
+ artifactId: isSet(object.artifactId)
2036
+ ? globalThis.String(object.artifactId)
2037
+ : isSet(object.artifact_id)
2038
+ ? globalThis.String(object.artifact_id)
2039
+ : "",
2040
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
2041
+ kind: isSet(object.kind) ? chatArtifactKindFromJSON(object.kind) : 0,
2042
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
2043
+ };
2044
+ },
2045
+ toJSON(message) {
2046
+ const obj = {};
2047
+ if (message.artifactId !== "") {
2048
+ obj.artifactId = message.artifactId;
2049
+ }
2050
+ if (message.title !== "") {
2051
+ obj.title = message.title;
2052
+ }
2053
+ if (message.kind !== 0) {
2054
+ obj.kind = chatArtifactKindToJSON(message.kind);
2055
+ }
2056
+ if (message.version !== 0) {
2057
+ obj.version = Math.round(message.version);
2058
+ }
2059
+ return obj;
2060
+ },
2061
+ create(base) {
2062
+ return exports.ChatStreamFrame_ArtifactCreated.fromPartial(base !== null && base !== void 0 ? base : {});
2063
+ },
2064
+ fromPartial(object) {
2065
+ var _a, _b, _c, _d;
2066
+ const message = createBaseChatStreamFrame_ArtifactCreated();
2067
+ message.artifactId = (_a = object.artifactId) !== null && _a !== void 0 ? _a : "";
2068
+ message.title = (_b = object.title) !== null && _b !== void 0 ? _b : "";
2069
+ message.kind = (_c = object.kind) !== null && _c !== void 0 ? _c : 0;
2070
+ message.version = (_d = object.version) !== null && _d !== void 0 ? _d : 0;
2071
+ return message;
2072
+ },
2073
+ };
2074
+ function createBaseChatStreamFrame_ArtifactUpdated() {
2075
+ return { artifactId: "", version: 0 };
2076
+ }
2077
+ exports.ChatStreamFrame_ArtifactUpdated = {
2078
+ encode(message, writer = new wire_1.BinaryWriter()) {
2079
+ if (message.artifactId !== "") {
2080
+ writer.uint32(10).string(message.artifactId);
2081
+ }
2082
+ if (message.version !== 0) {
2083
+ writer.uint32(16).int32(message.version);
2084
+ }
2085
+ return writer;
2086
+ },
2087
+ decode(input, length) {
2088
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2089
+ const end = length === undefined ? reader.len : reader.pos + length;
2090
+ const message = createBaseChatStreamFrame_ArtifactUpdated();
2091
+ while (reader.pos < end) {
2092
+ const tag = reader.uint32();
2093
+ switch (tag >>> 3) {
2094
+ case 1: {
2095
+ if (tag !== 10) {
2096
+ break;
2097
+ }
2098
+ message.artifactId = reader.string();
2099
+ continue;
2100
+ }
2101
+ case 2: {
2102
+ if (tag !== 16) {
2103
+ break;
2104
+ }
2105
+ message.version = reader.int32();
2106
+ continue;
2107
+ }
2108
+ }
2109
+ if ((tag & 7) === 4 || tag === 0) {
2110
+ break;
2111
+ }
2112
+ reader.skip(tag & 7);
2113
+ }
2114
+ return message;
2115
+ },
2116
+ fromJSON(object) {
2117
+ return {
2118
+ artifactId: isSet(object.artifactId)
2119
+ ? globalThis.String(object.artifactId)
2120
+ : isSet(object.artifact_id)
2121
+ ? globalThis.String(object.artifact_id)
2122
+ : "",
2123
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
2124
+ };
2125
+ },
2126
+ toJSON(message) {
2127
+ const obj = {};
2128
+ if (message.artifactId !== "") {
2129
+ obj.artifactId = message.artifactId;
2130
+ }
2131
+ if (message.version !== 0) {
2132
+ obj.version = Math.round(message.version);
2133
+ }
2134
+ return obj;
2135
+ },
2136
+ create(base) {
2137
+ return exports.ChatStreamFrame_ArtifactUpdated.fromPartial(base !== null && base !== void 0 ? base : {});
2138
+ },
2139
+ fromPartial(object) {
2140
+ var _a, _b;
2141
+ const message = createBaseChatStreamFrame_ArtifactUpdated();
2142
+ message.artifactId = (_a = object.artifactId) !== null && _a !== void 0 ? _a : "";
2143
+ message.version = (_b = object.version) !== null && _b !== void 0 ? _b : 0;
2144
+ return message;
2145
+ },
2146
+ };
2147
+ function createBaseChatStreamFrame_MessageComplete() {
2148
+ return { messageId: "", tokenUsage: undefined };
2149
+ }
2150
+ exports.ChatStreamFrame_MessageComplete = {
2151
+ encode(message, writer = new wire_1.BinaryWriter()) {
2152
+ if (message.messageId !== "") {
2153
+ writer.uint32(10).string(message.messageId);
2154
+ }
2155
+ if (message.tokenUsage !== undefined) {
2156
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.tokenUsage), writer.uint32(18).fork()).join();
2157
+ }
2158
+ return writer;
2159
+ },
2160
+ decode(input, length) {
2161
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2162
+ const end = length === undefined ? reader.len : reader.pos + length;
2163
+ const message = createBaseChatStreamFrame_MessageComplete();
2164
+ while (reader.pos < end) {
2165
+ const tag = reader.uint32();
2166
+ switch (tag >>> 3) {
2167
+ case 1: {
2168
+ if (tag !== 10) {
2169
+ break;
2170
+ }
2171
+ message.messageId = reader.string();
2172
+ continue;
2173
+ }
2174
+ case 2: {
2175
+ if (tag !== 18) {
2176
+ break;
2177
+ }
2178
+ message.tokenUsage = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
2179
+ continue;
2180
+ }
2181
+ }
2182
+ if ((tag & 7) === 4 || tag === 0) {
2183
+ break;
2184
+ }
2185
+ reader.skip(tag & 7);
2186
+ }
2187
+ return message;
2188
+ },
2189
+ fromJSON(object) {
2190
+ return {
2191
+ messageId: isSet(object.messageId)
2192
+ ? globalThis.String(object.messageId)
2193
+ : isSet(object.message_id)
2194
+ ? globalThis.String(object.message_id)
2195
+ : "",
2196
+ tokenUsage: isObject(object.tokenUsage)
2197
+ ? object.tokenUsage
2198
+ : isObject(object.token_usage)
2199
+ ? object.token_usage
2200
+ : undefined,
2201
+ };
2202
+ },
2203
+ toJSON(message) {
2204
+ const obj = {};
2205
+ if (message.messageId !== "") {
2206
+ obj.messageId = message.messageId;
2207
+ }
2208
+ if (message.tokenUsage !== undefined) {
2209
+ obj.tokenUsage = message.tokenUsage;
2210
+ }
2211
+ return obj;
2212
+ },
2213
+ create(base) {
2214
+ return exports.ChatStreamFrame_MessageComplete.fromPartial(base !== null && base !== void 0 ? base : {});
2215
+ },
2216
+ fromPartial(object) {
2217
+ var _a, _b;
2218
+ const message = createBaseChatStreamFrame_MessageComplete();
2219
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
2220
+ message.tokenUsage = (_b = object.tokenUsage) !== null && _b !== void 0 ? _b : undefined;
2221
+ return message;
2222
+ },
2223
+ };
2224
+ function createBaseChatStreamFrame_MessageError() {
2225
+ return { messageId: "", code: "", message: "" };
2226
+ }
2227
+ exports.ChatStreamFrame_MessageError = {
2228
+ encode(message, writer = new wire_1.BinaryWriter()) {
2229
+ if (message.messageId !== "") {
2230
+ writer.uint32(10).string(message.messageId);
2231
+ }
2232
+ if (message.code !== "") {
2233
+ writer.uint32(18).string(message.code);
2234
+ }
2235
+ if (message.message !== "") {
2236
+ writer.uint32(26).string(message.message);
2237
+ }
2238
+ return writer;
2239
+ },
2240
+ decode(input, length) {
2241
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2242
+ const end = length === undefined ? reader.len : reader.pos + length;
2243
+ const message = createBaseChatStreamFrame_MessageError();
2244
+ while (reader.pos < end) {
2245
+ const tag = reader.uint32();
2246
+ switch (tag >>> 3) {
2247
+ case 1: {
2248
+ if (tag !== 10) {
2249
+ break;
2250
+ }
2251
+ message.messageId = reader.string();
2252
+ continue;
2253
+ }
2254
+ case 2: {
2255
+ if (tag !== 18) {
2256
+ break;
2257
+ }
2258
+ message.code = reader.string();
2259
+ continue;
2260
+ }
2261
+ case 3: {
2262
+ if (tag !== 26) {
2263
+ break;
2264
+ }
2265
+ message.message = reader.string();
2266
+ continue;
2267
+ }
2268
+ }
2269
+ if ((tag & 7) === 4 || tag === 0) {
2270
+ break;
2271
+ }
2272
+ reader.skip(tag & 7);
2273
+ }
2274
+ return message;
2275
+ },
2276
+ fromJSON(object) {
2277
+ return {
2278
+ messageId: isSet(object.messageId)
2279
+ ? globalThis.String(object.messageId)
2280
+ : isSet(object.message_id)
2281
+ ? globalThis.String(object.message_id)
2282
+ : "",
2283
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
2284
+ message: isSet(object.message) ? globalThis.String(object.message) : "",
2285
+ };
2286
+ },
2287
+ toJSON(message) {
2288
+ const obj = {};
2289
+ if (message.messageId !== "") {
2290
+ obj.messageId = message.messageId;
2291
+ }
2292
+ if (message.code !== "") {
2293
+ obj.code = message.code;
2294
+ }
2295
+ if (message.message !== "") {
2296
+ obj.message = message.message;
2297
+ }
2298
+ return obj;
2299
+ },
2300
+ create(base) {
2301
+ return exports.ChatStreamFrame_MessageError.fromPartial(base !== null && base !== void 0 ? base : {});
2302
+ },
2303
+ fromPartial(object) {
2304
+ var _a, _b, _c;
2305
+ const message = createBaseChatStreamFrame_MessageError();
2306
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
2307
+ message.code = (_b = object.code) !== null && _b !== void 0 ? _b : "";
2308
+ message.message = (_c = object.message) !== null && _c !== void 0 ? _c : "";
2309
+ return message;
2310
+ },
2311
+ };
2312
+ function bytesFromBase64(b64) {
2313
+ if (globalThis.Buffer) {
2314
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
2315
+ }
2316
+ else {
2317
+ const bin = globalThis.atob(b64);
2318
+ const arr = new Uint8Array(bin.length);
2319
+ for (let i = 0; i < bin.length; ++i) {
2320
+ arr[i] = bin.charCodeAt(i);
2321
+ }
2322
+ return arr;
2323
+ }
2324
+ }
2325
+ function base64FromBytes(arr) {
2326
+ if (globalThis.Buffer) {
2327
+ return globalThis.Buffer.from(arr).toString("base64");
2328
+ }
2329
+ else {
2330
+ const bin = [];
2331
+ arr.forEach((byte) => {
2332
+ bin.push(globalThis.String.fromCharCode(byte));
2333
+ });
2334
+ return globalThis.btoa(bin.join(""));
2335
+ }
2336
+ }
2337
+ function toTimestamp(date) {
2338
+ const seconds = Math.trunc(date.getTime() / 1000);
2339
+ const nanos = (date.getTime() % 1000) * 1000000;
2340
+ return { seconds, nanos };
2341
+ }
2342
+ function fromTimestamp(t) {
2343
+ let millis = (t.seconds || 0) * 1000;
2344
+ millis += (t.nanos || 0) / 1000000;
2345
+ return new globalThis.Date(millis);
2346
+ }
2347
+ function fromJsonTimestamp(o) {
2348
+ if (o instanceof globalThis.Date) {
2349
+ return o;
2350
+ }
2351
+ else if (typeof o === "string") {
2352
+ return new globalThis.Date(o);
2353
+ }
2354
+ else {
2355
+ return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
2356
+ }
2357
+ }
2358
+ function isObject(value) {
2359
+ return typeof value === "object" && value !== null;
2360
+ }
2361
+ function isSet(value) {
2362
+ return value !== null && value !== undefined;
2363
+ }