weave-typescript 0.20.0 → 0.22.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,2342 @@
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
+ messageStarted: undefined,
1169
+ messageDelta: undefined,
1170
+ toolCallProposed: undefined,
1171
+ toolCallExecuting: undefined,
1172
+ toolCallResult: undefined,
1173
+ toolCallRejected: undefined,
1174
+ artifactCreated: undefined,
1175
+ artifactUpdated: undefined,
1176
+ messageComplete: undefined,
1177
+ messageError: undefined,
1178
+ };
1179
+ }
1180
+ exports.ChatStreamFrame = {
1181
+ encode(message, writer = new wire_1.BinaryWriter()) {
1182
+ if (message.messageStarted !== undefined) {
1183
+ exports.ChatStreamFrame_MessageStarted.encode(message.messageStarted, writer.uint32(10).fork()).join();
1184
+ }
1185
+ if (message.messageDelta !== undefined) {
1186
+ exports.ChatStreamFrame_MessageDelta.encode(message.messageDelta, writer.uint32(18).fork()).join();
1187
+ }
1188
+ if (message.toolCallProposed !== undefined) {
1189
+ exports.ChatStreamFrame_ToolCallProposed.encode(message.toolCallProposed, writer.uint32(26).fork()).join();
1190
+ }
1191
+ if (message.toolCallExecuting !== undefined) {
1192
+ exports.ChatStreamFrame_ToolCallExecuting.encode(message.toolCallExecuting, writer.uint32(34).fork()).join();
1193
+ }
1194
+ if (message.toolCallResult !== undefined) {
1195
+ exports.ChatStreamFrame_ToolCallResult.encode(message.toolCallResult, writer.uint32(42).fork()).join();
1196
+ }
1197
+ if (message.toolCallRejected !== undefined) {
1198
+ exports.ChatStreamFrame_ToolCallRejected.encode(message.toolCallRejected, writer.uint32(50).fork()).join();
1199
+ }
1200
+ if (message.artifactCreated !== undefined) {
1201
+ exports.ChatStreamFrame_ArtifactCreated.encode(message.artifactCreated, writer.uint32(58).fork()).join();
1202
+ }
1203
+ if (message.artifactUpdated !== undefined) {
1204
+ exports.ChatStreamFrame_ArtifactUpdated.encode(message.artifactUpdated, writer.uint32(66).fork()).join();
1205
+ }
1206
+ if (message.messageComplete !== undefined) {
1207
+ exports.ChatStreamFrame_MessageComplete.encode(message.messageComplete, writer.uint32(74).fork()).join();
1208
+ }
1209
+ if (message.messageError !== undefined) {
1210
+ exports.ChatStreamFrame_MessageError.encode(message.messageError, writer.uint32(82).fork()).join();
1211
+ }
1212
+ return writer;
1213
+ },
1214
+ decode(input, length) {
1215
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1216
+ const end = length === undefined ? reader.len : reader.pos + length;
1217
+ const message = createBaseChatStreamFrame();
1218
+ while (reader.pos < end) {
1219
+ const tag = reader.uint32();
1220
+ switch (tag >>> 3) {
1221
+ case 1: {
1222
+ if (tag !== 10) {
1223
+ break;
1224
+ }
1225
+ message.messageStarted = exports.ChatStreamFrame_MessageStarted.decode(reader, reader.uint32());
1226
+ continue;
1227
+ }
1228
+ case 2: {
1229
+ if (tag !== 18) {
1230
+ break;
1231
+ }
1232
+ message.messageDelta = exports.ChatStreamFrame_MessageDelta.decode(reader, reader.uint32());
1233
+ continue;
1234
+ }
1235
+ case 3: {
1236
+ if (tag !== 26) {
1237
+ break;
1238
+ }
1239
+ message.toolCallProposed = exports.ChatStreamFrame_ToolCallProposed.decode(reader, reader.uint32());
1240
+ continue;
1241
+ }
1242
+ case 4: {
1243
+ if (tag !== 34) {
1244
+ break;
1245
+ }
1246
+ message.toolCallExecuting = exports.ChatStreamFrame_ToolCallExecuting.decode(reader, reader.uint32());
1247
+ continue;
1248
+ }
1249
+ case 5: {
1250
+ if (tag !== 42) {
1251
+ break;
1252
+ }
1253
+ message.toolCallResult = exports.ChatStreamFrame_ToolCallResult.decode(reader, reader.uint32());
1254
+ continue;
1255
+ }
1256
+ case 6: {
1257
+ if (tag !== 50) {
1258
+ break;
1259
+ }
1260
+ message.toolCallRejected = exports.ChatStreamFrame_ToolCallRejected.decode(reader, reader.uint32());
1261
+ continue;
1262
+ }
1263
+ case 7: {
1264
+ if (tag !== 58) {
1265
+ break;
1266
+ }
1267
+ message.artifactCreated = exports.ChatStreamFrame_ArtifactCreated.decode(reader, reader.uint32());
1268
+ continue;
1269
+ }
1270
+ case 8: {
1271
+ if (tag !== 66) {
1272
+ break;
1273
+ }
1274
+ message.artifactUpdated = exports.ChatStreamFrame_ArtifactUpdated.decode(reader, reader.uint32());
1275
+ continue;
1276
+ }
1277
+ case 9: {
1278
+ if (tag !== 74) {
1279
+ break;
1280
+ }
1281
+ message.messageComplete = exports.ChatStreamFrame_MessageComplete.decode(reader, reader.uint32());
1282
+ continue;
1283
+ }
1284
+ case 10: {
1285
+ if (tag !== 82) {
1286
+ break;
1287
+ }
1288
+ message.messageError = exports.ChatStreamFrame_MessageError.decode(reader, reader.uint32());
1289
+ continue;
1290
+ }
1291
+ }
1292
+ if ((tag & 7) === 4 || tag === 0) {
1293
+ break;
1294
+ }
1295
+ reader.skip(tag & 7);
1296
+ }
1297
+ return message;
1298
+ },
1299
+ fromJSON(object) {
1300
+ return {
1301
+ messageStarted: isSet(object.messageStarted)
1302
+ ? exports.ChatStreamFrame_MessageStarted.fromJSON(object.messageStarted)
1303
+ : isSet(object.message_started)
1304
+ ? exports.ChatStreamFrame_MessageStarted.fromJSON(object.message_started)
1305
+ : undefined,
1306
+ messageDelta: isSet(object.messageDelta)
1307
+ ? exports.ChatStreamFrame_MessageDelta.fromJSON(object.messageDelta)
1308
+ : isSet(object.message_delta)
1309
+ ? exports.ChatStreamFrame_MessageDelta.fromJSON(object.message_delta)
1310
+ : undefined,
1311
+ toolCallProposed: isSet(object.toolCallProposed)
1312
+ ? exports.ChatStreamFrame_ToolCallProposed.fromJSON(object.toolCallProposed)
1313
+ : isSet(object.tool_call_proposed)
1314
+ ? exports.ChatStreamFrame_ToolCallProposed.fromJSON(object.tool_call_proposed)
1315
+ : undefined,
1316
+ toolCallExecuting: isSet(object.toolCallExecuting)
1317
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromJSON(object.toolCallExecuting)
1318
+ : isSet(object.tool_call_executing)
1319
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromJSON(object.tool_call_executing)
1320
+ : undefined,
1321
+ toolCallResult: isSet(object.toolCallResult)
1322
+ ? exports.ChatStreamFrame_ToolCallResult.fromJSON(object.toolCallResult)
1323
+ : isSet(object.tool_call_result)
1324
+ ? exports.ChatStreamFrame_ToolCallResult.fromJSON(object.tool_call_result)
1325
+ : undefined,
1326
+ toolCallRejected: isSet(object.toolCallRejected)
1327
+ ? exports.ChatStreamFrame_ToolCallRejected.fromJSON(object.toolCallRejected)
1328
+ : isSet(object.tool_call_rejected)
1329
+ ? exports.ChatStreamFrame_ToolCallRejected.fromJSON(object.tool_call_rejected)
1330
+ : undefined,
1331
+ artifactCreated: isSet(object.artifactCreated)
1332
+ ? exports.ChatStreamFrame_ArtifactCreated.fromJSON(object.artifactCreated)
1333
+ : isSet(object.artifact_created)
1334
+ ? exports.ChatStreamFrame_ArtifactCreated.fromJSON(object.artifact_created)
1335
+ : undefined,
1336
+ artifactUpdated: isSet(object.artifactUpdated)
1337
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromJSON(object.artifactUpdated)
1338
+ : isSet(object.artifact_updated)
1339
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromJSON(object.artifact_updated)
1340
+ : undefined,
1341
+ messageComplete: isSet(object.messageComplete)
1342
+ ? exports.ChatStreamFrame_MessageComplete.fromJSON(object.messageComplete)
1343
+ : isSet(object.message_complete)
1344
+ ? exports.ChatStreamFrame_MessageComplete.fromJSON(object.message_complete)
1345
+ : undefined,
1346
+ messageError: isSet(object.messageError)
1347
+ ? exports.ChatStreamFrame_MessageError.fromJSON(object.messageError)
1348
+ : isSet(object.message_error)
1349
+ ? exports.ChatStreamFrame_MessageError.fromJSON(object.message_error)
1350
+ : undefined,
1351
+ };
1352
+ },
1353
+ toJSON(message) {
1354
+ const obj = {};
1355
+ if (message.messageStarted !== undefined) {
1356
+ obj.messageStarted = exports.ChatStreamFrame_MessageStarted.toJSON(message.messageStarted);
1357
+ }
1358
+ if (message.messageDelta !== undefined) {
1359
+ obj.messageDelta = exports.ChatStreamFrame_MessageDelta.toJSON(message.messageDelta);
1360
+ }
1361
+ if (message.toolCallProposed !== undefined) {
1362
+ obj.toolCallProposed = exports.ChatStreamFrame_ToolCallProposed.toJSON(message.toolCallProposed);
1363
+ }
1364
+ if (message.toolCallExecuting !== undefined) {
1365
+ obj.toolCallExecuting = exports.ChatStreamFrame_ToolCallExecuting.toJSON(message.toolCallExecuting);
1366
+ }
1367
+ if (message.toolCallResult !== undefined) {
1368
+ obj.toolCallResult = exports.ChatStreamFrame_ToolCallResult.toJSON(message.toolCallResult);
1369
+ }
1370
+ if (message.toolCallRejected !== undefined) {
1371
+ obj.toolCallRejected = exports.ChatStreamFrame_ToolCallRejected.toJSON(message.toolCallRejected);
1372
+ }
1373
+ if (message.artifactCreated !== undefined) {
1374
+ obj.artifactCreated = exports.ChatStreamFrame_ArtifactCreated.toJSON(message.artifactCreated);
1375
+ }
1376
+ if (message.artifactUpdated !== undefined) {
1377
+ obj.artifactUpdated = exports.ChatStreamFrame_ArtifactUpdated.toJSON(message.artifactUpdated);
1378
+ }
1379
+ if (message.messageComplete !== undefined) {
1380
+ obj.messageComplete = exports.ChatStreamFrame_MessageComplete.toJSON(message.messageComplete);
1381
+ }
1382
+ if (message.messageError !== undefined) {
1383
+ obj.messageError = exports.ChatStreamFrame_MessageError.toJSON(message.messageError);
1384
+ }
1385
+ return obj;
1386
+ },
1387
+ create(base) {
1388
+ return exports.ChatStreamFrame.fromPartial(base !== null && base !== void 0 ? base : {});
1389
+ },
1390
+ fromPartial(object) {
1391
+ const message = createBaseChatStreamFrame();
1392
+ message.messageStarted = (object.messageStarted !== undefined && object.messageStarted !== null)
1393
+ ? exports.ChatStreamFrame_MessageStarted.fromPartial(object.messageStarted)
1394
+ : undefined;
1395
+ message.messageDelta = (object.messageDelta !== undefined && object.messageDelta !== null)
1396
+ ? exports.ChatStreamFrame_MessageDelta.fromPartial(object.messageDelta)
1397
+ : undefined;
1398
+ message.toolCallProposed = (object.toolCallProposed !== undefined && object.toolCallProposed !== null)
1399
+ ? exports.ChatStreamFrame_ToolCallProposed.fromPartial(object.toolCallProposed)
1400
+ : undefined;
1401
+ message.toolCallExecuting = (object.toolCallExecuting !== undefined && object.toolCallExecuting !== null)
1402
+ ? exports.ChatStreamFrame_ToolCallExecuting.fromPartial(object.toolCallExecuting)
1403
+ : undefined;
1404
+ message.toolCallResult = (object.toolCallResult !== undefined && object.toolCallResult !== null)
1405
+ ? exports.ChatStreamFrame_ToolCallResult.fromPartial(object.toolCallResult)
1406
+ : undefined;
1407
+ message.toolCallRejected = (object.toolCallRejected !== undefined && object.toolCallRejected !== null)
1408
+ ? exports.ChatStreamFrame_ToolCallRejected.fromPartial(object.toolCallRejected)
1409
+ : undefined;
1410
+ message.artifactCreated = (object.artifactCreated !== undefined && object.artifactCreated !== null)
1411
+ ? exports.ChatStreamFrame_ArtifactCreated.fromPartial(object.artifactCreated)
1412
+ : undefined;
1413
+ message.artifactUpdated = (object.artifactUpdated !== undefined && object.artifactUpdated !== null)
1414
+ ? exports.ChatStreamFrame_ArtifactUpdated.fromPartial(object.artifactUpdated)
1415
+ : undefined;
1416
+ message.messageComplete = (object.messageComplete !== undefined && object.messageComplete !== null)
1417
+ ? exports.ChatStreamFrame_MessageComplete.fromPartial(object.messageComplete)
1418
+ : undefined;
1419
+ message.messageError = (object.messageError !== undefined && object.messageError !== null)
1420
+ ? exports.ChatStreamFrame_MessageError.fromPartial(object.messageError)
1421
+ : undefined;
1422
+ return message;
1423
+ },
1424
+ };
1425
+ function createBaseChatStreamFrame_MessageStarted() {
1426
+ return { messageId: "", role: 0 };
1427
+ }
1428
+ exports.ChatStreamFrame_MessageStarted = {
1429
+ encode(message, writer = new wire_1.BinaryWriter()) {
1430
+ if (message.messageId !== "") {
1431
+ writer.uint32(10).string(message.messageId);
1432
+ }
1433
+ if (message.role !== 0) {
1434
+ writer.uint32(16).int32(message.role);
1435
+ }
1436
+ return writer;
1437
+ },
1438
+ decode(input, length) {
1439
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1440
+ const end = length === undefined ? reader.len : reader.pos + length;
1441
+ const message = createBaseChatStreamFrame_MessageStarted();
1442
+ while (reader.pos < end) {
1443
+ const tag = reader.uint32();
1444
+ switch (tag >>> 3) {
1445
+ case 1: {
1446
+ if (tag !== 10) {
1447
+ break;
1448
+ }
1449
+ message.messageId = reader.string();
1450
+ continue;
1451
+ }
1452
+ case 2: {
1453
+ if (tag !== 16) {
1454
+ break;
1455
+ }
1456
+ message.role = reader.int32();
1457
+ continue;
1458
+ }
1459
+ }
1460
+ if ((tag & 7) === 4 || tag === 0) {
1461
+ break;
1462
+ }
1463
+ reader.skip(tag & 7);
1464
+ }
1465
+ return message;
1466
+ },
1467
+ fromJSON(object) {
1468
+ return {
1469
+ messageId: isSet(object.messageId)
1470
+ ? globalThis.String(object.messageId)
1471
+ : isSet(object.message_id)
1472
+ ? globalThis.String(object.message_id)
1473
+ : "",
1474
+ role: isSet(object.role) ? chatMessageRoleFromJSON(object.role) : 0,
1475
+ };
1476
+ },
1477
+ toJSON(message) {
1478
+ const obj = {};
1479
+ if (message.messageId !== "") {
1480
+ obj.messageId = message.messageId;
1481
+ }
1482
+ if (message.role !== 0) {
1483
+ obj.role = chatMessageRoleToJSON(message.role);
1484
+ }
1485
+ return obj;
1486
+ },
1487
+ create(base) {
1488
+ return exports.ChatStreamFrame_MessageStarted.fromPartial(base !== null && base !== void 0 ? base : {});
1489
+ },
1490
+ fromPartial(object) {
1491
+ var _a, _b;
1492
+ const message = createBaseChatStreamFrame_MessageStarted();
1493
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1494
+ message.role = (_b = object.role) !== null && _b !== void 0 ? _b : 0;
1495
+ return message;
1496
+ },
1497
+ };
1498
+ function createBaseChatStreamFrame_MessageDelta() {
1499
+ return { messageId: "", textDelta: "" };
1500
+ }
1501
+ exports.ChatStreamFrame_MessageDelta = {
1502
+ encode(message, writer = new wire_1.BinaryWriter()) {
1503
+ if (message.messageId !== "") {
1504
+ writer.uint32(10).string(message.messageId);
1505
+ }
1506
+ if (message.textDelta !== "") {
1507
+ writer.uint32(18).string(message.textDelta);
1508
+ }
1509
+ return writer;
1510
+ },
1511
+ decode(input, length) {
1512
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1513
+ const end = length === undefined ? reader.len : reader.pos + length;
1514
+ const message = createBaseChatStreamFrame_MessageDelta();
1515
+ while (reader.pos < end) {
1516
+ const tag = reader.uint32();
1517
+ switch (tag >>> 3) {
1518
+ case 1: {
1519
+ if (tag !== 10) {
1520
+ break;
1521
+ }
1522
+ message.messageId = reader.string();
1523
+ continue;
1524
+ }
1525
+ case 2: {
1526
+ if (tag !== 18) {
1527
+ break;
1528
+ }
1529
+ message.textDelta = reader.string();
1530
+ continue;
1531
+ }
1532
+ }
1533
+ if ((tag & 7) === 4 || tag === 0) {
1534
+ break;
1535
+ }
1536
+ reader.skip(tag & 7);
1537
+ }
1538
+ return message;
1539
+ },
1540
+ fromJSON(object) {
1541
+ return {
1542
+ messageId: isSet(object.messageId)
1543
+ ? globalThis.String(object.messageId)
1544
+ : isSet(object.message_id)
1545
+ ? globalThis.String(object.message_id)
1546
+ : "",
1547
+ textDelta: isSet(object.textDelta)
1548
+ ? globalThis.String(object.textDelta)
1549
+ : isSet(object.text_delta)
1550
+ ? globalThis.String(object.text_delta)
1551
+ : "",
1552
+ };
1553
+ },
1554
+ toJSON(message) {
1555
+ const obj = {};
1556
+ if (message.messageId !== "") {
1557
+ obj.messageId = message.messageId;
1558
+ }
1559
+ if (message.textDelta !== "") {
1560
+ obj.textDelta = message.textDelta;
1561
+ }
1562
+ return obj;
1563
+ },
1564
+ create(base) {
1565
+ return exports.ChatStreamFrame_MessageDelta.fromPartial(base !== null && base !== void 0 ? base : {});
1566
+ },
1567
+ fromPartial(object) {
1568
+ var _a, _b;
1569
+ const message = createBaseChatStreamFrame_MessageDelta();
1570
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1571
+ message.textDelta = (_b = object.textDelta) !== null && _b !== void 0 ? _b : "";
1572
+ return message;
1573
+ },
1574
+ };
1575
+ function createBaseChatStreamFrame_ToolCallProposed() {
1576
+ return { messageId: "", toolCallId: "", name: "", arguments: undefined, requiresApproval: false };
1577
+ }
1578
+ exports.ChatStreamFrame_ToolCallProposed = {
1579
+ encode(message, writer = new wire_1.BinaryWriter()) {
1580
+ if (message.messageId !== "") {
1581
+ writer.uint32(10).string(message.messageId);
1582
+ }
1583
+ if (message.toolCallId !== "") {
1584
+ writer.uint32(18).string(message.toolCallId);
1585
+ }
1586
+ if (message.name !== "") {
1587
+ writer.uint32(26).string(message.name);
1588
+ }
1589
+ if (message.arguments !== undefined) {
1590
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.arguments), writer.uint32(34).fork()).join();
1591
+ }
1592
+ if (message.requiresApproval !== false) {
1593
+ writer.uint32(40).bool(message.requiresApproval);
1594
+ }
1595
+ return writer;
1596
+ },
1597
+ decode(input, length) {
1598
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1599
+ const end = length === undefined ? reader.len : reader.pos + length;
1600
+ const message = createBaseChatStreamFrame_ToolCallProposed();
1601
+ while (reader.pos < end) {
1602
+ const tag = reader.uint32();
1603
+ switch (tag >>> 3) {
1604
+ case 1: {
1605
+ if (tag !== 10) {
1606
+ break;
1607
+ }
1608
+ message.messageId = reader.string();
1609
+ continue;
1610
+ }
1611
+ case 2: {
1612
+ if (tag !== 18) {
1613
+ break;
1614
+ }
1615
+ message.toolCallId = reader.string();
1616
+ continue;
1617
+ }
1618
+ case 3: {
1619
+ if (tag !== 26) {
1620
+ break;
1621
+ }
1622
+ message.name = reader.string();
1623
+ continue;
1624
+ }
1625
+ case 4: {
1626
+ if (tag !== 34) {
1627
+ break;
1628
+ }
1629
+ message.arguments = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
1630
+ continue;
1631
+ }
1632
+ case 5: {
1633
+ if (tag !== 40) {
1634
+ break;
1635
+ }
1636
+ message.requiresApproval = reader.bool();
1637
+ continue;
1638
+ }
1639
+ }
1640
+ if ((tag & 7) === 4 || tag === 0) {
1641
+ break;
1642
+ }
1643
+ reader.skip(tag & 7);
1644
+ }
1645
+ return message;
1646
+ },
1647
+ fromJSON(object) {
1648
+ return {
1649
+ messageId: isSet(object.messageId)
1650
+ ? globalThis.String(object.messageId)
1651
+ : isSet(object.message_id)
1652
+ ? globalThis.String(object.message_id)
1653
+ : "",
1654
+ toolCallId: isSet(object.toolCallId)
1655
+ ? globalThis.String(object.toolCallId)
1656
+ : isSet(object.tool_call_id)
1657
+ ? globalThis.String(object.tool_call_id)
1658
+ : "",
1659
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1660
+ arguments: isObject(object.arguments) ? object.arguments : undefined,
1661
+ requiresApproval: isSet(object.requiresApproval)
1662
+ ? globalThis.Boolean(object.requiresApproval)
1663
+ : isSet(object.requires_approval)
1664
+ ? globalThis.Boolean(object.requires_approval)
1665
+ : false,
1666
+ };
1667
+ },
1668
+ toJSON(message) {
1669
+ const obj = {};
1670
+ if (message.messageId !== "") {
1671
+ obj.messageId = message.messageId;
1672
+ }
1673
+ if (message.toolCallId !== "") {
1674
+ obj.toolCallId = message.toolCallId;
1675
+ }
1676
+ if (message.name !== "") {
1677
+ obj.name = message.name;
1678
+ }
1679
+ if (message.arguments !== undefined) {
1680
+ obj.arguments = message.arguments;
1681
+ }
1682
+ if (message.requiresApproval !== false) {
1683
+ obj.requiresApproval = message.requiresApproval;
1684
+ }
1685
+ return obj;
1686
+ },
1687
+ create(base) {
1688
+ return exports.ChatStreamFrame_ToolCallProposed.fromPartial(base !== null && base !== void 0 ? base : {});
1689
+ },
1690
+ fromPartial(object) {
1691
+ var _a, _b, _c, _d, _e;
1692
+ const message = createBaseChatStreamFrame_ToolCallProposed();
1693
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
1694
+ message.toolCallId = (_b = object.toolCallId) !== null && _b !== void 0 ? _b : "";
1695
+ message.name = (_c = object.name) !== null && _c !== void 0 ? _c : "";
1696
+ message.arguments = (_d = object.arguments) !== null && _d !== void 0 ? _d : undefined;
1697
+ message.requiresApproval = (_e = object.requiresApproval) !== null && _e !== void 0 ? _e : false;
1698
+ return message;
1699
+ },
1700
+ };
1701
+ function createBaseChatStreamFrame_ToolCallExecuting() {
1702
+ return { toolCallId: "", name: "", arguments: undefined };
1703
+ }
1704
+ exports.ChatStreamFrame_ToolCallExecuting = {
1705
+ encode(message, writer = new wire_1.BinaryWriter()) {
1706
+ if (message.toolCallId !== "") {
1707
+ writer.uint32(10).string(message.toolCallId);
1708
+ }
1709
+ if (message.name !== "") {
1710
+ writer.uint32(18).string(message.name);
1711
+ }
1712
+ if (message.arguments !== undefined) {
1713
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.arguments), writer.uint32(26).fork()).join();
1714
+ }
1715
+ return writer;
1716
+ },
1717
+ decode(input, length) {
1718
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1719
+ const end = length === undefined ? reader.len : reader.pos + length;
1720
+ const message = createBaseChatStreamFrame_ToolCallExecuting();
1721
+ while (reader.pos < end) {
1722
+ const tag = reader.uint32();
1723
+ switch (tag >>> 3) {
1724
+ case 1: {
1725
+ if (tag !== 10) {
1726
+ break;
1727
+ }
1728
+ message.toolCallId = reader.string();
1729
+ continue;
1730
+ }
1731
+ case 2: {
1732
+ if (tag !== 18) {
1733
+ break;
1734
+ }
1735
+ message.name = reader.string();
1736
+ continue;
1737
+ }
1738
+ case 3: {
1739
+ if (tag !== 26) {
1740
+ break;
1741
+ }
1742
+ message.arguments = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
1743
+ continue;
1744
+ }
1745
+ }
1746
+ if ((tag & 7) === 4 || tag === 0) {
1747
+ break;
1748
+ }
1749
+ reader.skip(tag & 7);
1750
+ }
1751
+ return message;
1752
+ },
1753
+ fromJSON(object) {
1754
+ return {
1755
+ toolCallId: isSet(object.toolCallId)
1756
+ ? globalThis.String(object.toolCallId)
1757
+ : isSet(object.tool_call_id)
1758
+ ? globalThis.String(object.tool_call_id)
1759
+ : "",
1760
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1761
+ arguments: isObject(object.arguments) ? object.arguments : undefined,
1762
+ };
1763
+ },
1764
+ toJSON(message) {
1765
+ const obj = {};
1766
+ if (message.toolCallId !== "") {
1767
+ obj.toolCallId = message.toolCallId;
1768
+ }
1769
+ if (message.name !== "") {
1770
+ obj.name = message.name;
1771
+ }
1772
+ if (message.arguments !== undefined) {
1773
+ obj.arguments = message.arguments;
1774
+ }
1775
+ return obj;
1776
+ },
1777
+ create(base) {
1778
+ return exports.ChatStreamFrame_ToolCallExecuting.fromPartial(base !== null && base !== void 0 ? base : {});
1779
+ },
1780
+ fromPartial(object) {
1781
+ var _a, _b, _c;
1782
+ const message = createBaseChatStreamFrame_ToolCallExecuting();
1783
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1784
+ message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
1785
+ message.arguments = (_c = object.arguments) !== null && _c !== void 0 ? _c : undefined;
1786
+ return message;
1787
+ },
1788
+ };
1789
+ function createBaseChatStreamFrame_ToolCallResult() {
1790
+ return { toolCallId: "", status: "", summary: "" };
1791
+ }
1792
+ exports.ChatStreamFrame_ToolCallResult = {
1793
+ encode(message, writer = new wire_1.BinaryWriter()) {
1794
+ if (message.toolCallId !== "") {
1795
+ writer.uint32(10).string(message.toolCallId);
1796
+ }
1797
+ if (message.status !== "") {
1798
+ writer.uint32(18).string(message.status);
1799
+ }
1800
+ if (message.summary !== "") {
1801
+ writer.uint32(26).string(message.summary);
1802
+ }
1803
+ return writer;
1804
+ },
1805
+ decode(input, length) {
1806
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1807
+ const end = length === undefined ? reader.len : reader.pos + length;
1808
+ const message = createBaseChatStreamFrame_ToolCallResult();
1809
+ while (reader.pos < end) {
1810
+ const tag = reader.uint32();
1811
+ switch (tag >>> 3) {
1812
+ case 1: {
1813
+ if (tag !== 10) {
1814
+ break;
1815
+ }
1816
+ message.toolCallId = reader.string();
1817
+ continue;
1818
+ }
1819
+ case 2: {
1820
+ if (tag !== 18) {
1821
+ break;
1822
+ }
1823
+ message.status = reader.string();
1824
+ continue;
1825
+ }
1826
+ case 3: {
1827
+ if (tag !== 26) {
1828
+ break;
1829
+ }
1830
+ message.summary = reader.string();
1831
+ continue;
1832
+ }
1833
+ }
1834
+ if ((tag & 7) === 4 || tag === 0) {
1835
+ break;
1836
+ }
1837
+ reader.skip(tag & 7);
1838
+ }
1839
+ return message;
1840
+ },
1841
+ fromJSON(object) {
1842
+ return {
1843
+ toolCallId: isSet(object.toolCallId)
1844
+ ? globalThis.String(object.toolCallId)
1845
+ : isSet(object.tool_call_id)
1846
+ ? globalThis.String(object.tool_call_id)
1847
+ : "",
1848
+ status: isSet(object.status) ? globalThis.String(object.status) : "",
1849
+ summary: isSet(object.summary) ? globalThis.String(object.summary) : "",
1850
+ };
1851
+ },
1852
+ toJSON(message) {
1853
+ const obj = {};
1854
+ if (message.toolCallId !== "") {
1855
+ obj.toolCallId = message.toolCallId;
1856
+ }
1857
+ if (message.status !== "") {
1858
+ obj.status = message.status;
1859
+ }
1860
+ if (message.summary !== "") {
1861
+ obj.summary = message.summary;
1862
+ }
1863
+ return obj;
1864
+ },
1865
+ create(base) {
1866
+ return exports.ChatStreamFrame_ToolCallResult.fromPartial(base !== null && base !== void 0 ? base : {});
1867
+ },
1868
+ fromPartial(object) {
1869
+ var _a, _b, _c;
1870
+ const message = createBaseChatStreamFrame_ToolCallResult();
1871
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1872
+ message.status = (_b = object.status) !== null && _b !== void 0 ? _b : "";
1873
+ message.summary = (_c = object.summary) !== null && _c !== void 0 ? _c : "";
1874
+ return message;
1875
+ },
1876
+ };
1877
+ function createBaseChatStreamFrame_ToolCallRejected() {
1878
+ return { toolCallId: "", reason: "" };
1879
+ }
1880
+ exports.ChatStreamFrame_ToolCallRejected = {
1881
+ encode(message, writer = new wire_1.BinaryWriter()) {
1882
+ if (message.toolCallId !== "") {
1883
+ writer.uint32(10).string(message.toolCallId);
1884
+ }
1885
+ if (message.reason !== "") {
1886
+ writer.uint32(18).string(message.reason);
1887
+ }
1888
+ return writer;
1889
+ },
1890
+ decode(input, length) {
1891
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1892
+ const end = length === undefined ? reader.len : reader.pos + length;
1893
+ const message = createBaseChatStreamFrame_ToolCallRejected();
1894
+ while (reader.pos < end) {
1895
+ const tag = reader.uint32();
1896
+ switch (tag >>> 3) {
1897
+ case 1: {
1898
+ if (tag !== 10) {
1899
+ break;
1900
+ }
1901
+ message.toolCallId = reader.string();
1902
+ continue;
1903
+ }
1904
+ case 2: {
1905
+ if (tag !== 18) {
1906
+ break;
1907
+ }
1908
+ message.reason = reader.string();
1909
+ continue;
1910
+ }
1911
+ }
1912
+ if ((tag & 7) === 4 || tag === 0) {
1913
+ break;
1914
+ }
1915
+ reader.skip(tag & 7);
1916
+ }
1917
+ return message;
1918
+ },
1919
+ fromJSON(object) {
1920
+ return {
1921
+ toolCallId: isSet(object.toolCallId)
1922
+ ? globalThis.String(object.toolCallId)
1923
+ : isSet(object.tool_call_id)
1924
+ ? globalThis.String(object.tool_call_id)
1925
+ : "",
1926
+ reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
1927
+ };
1928
+ },
1929
+ toJSON(message) {
1930
+ const obj = {};
1931
+ if (message.toolCallId !== "") {
1932
+ obj.toolCallId = message.toolCallId;
1933
+ }
1934
+ if (message.reason !== "") {
1935
+ obj.reason = message.reason;
1936
+ }
1937
+ return obj;
1938
+ },
1939
+ create(base) {
1940
+ return exports.ChatStreamFrame_ToolCallRejected.fromPartial(base !== null && base !== void 0 ? base : {});
1941
+ },
1942
+ fromPartial(object) {
1943
+ var _a, _b;
1944
+ const message = createBaseChatStreamFrame_ToolCallRejected();
1945
+ message.toolCallId = (_a = object.toolCallId) !== null && _a !== void 0 ? _a : "";
1946
+ message.reason = (_b = object.reason) !== null && _b !== void 0 ? _b : "";
1947
+ return message;
1948
+ },
1949
+ };
1950
+ function createBaseChatStreamFrame_ArtifactCreated() {
1951
+ return { artifactId: "", title: "", kind: 0, version: 0 };
1952
+ }
1953
+ exports.ChatStreamFrame_ArtifactCreated = {
1954
+ encode(message, writer = new wire_1.BinaryWriter()) {
1955
+ if (message.artifactId !== "") {
1956
+ writer.uint32(10).string(message.artifactId);
1957
+ }
1958
+ if (message.title !== "") {
1959
+ writer.uint32(18).string(message.title);
1960
+ }
1961
+ if (message.kind !== 0) {
1962
+ writer.uint32(24).int32(message.kind);
1963
+ }
1964
+ if (message.version !== 0) {
1965
+ writer.uint32(32).int32(message.version);
1966
+ }
1967
+ return writer;
1968
+ },
1969
+ decode(input, length) {
1970
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1971
+ const end = length === undefined ? reader.len : reader.pos + length;
1972
+ const message = createBaseChatStreamFrame_ArtifactCreated();
1973
+ while (reader.pos < end) {
1974
+ const tag = reader.uint32();
1975
+ switch (tag >>> 3) {
1976
+ case 1: {
1977
+ if (tag !== 10) {
1978
+ break;
1979
+ }
1980
+ message.artifactId = reader.string();
1981
+ continue;
1982
+ }
1983
+ case 2: {
1984
+ if (tag !== 18) {
1985
+ break;
1986
+ }
1987
+ message.title = reader.string();
1988
+ continue;
1989
+ }
1990
+ case 3: {
1991
+ if (tag !== 24) {
1992
+ break;
1993
+ }
1994
+ message.kind = reader.int32();
1995
+ continue;
1996
+ }
1997
+ case 4: {
1998
+ if (tag !== 32) {
1999
+ break;
2000
+ }
2001
+ message.version = reader.int32();
2002
+ continue;
2003
+ }
2004
+ }
2005
+ if ((tag & 7) === 4 || tag === 0) {
2006
+ break;
2007
+ }
2008
+ reader.skip(tag & 7);
2009
+ }
2010
+ return message;
2011
+ },
2012
+ fromJSON(object) {
2013
+ return {
2014
+ artifactId: isSet(object.artifactId)
2015
+ ? globalThis.String(object.artifactId)
2016
+ : isSet(object.artifact_id)
2017
+ ? globalThis.String(object.artifact_id)
2018
+ : "",
2019
+ title: isSet(object.title) ? globalThis.String(object.title) : "",
2020
+ kind: isSet(object.kind) ? chatArtifactKindFromJSON(object.kind) : 0,
2021
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
2022
+ };
2023
+ },
2024
+ toJSON(message) {
2025
+ const obj = {};
2026
+ if (message.artifactId !== "") {
2027
+ obj.artifactId = message.artifactId;
2028
+ }
2029
+ if (message.title !== "") {
2030
+ obj.title = message.title;
2031
+ }
2032
+ if (message.kind !== 0) {
2033
+ obj.kind = chatArtifactKindToJSON(message.kind);
2034
+ }
2035
+ if (message.version !== 0) {
2036
+ obj.version = Math.round(message.version);
2037
+ }
2038
+ return obj;
2039
+ },
2040
+ create(base) {
2041
+ return exports.ChatStreamFrame_ArtifactCreated.fromPartial(base !== null && base !== void 0 ? base : {});
2042
+ },
2043
+ fromPartial(object) {
2044
+ var _a, _b, _c, _d;
2045
+ const message = createBaseChatStreamFrame_ArtifactCreated();
2046
+ message.artifactId = (_a = object.artifactId) !== null && _a !== void 0 ? _a : "";
2047
+ message.title = (_b = object.title) !== null && _b !== void 0 ? _b : "";
2048
+ message.kind = (_c = object.kind) !== null && _c !== void 0 ? _c : 0;
2049
+ message.version = (_d = object.version) !== null && _d !== void 0 ? _d : 0;
2050
+ return message;
2051
+ },
2052
+ };
2053
+ function createBaseChatStreamFrame_ArtifactUpdated() {
2054
+ return { artifactId: "", version: 0 };
2055
+ }
2056
+ exports.ChatStreamFrame_ArtifactUpdated = {
2057
+ encode(message, writer = new wire_1.BinaryWriter()) {
2058
+ if (message.artifactId !== "") {
2059
+ writer.uint32(10).string(message.artifactId);
2060
+ }
2061
+ if (message.version !== 0) {
2062
+ writer.uint32(16).int32(message.version);
2063
+ }
2064
+ return writer;
2065
+ },
2066
+ decode(input, length) {
2067
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2068
+ const end = length === undefined ? reader.len : reader.pos + length;
2069
+ const message = createBaseChatStreamFrame_ArtifactUpdated();
2070
+ while (reader.pos < end) {
2071
+ const tag = reader.uint32();
2072
+ switch (tag >>> 3) {
2073
+ case 1: {
2074
+ if (tag !== 10) {
2075
+ break;
2076
+ }
2077
+ message.artifactId = reader.string();
2078
+ continue;
2079
+ }
2080
+ case 2: {
2081
+ if (tag !== 16) {
2082
+ break;
2083
+ }
2084
+ message.version = reader.int32();
2085
+ continue;
2086
+ }
2087
+ }
2088
+ if ((tag & 7) === 4 || tag === 0) {
2089
+ break;
2090
+ }
2091
+ reader.skip(tag & 7);
2092
+ }
2093
+ return message;
2094
+ },
2095
+ fromJSON(object) {
2096
+ return {
2097
+ artifactId: isSet(object.artifactId)
2098
+ ? globalThis.String(object.artifactId)
2099
+ : isSet(object.artifact_id)
2100
+ ? globalThis.String(object.artifact_id)
2101
+ : "",
2102
+ version: isSet(object.version) ? globalThis.Number(object.version) : 0,
2103
+ };
2104
+ },
2105
+ toJSON(message) {
2106
+ const obj = {};
2107
+ if (message.artifactId !== "") {
2108
+ obj.artifactId = message.artifactId;
2109
+ }
2110
+ if (message.version !== 0) {
2111
+ obj.version = Math.round(message.version);
2112
+ }
2113
+ return obj;
2114
+ },
2115
+ create(base) {
2116
+ return exports.ChatStreamFrame_ArtifactUpdated.fromPartial(base !== null && base !== void 0 ? base : {});
2117
+ },
2118
+ fromPartial(object) {
2119
+ var _a, _b;
2120
+ const message = createBaseChatStreamFrame_ArtifactUpdated();
2121
+ message.artifactId = (_a = object.artifactId) !== null && _a !== void 0 ? _a : "";
2122
+ message.version = (_b = object.version) !== null && _b !== void 0 ? _b : 0;
2123
+ return message;
2124
+ },
2125
+ };
2126
+ function createBaseChatStreamFrame_MessageComplete() {
2127
+ return { messageId: "", tokenUsage: undefined };
2128
+ }
2129
+ exports.ChatStreamFrame_MessageComplete = {
2130
+ encode(message, writer = new wire_1.BinaryWriter()) {
2131
+ if (message.messageId !== "") {
2132
+ writer.uint32(10).string(message.messageId);
2133
+ }
2134
+ if (message.tokenUsage !== undefined) {
2135
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.tokenUsage), writer.uint32(18).fork()).join();
2136
+ }
2137
+ return writer;
2138
+ },
2139
+ decode(input, length) {
2140
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2141
+ const end = length === undefined ? reader.len : reader.pos + length;
2142
+ const message = createBaseChatStreamFrame_MessageComplete();
2143
+ while (reader.pos < end) {
2144
+ const tag = reader.uint32();
2145
+ switch (tag >>> 3) {
2146
+ case 1: {
2147
+ if (tag !== 10) {
2148
+ break;
2149
+ }
2150
+ message.messageId = reader.string();
2151
+ continue;
2152
+ }
2153
+ case 2: {
2154
+ if (tag !== 18) {
2155
+ break;
2156
+ }
2157
+ message.tokenUsage = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
2158
+ continue;
2159
+ }
2160
+ }
2161
+ if ((tag & 7) === 4 || tag === 0) {
2162
+ break;
2163
+ }
2164
+ reader.skip(tag & 7);
2165
+ }
2166
+ return message;
2167
+ },
2168
+ fromJSON(object) {
2169
+ return {
2170
+ messageId: isSet(object.messageId)
2171
+ ? globalThis.String(object.messageId)
2172
+ : isSet(object.message_id)
2173
+ ? globalThis.String(object.message_id)
2174
+ : "",
2175
+ tokenUsage: isObject(object.tokenUsage)
2176
+ ? object.tokenUsage
2177
+ : isObject(object.token_usage)
2178
+ ? object.token_usage
2179
+ : undefined,
2180
+ };
2181
+ },
2182
+ toJSON(message) {
2183
+ const obj = {};
2184
+ if (message.messageId !== "") {
2185
+ obj.messageId = message.messageId;
2186
+ }
2187
+ if (message.tokenUsage !== undefined) {
2188
+ obj.tokenUsage = message.tokenUsage;
2189
+ }
2190
+ return obj;
2191
+ },
2192
+ create(base) {
2193
+ return exports.ChatStreamFrame_MessageComplete.fromPartial(base !== null && base !== void 0 ? base : {});
2194
+ },
2195
+ fromPartial(object) {
2196
+ var _a, _b;
2197
+ const message = createBaseChatStreamFrame_MessageComplete();
2198
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
2199
+ message.tokenUsage = (_b = object.tokenUsage) !== null && _b !== void 0 ? _b : undefined;
2200
+ return message;
2201
+ },
2202
+ };
2203
+ function createBaseChatStreamFrame_MessageError() {
2204
+ return { messageId: "", code: "", message: "" };
2205
+ }
2206
+ exports.ChatStreamFrame_MessageError = {
2207
+ encode(message, writer = new wire_1.BinaryWriter()) {
2208
+ if (message.messageId !== "") {
2209
+ writer.uint32(10).string(message.messageId);
2210
+ }
2211
+ if (message.code !== "") {
2212
+ writer.uint32(18).string(message.code);
2213
+ }
2214
+ if (message.message !== "") {
2215
+ writer.uint32(26).string(message.message);
2216
+ }
2217
+ return writer;
2218
+ },
2219
+ decode(input, length) {
2220
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2221
+ const end = length === undefined ? reader.len : reader.pos + length;
2222
+ const message = createBaseChatStreamFrame_MessageError();
2223
+ while (reader.pos < end) {
2224
+ const tag = reader.uint32();
2225
+ switch (tag >>> 3) {
2226
+ case 1: {
2227
+ if (tag !== 10) {
2228
+ break;
2229
+ }
2230
+ message.messageId = reader.string();
2231
+ continue;
2232
+ }
2233
+ case 2: {
2234
+ if (tag !== 18) {
2235
+ break;
2236
+ }
2237
+ message.code = reader.string();
2238
+ continue;
2239
+ }
2240
+ case 3: {
2241
+ if (tag !== 26) {
2242
+ break;
2243
+ }
2244
+ message.message = reader.string();
2245
+ continue;
2246
+ }
2247
+ }
2248
+ if ((tag & 7) === 4 || tag === 0) {
2249
+ break;
2250
+ }
2251
+ reader.skip(tag & 7);
2252
+ }
2253
+ return message;
2254
+ },
2255
+ fromJSON(object) {
2256
+ return {
2257
+ messageId: isSet(object.messageId)
2258
+ ? globalThis.String(object.messageId)
2259
+ : isSet(object.message_id)
2260
+ ? globalThis.String(object.message_id)
2261
+ : "",
2262
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
2263
+ message: isSet(object.message) ? globalThis.String(object.message) : "",
2264
+ };
2265
+ },
2266
+ toJSON(message) {
2267
+ const obj = {};
2268
+ if (message.messageId !== "") {
2269
+ obj.messageId = message.messageId;
2270
+ }
2271
+ if (message.code !== "") {
2272
+ obj.code = message.code;
2273
+ }
2274
+ if (message.message !== "") {
2275
+ obj.message = message.message;
2276
+ }
2277
+ return obj;
2278
+ },
2279
+ create(base) {
2280
+ return exports.ChatStreamFrame_MessageError.fromPartial(base !== null && base !== void 0 ? base : {});
2281
+ },
2282
+ fromPartial(object) {
2283
+ var _a, _b, _c;
2284
+ const message = createBaseChatStreamFrame_MessageError();
2285
+ message.messageId = (_a = object.messageId) !== null && _a !== void 0 ? _a : "";
2286
+ message.code = (_b = object.code) !== null && _b !== void 0 ? _b : "";
2287
+ message.message = (_c = object.message) !== null && _c !== void 0 ? _c : "";
2288
+ return message;
2289
+ },
2290
+ };
2291
+ function bytesFromBase64(b64) {
2292
+ if (globalThis.Buffer) {
2293
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
2294
+ }
2295
+ else {
2296
+ const bin = globalThis.atob(b64);
2297
+ const arr = new Uint8Array(bin.length);
2298
+ for (let i = 0; i < bin.length; ++i) {
2299
+ arr[i] = bin.charCodeAt(i);
2300
+ }
2301
+ return arr;
2302
+ }
2303
+ }
2304
+ function base64FromBytes(arr) {
2305
+ if (globalThis.Buffer) {
2306
+ return globalThis.Buffer.from(arr).toString("base64");
2307
+ }
2308
+ else {
2309
+ const bin = [];
2310
+ arr.forEach((byte) => {
2311
+ bin.push(globalThis.String.fromCharCode(byte));
2312
+ });
2313
+ return globalThis.btoa(bin.join(""));
2314
+ }
2315
+ }
2316
+ function toTimestamp(date) {
2317
+ const seconds = Math.trunc(date.getTime() / 1000);
2318
+ const nanos = (date.getTime() % 1000) * 1000000;
2319
+ return { seconds, nanos };
2320
+ }
2321
+ function fromTimestamp(t) {
2322
+ let millis = (t.seconds || 0) * 1000;
2323
+ millis += (t.nanos || 0) / 1000000;
2324
+ return new globalThis.Date(millis);
2325
+ }
2326
+ function fromJsonTimestamp(o) {
2327
+ if (o instanceof globalThis.Date) {
2328
+ return o;
2329
+ }
2330
+ else if (typeof o === "string") {
2331
+ return new globalThis.Date(o);
2332
+ }
2333
+ else {
2334
+ return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
2335
+ }
2336
+ }
2337
+ function isObject(value) {
2338
+ return typeof value === "object" && value !== null;
2339
+ }
2340
+ function isSet(value) {
2341
+ return value !== null && value !== undefined;
2342
+ }