@world-engines/protocol-ts 0.1.0-alpha.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.
Files changed (74) hide show
  1. package/LICENSE +46 -0
  2. package/dist/entity-prop-envelope.d.ts +36 -0
  3. package/dist/entity-prop-envelope.js +50 -0
  4. package/dist/gen/v1/auth.d.ts +46 -0
  5. package/dist/gen/v1/auth.js +278 -0
  6. package/dist/gen/v1/billing.d.ts +71 -0
  7. package/dist/gen/v1/billing.js +521 -0
  8. package/dist/gen/v1/common.d.ts +65 -0
  9. package/dist/gen/v1/common.js +387 -0
  10. package/dist/gen/v1/llm.d.ts +317 -0
  11. package/dist/gen/v1/llm.js +3557 -0
  12. package/dist/gen/v1/mcp.d.ts +373 -0
  13. package/dist/gen/v1/mcp.js +3190 -0
  14. package/dist/gen/v1/moderation.d.ts +51 -0
  15. package/dist/gen/v1/moderation.js +368 -0
  16. package/dist/gen/v1/neutral_scenario_source.d.ts +80 -0
  17. package/dist/gen/v1/neutral_scenario_source.js +569 -0
  18. package/dist/gen/v1/relation_kind.d.ts +105 -0
  19. package/dist/gen/v1/relation_kind.js +562 -0
  20. package/dist/gen/v1/rest/admin.d.ts +432 -0
  21. package/dist/gen/v1/rest/admin.js +4957 -0
  22. package/dist/gen/v1/rest/asset.d.ts +205 -0
  23. package/dist/gen/v1/rest/asset.js +2200 -0
  24. package/dist/gen/v1/rest/auth.d.ts +275 -0
  25. package/dist/gen/v1/rest/auth.js +2896 -0
  26. package/dist/gen/v1/rest/billing.d.ts +101 -0
  27. package/dist/gen/v1/rest/billing.js +866 -0
  28. package/dist/gen/v1/rest/common.d.ts +179 -0
  29. package/dist/gen/v1/rest/common.js +1358 -0
  30. package/dist/gen/v1/rest/creator.d.ts +354 -0
  31. package/dist/gen/v1/rest/creator.js +4169 -0
  32. package/dist/gen/v1/rest/messaging.d.ts +190 -0
  33. package/dist/gen/v1/rest/messaging.js +2017 -0
  34. package/dist/gen/v1/rest/moderation.d.ts +61 -0
  35. package/dist/gen/v1/rest/moderation.js +569 -0
  36. package/dist/gen/v1/rest/pet.d.ts +98 -0
  37. package/dist/gen/v1/rest/pet.js +698 -0
  38. package/dist/gen/v1/rest/project_transfer.d.ts +470 -0
  39. package/dist/gen/v1/rest/project_transfer.js +5266 -0
  40. package/dist/gen/v1/rest/scenario.d.ts +756 -0
  41. package/dist/gen/v1/rest/scenario.js +8768 -0
  42. package/dist/gen/v1/rest/stock_bounty.d.ts +154 -0
  43. package/dist/gen/v1/rest/stock_bounty.js +1547 -0
  44. package/dist/gen/v1/rest/stocks.d.ts +465 -0
  45. package/dist/gen/v1/rest/stocks.js +5200 -0
  46. package/dist/gen/v1/rest/support_ticket.d.ts +61 -0
  47. package/dist/gen/v1/rest/support_ticket.js +511 -0
  48. package/dist/gen/v1/rest/users.d.ts +292 -0
  49. package/dist/gen/v1/rest/users.js +2879 -0
  50. package/dist/gen/v1/rest/violations.d.ts +52 -0
  51. package/dist/gen/v1/rest/violations.js +338 -0
  52. package/dist/gen/v1/sav.d.ts +987 -0
  53. package/dist/gen/v1/sav.js +12327 -0
  54. package/dist/gen/v1/save.d.ts +68 -0
  55. package/dist/gen/v1/save.js +595 -0
  56. package/dist/gen/v1/scenario_part_source.d.ts +94 -0
  57. package/dist/gen/v1/scenario_part_source.js +913 -0
  58. package/dist/gen/v1/session.d.ts +49 -0
  59. package/dist/gen/v1/session.js +311 -0
  60. package/dist/gen/v1/view_state.d.ts +267 -0
  61. package/dist/gen/v1/view_state.js +3239 -0
  62. package/dist/gen/v1/world.d.ts +82 -0
  63. package/dist/gen/v1/world.js +707 -0
  64. package/dist/gen/v1/world_memory.d.ts +545 -0
  65. package/dist/gen/v1/world_memory.js +5816 -0
  66. package/dist/gen/v1/world_memory_privacy.d.ts +96 -0
  67. package/dist/gen/v1/world_memory_privacy.js +994 -0
  68. package/dist/gen/v1/ws_frame.d.ts +1626 -0
  69. package/dist/gen/v1/ws_frame.js +18253 -0
  70. package/dist/index.d.ts +2 -0
  71. package/dist/index.js +5 -0
  72. package/dist/ladybug-extraction.d.ts +36 -0
  73. package/dist/ladybug-extraction.js +1 -0
  74. package/package.json +65 -0
@@ -0,0 +1,3190 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc unknown
5
+ // source: v1/mcp.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { ErrorInfo } from "./common.js";
9
+ /**
10
+ * 渐进式召回的截断原因。调用方必须把 UNSPECIFIED 与 truncated=false 绑定;
11
+ * truncated=true 时原因必须非 UNSPECIFIED,禁止把预算耗尽伪装成完整结果。
12
+ */
13
+ export var RetrievalTruncationReason;
14
+ (function (RetrievalTruncationReason) {
15
+ RetrievalTruncationReason[RetrievalTruncationReason["RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED"] = 0] = "RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED";
16
+ RetrievalTruncationReason[RetrievalTruncationReason["RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET"] = 1] = "RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET";
17
+ RetrievalTruncationReason[RetrievalTruncationReason["RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT"] = 2] = "RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT";
18
+ RetrievalTruncationReason[RetrievalTruncationReason["RETRIEVAL_TRUNCATION_REASON_DEADLINE"] = 3] = "RETRIEVAL_TRUNCATION_REASON_DEADLINE";
19
+ RetrievalTruncationReason[RetrievalTruncationReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
+ })(RetrievalTruncationReason || (RetrievalTruncationReason = {}));
21
+ export function retrievalTruncationReasonFromJSON(object) {
22
+ switch (object) {
23
+ case 0:
24
+ case "RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED":
25
+ return RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED;
26
+ case 1:
27
+ case "RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET":
28
+ return RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET;
29
+ case 2:
30
+ case "RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT":
31
+ return RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT;
32
+ case 3:
33
+ case "RETRIEVAL_TRUNCATION_REASON_DEADLINE":
34
+ return RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_DEADLINE;
35
+ case -1:
36
+ case "UNRECOGNIZED":
37
+ default:
38
+ return RetrievalTruncationReason.UNRECOGNIZED;
39
+ }
40
+ }
41
+ export function retrievalTruncationReasonToJSON(object) {
42
+ switch (object) {
43
+ case RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED:
44
+ return "RETRIEVAL_TRUNCATION_REASON_UNSPECIFIED";
45
+ case RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET:
46
+ return "RETRIEVAL_TRUNCATION_REASON_BYTE_BUDGET";
47
+ case RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT:
48
+ return "RETRIEVAL_TRUNCATION_REASON_RESULT_LIMIT";
49
+ case RetrievalTruncationReason.RETRIEVAL_TRUNCATION_REASON_DEADLINE:
50
+ return "RETRIEVAL_TRUNCATION_REASON_DEADLINE";
51
+ case RetrievalTruncationReason.UNRECOGNIZED:
52
+ default:
53
+ return "UNRECOGNIZED";
54
+ }
55
+ }
56
+ export var RetrievalMatchArm;
57
+ (function (RetrievalMatchArm) {
58
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_UNSPECIFIED"] = 0] = "RETRIEVAL_MATCH_ARM_UNSPECIFIED";
59
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_VECTOR"] = 1] = "RETRIEVAL_MATCH_ARM_VECTOR";
60
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_KEYWORD"] = 2] = "RETRIEVAL_MATCH_ARM_KEYWORD";
61
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_RELATIONAL"] = 3] = "RETRIEVAL_MATCH_ARM_RELATIONAL";
62
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_TRIE"] = 4] = "RETRIEVAL_MATCH_ARM_TRIE";
63
+ RetrievalMatchArm[RetrievalMatchArm["RETRIEVAL_MATCH_ARM_NGRAM"] = 5] = "RETRIEVAL_MATCH_ARM_NGRAM";
64
+ RetrievalMatchArm[RetrievalMatchArm["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
65
+ })(RetrievalMatchArm || (RetrievalMatchArm = {}));
66
+ export function retrievalMatchArmFromJSON(object) {
67
+ switch (object) {
68
+ case 0:
69
+ case "RETRIEVAL_MATCH_ARM_UNSPECIFIED":
70
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_UNSPECIFIED;
71
+ case 1:
72
+ case "RETRIEVAL_MATCH_ARM_VECTOR":
73
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_VECTOR;
74
+ case 2:
75
+ case "RETRIEVAL_MATCH_ARM_KEYWORD":
76
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_KEYWORD;
77
+ case 3:
78
+ case "RETRIEVAL_MATCH_ARM_RELATIONAL":
79
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_RELATIONAL;
80
+ case 4:
81
+ case "RETRIEVAL_MATCH_ARM_TRIE":
82
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_TRIE;
83
+ case 5:
84
+ case "RETRIEVAL_MATCH_ARM_NGRAM":
85
+ return RetrievalMatchArm.RETRIEVAL_MATCH_ARM_NGRAM;
86
+ case -1:
87
+ case "UNRECOGNIZED":
88
+ default:
89
+ return RetrievalMatchArm.UNRECOGNIZED;
90
+ }
91
+ }
92
+ export function retrievalMatchArmToJSON(object) {
93
+ switch (object) {
94
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_UNSPECIFIED:
95
+ return "RETRIEVAL_MATCH_ARM_UNSPECIFIED";
96
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_VECTOR:
97
+ return "RETRIEVAL_MATCH_ARM_VECTOR";
98
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_KEYWORD:
99
+ return "RETRIEVAL_MATCH_ARM_KEYWORD";
100
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_RELATIONAL:
101
+ return "RETRIEVAL_MATCH_ARM_RELATIONAL";
102
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_TRIE:
103
+ return "RETRIEVAL_MATCH_ARM_TRIE";
104
+ case RetrievalMatchArm.RETRIEVAL_MATCH_ARM_NGRAM:
105
+ return "RETRIEVAL_MATCH_ARM_NGRAM";
106
+ case RetrievalMatchArm.UNRECOGNIZED:
107
+ default:
108
+ return "UNRECOGNIZED";
109
+ }
110
+ }
111
+ export var RecallRealworldProvenance;
112
+ (function (RecallRealworldProvenance) {
113
+ RecallRealworldProvenance[RecallRealworldProvenance["RECALL_REALWORLD_PROVENANCE_UNSPECIFIED"] = 0] = "RECALL_REALWORLD_PROVENANCE_UNSPECIFIED";
114
+ RecallRealworldProvenance[RecallRealworldProvenance["RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE"] = 1] = "RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE";
115
+ RecallRealworldProvenance[RecallRealworldProvenance["RECALL_REALWORLD_PROVENANCE_FICTIONAL"] = 2] = "RECALL_REALWORLD_PROVENANCE_FICTIONAL";
116
+ RecallRealworldProvenance[RecallRealworldProvenance["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
117
+ })(RecallRealworldProvenance || (RecallRealworldProvenance = {}));
118
+ export function recallRealworldProvenanceFromJSON(object) {
119
+ switch (object) {
120
+ case 0:
121
+ case "RECALL_REALWORLD_PROVENANCE_UNSPECIFIED":
122
+ return RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_UNSPECIFIED;
123
+ case 1:
124
+ case "RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE":
125
+ return RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE;
126
+ case 2:
127
+ case "RECALL_REALWORLD_PROVENANCE_FICTIONAL":
128
+ return RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_FICTIONAL;
129
+ case -1:
130
+ case "UNRECOGNIZED":
131
+ default:
132
+ return RecallRealworldProvenance.UNRECOGNIZED;
133
+ }
134
+ }
135
+ export function recallRealworldProvenanceToJSON(object) {
136
+ switch (object) {
137
+ case RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_UNSPECIFIED:
138
+ return "RECALL_REALWORLD_PROVENANCE_UNSPECIFIED";
139
+ case RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE:
140
+ return "RECALL_REALWORLD_PROVENANCE_HAS_PROTOTYPE";
141
+ case RecallRealworldProvenance.RECALL_REALWORLD_PROVENANCE_FICTIONAL:
142
+ return "RECALL_REALWORLD_PROVENANCE_FICTIONAL";
143
+ case RecallRealworldProvenance.UNRECOGNIZED:
144
+ default:
145
+ return "UNRECOGNIZED";
146
+ }
147
+ }
148
+ export var McpTool;
149
+ (function (McpTool) {
150
+ McpTool[McpTool["MCP_TOOL_UNSPECIFIED"] = 0] = "MCP_TOOL_UNSPECIFIED";
151
+ /** MCP_TOOL_GRAPH_QUERY - 玩家图向量 db 查询 */
152
+ McpTool[McpTool["MCP_TOOL_GRAPH_QUERY"] = 1] = "MCP_TOOL_GRAPH_QUERY";
153
+ /** MCP_TOOL_VECTOR_SEARCH - 向量近邻搜索 */
154
+ McpTool[McpTool["MCP_TOOL_VECTOR_SEARCH"] = 2] = "MCP_TOOL_VECTOR_SEARCH";
155
+ /** MCP_TOOL_FULL_TEXT_SEARCH - 全文搜索 */
156
+ McpTool[McpTool["MCP_TOOL_FULL_TEXT_SEARCH"] = 3] = "MCP_TOOL_FULL_TEXT_SEARCH";
157
+ /** MCP_TOOL_ENTITY_GET - 按 id 取实体 */
158
+ McpTool[McpTool["MCP_TOOL_ENTITY_GET"] = 4] = "MCP_TOOL_ENTITY_GET";
159
+ /** MCP_TOOL_RELATION_LIST - 列实体的关系 */
160
+ McpTool[McpTool["MCP_TOOL_RELATION_LIST"] = 5] = "MCP_TOOL_RELATION_LIST";
161
+ /** MCP_TOOL_SAVE_COMMIT_LOCK - 存档冲突仲裁前置锁 */
162
+ McpTool[McpTool["MCP_TOOL_SAVE_COMMIT_LOCK"] = 6] = "MCP_TOOL_SAVE_COMMIT_LOCK";
163
+ /** MCP_TOOL_WORLD_EVENT_EMIT - 写入世界事件 */
164
+ McpTool[McpTool["MCP_TOOL_WORLD_EVENT_EMIT"] = 7] = "MCP_TOOL_WORLD_EVENT_EMIT";
165
+ /** MCP_TOOL_GRAPH_RAG_SEARCH - GraphRAG 组合检索 */
166
+ McpTool[McpTool["MCP_TOOL_GRAPH_RAG_SEARCH"] = 8] = "MCP_TOOL_GRAPH_RAG_SEARCH";
167
+ /** MCP_TOOL_EXPLORE_WORLD - director 高层探索 服务端拦截路由到子代理 不反向穿透客户端 */
168
+ McpTool[McpTool["MCP_TOOL_EXPLORE_WORLD"] = 9] = "MCP_TOOL_EXPLORE_WORLD";
169
+ /** MCP_TOOL_PROPOSE_ACTION - 多人场景行动提案 Phase2 接线 服务端拦截不反向穿透客户端 */
170
+ McpTool[McpTool["MCP_TOOL_PROPOSE_ACTION"] = 10] = "MCP_TOOL_PROPOSE_ACTION";
171
+ /** MCP_TOOL_SCENE_CLAIM - 场景占用声明 客户端 WS 帧驱动 非导演工具 (ADR-0058 wire 冻结保留 ADR-0059 导演只用 propose_action) */
172
+ McpTool[McpTool["MCP_TOOL_SCENE_CLAIM"] = 11] = "MCP_TOOL_SCENE_CLAIM";
173
+ /** MCP_TOOL_TURN_ACQUIRE - 回合获取 客户端 WS 帧驱动 非导演工具 */
174
+ McpTool[McpTool["MCP_TOOL_TURN_ACQUIRE"] = 12] = "MCP_TOOL_TURN_ACQUIRE";
175
+ McpTool[McpTool["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
176
+ })(McpTool || (McpTool = {}));
177
+ export function mcpToolFromJSON(object) {
178
+ switch (object) {
179
+ case 0:
180
+ case "MCP_TOOL_UNSPECIFIED":
181
+ return McpTool.MCP_TOOL_UNSPECIFIED;
182
+ case 1:
183
+ case "MCP_TOOL_GRAPH_QUERY":
184
+ return McpTool.MCP_TOOL_GRAPH_QUERY;
185
+ case 2:
186
+ case "MCP_TOOL_VECTOR_SEARCH":
187
+ return McpTool.MCP_TOOL_VECTOR_SEARCH;
188
+ case 3:
189
+ case "MCP_TOOL_FULL_TEXT_SEARCH":
190
+ return McpTool.MCP_TOOL_FULL_TEXT_SEARCH;
191
+ case 4:
192
+ case "MCP_TOOL_ENTITY_GET":
193
+ return McpTool.MCP_TOOL_ENTITY_GET;
194
+ case 5:
195
+ case "MCP_TOOL_RELATION_LIST":
196
+ return McpTool.MCP_TOOL_RELATION_LIST;
197
+ case 6:
198
+ case "MCP_TOOL_SAVE_COMMIT_LOCK":
199
+ return McpTool.MCP_TOOL_SAVE_COMMIT_LOCK;
200
+ case 7:
201
+ case "MCP_TOOL_WORLD_EVENT_EMIT":
202
+ return McpTool.MCP_TOOL_WORLD_EVENT_EMIT;
203
+ case 8:
204
+ case "MCP_TOOL_GRAPH_RAG_SEARCH":
205
+ return McpTool.MCP_TOOL_GRAPH_RAG_SEARCH;
206
+ case 9:
207
+ case "MCP_TOOL_EXPLORE_WORLD":
208
+ return McpTool.MCP_TOOL_EXPLORE_WORLD;
209
+ case 10:
210
+ case "MCP_TOOL_PROPOSE_ACTION":
211
+ return McpTool.MCP_TOOL_PROPOSE_ACTION;
212
+ case 11:
213
+ case "MCP_TOOL_SCENE_CLAIM":
214
+ return McpTool.MCP_TOOL_SCENE_CLAIM;
215
+ case 12:
216
+ case "MCP_TOOL_TURN_ACQUIRE":
217
+ return McpTool.MCP_TOOL_TURN_ACQUIRE;
218
+ case -1:
219
+ case "UNRECOGNIZED":
220
+ default:
221
+ return McpTool.UNRECOGNIZED;
222
+ }
223
+ }
224
+ export function mcpToolToJSON(object) {
225
+ switch (object) {
226
+ case McpTool.MCP_TOOL_UNSPECIFIED:
227
+ return "MCP_TOOL_UNSPECIFIED";
228
+ case McpTool.MCP_TOOL_GRAPH_QUERY:
229
+ return "MCP_TOOL_GRAPH_QUERY";
230
+ case McpTool.MCP_TOOL_VECTOR_SEARCH:
231
+ return "MCP_TOOL_VECTOR_SEARCH";
232
+ case McpTool.MCP_TOOL_FULL_TEXT_SEARCH:
233
+ return "MCP_TOOL_FULL_TEXT_SEARCH";
234
+ case McpTool.MCP_TOOL_ENTITY_GET:
235
+ return "MCP_TOOL_ENTITY_GET";
236
+ case McpTool.MCP_TOOL_RELATION_LIST:
237
+ return "MCP_TOOL_RELATION_LIST";
238
+ case McpTool.MCP_TOOL_SAVE_COMMIT_LOCK:
239
+ return "MCP_TOOL_SAVE_COMMIT_LOCK";
240
+ case McpTool.MCP_TOOL_WORLD_EVENT_EMIT:
241
+ return "MCP_TOOL_WORLD_EVENT_EMIT";
242
+ case McpTool.MCP_TOOL_GRAPH_RAG_SEARCH:
243
+ return "MCP_TOOL_GRAPH_RAG_SEARCH";
244
+ case McpTool.MCP_TOOL_EXPLORE_WORLD:
245
+ return "MCP_TOOL_EXPLORE_WORLD";
246
+ case McpTool.MCP_TOOL_PROPOSE_ACTION:
247
+ return "MCP_TOOL_PROPOSE_ACTION";
248
+ case McpTool.MCP_TOOL_SCENE_CLAIM:
249
+ return "MCP_TOOL_SCENE_CLAIM";
250
+ case McpTool.MCP_TOOL_TURN_ACQUIRE:
251
+ return "MCP_TOOL_TURN_ACQUIRE";
252
+ case McpTool.UNRECOGNIZED:
253
+ default:
254
+ return "UNRECOGNIZED";
255
+ }
256
+ }
257
+ function createBaseMcpToolCapability() {
258
+ return {
259
+ tool_name: "",
260
+ contract_version: 0,
261
+ read_only: false,
262
+ idempotent: false,
263
+ max_request_bytes: 0,
264
+ max_result_bytes: 0,
265
+ input_schema_sha256: "",
266
+ output_schema_sha256: "",
267
+ supports_cancel: false,
268
+ supports_progress: false,
269
+ timeout_ms: 0,
270
+ _unknownFields: {},
271
+ };
272
+ }
273
+ export const McpToolCapability = {
274
+ encode(message, writer = new BinaryWriter()) {
275
+ if (message.tool_name !== "") {
276
+ writer.uint32(10).string(message.tool_name);
277
+ }
278
+ if (message.contract_version !== 0) {
279
+ writer.uint32(16).uint32(message.contract_version);
280
+ }
281
+ if (message.read_only !== false) {
282
+ writer.uint32(24).bool(message.read_only);
283
+ }
284
+ if (message.idempotent !== false) {
285
+ writer.uint32(32).bool(message.idempotent);
286
+ }
287
+ if (message.max_request_bytes !== 0) {
288
+ writer.uint32(40).uint32(message.max_request_bytes);
289
+ }
290
+ if (message.max_result_bytes !== 0) {
291
+ writer.uint32(48).uint32(message.max_result_bytes);
292
+ }
293
+ if (message.input_schema_sha256 !== "") {
294
+ writer.uint32(58).string(message.input_schema_sha256);
295
+ }
296
+ if (message.output_schema_sha256 !== "") {
297
+ writer.uint32(66).string(message.output_schema_sha256);
298
+ }
299
+ if (message.supports_cancel !== false) {
300
+ writer.uint32(72).bool(message.supports_cancel);
301
+ }
302
+ if (message.supports_progress !== false) {
303
+ writer.uint32(80).bool(message.supports_progress);
304
+ }
305
+ if (message.timeout_ms !== 0) {
306
+ writer.uint32(88).uint32(message.timeout_ms);
307
+ }
308
+ if (message._unknownFields !== undefined) {
309
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
310
+ const tag = parseInt(key, 10);
311
+ for (const value of values) {
312
+ writer.uint32(tag).raw(value);
313
+ }
314
+ }
315
+ }
316
+ return writer;
317
+ },
318
+ decode(input, length) {
319
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
320
+ const end = length === undefined ? reader.len : reader.pos + length;
321
+ const message = createBaseMcpToolCapability();
322
+ while (reader.pos < end) {
323
+ const tag = reader.uint32();
324
+ switch (tag >>> 3) {
325
+ case 1: {
326
+ if (tag !== 10) {
327
+ break;
328
+ }
329
+ message.tool_name = reader.string();
330
+ continue;
331
+ }
332
+ case 2: {
333
+ if (tag !== 16) {
334
+ break;
335
+ }
336
+ message.contract_version = reader.uint32();
337
+ continue;
338
+ }
339
+ case 3: {
340
+ if (tag !== 24) {
341
+ break;
342
+ }
343
+ message.read_only = reader.bool();
344
+ continue;
345
+ }
346
+ case 4: {
347
+ if (tag !== 32) {
348
+ break;
349
+ }
350
+ message.idempotent = reader.bool();
351
+ continue;
352
+ }
353
+ case 5: {
354
+ if (tag !== 40) {
355
+ break;
356
+ }
357
+ message.max_request_bytes = reader.uint32();
358
+ continue;
359
+ }
360
+ case 6: {
361
+ if (tag !== 48) {
362
+ break;
363
+ }
364
+ message.max_result_bytes = reader.uint32();
365
+ continue;
366
+ }
367
+ case 7: {
368
+ if (tag !== 58) {
369
+ break;
370
+ }
371
+ message.input_schema_sha256 = reader.string();
372
+ continue;
373
+ }
374
+ case 8: {
375
+ if (tag !== 66) {
376
+ break;
377
+ }
378
+ message.output_schema_sha256 = reader.string();
379
+ continue;
380
+ }
381
+ case 9: {
382
+ if (tag !== 72) {
383
+ break;
384
+ }
385
+ message.supports_cancel = reader.bool();
386
+ continue;
387
+ }
388
+ case 10: {
389
+ if (tag !== 80) {
390
+ break;
391
+ }
392
+ message.supports_progress = reader.bool();
393
+ continue;
394
+ }
395
+ case 11: {
396
+ if (tag !== 88) {
397
+ break;
398
+ }
399
+ message.timeout_ms = reader.uint32();
400
+ continue;
401
+ }
402
+ }
403
+ if ((tag & 7) === 4 || tag === 0) {
404
+ break;
405
+ }
406
+ const buf = reader.skip(tag & 7);
407
+ const list = message._unknownFields[tag];
408
+ if (list === undefined) {
409
+ message._unknownFields[tag] = [buf];
410
+ }
411
+ else {
412
+ list.push(buf);
413
+ }
414
+ }
415
+ return message;
416
+ },
417
+ fromJSON(object) {
418
+ return {
419
+ tool_name: isSet(object.toolName)
420
+ ? globalThis.String(object.toolName)
421
+ : isSet(object.tool_name)
422
+ ? globalThis.String(object.tool_name)
423
+ : "",
424
+ contract_version: isSet(object.contractVersion)
425
+ ? globalThis.Number(object.contractVersion)
426
+ : isSet(object.contract_version)
427
+ ? globalThis.Number(object.contract_version)
428
+ : 0,
429
+ read_only: isSet(object.readOnly)
430
+ ? globalThis.Boolean(object.readOnly)
431
+ : isSet(object.read_only)
432
+ ? globalThis.Boolean(object.read_only)
433
+ : false,
434
+ idempotent: isSet(object.idempotent) ? globalThis.Boolean(object.idempotent) : false,
435
+ max_request_bytes: isSet(object.maxRequestBytes)
436
+ ? globalThis.Number(object.maxRequestBytes)
437
+ : isSet(object.max_request_bytes)
438
+ ? globalThis.Number(object.max_request_bytes)
439
+ : 0,
440
+ max_result_bytes: isSet(object.maxResultBytes)
441
+ ? globalThis.Number(object.maxResultBytes)
442
+ : isSet(object.max_result_bytes)
443
+ ? globalThis.Number(object.max_result_bytes)
444
+ : 0,
445
+ input_schema_sha256: isSet(object.inputSchemaSha256)
446
+ ? globalThis.String(object.inputSchemaSha256)
447
+ : isSet(object.input_schema_sha256)
448
+ ? globalThis.String(object.input_schema_sha256)
449
+ : "",
450
+ output_schema_sha256: isSet(object.outputSchemaSha256)
451
+ ? globalThis.String(object.outputSchemaSha256)
452
+ : isSet(object.output_schema_sha256)
453
+ ? globalThis.String(object.output_schema_sha256)
454
+ : "",
455
+ supports_cancel: isSet(object.supportsCancel)
456
+ ? globalThis.Boolean(object.supportsCancel)
457
+ : isSet(object.supports_cancel)
458
+ ? globalThis.Boolean(object.supports_cancel)
459
+ : false,
460
+ supports_progress: isSet(object.supportsProgress)
461
+ ? globalThis.Boolean(object.supportsProgress)
462
+ : isSet(object.supports_progress)
463
+ ? globalThis.Boolean(object.supports_progress)
464
+ : false,
465
+ timeout_ms: isSet(object.timeoutMs)
466
+ ? globalThis.Number(object.timeoutMs)
467
+ : isSet(object.timeout_ms)
468
+ ? globalThis.Number(object.timeout_ms)
469
+ : 0,
470
+ };
471
+ },
472
+ toJSON(message) {
473
+ const obj = {};
474
+ if (message.tool_name !== "") {
475
+ obj.toolName = message.tool_name;
476
+ }
477
+ if (message.contract_version !== 0) {
478
+ obj.contractVersion = Math.round(message.contract_version);
479
+ }
480
+ if (message.read_only !== false) {
481
+ obj.readOnly = message.read_only;
482
+ }
483
+ if (message.idempotent !== false) {
484
+ obj.idempotent = message.idempotent;
485
+ }
486
+ if (message.max_request_bytes !== 0) {
487
+ obj.maxRequestBytes = Math.round(message.max_request_bytes);
488
+ }
489
+ if (message.max_result_bytes !== 0) {
490
+ obj.maxResultBytes = Math.round(message.max_result_bytes);
491
+ }
492
+ if (message.input_schema_sha256 !== "") {
493
+ obj.inputSchemaSha256 = message.input_schema_sha256;
494
+ }
495
+ if (message.output_schema_sha256 !== "") {
496
+ obj.outputSchemaSha256 = message.output_schema_sha256;
497
+ }
498
+ if (message.supports_cancel !== false) {
499
+ obj.supportsCancel = message.supports_cancel;
500
+ }
501
+ if (message.supports_progress !== false) {
502
+ obj.supportsProgress = message.supports_progress;
503
+ }
504
+ if (message.timeout_ms !== 0) {
505
+ obj.timeoutMs = Math.round(message.timeout_ms);
506
+ }
507
+ return obj;
508
+ },
509
+ create(base) {
510
+ return McpToolCapability.fromPartial(base ?? {});
511
+ },
512
+ fromPartial(object) {
513
+ const message = createBaseMcpToolCapability();
514
+ message.tool_name = object.tool_name ?? "";
515
+ message.contract_version = object.contract_version ?? 0;
516
+ message.read_only = object.read_only ?? false;
517
+ message.idempotent = object.idempotent ?? false;
518
+ message.max_request_bytes = object.max_request_bytes ?? 0;
519
+ message.max_result_bytes = object.max_result_bytes ?? 0;
520
+ message.input_schema_sha256 = object.input_schema_sha256 ?? "";
521
+ message.output_schema_sha256 = object.output_schema_sha256 ?? "";
522
+ message.supports_cancel = object.supports_cancel ?? false;
523
+ message.supports_progress = object.supports_progress ?? false;
524
+ message.timeout_ms = object.timeout_ms ?? 0;
525
+ return message;
526
+ },
527
+ };
528
+ function createBaseMcpSessionCapabilities() {
529
+ return { generation: "0", contract_version: 0, tools: [], manifest_sha256: "", _unknownFields: {} };
530
+ }
531
+ export const McpSessionCapabilities = {
532
+ encode(message, writer = new BinaryWriter()) {
533
+ if (message.generation !== "0") {
534
+ writer.uint32(8).uint64(message.generation);
535
+ }
536
+ if (message.contract_version !== 0) {
537
+ writer.uint32(16).uint32(message.contract_version);
538
+ }
539
+ for (const v of message.tools) {
540
+ McpToolCapability.encode(v, writer.uint32(26).fork()).join();
541
+ }
542
+ if (message.manifest_sha256 !== "") {
543
+ writer.uint32(34).string(message.manifest_sha256);
544
+ }
545
+ if (message._unknownFields !== undefined) {
546
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
547
+ const tag = parseInt(key, 10);
548
+ for (const value of values) {
549
+ writer.uint32(tag).raw(value);
550
+ }
551
+ }
552
+ }
553
+ return writer;
554
+ },
555
+ decode(input, length) {
556
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
557
+ const end = length === undefined ? reader.len : reader.pos + length;
558
+ const message = createBaseMcpSessionCapabilities();
559
+ while (reader.pos < end) {
560
+ const tag = reader.uint32();
561
+ switch (tag >>> 3) {
562
+ case 1: {
563
+ if (tag !== 8) {
564
+ break;
565
+ }
566
+ message.generation = reader.uint64().toString();
567
+ continue;
568
+ }
569
+ case 2: {
570
+ if (tag !== 16) {
571
+ break;
572
+ }
573
+ message.contract_version = reader.uint32();
574
+ continue;
575
+ }
576
+ case 3: {
577
+ if (tag !== 26) {
578
+ break;
579
+ }
580
+ message.tools.push(McpToolCapability.decode(reader, reader.uint32()));
581
+ continue;
582
+ }
583
+ case 4: {
584
+ if (tag !== 34) {
585
+ break;
586
+ }
587
+ message.manifest_sha256 = reader.string();
588
+ continue;
589
+ }
590
+ }
591
+ if ((tag & 7) === 4 || tag === 0) {
592
+ break;
593
+ }
594
+ const buf = reader.skip(tag & 7);
595
+ const list = message._unknownFields[tag];
596
+ if (list === undefined) {
597
+ message._unknownFields[tag] = [buf];
598
+ }
599
+ else {
600
+ list.push(buf);
601
+ }
602
+ }
603
+ return message;
604
+ },
605
+ fromJSON(object) {
606
+ return {
607
+ generation: isSet(object.generation) ? globalThis.String(object.generation) : "0",
608
+ contract_version: isSet(object.contractVersion)
609
+ ? globalThis.Number(object.contractVersion)
610
+ : isSet(object.contract_version)
611
+ ? globalThis.Number(object.contract_version)
612
+ : 0,
613
+ tools: globalThis.Array.isArray(object?.tools) ? object.tools.map((e) => McpToolCapability.fromJSON(e)) : [],
614
+ manifest_sha256: isSet(object.manifestSha256)
615
+ ? globalThis.String(object.manifestSha256)
616
+ : isSet(object.manifest_sha256)
617
+ ? globalThis.String(object.manifest_sha256)
618
+ : "",
619
+ };
620
+ },
621
+ toJSON(message) {
622
+ const obj = {};
623
+ if (message.generation !== "0") {
624
+ obj.generation = message.generation;
625
+ }
626
+ if (message.contract_version !== 0) {
627
+ obj.contractVersion = Math.round(message.contract_version);
628
+ }
629
+ if (message.tools?.length) {
630
+ obj.tools = message.tools.map((e) => McpToolCapability.toJSON(e));
631
+ }
632
+ if (message.manifest_sha256 !== "") {
633
+ obj.manifestSha256 = message.manifest_sha256;
634
+ }
635
+ return obj;
636
+ },
637
+ create(base) {
638
+ return McpSessionCapabilities.fromPartial(base ?? {});
639
+ },
640
+ fromPartial(object) {
641
+ const message = createBaseMcpSessionCapabilities();
642
+ message.generation = object.generation ?? "0";
643
+ message.contract_version = object.contract_version ?? 0;
644
+ message.tools = object.tools?.map((e) => McpToolCapability.fromPartial(e)) || [];
645
+ message.manifest_sha256 = object.manifest_sha256 ?? "";
646
+ return message;
647
+ },
648
+ };
649
+ function createBaseMcpSessionCapabilityAck() {
650
+ return {
651
+ generation: "0",
652
+ contract_version: 0,
653
+ accepted_tools: [],
654
+ manifest_sha256: "",
655
+ legacy: false,
656
+ _unknownFields: {},
657
+ };
658
+ }
659
+ export const McpSessionCapabilityAck = {
660
+ encode(message, writer = new BinaryWriter()) {
661
+ if (message.generation !== "0") {
662
+ writer.uint32(8).uint64(message.generation);
663
+ }
664
+ if (message.contract_version !== 0) {
665
+ writer.uint32(16).uint32(message.contract_version);
666
+ }
667
+ for (const v of message.accepted_tools) {
668
+ McpToolCapability.encode(v, writer.uint32(26).fork()).join();
669
+ }
670
+ if (message.manifest_sha256 !== "") {
671
+ writer.uint32(34).string(message.manifest_sha256);
672
+ }
673
+ if (message.legacy !== false) {
674
+ writer.uint32(40).bool(message.legacy);
675
+ }
676
+ if (message._unknownFields !== undefined) {
677
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
678
+ const tag = parseInt(key, 10);
679
+ for (const value of values) {
680
+ writer.uint32(tag).raw(value);
681
+ }
682
+ }
683
+ }
684
+ return writer;
685
+ },
686
+ decode(input, length) {
687
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
688
+ const end = length === undefined ? reader.len : reader.pos + length;
689
+ const message = createBaseMcpSessionCapabilityAck();
690
+ while (reader.pos < end) {
691
+ const tag = reader.uint32();
692
+ switch (tag >>> 3) {
693
+ case 1: {
694
+ if (tag !== 8) {
695
+ break;
696
+ }
697
+ message.generation = reader.uint64().toString();
698
+ continue;
699
+ }
700
+ case 2: {
701
+ if (tag !== 16) {
702
+ break;
703
+ }
704
+ message.contract_version = reader.uint32();
705
+ continue;
706
+ }
707
+ case 3: {
708
+ if (tag !== 26) {
709
+ break;
710
+ }
711
+ message.accepted_tools.push(McpToolCapability.decode(reader, reader.uint32()));
712
+ continue;
713
+ }
714
+ case 4: {
715
+ if (tag !== 34) {
716
+ break;
717
+ }
718
+ message.manifest_sha256 = reader.string();
719
+ continue;
720
+ }
721
+ case 5: {
722
+ if (tag !== 40) {
723
+ break;
724
+ }
725
+ message.legacy = reader.bool();
726
+ continue;
727
+ }
728
+ }
729
+ if ((tag & 7) === 4 || tag === 0) {
730
+ break;
731
+ }
732
+ const buf = reader.skip(tag & 7);
733
+ const list = message._unknownFields[tag];
734
+ if (list === undefined) {
735
+ message._unknownFields[tag] = [buf];
736
+ }
737
+ else {
738
+ list.push(buf);
739
+ }
740
+ }
741
+ return message;
742
+ },
743
+ fromJSON(object) {
744
+ return {
745
+ generation: isSet(object.generation) ? globalThis.String(object.generation) : "0",
746
+ contract_version: isSet(object.contractVersion)
747
+ ? globalThis.Number(object.contractVersion)
748
+ : isSet(object.contract_version)
749
+ ? globalThis.Number(object.contract_version)
750
+ : 0,
751
+ accepted_tools: globalThis.Array.isArray(object?.acceptedTools)
752
+ ? object.acceptedTools.map((e) => McpToolCapability.fromJSON(e))
753
+ : globalThis.Array.isArray(object?.accepted_tools)
754
+ ? object.accepted_tools.map((e) => McpToolCapability.fromJSON(e))
755
+ : [],
756
+ manifest_sha256: isSet(object.manifestSha256)
757
+ ? globalThis.String(object.manifestSha256)
758
+ : isSet(object.manifest_sha256)
759
+ ? globalThis.String(object.manifest_sha256)
760
+ : "",
761
+ legacy: isSet(object.legacy) ? globalThis.Boolean(object.legacy) : false,
762
+ };
763
+ },
764
+ toJSON(message) {
765
+ const obj = {};
766
+ if (message.generation !== "0") {
767
+ obj.generation = message.generation;
768
+ }
769
+ if (message.contract_version !== 0) {
770
+ obj.contractVersion = Math.round(message.contract_version);
771
+ }
772
+ if (message.accepted_tools?.length) {
773
+ obj.acceptedTools = message.accepted_tools.map((e) => McpToolCapability.toJSON(e));
774
+ }
775
+ if (message.manifest_sha256 !== "") {
776
+ obj.manifestSha256 = message.manifest_sha256;
777
+ }
778
+ if (message.legacy !== false) {
779
+ obj.legacy = message.legacy;
780
+ }
781
+ return obj;
782
+ },
783
+ create(base) {
784
+ return McpSessionCapabilityAck.fromPartial(base ?? {});
785
+ },
786
+ fromPartial(object) {
787
+ const message = createBaseMcpSessionCapabilityAck();
788
+ message.generation = object.generation ?? "0";
789
+ message.contract_version = object.contract_version ?? 0;
790
+ message.accepted_tools = object.accepted_tools?.map((e) => McpToolCapability.fromPartial(e)) || [];
791
+ message.manifest_sha256 = object.manifest_sha256 ?? "";
792
+ message.legacy = object.legacy ?? false;
793
+ return message;
794
+ },
795
+ };
796
+ function createBaseMcpToolCall() {
797
+ return { call_id: "", tool_name: "", arguments_json: new Uint8Array(0), _unknownFields: {} };
798
+ }
799
+ export const McpToolCall = {
800
+ encode(message, writer = new BinaryWriter()) {
801
+ if (message.call_id !== "") {
802
+ writer.uint32(10).string(message.call_id);
803
+ }
804
+ if (message.tool_name !== "") {
805
+ writer.uint32(18).string(message.tool_name);
806
+ }
807
+ if (message.arguments_json.length !== 0) {
808
+ writer.uint32(26).bytes(message.arguments_json);
809
+ }
810
+ if (message._unknownFields !== undefined) {
811
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
812
+ const tag = parseInt(key, 10);
813
+ for (const value of values) {
814
+ writer.uint32(tag).raw(value);
815
+ }
816
+ }
817
+ }
818
+ return writer;
819
+ },
820
+ decode(input, length) {
821
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
822
+ const end = length === undefined ? reader.len : reader.pos + length;
823
+ const message = createBaseMcpToolCall();
824
+ while (reader.pos < end) {
825
+ const tag = reader.uint32();
826
+ switch (tag >>> 3) {
827
+ case 1: {
828
+ if (tag !== 10) {
829
+ break;
830
+ }
831
+ message.call_id = reader.string();
832
+ continue;
833
+ }
834
+ case 2: {
835
+ if (tag !== 18) {
836
+ break;
837
+ }
838
+ message.tool_name = reader.string();
839
+ continue;
840
+ }
841
+ case 3: {
842
+ if (tag !== 26) {
843
+ break;
844
+ }
845
+ message.arguments_json = reader.bytes();
846
+ continue;
847
+ }
848
+ }
849
+ if ((tag & 7) === 4 || tag === 0) {
850
+ break;
851
+ }
852
+ const buf = reader.skip(tag & 7);
853
+ const list = message._unknownFields[tag];
854
+ if (list === undefined) {
855
+ message._unknownFields[tag] = [buf];
856
+ }
857
+ else {
858
+ list.push(buf);
859
+ }
860
+ }
861
+ return message;
862
+ },
863
+ fromJSON(object) {
864
+ return {
865
+ call_id: isSet(object.callId)
866
+ ? globalThis.String(object.callId)
867
+ : isSet(object.call_id)
868
+ ? globalThis.String(object.call_id)
869
+ : "",
870
+ tool_name: isSet(object.toolName)
871
+ ? globalThis.String(object.toolName)
872
+ : isSet(object.tool_name)
873
+ ? globalThis.String(object.tool_name)
874
+ : "",
875
+ arguments_json: isSet(object.argumentsJson)
876
+ ? bytesFromBase64(object.argumentsJson)
877
+ : isSet(object.arguments_json)
878
+ ? bytesFromBase64(object.arguments_json)
879
+ : new Uint8Array(0),
880
+ };
881
+ },
882
+ toJSON(message) {
883
+ const obj = {};
884
+ if (message.call_id !== "") {
885
+ obj.callId = message.call_id;
886
+ }
887
+ if (message.tool_name !== "") {
888
+ obj.toolName = message.tool_name;
889
+ }
890
+ if (message.arguments_json.length !== 0) {
891
+ obj.argumentsJson = base64FromBytes(message.arguments_json);
892
+ }
893
+ return obj;
894
+ },
895
+ create(base) {
896
+ return McpToolCall.fromPartial(base ?? {});
897
+ },
898
+ fromPartial(object) {
899
+ const message = createBaseMcpToolCall();
900
+ message.call_id = object.call_id ?? "";
901
+ message.tool_name = object.tool_name ?? "";
902
+ message.arguments_json = object.arguments_json ?? new Uint8Array(0);
903
+ return message;
904
+ },
905
+ };
906
+ function createBaseMcpToolResult() {
907
+ return { call_id: "", ok: false, result_json: new Uint8Array(0), error: undefined, _unknownFields: {} };
908
+ }
909
+ export const McpToolResult = {
910
+ encode(message, writer = new BinaryWriter()) {
911
+ if (message.call_id !== "") {
912
+ writer.uint32(10).string(message.call_id);
913
+ }
914
+ if (message.ok !== false) {
915
+ writer.uint32(16).bool(message.ok);
916
+ }
917
+ if (message.result_json.length !== 0) {
918
+ writer.uint32(26).bytes(message.result_json);
919
+ }
920
+ if (message.error !== undefined) {
921
+ ErrorInfo.encode(message.error, writer.uint32(34).fork()).join();
922
+ }
923
+ if (message._unknownFields !== undefined) {
924
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
925
+ const tag = parseInt(key, 10);
926
+ for (const value of values) {
927
+ writer.uint32(tag).raw(value);
928
+ }
929
+ }
930
+ }
931
+ return writer;
932
+ },
933
+ decode(input, length) {
934
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
935
+ const end = length === undefined ? reader.len : reader.pos + length;
936
+ const message = createBaseMcpToolResult();
937
+ while (reader.pos < end) {
938
+ const tag = reader.uint32();
939
+ switch (tag >>> 3) {
940
+ case 1: {
941
+ if (tag !== 10) {
942
+ break;
943
+ }
944
+ message.call_id = reader.string();
945
+ continue;
946
+ }
947
+ case 2: {
948
+ if (tag !== 16) {
949
+ break;
950
+ }
951
+ message.ok = reader.bool();
952
+ continue;
953
+ }
954
+ case 3: {
955
+ if (tag !== 26) {
956
+ break;
957
+ }
958
+ message.result_json = reader.bytes();
959
+ continue;
960
+ }
961
+ case 4: {
962
+ if (tag !== 34) {
963
+ break;
964
+ }
965
+ message.error = ErrorInfo.decode(reader, reader.uint32());
966
+ continue;
967
+ }
968
+ }
969
+ if ((tag & 7) === 4 || tag === 0) {
970
+ break;
971
+ }
972
+ const buf = reader.skip(tag & 7);
973
+ const list = message._unknownFields[tag];
974
+ if (list === undefined) {
975
+ message._unknownFields[tag] = [buf];
976
+ }
977
+ else {
978
+ list.push(buf);
979
+ }
980
+ }
981
+ return message;
982
+ },
983
+ fromJSON(object) {
984
+ return {
985
+ call_id: isSet(object.callId)
986
+ ? globalThis.String(object.callId)
987
+ : isSet(object.call_id)
988
+ ? globalThis.String(object.call_id)
989
+ : "",
990
+ ok: isSet(object.ok) ? globalThis.Boolean(object.ok) : false,
991
+ result_json: isSet(object.resultJson)
992
+ ? bytesFromBase64(object.resultJson)
993
+ : isSet(object.result_json)
994
+ ? bytesFromBase64(object.result_json)
995
+ : new Uint8Array(0),
996
+ error: isSet(object.error) ? ErrorInfo.fromJSON(object.error) : undefined,
997
+ };
998
+ },
999
+ toJSON(message) {
1000
+ const obj = {};
1001
+ if (message.call_id !== "") {
1002
+ obj.callId = message.call_id;
1003
+ }
1004
+ if (message.ok !== false) {
1005
+ obj.ok = message.ok;
1006
+ }
1007
+ if (message.result_json.length !== 0) {
1008
+ obj.resultJson = base64FromBytes(message.result_json);
1009
+ }
1010
+ if (message.error !== undefined) {
1011
+ obj.error = ErrorInfo.toJSON(message.error);
1012
+ }
1013
+ return obj;
1014
+ },
1015
+ create(base) {
1016
+ return McpToolResult.fromPartial(base ?? {});
1017
+ },
1018
+ fromPartial(object) {
1019
+ const message = createBaseMcpToolResult();
1020
+ message.call_id = object.call_id ?? "";
1021
+ message.ok = object.ok ?? false;
1022
+ message.result_json = object.result_json ?? new Uint8Array(0);
1023
+ message.error = (object.error !== undefined && object.error !== null)
1024
+ ? ErrorInfo.fromPartial(object.error)
1025
+ : undefined;
1026
+ return message;
1027
+ },
1028
+ };
1029
+ function createBaseRetrievalQueryV1() {
1030
+ return {
1031
+ query_index: 0,
1032
+ query_embedding_f32_le: new Uint8Array(0),
1033
+ embedding_dimension: 0,
1034
+ descriptor_sha256: "",
1035
+ query_text: "",
1036
+ fields: [],
1037
+ edge_kinds: [],
1038
+ depth: 0,
1039
+ content_byte_budget: 0,
1040
+ _unknownFields: {},
1041
+ };
1042
+ }
1043
+ export const RetrievalQueryV1 = {
1044
+ encode(message, writer = new BinaryWriter()) {
1045
+ if (message.query_index !== 0) {
1046
+ writer.uint32(8).uint32(message.query_index);
1047
+ }
1048
+ if (message.query_embedding_f32_le.length !== 0) {
1049
+ writer.uint32(18).bytes(message.query_embedding_f32_le);
1050
+ }
1051
+ if (message.embedding_dimension !== 0) {
1052
+ writer.uint32(24).uint32(message.embedding_dimension);
1053
+ }
1054
+ if (message.descriptor_sha256 !== "") {
1055
+ writer.uint32(34).string(message.descriptor_sha256);
1056
+ }
1057
+ if (message.query_text !== "") {
1058
+ writer.uint32(42).string(message.query_text);
1059
+ }
1060
+ for (const v of message.fields) {
1061
+ writer.uint32(50).string(v);
1062
+ }
1063
+ for (const v of message.edge_kinds) {
1064
+ writer.uint32(58).string(v);
1065
+ }
1066
+ if (message.depth !== 0) {
1067
+ writer.uint32(64).uint32(message.depth);
1068
+ }
1069
+ if (message.content_byte_budget !== 0) {
1070
+ writer.uint32(72).uint32(message.content_byte_budget);
1071
+ }
1072
+ if (message._unknownFields !== undefined) {
1073
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
1074
+ const tag = parseInt(key, 10);
1075
+ for (const value of values) {
1076
+ writer.uint32(tag).raw(value);
1077
+ }
1078
+ }
1079
+ }
1080
+ return writer;
1081
+ },
1082
+ decode(input, length) {
1083
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1084
+ const end = length === undefined ? reader.len : reader.pos + length;
1085
+ const message = createBaseRetrievalQueryV1();
1086
+ while (reader.pos < end) {
1087
+ const tag = reader.uint32();
1088
+ switch (tag >>> 3) {
1089
+ case 1: {
1090
+ if (tag !== 8) {
1091
+ break;
1092
+ }
1093
+ message.query_index = reader.uint32();
1094
+ continue;
1095
+ }
1096
+ case 2: {
1097
+ if (tag !== 18) {
1098
+ break;
1099
+ }
1100
+ message.query_embedding_f32_le = reader.bytes();
1101
+ continue;
1102
+ }
1103
+ case 3: {
1104
+ if (tag !== 24) {
1105
+ break;
1106
+ }
1107
+ message.embedding_dimension = reader.uint32();
1108
+ continue;
1109
+ }
1110
+ case 4: {
1111
+ if (tag !== 34) {
1112
+ break;
1113
+ }
1114
+ message.descriptor_sha256 = reader.string();
1115
+ continue;
1116
+ }
1117
+ case 5: {
1118
+ if (tag !== 42) {
1119
+ break;
1120
+ }
1121
+ message.query_text = reader.string();
1122
+ continue;
1123
+ }
1124
+ case 6: {
1125
+ if (tag !== 50) {
1126
+ break;
1127
+ }
1128
+ message.fields.push(reader.string());
1129
+ continue;
1130
+ }
1131
+ case 7: {
1132
+ if (tag !== 58) {
1133
+ break;
1134
+ }
1135
+ message.edge_kinds.push(reader.string());
1136
+ continue;
1137
+ }
1138
+ case 8: {
1139
+ if (tag !== 64) {
1140
+ break;
1141
+ }
1142
+ message.depth = reader.uint32();
1143
+ continue;
1144
+ }
1145
+ case 9: {
1146
+ if (tag !== 72) {
1147
+ break;
1148
+ }
1149
+ message.content_byte_budget = reader.uint32();
1150
+ continue;
1151
+ }
1152
+ }
1153
+ if ((tag & 7) === 4 || tag === 0) {
1154
+ break;
1155
+ }
1156
+ const buf = reader.skip(tag & 7);
1157
+ const list = message._unknownFields[tag];
1158
+ if (list === undefined) {
1159
+ message._unknownFields[tag] = [buf];
1160
+ }
1161
+ else {
1162
+ list.push(buf);
1163
+ }
1164
+ }
1165
+ return message;
1166
+ },
1167
+ fromJSON(object) {
1168
+ return {
1169
+ query_index: isSet(object.queryIndex)
1170
+ ? globalThis.Number(object.queryIndex)
1171
+ : isSet(object.query_index)
1172
+ ? globalThis.Number(object.query_index)
1173
+ : 0,
1174
+ query_embedding_f32_le: isSet(object.queryEmbeddingF32Le)
1175
+ ? bytesFromBase64(object.queryEmbeddingF32Le)
1176
+ : isSet(object.query_embedding_f32_le)
1177
+ ? bytesFromBase64(object.query_embedding_f32_le)
1178
+ : new Uint8Array(0),
1179
+ embedding_dimension: isSet(object.embeddingDimension)
1180
+ ? globalThis.Number(object.embeddingDimension)
1181
+ : isSet(object.embedding_dimension)
1182
+ ? globalThis.Number(object.embedding_dimension)
1183
+ : 0,
1184
+ descriptor_sha256: isSet(object.descriptorSha256)
1185
+ ? globalThis.String(object.descriptorSha256)
1186
+ : isSet(object.descriptor_sha256)
1187
+ ? globalThis.String(object.descriptor_sha256)
1188
+ : "",
1189
+ query_text: isSet(object.queryText)
1190
+ ? globalThis.String(object.queryText)
1191
+ : isSet(object.query_text)
1192
+ ? globalThis.String(object.query_text)
1193
+ : "",
1194
+ fields: globalThis.Array.isArray(object?.fields)
1195
+ ? object.fields.map((e) => globalThis.String(e))
1196
+ : [],
1197
+ edge_kinds: globalThis.Array.isArray(object?.edgeKinds)
1198
+ ? object.edgeKinds.map((e) => globalThis.String(e))
1199
+ : globalThis.Array.isArray(object?.edge_kinds)
1200
+ ? object.edge_kinds.map((e) => globalThis.String(e))
1201
+ : [],
1202
+ depth: isSet(object.depth) ? globalThis.Number(object.depth) : 0,
1203
+ content_byte_budget: isSet(object.contentByteBudget)
1204
+ ? globalThis.Number(object.contentByteBudget)
1205
+ : isSet(object.content_byte_budget)
1206
+ ? globalThis.Number(object.content_byte_budget)
1207
+ : 0,
1208
+ };
1209
+ },
1210
+ toJSON(message) {
1211
+ const obj = {};
1212
+ if (message.query_index !== 0) {
1213
+ obj.queryIndex = Math.round(message.query_index);
1214
+ }
1215
+ if (message.query_embedding_f32_le.length !== 0) {
1216
+ obj.queryEmbeddingF32Le = base64FromBytes(message.query_embedding_f32_le);
1217
+ }
1218
+ if (message.embedding_dimension !== 0) {
1219
+ obj.embeddingDimension = Math.round(message.embedding_dimension);
1220
+ }
1221
+ if (message.descriptor_sha256 !== "") {
1222
+ obj.descriptorSha256 = message.descriptor_sha256;
1223
+ }
1224
+ if (message.query_text !== "") {
1225
+ obj.queryText = message.query_text;
1226
+ }
1227
+ if (message.fields?.length) {
1228
+ obj.fields = message.fields;
1229
+ }
1230
+ if (message.edge_kinds?.length) {
1231
+ obj.edgeKinds = message.edge_kinds;
1232
+ }
1233
+ if (message.depth !== 0) {
1234
+ obj.depth = Math.round(message.depth);
1235
+ }
1236
+ if (message.content_byte_budget !== 0) {
1237
+ obj.contentByteBudget = Math.round(message.content_byte_budget);
1238
+ }
1239
+ return obj;
1240
+ },
1241
+ create(base) {
1242
+ return RetrievalQueryV1.fromPartial(base ?? {});
1243
+ },
1244
+ fromPartial(object) {
1245
+ const message = createBaseRetrievalQueryV1();
1246
+ message.query_index = object.query_index ?? 0;
1247
+ message.query_embedding_f32_le = object.query_embedding_f32_le ?? new Uint8Array(0);
1248
+ message.embedding_dimension = object.embedding_dimension ?? 0;
1249
+ message.descriptor_sha256 = object.descriptor_sha256 ?? "";
1250
+ message.query_text = object.query_text ?? "";
1251
+ message.fields = object.fields?.map((e) => e) || [];
1252
+ message.edge_kinds = object.edge_kinds?.map((e) => e) || [];
1253
+ message.depth = object.depth ?? 0;
1254
+ message.content_byte_budget = object.content_byte_budget ?? 0;
1255
+ return message;
1256
+ },
1257
+ };
1258
+ function createBaseRetrieveBatchRequest() {
1259
+ return {
1260
+ operation_id: "",
1261
+ runtime_scope_sha256: "",
1262
+ descriptor_sha256: "",
1263
+ queries: [],
1264
+ content_byte_budget: 0,
1265
+ turn_remaining_content_bytes: 0,
1266
+ _unknownFields: {},
1267
+ };
1268
+ }
1269
+ export const RetrieveBatchRequest = {
1270
+ encode(message, writer = new BinaryWriter()) {
1271
+ if (message.operation_id !== "") {
1272
+ writer.uint32(10).string(message.operation_id);
1273
+ }
1274
+ if (message.runtime_scope_sha256 !== "") {
1275
+ writer.uint32(18).string(message.runtime_scope_sha256);
1276
+ }
1277
+ if (message.descriptor_sha256 !== "") {
1278
+ writer.uint32(26).string(message.descriptor_sha256);
1279
+ }
1280
+ for (const v of message.queries) {
1281
+ RetrievalQueryV1.encode(v, writer.uint32(34).fork()).join();
1282
+ }
1283
+ if (message.content_byte_budget !== 0) {
1284
+ writer.uint32(40).uint32(message.content_byte_budget);
1285
+ }
1286
+ if (message.turn_remaining_content_bytes !== 0) {
1287
+ writer.uint32(48).uint32(message.turn_remaining_content_bytes);
1288
+ }
1289
+ if (message._unknownFields !== undefined) {
1290
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
1291
+ const tag = parseInt(key, 10);
1292
+ for (const value of values) {
1293
+ writer.uint32(tag).raw(value);
1294
+ }
1295
+ }
1296
+ }
1297
+ return writer;
1298
+ },
1299
+ decode(input, length) {
1300
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1301
+ const end = length === undefined ? reader.len : reader.pos + length;
1302
+ const message = createBaseRetrieveBatchRequest();
1303
+ while (reader.pos < end) {
1304
+ const tag = reader.uint32();
1305
+ switch (tag >>> 3) {
1306
+ case 1: {
1307
+ if (tag !== 10) {
1308
+ break;
1309
+ }
1310
+ message.operation_id = reader.string();
1311
+ continue;
1312
+ }
1313
+ case 2: {
1314
+ if (tag !== 18) {
1315
+ break;
1316
+ }
1317
+ message.runtime_scope_sha256 = reader.string();
1318
+ continue;
1319
+ }
1320
+ case 3: {
1321
+ if (tag !== 26) {
1322
+ break;
1323
+ }
1324
+ message.descriptor_sha256 = reader.string();
1325
+ continue;
1326
+ }
1327
+ case 4: {
1328
+ if (tag !== 34) {
1329
+ break;
1330
+ }
1331
+ message.queries.push(RetrievalQueryV1.decode(reader, reader.uint32()));
1332
+ continue;
1333
+ }
1334
+ case 5: {
1335
+ if (tag !== 40) {
1336
+ break;
1337
+ }
1338
+ message.content_byte_budget = reader.uint32();
1339
+ continue;
1340
+ }
1341
+ case 6: {
1342
+ if (tag !== 48) {
1343
+ break;
1344
+ }
1345
+ message.turn_remaining_content_bytes = reader.uint32();
1346
+ continue;
1347
+ }
1348
+ }
1349
+ if ((tag & 7) === 4 || tag === 0) {
1350
+ break;
1351
+ }
1352
+ const buf = reader.skip(tag & 7);
1353
+ const list = message._unknownFields[tag];
1354
+ if (list === undefined) {
1355
+ message._unknownFields[tag] = [buf];
1356
+ }
1357
+ else {
1358
+ list.push(buf);
1359
+ }
1360
+ }
1361
+ return message;
1362
+ },
1363
+ fromJSON(object) {
1364
+ return {
1365
+ operation_id: isSet(object.operationId)
1366
+ ? globalThis.String(object.operationId)
1367
+ : isSet(object.operation_id)
1368
+ ? globalThis.String(object.operation_id)
1369
+ : "",
1370
+ runtime_scope_sha256: isSet(object.runtimeScopeSha256)
1371
+ ? globalThis.String(object.runtimeScopeSha256)
1372
+ : isSet(object.runtime_scope_sha256)
1373
+ ? globalThis.String(object.runtime_scope_sha256)
1374
+ : "",
1375
+ descriptor_sha256: isSet(object.descriptorSha256)
1376
+ ? globalThis.String(object.descriptorSha256)
1377
+ : isSet(object.descriptor_sha256)
1378
+ ? globalThis.String(object.descriptor_sha256)
1379
+ : "",
1380
+ queries: globalThis.Array.isArray(object?.queries)
1381
+ ? object.queries.map((e) => RetrievalQueryV1.fromJSON(e))
1382
+ : [],
1383
+ content_byte_budget: isSet(object.contentByteBudget)
1384
+ ? globalThis.Number(object.contentByteBudget)
1385
+ : isSet(object.content_byte_budget)
1386
+ ? globalThis.Number(object.content_byte_budget)
1387
+ : 0,
1388
+ turn_remaining_content_bytes: isSet(object.turnRemainingContentBytes)
1389
+ ? globalThis.Number(object.turnRemainingContentBytes)
1390
+ : isSet(object.turn_remaining_content_bytes)
1391
+ ? globalThis.Number(object.turn_remaining_content_bytes)
1392
+ : 0,
1393
+ };
1394
+ },
1395
+ toJSON(message) {
1396
+ const obj = {};
1397
+ if (message.operation_id !== "") {
1398
+ obj.operationId = message.operation_id;
1399
+ }
1400
+ if (message.runtime_scope_sha256 !== "") {
1401
+ obj.runtimeScopeSha256 = message.runtime_scope_sha256;
1402
+ }
1403
+ if (message.descriptor_sha256 !== "") {
1404
+ obj.descriptorSha256 = message.descriptor_sha256;
1405
+ }
1406
+ if (message.queries?.length) {
1407
+ obj.queries = message.queries.map((e) => RetrievalQueryV1.toJSON(e));
1408
+ }
1409
+ if (message.content_byte_budget !== 0) {
1410
+ obj.contentByteBudget = Math.round(message.content_byte_budget);
1411
+ }
1412
+ if (message.turn_remaining_content_bytes !== 0) {
1413
+ obj.turnRemainingContentBytes = Math.round(message.turn_remaining_content_bytes);
1414
+ }
1415
+ return obj;
1416
+ },
1417
+ create(base) {
1418
+ return RetrieveBatchRequest.fromPartial(base ?? {});
1419
+ },
1420
+ fromPartial(object) {
1421
+ const message = createBaseRetrieveBatchRequest();
1422
+ message.operation_id = object.operation_id ?? "";
1423
+ message.runtime_scope_sha256 = object.runtime_scope_sha256 ?? "";
1424
+ message.descriptor_sha256 = object.descriptor_sha256 ?? "";
1425
+ message.queries = object.queries?.map((e) => RetrievalQueryV1.fromPartial(e)) || [];
1426
+ message.content_byte_budget = object.content_byte_budget ?? 0;
1427
+ message.turn_remaining_content_bytes = object.turn_remaining_content_bytes ?? 0;
1428
+ return message;
1429
+ },
1430
+ };
1431
+ function createBaseRecallMatchReasonV1() {
1432
+ return { arm: 0, rank: 0, score: 0, matched_terms: [], relation_edge_kinds: [], _unknownFields: {} };
1433
+ }
1434
+ export const RecallMatchReasonV1 = {
1435
+ encode(message, writer = new BinaryWriter()) {
1436
+ if (message.arm !== 0) {
1437
+ writer.uint32(8).int32(message.arm);
1438
+ }
1439
+ if (message.rank !== 0) {
1440
+ writer.uint32(16).uint32(message.rank);
1441
+ }
1442
+ if (message.score !== 0) {
1443
+ writer.uint32(29).float(message.score);
1444
+ }
1445
+ for (const v of message.matched_terms) {
1446
+ writer.uint32(34).string(v);
1447
+ }
1448
+ for (const v of message.relation_edge_kinds) {
1449
+ writer.uint32(42).string(v);
1450
+ }
1451
+ if (message._unknownFields !== undefined) {
1452
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
1453
+ const tag = parseInt(key, 10);
1454
+ for (const value of values) {
1455
+ writer.uint32(tag).raw(value);
1456
+ }
1457
+ }
1458
+ }
1459
+ return writer;
1460
+ },
1461
+ decode(input, length) {
1462
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1463
+ const end = length === undefined ? reader.len : reader.pos + length;
1464
+ const message = createBaseRecallMatchReasonV1();
1465
+ while (reader.pos < end) {
1466
+ const tag = reader.uint32();
1467
+ switch (tag >>> 3) {
1468
+ case 1: {
1469
+ if (tag !== 8) {
1470
+ break;
1471
+ }
1472
+ message.arm = reader.int32();
1473
+ continue;
1474
+ }
1475
+ case 2: {
1476
+ if (tag !== 16) {
1477
+ break;
1478
+ }
1479
+ message.rank = reader.uint32();
1480
+ continue;
1481
+ }
1482
+ case 3: {
1483
+ if (tag !== 29) {
1484
+ break;
1485
+ }
1486
+ message.score = reader.float();
1487
+ continue;
1488
+ }
1489
+ case 4: {
1490
+ if (tag !== 34) {
1491
+ break;
1492
+ }
1493
+ message.matched_terms.push(reader.string());
1494
+ continue;
1495
+ }
1496
+ case 5: {
1497
+ if (tag !== 42) {
1498
+ break;
1499
+ }
1500
+ message.relation_edge_kinds.push(reader.string());
1501
+ continue;
1502
+ }
1503
+ }
1504
+ if ((tag & 7) === 4 || tag === 0) {
1505
+ break;
1506
+ }
1507
+ const buf = reader.skip(tag & 7);
1508
+ const list = message._unknownFields[tag];
1509
+ if (list === undefined) {
1510
+ message._unknownFields[tag] = [buf];
1511
+ }
1512
+ else {
1513
+ list.push(buf);
1514
+ }
1515
+ }
1516
+ return message;
1517
+ },
1518
+ fromJSON(object) {
1519
+ return {
1520
+ arm: isSet(object.arm) ? retrievalMatchArmFromJSON(object.arm) : 0,
1521
+ rank: isSet(object.rank) ? globalThis.Number(object.rank) : 0,
1522
+ score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1523
+ matched_terms: globalThis.Array.isArray(object?.matchedTerms)
1524
+ ? object.matchedTerms.map((e) => globalThis.String(e))
1525
+ : globalThis.Array.isArray(object?.matched_terms)
1526
+ ? object.matched_terms.map((e) => globalThis.String(e))
1527
+ : [],
1528
+ relation_edge_kinds: globalThis.Array.isArray(object?.relationEdgeKinds)
1529
+ ? object.relationEdgeKinds.map((e) => globalThis.String(e))
1530
+ : globalThis.Array.isArray(object?.relation_edge_kinds)
1531
+ ? object.relation_edge_kinds.map((e) => globalThis.String(e))
1532
+ : [],
1533
+ };
1534
+ },
1535
+ toJSON(message) {
1536
+ const obj = {};
1537
+ if (message.arm !== 0) {
1538
+ obj.arm = retrievalMatchArmToJSON(message.arm);
1539
+ }
1540
+ if (message.rank !== 0) {
1541
+ obj.rank = Math.round(message.rank);
1542
+ }
1543
+ if (message.score !== 0) {
1544
+ obj.score = message.score;
1545
+ }
1546
+ if (message.matched_terms?.length) {
1547
+ obj.matchedTerms = message.matched_terms;
1548
+ }
1549
+ if (message.relation_edge_kinds?.length) {
1550
+ obj.relationEdgeKinds = message.relation_edge_kinds;
1551
+ }
1552
+ return obj;
1553
+ },
1554
+ create(base) {
1555
+ return RecallMatchReasonV1.fromPartial(base ?? {});
1556
+ },
1557
+ fromPartial(object) {
1558
+ const message = createBaseRecallMatchReasonV1();
1559
+ message.arm = object.arm ?? 0;
1560
+ message.rank = object.rank ?? 0;
1561
+ message.score = object.score ?? 0;
1562
+ message.matched_terms = object.matched_terms?.map((e) => e) || [];
1563
+ message.relation_edge_kinds = object.relation_edge_kinds?.map((e) => e) || [];
1564
+ return message;
1565
+ },
1566
+ };
1567
+ function createBaseRecallProvenanceV1() {
1568
+ return {
1569
+ seed_entity_id: "",
1570
+ hop: 0,
1571
+ source_message_id: "",
1572
+ turn_id: "",
1573
+ write_seq: "0",
1574
+ realworld_provenance: 0,
1575
+ prototype_name: "",
1576
+ _unknownFields: {},
1577
+ };
1578
+ }
1579
+ export const RecallProvenanceV1 = {
1580
+ encode(message, writer = new BinaryWriter()) {
1581
+ if (message.seed_entity_id !== "") {
1582
+ writer.uint32(10).string(message.seed_entity_id);
1583
+ }
1584
+ if (message.hop !== 0) {
1585
+ writer.uint32(16).uint32(message.hop);
1586
+ }
1587
+ if (message.source_message_id !== "") {
1588
+ writer.uint32(26).string(message.source_message_id);
1589
+ }
1590
+ if (message.turn_id !== "") {
1591
+ writer.uint32(34).string(message.turn_id);
1592
+ }
1593
+ if (message.write_seq !== "0") {
1594
+ writer.uint32(40).uint64(message.write_seq);
1595
+ }
1596
+ if (message.realworld_provenance !== 0) {
1597
+ writer.uint32(48).int32(message.realworld_provenance);
1598
+ }
1599
+ if (message.prototype_name !== "") {
1600
+ writer.uint32(58).string(message.prototype_name);
1601
+ }
1602
+ if (message._unknownFields !== undefined) {
1603
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
1604
+ const tag = parseInt(key, 10);
1605
+ for (const value of values) {
1606
+ writer.uint32(tag).raw(value);
1607
+ }
1608
+ }
1609
+ }
1610
+ return writer;
1611
+ },
1612
+ decode(input, length) {
1613
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1614
+ const end = length === undefined ? reader.len : reader.pos + length;
1615
+ const message = createBaseRecallProvenanceV1();
1616
+ while (reader.pos < end) {
1617
+ const tag = reader.uint32();
1618
+ switch (tag >>> 3) {
1619
+ case 1: {
1620
+ if (tag !== 10) {
1621
+ break;
1622
+ }
1623
+ message.seed_entity_id = reader.string();
1624
+ continue;
1625
+ }
1626
+ case 2: {
1627
+ if (tag !== 16) {
1628
+ break;
1629
+ }
1630
+ message.hop = reader.uint32();
1631
+ continue;
1632
+ }
1633
+ case 3: {
1634
+ if (tag !== 26) {
1635
+ break;
1636
+ }
1637
+ message.source_message_id = reader.string();
1638
+ continue;
1639
+ }
1640
+ case 4: {
1641
+ if (tag !== 34) {
1642
+ break;
1643
+ }
1644
+ message.turn_id = reader.string();
1645
+ continue;
1646
+ }
1647
+ case 5: {
1648
+ if (tag !== 40) {
1649
+ break;
1650
+ }
1651
+ message.write_seq = reader.uint64().toString();
1652
+ continue;
1653
+ }
1654
+ case 6: {
1655
+ if (tag !== 48) {
1656
+ break;
1657
+ }
1658
+ message.realworld_provenance = reader.int32();
1659
+ continue;
1660
+ }
1661
+ case 7: {
1662
+ if (tag !== 58) {
1663
+ break;
1664
+ }
1665
+ message.prototype_name = reader.string();
1666
+ continue;
1667
+ }
1668
+ }
1669
+ if ((tag & 7) === 4 || tag === 0) {
1670
+ break;
1671
+ }
1672
+ const buf = reader.skip(tag & 7);
1673
+ const list = message._unknownFields[tag];
1674
+ if (list === undefined) {
1675
+ message._unknownFields[tag] = [buf];
1676
+ }
1677
+ else {
1678
+ list.push(buf);
1679
+ }
1680
+ }
1681
+ return message;
1682
+ },
1683
+ fromJSON(object) {
1684
+ return {
1685
+ seed_entity_id: isSet(object.seedEntityId)
1686
+ ? globalThis.String(object.seedEntityId)
1687
+ : isSet(object.seed_entity_id)
1688
+ ? globalThis.String(object.seed_entity_id)
1689
+ : "",
1690
+ hop: isSet(object.hop) ? globalThis.Number(object.hop) : 0,
1691
+ source_message_id: isSet(object.sourceMessageId)
1692
+ ? globalThis.String(object.sourceMessageId)
1693
+ : isSet(object.source_message_id)
1694
+ ? globalThis.String(object.source_message_id)
1695
+ : "",
1696
+ turn_id: isSet(object.turnId)
1697
+ ? globalThis.String(object.turnId)
1698
+ : isSet(object.turn_id)
1699
+ ? globalThis.String(object.turn_id)
1700
+ : "",
1701
+ write_seq: isSet(object.writeSeq)
1702
+ ? globalThis.String(object.writeSeq)
1703
+ : isSet(object.write_seq)
1704
+ ? globalThis.String(object.write_seq)
1705
+ : "0",
1706
+ realworld_provenance: isSet(object.realworldProvenance)
1707
+ ? recallRealworldProvenanceFromJSON(object.realworldProvenance)
1708
+ : isSet(object.realworld_provenance)
1709
+ ? recallRealworldProvenanceFromJSON(object.realworld_provenance)
1710
+ : 0,
1711
+ prototype_name: isSet(object.prototypeName)
1712
+ ? globalThis.String(object.prototypeName)
1713
+ : isSet(object.prototype_name)
1714
+ ? globalThis.String(object.prototype_name)
1715
+ : "",
1716
+ };
1717
+ },
1718
+ toJSON(message) {
1719
+ const obj = {};
1720
+ if (message.seed_entity_id !== "") {
1721
+ obj.seedEntityId = message.seed_entity_id;
1722
+ }
1723
+ if (message.hop !== 0) {
1724
+ obj.hop = Math.round(message.hop);
1725
+ }
1726
+ if (message.source_message_id !== "") {
1727
+ obj.sourceMessageId = message.source_message_id;
1728
+ }
1729
+ if (message.turn_id !== "") {
1730
+ obj.turnId = message.turn_id;
1731
+ }
1732
+ if (message.write_seq !== "0") {
1733
+ obj.writeSeq = message.write_seq;
1734
+ }
1735
+ if (message.realworld_provenance !== 0) {
1736
+ obj.realworldProvenance = recallRealworldProvenanceToJSON(message.realworld_provenance);
1737
+ }
1738
+ if (message.prototype_name !== "") {
1739
+ obj.prototypeName = message.prototype_name;
1740
+ }
1741
+ return obj;
1742
+ },
1743
+ create(base) {
1744
+ return RecallProvenanceV1.fromPartial(base ?? {});
1745
+ },
1746
+ fromPartial(object) {
1747
+ const message = createBaseRecallProvenanceV1();
1748
+ message.seed_entity_id = object.seed_entity_id ?? "";
1749
+ message.hop = object.hop ?? 0;
1750
+ message.source_message_id = object.source_message_id ?? "";
1751
+ message.turn_id = object.turn_id ?? "";
1752
+ message.write_seq = object.write_seq ?? "0";
1753
+ message.realworld_provenance = object.realworld_provenance ?? 0;
1754
+ message.prototype_name = object.prototype_name ?? "";
1755
+ return message;
1756
+ },
1757
+ };
1758
+ function createBaseRecallSummaryV1() {
1759
+ return {
1760
+ query_index: 0,
1761
+ recall_id: "",
1762
+ entity_id: "",
1763
+ entity_kind: "",
1764
+ display_name: "",
1765
+ summary: "",
1766
+ relevance_score: 0,
1767
+ available_fields: [],
1768
+ available_edge_kinds: [],
1769
+ materialized_depth: 0,
1770
+ field_values_utf8: {},
1771
+ edge_lists_utf8_json: {},
1772
+ content_sha256: "",
1773
+ why_matched: [],
1774
+ provenance: [],
1775
+ _unknownFields: {},
1776
+ };
1777
+ }
1778
+ export const RecallSummaryV1 = {
1779
+ encode(message, writer = new BinaryWriter()) {
1780
+ if (message.query_index !== 0) {
1781
+ writer.uint32(8).uint32(message.query_index);
1782
+ }
1783
+ if (message.recall_id !== "") {
1784
+ writer.uint32(18).string(message.recall_id);
1785
+ }
1786
+ if (message.entity_id !== "") {
1787
+ writer.uint32(26).string(message.entity_id);
1788
+ }
1789
+ if (message.entity_kind !== "") {
1790
+ writer.uint32(34).string(message.entity_kind);
1791
+ }
1792
+ if (message.display_name !== "") {
1793
+ writer.uint32(42).string(message.display_name);
1794
+ }
1795
+ if (message.summary !== "") {
1796
+ writer.uint32(50).string(message.summary);
1797
+ }
1798
+ if (message.relevance_score !== 0) {
1799
+ writer.uint32(61).float(message.relevance_score);
1800
+ }
1801
+ for (const v of message.available_fields) {
1802
+ writer.uint32(66).string(v);
1803
+ }
1804
+ for (const v of message.available_edge_kinds) {
1805
+ writer.uint32(74).string(v);
1806
+ }
1807
+ if (message.materialized_depth !== 0) {
1808
+ writer.uint32(80).uint32(message.materialized_depth);
1809
+ }
1810
+ globalThis.Object.entries(message.field_values_utf8).forEach(([key, value]) => {
1811
+ RecallSummaryV1_FieldValuesUtf8Entry.encode({ key: key, value }, writer.uint32(90).fork()).join();
1812
+ });
1813
+ globalThis.Object.entries(message.edge_lists_utf8_json).forEach(([key, value]) => {
1814
+ RecallSummaryV1_EdgeListsUtf8JsonEntry.encode({ key: key, value }, writer.uint32(98).fork()).join();
1815
+ });
1816
+ if (message.content_sha256 !== "") {
1817
+ writer.uint32(106).string(message.content_sha256);
1818
+ }
1819
+ for (const v of message.why_matched) {
1820
+ RecallMatchReasonV1.encode(v, writer.uint32(114).fork()).join();
1821
+ }
1822
+ for (const v of message.provenance) {
1823
+ RecallProvenanceV1.encode(v, writer.uint32(122).fork()).join();
1824
+ }
1825
+ if (message._unknownFields !== undefined) {
1826
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
1827
+ const tag = parseInt(key, 10);
1828
+ for (const value of values) {
1829
+ writer.uint32(tag).raw(value);
1830
+ }
1831
+ }
1832
+ }
1833
+ return writer;
1834
+ },
1835
+ decode(input, length) {
1836
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1837
+ const end = length === undefined ? reader.len : reader.pos + length;
1838
+ const message = createBaseRecallSummaryV1();
1839
+ while (reader.pos < end) {
1840
+ const tag = reader.uint32();
1841
+ switch (tag >>> 3) {
1842
+ case 1: {
1843
+ if (tag !== 8) {
1844
+ break;
1845
+ }
1846
+ message.query_index = reader.uint32();
1847
+ continue;
1848
+ }
1849
+ case 2: {
1850
+ if (tag !== 18) {
1851
+ break;
1852
+ }
1853
+ message.recall_id = reader.string();
1854
+ continue;
1855
+ }
1856
+ case 3: {
1857
+ if (tag !== 26) {
1858
+ break;
1859
+ }
1860
+ message.entity_id = reader.string();
1861
+ continue;
1862
+ }
1863
+ case 4: {
1864
+ if (tag !== 34) {
1865
+ break;
1866
+ }
1867
+ message.entity_kind = reader.string();
1868
+ continue;
1869
+ }
1870
+ case 5: {
1871
+ if (tag !== 42) {
1872
+ break;
1873
+ }
1874
+ message.display_name = reader.string();
1875
+ continue;
1876
+ }
1877
+ case 6: {
1878
+ if (tag !== 50) {
1879
+ break;
1880
+ }
1881
+ message.summary = reader.string();
1882
+ continue;
1883
+ }
1884
+ case 7: {
1885
+ if (tag !== 61) {
1886
+ break;
1887
+ }
1888
+ message.relevance_score = reader.float();
1889
+ continue;
1890
+ }
1891
+ case 8: {
1892
+ if (tag !== 66) {
1893
+ break;
1894
+ }
1895
+ message.available_fields.push(reader.string());
1896
+ continue;
1897
+ }
1898
+ case 9: {
1899
+ if (tag !== 74) {
1900
+ break;
1901
+ }
1902
+ message.available_edge_kinds.push(reader.string());
1903
+ continue;
1904
+ }
1905
+ case 10: {
1906
+ if (tag !== 80) {
1907
+ break;
1908
+ }
1909
+ message.materialized_depth = reader.uint32();
1910
+ continue;
1911
+ }
1912
+ case 11: {
1913
+ if (tag !== 90) {
1914
+ break;
1915
+ }
1916
+ const entry11 = RecallSummaryV1_FieldValuesUtf8Entry.decode(reader, reader.uint32());
1917
+ if (entry11.value !== undefined) {
1918
+ message.field_values_utf8[entry11.key] = entry11.value;
1919
+ }
1920
+ continue;
1921
+ }
1922
+ case 12: {
1923
+ if (tag !== 98) {
1924
+ break;
1925
+ }
1926
+ const entry12 = RecallSummaryV1_EdgeListsUtf8JsonEntry.decode(reader, reader.uint32());
1927
+ if (entry12.value !== undefined) {
1928
+ message.edge_lists_utf8_json[entry12.key] = entry12.value;
1929
+ }
1930
+ continue;
1931
+ }
1932
+ case 13: {
1933
+ if (tag !== 106) {
1934
+ break;
1935
+ }
1936
+ message.content_sha256 = reader.string();
1937
+ continue;
1938
+ }
1939
+ case 14: {
1940
+ if (tag !== 114) {
1941
+ break;
1942
+ }
1943
+ message.why_matched.push(RecallMatchReasonV1.decode(reader, reader.uint32()));
1944
+ continue;
1945
+ }
1946
+ case 15: {
1947
+ if (tag !== 122) {
1948
+ break;
1949
+ }
1950
+ message.provenance.push(RecallProvenanceV1.decode(reader, reader.uint32()));
1951
+ continue;
1952
+ }
1953
+ }
1954
+ if ((tag & 7) === 4 || tag === 0) {
1955
+ break;
1956
+ }
1957
+ const buf = reader.skip(tag & 7);
1958
+ const list = message._unknownFields[tag];
1959
+ if (list === undefined) {
1960
+ message._unknownFields[tag] = [buf];
1961
+ }
1962
+ else {
1963
+ list.push(buf);
1964
+ }
1965
+ }
1966
+ return message;
1967
+ },
1968
+ fromJSON(object) {
1969
+ return {
1970
+ query_index: isSet(object.queryIndex)
1971
+ ? globalThis.Number(object.queryIndex)
1972
+ : isSet(object.query_index)
1973
+ ? globalThis.Number(object.query_index)
1974
+ : 0,
1975
+ recall_id: isSet(object.recallId)
1976
+ ? globalThis.String(object.recallId)
1977
+ : isSet(object.recall_id)
1978
+ ? globalThis.String(object.recall_id)
1979
+ : "",
1980
+ entity_id: isSet(object.entityId)
1981
+ ? globalThis.String(object.entityId)
1982
+ : isSet(object.entity_id)
1983
+ ? globalThis.String(object.entity_id)
1984
+ : "",
1985
+ entity_kind: isSet(object.entityKind)
1986
+ ? globalThis.String(object.entityKind)
1987
+ : isSet(object.entity_kind)
1988
+ ? globalThis.String(object.entity_kind)
1989
+ : "",
1990
+ display_name: isSet(object.displayName)
1991
+ ? globalThis.String(object.displayName)
1992
+ : isSet(object.display_name)
1993
+ ? globalThis.String(object.display_name)
1994
+ : "",
1995
+ summary: isSet(object.summary) ? globalThis.String(object.summary) : "",
1996
+ relevance_score: isSet(object.relevanceScore)
1997
+ ? globalThis.Number(object.relevanceScore)
1998
+ : isSet(object.relevance_score)
1999
+ ? globalThis.Number(object.relevance_score)
2000
+ : 0,
2001
+ available_fields: globalThis.Array.isArray(object?.availableFields)
2002
+ ? object.availableFields.map((e) => globalThis.String(e))
2003
+ : globalThis.Array.isArray(object?.available_fields)
2004
+ ? object.available_fields.map((e) => globalThis.String(e))
2005
+ : [],
2006
+ available_edge_kinds: globalThis.Array.isArray(object?.availableEdgeKinds)
2007
+ ? object.availableEdgeKinds.map((e) => globalThis.String(e))
2008
+ : globalThis.Array.isArray(object?.available_edge_kinds)
2009
+ ? object.available_edge_kinds.map((e) => globalThis.String(e))
2010
+ : [],
2011
+ materialized_depth: isSet(object.materializedDepth)
2012
+ ? globalThis.Number(object.materializedDepth)
2013
+ : isSet(object.materialized_depth)
2014
+ ? globalThis.Number(object.materialized_depth)
2015
+ : 0,
2016
+ field_values_utf8: isObject(object.fieldValuesUtf8)
2017
+ ? globalThis.Object.entries(object.fieldValuesUtf8).reduce((acc, [key, value]) => {
2018
+ acc[key] = bytesFromBase64(value);
2019
+ return acc;
2020
+ }, {})
2021
+ : isObject(object.field_values_utf8)
2022
+ ? globalThis.Object.entries(object.field_values_utf8).reduce((acc, [key, value]) => {
2023
+ acc[key] = bytesFromBase64(value);
2024
+ return acc;
2025
+ }, {})
2026
+ : {},
2027
+ edge_lists_utf8_json: isObject(object.edgeListsUtf8Json)
2028
+ ? globalThis.Object.entries(object.edgeListsUtf8Json).reduce((acc, [key, value]) => {
2029
+ acc[key] = bytesFromBase64(value);
2030
+ return acc;
2031
+ }, {})
2032
+ : isObject(object.edge_lists_utf8_json)
2033
+ ? globalThis.Object.entries(object.edge_lists_utf8_json).reduce((acc, [key, value]) => {
2034
+ acc[key] = bytesFromBase64(value);
2035
+ return acc;
2036
+ }, {})
2037
+ : {},
2038
+ content_sha256: isSet(object.contentSha256)
2039
+ ? globalThis.String(object.contentSha256)
2040
+ : isSet(object.content_sha256)
2041
+ ? globalThis.String(object.content_sha256)
2042
+ : "",
2043
+ why_matched: globalThis.Array.isArray(object?.whyMatched)
2044
+ ? object.whyMatched.map((e) => RecallMatchReasonV1.fromJSON(e))
2045
+ : globalThis.Array.isArray(object?.why_matched)
2046
+ ? object.why_matched.map((e) => RecallMatchReasonV1.fromJSON(e))
2047
+ : [],
2048
+ provenance: globalThis.Array.isArray(object?.provenance)
2049
+ ? object.provenance.map((e) => RecallProvenanceV1.fromJSON(e))
2050
+ : [],
2051
+ };
2052
+ },
2053
+ toJSON(message) {
2054
+ const obj = {};
2055
+ if (message.query_index !== 0) {
2056
+ obj.queryIndex = Math.round(message.query_index);
2057
+ }
2058
+ if (message.recall_id !== "") {
2059
+ obj.recallId = message.recall_id;
2060
+ }
2061
+ if (message.entity_id !== "") {
2062
+ obj.entityId = message.entity_id;
2063
+ }
2064
+ if (message.entity_kind !== "") {
2065
+ obj.entityKind = message.entity_kind;
2066
+ }
2067
+ if (message.display_name !== "") {
2068
+ obj.displayName = message.display_name;
2069
+ }
2070
+ if (message.summary !== "") {
2071
+ obj.summary = message.summary;
2072
+ }
2073
+ if (message.relevance_score !== 0) {
2074
+ obj.relevanceScore = message.relevance_score;
2075
+ }
2076
+ if (message.available_fields?.length) {
2077
+ obj.availableFields = message.available_fields;
2078
+ }
2079
+ if (message.available_edge_kinds?.length) {
2080
+ obj.availableEdgeKinds = message.available_edge_kinds;
2081
+ }
2082
+ if (message.materialized_depth !== 0) {
2083
+ obj.materializedDepth = Math.round(message.materialized_depth);
2084
+ }
2085
+ if (message.field_values_utf8) {
2086
+ const entries = globalThis.Object.entries(message.field_values_utf8);
2087
+ if (entries.length > 0) {
2088
+ obj.fieldValuesUtf8 = {};
2089
+ entries.forEach(([k, v]) => {
2090
+ obj.fieldValuesUtf8[k] = base64FromBytes(v);
2091
+ });
2092
+ }
2093
+ }
2094
+ if (message.edge_lists_utf8_json) {
2095
+ const entries = globalThis.Object.entries(message.edge_lists_utf8_json);
2096
+ if (entries.length > 0) {
2097
+ obj.edgeListsUtf8Json = {};
2098
+ entries.forEach(([k, v]) => {
2099
+ obj.edgeListsUtf8Json[k] = base64FromBytes(v);
2100
+ });
2101
+ }
2102
+ }
2103
+ if (message.content_sha256 !== "") {
2104
+ obj.contentSha256 = message.content_sha256;
2105
+ }
2106
+ if (message.why_matched?.length) {
2107
+ obj.whyMatched = message.why_matched.map((e) => RecallMatchReasonV1.toJSON(e));
2108
+ }
2109
+ if (message.provenance?.length) {
2110
+ obj.provenance = message.provenance.map((e) => RecallProvenanceV1.toJSON(e));
2111
+ }
2112
+ return obj;
2113
+ },
2114
+ create(base) {
2115
+ return RecallSummaryV1.fromPartial(base ?? {});
2116
+ },
2117
+ fromPartial(object) {
2118
+ const message = createBaseRecallSummaryV1();
2119
+ message.query_index = object.query_index ?? 0;
2120
+ message.recall_id = object.recall_id ?? "";
2121
+ message.entity_id = object.entity_id ?? "";
2122
+ message.entity_kind = object.entity_kind ?? "";
2123
+ message.display_name = object.display_name ?? "";
2124
+ message.summary = object.summary ?? "";
2125
+ message.relevance_score = object.relevance_score ?? 0;
2126
+ message.available_fields = object.available_fields?.map((e) => e) || [];
2127
+ message.available_edge_kinds = object.available_edge_kinds?.map((e) => e) || [];
2128
+ message.materialized_depth = object.materialized_depth ?? 0;
2129
+ message.field_values_utf8 = globalThis.Object.entries(object.field_values_utf8 ?? {})
2130
+ .reduce((acc, [key, value]) => {
2131
+ if (value !== undefined) {
2132
+ acc[key] = value;
2133
+ }
2134
+ return acc;
2135
+ }, {});
2136
+ message.edge_lists_utf8_json =
2137
+ globalThis.Object.entries(object.edge_lists_utf8_json ?? {}).reduce((acc, [key, value]) => {
2138
+ if (value !== undefined) {
2139
+ acc[key] = value;
2140
+ }
2141
+ return acc;
2142
+ }, {});
2143
+ message.content_sha256 = object.content_sha256 ?? "";
2144
+ message.why_matched = object.why_matched?.map((e) => RecallMatchReasonV1.fromPartial(e)) || [];
2145
+ message.provenance = object.provenance?.map((e) => RecallProvenanceV1.fromPartial(e)) || [];
2146
+ return message;
2147
+ },
2148
+ };
2149
+ function createBaseRecallSummaryV1_FieldValuesUtf8Entry() {
2150
+ return { key: "", value: new Uint8Array(0), _unknownFields: {} };
2151
+ }
2152
+ export const RecallSummaryV1_FieldValuesUtf8Entry = {
2153
+ encode(message, writer = new BinaryWriter()) {
2154
+ if (message.key !== "") {
2155
+ writer.uint32(10).string(message.key);
2156
+ }
2157
+ if (message.value.length !== 0) {
2158
+ writer.uint32(18).bytes(message.value);
2159
+ }
2160
+ if (message._unknownFields !== undefined) {
2161
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
2162
+ const tag = parseInt(key, 10);
2163
+ for (const value of values) {
2164
+ writer.uint32(tag).raw(value);
2165
+ }
2166
+ }
2167
+ }
2168
+ return writer;
2169
+ },
2170
+ decode(input, length) {
2171
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2172
+ const end = length === undefined ? reader.len : reader.pos + length;
2173
+ const message = createBaseRecallSummaryV1_FieldValuesUtf8Entry();
2174
+ while (reader.pos < end) {
2175
+ const tag = reader.uint32();
2176
+ switch (tag >>> 3) {
2177
+ case 1: {
2178
+ if (tag !== 10) {
2179
+ break;
2180
+ }
2181
+ message.key = reader.string();
2182
+ continue;
2183
+ }
2184
+ case 2: {
2185
+ if (tag !== 18) {
2186
+ break;
2187
+ }
2188
+ message.value = reader.bytes();
2189
+ continue;
2190
+ }
2191
+ }
2192
+ if ((tag & 7) === 4 || tag === 0) {
2193
+ break;
2194
+ }
2195
+ const buf = reader.skip(tag & 7);
2196
+ const list = message._unknownFields[tag];
2197
+ if (list === undefined) {
2198
+ message._unknownFields[tag] = [buf];
2199
+ }
2200
+ else {
2201
+ list.push(buf);
2202
+ }
2203
+ }
2204
+ return message;
2205
+ },
2206
+ fromJSON(object) {
2207
+ return {
2208
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2209
+ value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
2210
+ };
2211
+ },
2212
+ toJSON(message) {
2213
+ const obj = {};
2214
+ if (message.key !== "") {
2215
+ obj.key = message.key;
2216
+ }
2217
+ if (message.value.length !== 0) {
2218
+ obj.value = base64FromBytes(message.value);
2219
+ }
2220
+ return obj;
2221
+ },
2222
+ create(base) {
2223
+ return RecallSummaryV1_FieldValuesUtf8Entry.fromPartial(base ?? {});
2224
+ },
2225
+ fromPartial(object) {
2226
+ const message = createBaseRecallSummaryV1_FieldValuesUtf8Entry();
2227
+ message.key = object.key ?? "";
2228
+ message.value = object.value ?? new Uint8Array(0);
2229
+ return message;
2230
+ },
2231
+ };
2232
+ function createBaseRecallSummaryV1_EdgeListsUtf8JsonEntry() {
2233
+ return { key: "", value: new Uint8Array(0), _unknownFields: {} };
2234
+ }
2235
+ export const RecallSummaryV1_EdgeListsUtf8JsonEntry = {
2236
+ encode(message, writer = new BinaryWriter()) {
2237
+ if (message.key !== "") {
2238
+ writer.uint32(10).string(message.key);
2239
+ }
2240
+ if (message.value.length !== 0) {
2241
+ writer.uint32(18).bytes(message.value);
2242
+ }
2243
+ if (message._unknownFields !== undefined) {
2244
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
2245
+ const tag = parseInt(key, 10);
2246
+ for (const value of values) {
2247
+ writer.uint32(tag).raw(value);
2248
+ }
2249
+ }
2250
+ }
2251
+ return writer;
2252
+ },
2253
+ decode(input, length) {
2254
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2255
+ const end = length === undefined ? reader.len : reader.pos + length;
2256
+ const message = createBaseRecallSummaryV1_EdgeListsUtf8JsonEntry();
2257
+ while (reader.pos < end) {
2258
+ const tag = reader.uint32();
2259
+ switch (tag >>> 3) {
2260
+ case 1: {
2261
+ if (tag !== 10) {
2262
+ break;
2263
+ }
2264
+ message.key = reader.string();
2265
+ continue;
2266
+ }
2267
+ case 2: {
2268
+ if (tag !== 18) {
2269
+ break;
2270
+ }
2271
+ message.value = reader.bytes();
2272
+ continue;
2273
+ }
2274
+ }
2275
+ if ((tag & 7) === 4 || tag === 0) {
2276
+ break;
2277
+ }
2278
+ const buf = reader.skip(tag & 7);
2279
+ const list = message._unknownFields[tag];
2280
+ if (list === undefined) {
2281
+ message._unknownFields[tag] = [buf];
2282
+ }
2283
+ else {
2284
+ list.push(buf);
2285
+ }
2286
+ }
2287
+ return message;
2288
+ },
2289
+ fromJSON(object) {
2290
+ return {
2291
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2292
+ value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
2293
+ };
2294
+ },
2295
+ toJSON(message) {
2296
+ const obj = {};
2297
+ if (message.key !== "") {
2298
+ obj.key = message.key;
2299
+ }
2300
+ if (message.value.length !== 0) {
2301
+ obj.value = base64FromBytes(message.value);
2302
+ }
2303
+ return obj;
2304
+ },
2305
+ create(base) {
2306
+ return RecallSummaryV1_EdgeListsUtf8JsonEntry.fromPartial(base ?? {});
2307
+ },
2308
+ fromPartial(object) {
2309
+ const message = createBaseRecallSummaryV1_EdgeListsUtf8JsonEntry();
2310
+ message.key = object.key ?? "";
2311
+ message.value = object.value ?? new Uint8Array(0);
2312
+ return message;
2313
+ },
2314
+ };
2315
+ function createBaseRetrieveBatchResponse() {
2316
+ return {
2317
+ operation_id: "",
2318
+ runtime_scope_sha256: "",
2319
+ descriptor_sha256: "",
2320
+ summaries: [],
2321
+ content_bytes: 0,
2322
+ truncated: false,
2323
+ truncation_reason: 0,
2324
+ next_query_index: undefined,
2325
+ continuation_token: "",
2326
+ omitted_summary_count: 0,
2327
+ content_byte_budget: 0,
2328
+ _unknownFields: {},
2329
+ };
2330
+ }
2331
+ export const RetrieveBatchResponse = {
2332
+ encode(message, writer = new BinaryWriter()) {
2333
+ if (message.operation_id !== "") {
2334
+ writer.uint32(10).string(message.operation_id);
2335
+ }
2336
+ if (message.runtime_scope_sha256 !== "") {
2337
+ writer.uint32(18).string(message.runtime_scope_sha256);
2338
+ }
2339
+ if (message.descriptor_sha256 !== "") {
2340
+ writer.uint32(26).string(message.descriptor_sha256);
2341
+ }
2342
+ for (const v of message.summaries) {
2343
+ RecallSummaryV1.encode(v, writer.uint32(34).fork()).join();
2344
+ }
2345
+ if (message.content_bytes !== 0) {
2346
+ writer.uint32(40).uint32(message.content_bytes);
2347
+ }
2348
+ if (message.truncated !== false) {
2349
+ writer.uint32(48).bool(message.truncated);
2350
+ }
2351
+ if (message.truncation_reason !== 0) {
2352
+ writer.uint32(56).int32(message.truncation_reason);
2353
+ }
2354
+ if (message.next_query_index !== undefined) {
2355
+ writer.uint32(64).uint32(message.next_query_index);
2356
+ }
2357
+ if (message.continuation_token !== "") {
2358
+ writer.uint32(74).string(message.continuation_token);
2359
+ }
2360
+ if (message.omitted_summary_count !== 0) {
2361
+ writer.uint32(80).uint32(message.omitted_summary_count);
2362
+ }
2363
+ if (message.content_byte_budget !== 0) {
2364
+ writer.uint32(88).uint32(message.content_byte_budget);
2365
+ }
2366
+ if (message._unknownFields !== undefined) {
2367
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
2368
+ const tag = parseInt(key, 10);
2369
+ for (const value of values) {
2370
+ writer.uint32(tag).raw(value);
2371
+ }
2372
+ }
2373
+ }
2374
+ return writer;
2375
+ },
2376
+ decode(input, length) {
2377
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2378
+ const end = length === undefined ? reader.len : reader.pos + length;
2379
+ const message = createBaseRetrieveBatchResponse();
2380
+ while (reader.pos < end) {
2381
+ const tag = reader.uint32();
2382
+ switch (tag >>> 3) {
2383
+ case 1: {
2384
+ if (tag !== 10) {
2385
+ break;
2386
+ }
2387
+ message.operation_id = reader.string();
2388
+ continue;
2389
+ }
2390
+ case 2: {
2391
+ if (tag !== 18) {
2392
+ break;
2393
+ }
2394
+ message.runtime_scope_sha256 = reader.string();
2395
+ continue;
2396
+ }
2397
+ case 3: {
2398
+ if (tag !== 26) {
2399
+ break;
2400
+ }
2401
+ message.descriptor_sha256 = reader.string();
2402
+ continue;
2403
+ }
2404
+ case 4: {
2405
+ if (tag !== 34) {
2406
+ break;
2407
+ }
2408
+ message.summaries.push(RecallSummaryV1.decode(reader, reader.uint32()));
2409
+ continue;
2410
+ }
2411
+ case 5: {
2412
+ if (tag !== 40) {
2413
+ break;
2414
+ }
2415
+ message.content_bytes = reader.uint32();
2416
+ continue;
2417
+ }
2418
+ case 6: {
2419
+ if (tag !== 48) {
2420
+ break;
2421
+ }
2422
+ message.truncated = reader.bool();
2423
+ continue;
2424
+ }
2425
+ case 7: {
2426
+ if (tag !== 56) {
2427
+ break;
2428
+ }
2429
+ message.truncation_reason = reader.int32();
2430
+ continue;
2431
+ }
2432
+ case 8: {
2433
+ if (tag !== 64) {
2434
+ break;
2435
+ }
2436
+ message.next_query_index = reader.uint32();
2437
+ continue;
2438
+ }
2439
+ case 9: {
2440
+ if (tag !== 74) {
2441
+ break;
2442
+ }
2443
+ message.continuation_token = reader.string();
2444
+ continue;
2445
+ }
2446
+ case 10: {
2447
+ if (tag !== 80) {
2448
+ break;
2449
+ }
2450
+ message.omitted_summary_count = reader.uint32();
2451
+ continue;
2452
+ }
2453
+ case 11: {
2454
+ if (tag !== 88) {
2455
+ break;
2456
+ }
2457
+ message.content_byte_budget = reader.uint32();
2458
+ continue;
2459
+ }
2460
+ }
2461
+ if ((tag & 7) === 4 || tag === 0) {
2462
+ break;
2463
+ }
2464
+ const buf = reader.skip(tag & 7);
2465
+ const list = message._unknownFields[tag];
2466
+ if (list === undefined) {
2467
+ message._unknownFields[tag] = [buf];
2468
+ }
2469
+ else {
2470
+ list.push(buf);
2471
+ }
2472
+ }
2473
+ return message;
2474
+ },
2475
+ fromJSON(object) {
2476
+ return {
2477
+ operation_id: isSet(object.operationId)
2478
+ ? globalThis.String(object.operationId)
2479
+ : isSet(object.operation_id)
2480
+ ? globalThis.String(object.operation_id)
2481
+ : "",
2482
+ runtime_scope_sha256: isSet(object.runtimeScopeSha256)
2483
+ ? globalThis.String(object.runtimeScopeSha256)
2484
+ : isSet(object.runtime_scope_sha256)
2485
+ ? globalThis.String(object.runtime_scope_sha256)
2486
+ : "",
2487
+ descriptor_sha256: isSet(object.descriptorSha256)
2488
+ ? globalThis.String(object.descriptorSha256)
2489
+ : isSet(object.descriptor_sha256)
2490
+ ? globalThis.String(object.descriptor_sha256)
2491
+ : "",
2492
+ summaries: globalThis.Array.isArray(object?.summaries)
2493
+ ? object.summaries.map((e) => RecallSummaryV1.fromJSON(e))
2494
+ : [],
2495
+ content_bytes: isSet(object.contentBytes)
2496
+ ? globalThis.Number(object.contentBytes)
2497
+ : isSet(object.content_bytes)
2498
+ ? globalThis.Number(object.content_bytes)
2499
+ : 0,
2500
+ truncated: isSet(object.truncated) ? globalThis.Boolean(object.truncated) : false,
2501
+ truncation_reason: isSet(object.truncationReason)
2502
+ ? retrievalTruncationReasonFromJSON(object.truncationReason)
2503
+ : isSet(object.truncation_reason)
2504
+ ? retrievalTruncationReasonFromJSON(object.truncation_reason)
2505
+ : 0,
2506
+ next_query_index: isSet(object.nextQueryIndex)
2507
+ ? globalThis.Number(object.nextQueryIndex)
2508
+ : isSet(object.next_query_index)
2509
+ ? globalThis.Number(object.next_query_index)
2510
+ : undefined,
2511
+ continuation_token: isSet(object.continuationToken)
2512
+ ? globalThis.String(object.continuationToken)
2513
+ : isSet(object.continuation_token)
2514
+ ? globalThis.String(object.continuation_token)
2515
+ : "",
2516
+ omitted_summary_count: isSet(object.omittedSummaryCount)
2517
+ ? globalThis.Number(object.omittedSummaryCount)
2518
+ : isSet(object.omitted_summary_count)
2519
+ ? globalThis.Number(object.omitted_summary_count)
2520
+ : 0,
2521
+ content_byte_budget: isSet(object.contentByteBudget)
2522
+ ? globalThis.Number(object.contentByteBudget)
2523
+ : isSet(object.content_byte_budget)
2524
+ ? globalThis.Number(object.content_byte_budget)
2525
+ : 0,
2526
+ };
2527
+ },
2528
+ toJSON(message) {
2529
+ const obj = {};
2530
+ if (message.operation_id !== "") {
2531
+ obj.operationId = message.operation_id;
2532
+ }
2533
+ if (message.runtime_scope_sha256 !== "") {
2534
+ obj.runtimeScopeSha256 = message.runtime_scope_sha256;
2535
+ }
2536
+ if (message.descriptor_sha256 !== "") {
2537
+ obj.descriptorSha256 = message.descriptor_sha256;
2538
+ }
2539
+ if (message.summaries?.length) {
2540
+ obj.summaries = message.summaries.map((e) => RecallSummaryV1.toJSON(e));
2541
+ }
2542
+ if (message.content_bytes !== 0) {
2543
+ obj.contentBytes = Math.round(message.content_bytes);
2544
+ }
2545
+ if (message.truncated !== false) {
2546
+ obj.truncated = message.truncated;
2547
+ }
2548
+ if (message.truncation_reason !== 0) {
2549
+ obj.truncationReason = retrievalTruncationReasonToJSON(message.truncation_reason);
2550
+ }
2551
+ if (message.next_query_index !== undefined) {
2552
+ obj.nextQueryIndex = Math.round(message.next_query_index);
2553
+ }
2554
+ if (message.continuation_token !== "") {
2555
+ obj.continuationToken = message.continuation_token;
2556
+ }
2557
+ if (message.omitted_summary_count !== 0) {
2558
+ obj.omittedSummaryCount = Math.round(message.omitted_summary_count);
2559
+ }
2560
+ if (message.content_byte_budget !== 0) {
2561
+ obj.contentByteBudget = Math.round(message.content_byte_budget);
2562
+ }
2563
+ return obj;
2564
+ },
2565
+ create(base) {
2566
+ return RetrieveBatchResponse.fromPartial(base ?? {});
2567
+ },
2568
+ fromPartial(object) {
2569
+ const message = createBaseRetrieveBatchResponse();
2570
+ message.operation_id = object.operation_id ?? "";
2571
+ message.runtime_scope_sha256 = object.runtime_scope_sha256 ?? "";
2572
+ message.descriptor_sha256 = object.descriptor_sha256 ?? "";
2573
+ message.summaries = object.summaries?.map((e) => RecallSummaryV1.fromPartial(e)) || [];
2574
+ message.content_bytes = object.content_bytes ?? 0;
2575
+ message.truncated = object.truncated ?? false;
2576
+ message.truncation_reason = object.truncation_reason ?? 0;
2577
+ message.next_query_index = object.next_query_index ?? undefined;
2578
+ message.continuation_token = object.continuation_token ?? "";
2579
+ message.omitted_summary_count = object.omitted_summary_count ?? 0;
2580
+ message.content_byte_budget = object.content_byte_budget ?? 0;
2581
+ return message;
2582
+ },
2583
+ };
2584
+ function createBaseRetrievalExpandRequest() {
2585
+ return {
2586
+ operation_id: "",
2587
+ runtime_scope_sha256: "",
2588
+ descriptor_sha256: "",
2589
+ query_index: 0,
2590
+ recall_ids: [],
2591
+ fields: [],
2592
+ edge_kinds: [],
2593
+ depth: 0,
2594
+ content_byte_budget: 0,
2595
+ continuation_token: "",
2596
+ turn_remaining_content_bytes: 0,
2597
+ _unknownFields: {},
2598
+ };
2599
+ }
2600
+ export const RetrievalExpandRequest = {
2601
+ encode(message, writer = new BinaryWriter()) {
2602
+ if (message.operation_id !== "") {
2603
+ writer.uint32(10).string(message.operation_id);
2604
+ }
2605
+ if (message.runtime_scope_sha256 !== "") {
2606
+ writer.uint32(18).string(message.runtime_scope_sha256);
2607
+ }
2608
+ if (message.descriptor_sha256 !== "") {
2609
+ writer.uint32(26).string(message.descriptor_sha256);
2610
+ }
2611
+ if (message.query_index !== 0) {
2612
+ writer.uint32(32).uint32(message.query_index);
2613
+ }
2614
+ for (const v of message.recall_ids) {
2615
+ writer.uint32(42).string(v);
2616
+ }
2617
+ for (const v of message.fields) {
2618
+ writer.uint32(50).string(v);
2619
+ }
2620
+ for (const v of message.edge_kinds) {
2621
+ writer.uint32(58).string(v);
2622
+ }
2623
+ if (message.depth !== 0) {
2624
+ writer.uint32(64).uint32(message.depth);
2625
+ }
2626
+ if (message.content_byte_budget !== 0) {
2627
+ writer.uint32(72).uint32(message.content_byte_budget);
2628
+ }
2629
+ if (message.continuation_token !== "") {
2630
+ writer.uint32(82).string(message.continuation_token);
2631
+ }
2632
+ if (message.turn_remaining_content_bytes !== 0) {
2633
+ writer.uint32(88).uint32(message.turn_remaining_content_bytes);
2634
+ }
2635
+ if (message._unknownFields !== undefined) {
2636
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
2637
+ const tag = parseInt(key, 10);
2638
+ for (const value of values) {
2639
+ writer.uint32(tag).raw(value);
2640
+ }
2641
+ }
2642
+ }
2643
+ return writer;
2644
+ },
2645
+ decode(input, length) {
2646
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2647
+ const end = length === undefined ? reader.len : reader.pos + length;
2648
+ const message = createBaseRetrievalExpandRequest();
2649
+ while (reader.pos < end) {
2650
+ const tag = reader.uint32();
2651
+ switch (tag >>> 3) {
2652
+ case 1: {
2653
+ if (tag !== 10) {
2654
+ break;
2655
+ }
2656
+ message.operation_id = reader.string();
2657
+ continue;
2658
+ }
2659
+ case 2: {
2660
+ if (tag !== 18) {
2661
+ break;
2662
+ }
2663
+ message.runtime_scope_sha256 = reader.string();
2664
+ continue;
2665
+ }
2666
+ case 3: {
2667
+ if (tag !== 26) {
2668
+ break;
2669
+ }
2670
+ message.descriptor_sha256 = reader.string();
2671
+ continue;
2672
+ }
2673
+ case 4: {
2674
+ if (tag !== 32) {
2675
+ break;
2676
+ }
2677
+ message.query_index = reader.uint32();
2678
+ continue;
2679
+ }
2680
+ case 5: {
2681
+ if (tag !== 42) {
2682
+ break;
2683
+ }
2684
+ message.recall_ids.push(reader.string());
2685
+ continue;
2686
+ }
2687
+ case 6: {
2688
+ if (tag !== 50) {
2689
+ break;
2690
+ }
2691
+ message.fields.push(reader.string());
2692
+ continue;
2693
+ }
2694
+ case 7: {
2695
+ if (tag !== 58) {
2696
+ break;
2697
+ }
2698
+ message.edge_kinds.push(reader.string());
2699
+ continue;
2700
+ }
2701
+ case 8: {
2702
+ if (tag !== 64) {
2703
+ break;
2704
+ }
2705
+ message.depth = reader.uint32();
2706
+ continue;
2707
+ }
2708
+ case 9: {
2709
+ if (tag !== 72) {
2710
+ break;
2711
+ }
2712
+ message.content_byte_budget = reader.uint32();
2713
+ continue;
2714
+ }
2715
+ case 10: {
2716
+ if (tag !== 82) {
2717
+ break;
2718
+ }
2719
+ message.continuation_token = reader.string();
2720
+ continue;
2721
+ }
2722
+ case 11: {
2723
+ if (tag !== 88) {
2724
+ break;
2725
+ }
2726
+ message.turn_remaining_content_bytes = reader.uint32();
2727
+ continue;
2728
+ }
2729
+ }
2730
+ if ((tag & 7) === 4 || tag === 0) {
2731
+ break;
2732
+ }
2733
+ const buf = reader.skip(tag & 7);
2734
+ const list = message._unknownFields[tag];
2735
+ if (list === undefined) {
2736
+ message._unknownFields[tag] = [buf];
2737
+ }
2738
+ else {
2739
+ list.push(buf);
2740
+ }
2741
+ }
2742
+ return message;
2743
+ },
2744
+ fromJSON(object) {
2745
+ return {
2746
+ operation_id: isSet(object.operationId)
2747
+ ? globalThis.String(object.operationId)
2748
+ : isSet(object.operation_id)
2749
+ ? globalThis.String(object.operation_id)
2750
+ : "",
2751
+ runtime_scope_sha256: isSet(object.runtimeScopeSha256)
2752
+ ? globalThis.String(object.runtimeScopeSha256)
2753
+ : isSet(object.runtime_scope_sha256)
2754
+ ? globalThis.String(object.runtime_scope_sha256)
2755
+ : "",
2756
+ descriptor_sha256: isSet(object.descriptorSha256)
2757
+ ? globalThis.String(object.descriptorSha256)
2758
+ : isSet(object.descriptor_sha256)
2759
+ ? globalThis.String(object.descriptor_sha256)
2760
+ : "",
2761
+ query_index: isSet(object.queryIndex)
2762
+ ? globalThis.Number(object.queryIndex)
2763
+ : isSet(object.query_index)
2764
+ ? globalThis.Number(object.query_index)
2765
+ : 0,
2766
+ recall_ids: globalThis.Array.isArray(object?.recallIds)
2767
+ ? object.recallIds.map((e) => globalThis.String(e))
2768
+ : globalThis.Array.isArray(object?.recall_ids)
2769
+ ? object.recall_ids.map((e) => globalThis.String(e))
2770
+ : [],
2771
+ fields: globalThis.Array.isArray(object?.fields) ? object.fields.map((e) => globalThis.String(e)) : [],
2772
+ edge_kinds: globalThis.Array.isArray(object?.edgeKinds)
2773
+ ? object.edgeKinds.map((e) => globalThis.String(e))
2774
+ : globalThis.Array.isArray(object?.edge_kinds)
2775
+ ? object.edge_kinds.map((e) => globalThis.String(e))
2776
+ : [],
2777
+ depth: isSet(object.depth) ? globalThis.Number(object.depth) : 0,
2778
+ content_byte_budget: isSet(object.contentByteBudget)
2779
+ ? globalThis.Number(object.contentByteBudget)
2780
+ : isSet(object.content_byte_budget)
2781
+ ? globalThis.Number(object.content_byte_budget)
2782
+ : 0,
2783
+ continuation_token: isSet(object.continuationToken)
2784
+ ? globalThis.String(object.continuationToken)
2785
+ : isSet(object.continuation_token)
2786
+ ? globalThis.String(object.continuation_token)
2787
+ : "",
2788
+ turn_remaining_content_bytes: isSet(object.turnRemainingContentBytes)
2789
+ ? globalThis.Number(object.turnRemainingContentBytes)
2790
+ : isSet(object.turn_remaining_content_bytes)
2791
+ ? globalThis.Number(object.turn_remaining_content_bytes)
2792
+ : 0,
2793
+ };
2794
+ },
2795
+ toJSON(message) {
2796
+ const obj = {};
2797
+ if (message.operation_id !== "") {
2798
+ obj.operationId = message.operation_id;
2799
+ }
2800
+ if (message.runtime_scope_sha256 !== "") {
2801
+ obj.runtimeScopeSha256 = message.runtime_scope_sha256;
2802
+ }
2803
+ if (message.descriptor_sha256 !== "") {
2804
+ obj.descriptorSha256 = message.descriptor_sha256;
2805
+ }
2806
+ if (message.query_index !== 0) {
2807
+ obj.queryIndex = Math.round(message.query_index);
2808
+ }
2809
+ if (message.recall_ids?.length) {
2810
+ obj.recallIds = message.recall_ids;
2811
+ }
2812
+ if (message.fields?.length) {
2813
+ obj.fields = message.fields;
2814
+ }
2815
+ if (message.edge_kinds?.length) {
2816
+ obj.edgeKinds = message.edge_kinds;
2817
+ }
2818
+ if (message.depth !== 0) {
2819
+ obj.depth = Math.round(message.depth);
2820
+ }
2821
+ if (message.content_byte_budget !== 0) {
2822
+ obj.contentByteBudget = Math.round(message.content_byte_budget);
2823
+ }
2824
+ if (message.continuation_token !== "") {
2825
+ obj.continuationToken = message.continuation_token;
2826
+ }
2827
+ if (message.turn_remaining_content_bytes !== 0) {
2828
+ obj.turnRemainingContentBytes = Math.round(message.turn_remaining_content_bytes);
2829
+ }
2830
+ return obj;
2831
+ },
2832
+ create(base) {
2833
+ return RetrievalExpandRequest.fromPartial(base ?? {});
2834
+ },
2835
+ fromPartial(object) {
2836
+ const message = createBaseRetrievalExpandRequest();
2837
+ message.operation_id = object.operation_id ?? "";
2838
+ message.runtime_scope_sha256 = object.runtime_scope_sha256 ?? "";
2839
+ message.descriptor_sha256 = object.descriptor_sha256 ?? "";
2840
+ message.query_index = object.query_index ?? 0;
2841
+ message.recall_ids = object.recall_ids?.map((e) => e) || [];
2842
+ message.fields = object.fields?.map((e) => e) || [];
2843
+ message.edge_kinds = object.edge_kinds?.map((e) => e) || [];
2844
+ message.depth = object.depth ?? 0;
2845
+ message.content_byte_budget = object.content_byte_budget ?? 0;
2846
+ message.continuation_token = object.continuation_token ?? "";
2847
+ message.turn_remaining_content_bytes = object.turn_remaining_content_bytes ?? 0;
2848
+ return message;
2849
+ },
2850
+ };
2851
+ function createBaseRetrievalExpandResponse() {
2852
+ return {
2853
+ operation_id: "",
2854
+ runtime_scope_sha256: "",
2855
+ descriptor_sha256: "",
2856
+ query_index: 0,
2857
+ summaries: [],
2858
+ content_bytes: 0,
2859
+ truncated: false,
2860
+ truncation_reason: 0,
2861
+ continuation_token: "",
2862
+ omitted_field_count: 0,
2863
+ omitted_edge_count: 0,
2864
+ omitted_summary_count: 0,
2865
+ content_byte_budget: 0,
2866
+ _unknownFields: {},
2867
+ };
2868
+ }
2869
+ export const RetrievalExpandResponse = {
2870
+ encode(message, writer = new BinaryWriter()) {
2871
+ if (message.operation_id !== "") {
2872
+ writer.uint32(10).string(message.operation_id);
2873
+ }
2874
+ if (message.runtime_scope_sha256 !== "") {
2875
+ writer.uint32(18).string(message.runtime_scope_sha256);
2876
+ }
2877
+ if (message.descriptor_sha256 !== "") {
2878
+ writer.uint32(26).string(message.descriptor_sha256);
2879
+ }
2880
+ if (message.query_index !== 0) {
2881
+ writer.uint32(32).uint32(message.query_index);
2882
+ }
2883
+ for (const v of message.summaries) {
2884
+ RecallSummaryV1.encode(v, writer.uint32(42).fork()).join();
2885
+ }
2886
+ if (message.content_bytes !== 0) {
2887
+ writer.uint32(48).uint32(message.content_bytes);
2888
+ }
2889
+ if (message.truncated !== false) {
2890
+ writer.uint32(56).bool(message.truncated);
2891
+ }
2892
+ if (message.truncation_reason !== 0) {
2893
+ writer.uint32(64).int32(message.truncation_reason);
2894
+ }
2895
+ if (message.continuation_token !== "") {
2896
+ writer.uint32(74).string(message.continuation_token);
2897
+ }
2898
+ if (message.omitted_field_count !== 0) {
2899
+ writer.uint32(80).uint32(message.omitted_field_count);
2900
+ }
2901
+ if (message.omitted_edge_count !== 0) {
2902
+ writer.uint32(88).uint32(message.omitted_edge_count);
2903
+ }
2904
+ if (message.omitted_summary_count !== 0) {
2905
+ writer.uint32(96).uint32(message.omitted_summary_count);
2906
+ }
2907
+ if (message.content_byte_budget !== 0) {
2908
+ writer.uint32(104).uint32(message.content_byte_budget);
2909
+ }
2910
+ if (message._unknownFields !== undefined) {
2911
+ for (const [key, values] of globalThis.Object.entries(message._unknownFields)) {
2912
+ const tag = parseInt(key, 10);
2913
+ for (const value of values) {
2914
+ writer.uint32(tag).raw(value);
2915
+ }
2916
+ }
2917
+ }
2918
+ return writer;
2919
+ },
2920
+ decode(input, length) {
2921
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2922
+ const end = length === undefined ? reader.len : reader.pos + length;
2923
+ const message = createBaseRetrievalExpandResponse();
2924
+ while (reader.pos < end) {
2925
+ const tag = reader.uint32();
2926
+ switch (tag >>> 3) {
2927
+ case 1: {
2928
+ if (tag !== 10) {
2929
+ break;
2930
+ }
2931
+ message.operation_id = reader.string();
2932
+ continue;
2933
+ }
2934
+ case 2: {
2935
+ if (tag !== 18) {
2936
+ break;
2937
+ }
2938
+ message.runtime_scope_sha256 = reader.string();
2939
+ continue;
2940
+ }
2941
+ case 3: {
2942
+ if (tag !== 26) {
2943
+ break;
2944
+ }
2945
+ message.descriptor_sha256 = reader.string();
2946
+ continue;
2947
+ }
2948
+ case 4: {
2949
+ if (tag !== 32) {
2950
+ break;
2951
+ }
2952
+ message.query_index = reader.uint32();
2953
+ continue;
2954
+ }
2955
+ case 5: {
2956
+ if (tag !== 42) {
2957
+ break;
2958
+ }
2959
+ message.summaries.push(RecallSummaryV1.decode(reader, reader.uint32()));
2960
+ continue;
2961
+ }
2962
+ case 6: {
2963
+ if (tag !== 48) {
2964
+ break;
2965
+ }
2966
+ message.content_bytes = reader.uint32();
2967
+ continue;
2968
+ }
2969
+ case 7: {
2970
+ if (tag !== 56) {
2971
+ break;
2972
+ }
2973
+ message.truncated = reader.bool();
2974
+ continue;
2975
+ }
2976
+ case 8: {
2977
+ if (tag !== 64) {
2978
+ break;
2979
+ }
2980
+ message.truncation_reason = reader.int32();
2981
+ continue;
2982
+ }
2983
+ case 9: {
2984
+ if (tag !== 74) {
2985
+ break;
2986
+ }
2987
+ message.continuation_token = reader.string();
2988
+ continue;
2989
+ }
2990
+ case 10: {
2991
+ if (tag !== 80) {
2992
+ break;
2993
+ }
2994
+ message.omitted_field_count = reader.uint32();
2995
+ continue;
2996
+ }
2997
+ case 11: {
2998
+ if (tag !== 88) {
2999
+ break;
3000
+ }
3001
+ message.omitted_edge_count = reader.uint32();
3002
+ continue;
3003
+ }
3004
+ case 12: {
3005
+ if (tag !== 96) {
3006
+ break;
3007
+ }
3008
+ message.omitted_summary_count = reader.uint32();
3009
+ continue;
3010
+ }
3011
+ case 13: {
3012
+ if (tag !== 104) {
3013
+ break;
3014
+ }
3015
+ message.content_byte_budget = reader.uint32();
3016
+ continue;
3017
+ }
3018
+ }
3019
+ if ((tag & 7) === 4 || tag === 0) {
3020
+ break;
3021
+ }
3022
+ const buf = reader.skip(tag & 7);
3023
+ const list = message._unknownFields[tag];
3024
+ if (list === undefined) {
3025
+ message._unknownFields[tag] = [buf];
3026
+ }
3027
+ else {
3028
+ list.push(buf);
3029
+ }
3030
+ }
3031
+ return message;
3032
+ },
3033
+ fromJSON(object) {
3034
+ return {
3035
+ operation_id: isSet(object.operationId)
3036
+ ? globalThis.String(object.operationId)
3037
+ : isSet(object.operation_id)
3038
+ ? globalThis.String(object.operation_id)
3039
+ : "",
3040
+ runtime_scope_sha256: isSet(object.runtimeScopeSha256)
3041
+ ? globalThis.String(object.runtimeScopeSha256)
3042
+ : isSet(object.runtime_scope_sha256)
3043
+ ? globalThis.String(object.runtime_scope_sha256)
3044
+ : "",
3045
+ descriptor_sha256: isSet(object.descriptorSha256)
3046
+ ? globalThis.String(object.descriptorSha256)
3047
+ : isSet(object.descriptor_sha256)
3048
+ ? globalThis.String(object.descriptor_sha256)
3049
+ : "",
3050
+ query_index: isSet(object.queryIndex)
3051
+ ? globalThis.Number(object.queryIndex)
3052
+ : isSet(object.query_index)
3053
+ ? globalThis.Number(object.query_index)
3054
+ : 0,
3055
+ summaries: globalThis.Array.isArray(object?.summaries)
3056
+ ? object.summaries.map((e) => RecallSummaryV1.fromJSON(e))
3057
+ : [],
3058
+ content_bytes: isSet(object.contentBytes)
3059
+ ? globalThis.Number(object.contentBytes)
3060
+ : isSet(object.content_bytes)
3061
+ ? globalThis.Number(object.content_bytes)
3062
+ : 0,
3063
+ truncated: isSet(object.truncated) ? globalThis.Boolean(object.truncated) : false,
3064
+ truncation_reason: isSet(object.truncationReason)
3065
+ ? retrievalTruncationReasonFromJSON(object.truncationReason)
3066
+ : isSet(object.truncation_reason)
3067
+ ? retrievalTruncationReasonFromJSON(object.truncation_reason)
3068
+ : 0,
3069
+ continuation_token: isSet(object.continuationToken)
3070
+ ? globalThis.String(object.continuationToken)
3071
+ : isSet(object.continuation_token)
3072
+ ? globalThis.String(object.continuation_token)
3073
+ : "",
3074
+ omitted_field_count: isSet(object.omittedFieldCount)
3075
+ ? globalThis.Number(object.omittedFieldCount)
3076
+ : isSet(object.omitted_field_count)
3077
+ ? globalThis.Number(object.omitted_field_count)
3078
+ : 0,
3079
+ omitted_edge_count: isSet(object.omittedEdgeCount)
3080
+ ? globalThis.Number(object.omittedEdgeCount)
3081
+ : isSet(object.omitted_edge_count)
3082
+ ? globalThis.Number(object.omitted_edge_count)
3083
+ : 0,
3084
+ omitted_summary_count: isSet(object.omittedSummaryCount)
3085
+ ? globalThis.Number(object.omittedSummaryCount)
3086
+ : isSet(object.omitted_summary_count)
3087
+ ? globalThis.Number(object.omitted_summary_count)
3088
+ : 0,
3089
+ content_byte_budget: isSet(object.contentByteBudget)
3090
+ ? globalThis.Number(object.contentByteBudget)
3091
+ : isSet(object.content_byte_budget)
3092
+ ? globalThis.Number(object.content_byte_budget)
3093
+ : 0,
3094
+ };
3095
+ },
3096
+ toJSON(message) {
3097
+ const obj = {};
3098
+ if (message.operation_id !== "") {
3099
+ obj.operationId = message.operation_id;
3100
+ }
3101
+ if (message.runtime_scope_sha256 !== "") {
3102
+ obj.runtimeScopeSha256 = message.runtime_scope_sha256;
3103
+ }
3104
+ if (message.descriptor_sha256 !== "") {
3105
+ obj.descriptorSha256 = message.descriptor_sha256;
3106
+ }
3107
+ if (message.query_index !== 0) {
3108
+ obj.queryIndex = Math.round(message.query_index);
3109
+ }
3110
+ if (message.summaries?.length) {
3111
+ obj.summaries = message.summaries.map((e) => RecallSummaryV1.toJSON(e));
3112
+ }
3113
+ if (message.content_bytes !== 0) {
3114
+ obj.contentBytes = Math.round(message.content_bytes);
3115
+ }
3116
+ if (message.truncated !== false) {
3117
+ obj.truncated = message.truncated;
3118
+ }
3119
+ if (message.truncation_reason !== 0) {
3120
+ obj.truncationReason = retrievalTruncationReasonToJSON(message.truncation_reason);
3121
+ }
3122
+ if (message.continuation_token !== "") {
3123
+ obj.continuationToken = message.continuation_token;
3124
+ }
3125
+ if (message.omitted_field_count !== 0) {
3126
+ obj.omittedFieldCount = Math.round(message.omitted_field_count);
3127
+ }
3128
+ if (message.omitted_edge_count !== 0) {
3129
+ obj.omittedEdgeCount = Math.round(message.omitted_edge_count);
3130
+ }
3131
+ if (message.omitted_summary_count !== 0) {
3132
+ obj.omittedSummaryCount = Math.round(message.omitted_summary_count);
3133
+ }
3134
+ if (message.content_byte_budget !== 0) {
3135
+ obj.contentByteBudget = Math.round(message.content_byte_budget);
3136
+ }
3137
+ return obj;
3138
+ },
3139
+ create(base) {
3140
+ return RetrievalExpandResponse.fromPartial(base ?? {});
3141
+ },
3142
+ fromPartial(object) {
3143
+ const message = createBaseRetrievalExpandResponse();
3144
+ message.operation_id = object.operation_id ?? "";
3145
+ message.runtime_scope_sha256 = object.runtime_scope_sha256 ?? "";
3146
+ message.descriptor_sha256 = object.descriptor_sha256 ?? "";
3147
+ message.query_index = object.query_index ?? 0;
3148
+ message.summaries = object.summaries?.map((e) => RecallSummaryV1.fromPartial(e)) || [];
3149
+ message.content_bytes = object.content_bytes ?? 0;
3150
+ message.truncated = object.truncated ?? false;
3151
+ message.truncation_reason = object.truncation_reason ?? 0;
3152
+ message.continuation_token = object.continuation_token ?? "";
3153
+ message.omitted_field_count = object.omitted_field_count ?? 0;
3154
+ message.omitted_edge_count = object.omitted_edge_count ?? 0;
3155
+ message.omitted_summary_count = object.omitted_summary_count ?? 0;
3156
+ message.content_byte_budget = object.content_byte_budget ?? 0;
3157
+ return message;
3158
+ },
3159
+ };
3160
+ function bytesFromBase64(b64) {
3161
+ if (globalThis.Buffer) {
3162
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
3163
+ }
3164
+ else {
3165
+ const bin = globalThis.atob(b64);
3166
+ const arr = new Uint8Array(bin.length);
3167
+ for (let i = 0; i < bin.length; ++i) {
3168
+ arr[i] = bin.charCodeAt(i);
3169
+ }
3170
+ return arr;
3171
+ }
3172
+ }
3173
+ function base64FromBytes(arr) {
3174
+ if (globalThis.Buffer) {
3175
+ return globalThis.Buffer.from(arr).toString("base64");
3176
+ }
3177
+ else {
3178
+ const bin = [];
3179
+ arr.forEach((byte) => {
3180
+ bin.push(globalThis.String.fromCharCode(byte));
3181
+ });
3182
+ return globalThis.btoa(bin.join(""));
3183
+ }
3184
+ }
3185
+ function isObject(value) {
3186
+ return typeof value === "object" && value !== null;
3187
+ }
3188
+ function isSet(value) {
3189
+ return value !== null && value !== undefined;
3190
+ }