@mindburn/helm-ai-kernel 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,990 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.6
4
+ // protoc v7.34.1
5
+ // source: helm/intervention/v1/intervention.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { Timestamp } from "../../../google/protobuf/timestamp";
9
+ export const protobufPackage = "helm.intervention.v1";
10
+ /**
11
+ * HELM Intervention Fabric Protocol Buffer Definitions
12
+ *
13
+ * Canonical IDL for intervention objects and receipts.
14
+ * Stability: v1 additive-only.
15
+ */
16
+ export var InterventionReason;
17
+ (function (InterventionReason) {
18
+ InterventionReason[InterventionReason["INTERVENTION_REASON_UNSPECIFIED"] = 0] = "INTERVENTION_REASON_UNSPECIFIED";
19
+ InterventionReason[InterventionReason["INTERVENTION_REASON_POLICY_DENY"] = 1] = "INTERVENTION_REASON_POLICY_DENY";
20
+ InterventionReason[InterventionReason["INTERVENTION_REASON_APPROVAL_NEEDED"] = 2] = "INTERVENTION_REASON_APPROVAL_NEEDED";
21
+ InterventionReason[InterventionReason["INTERVENTION_REASON_EVIDENCE_GAP"] = 3] = "INTERVENTION_REASON_EVIDENCE_GAP";
22
+ InterventionReason[InterventionReason["INTERVENTION_REASON_RISK_THRESHOLD"] = 4] = "INTERVENTION_REASON_RISK_THRESHOLD";
23
+ InterventionReason[InterventionReason["INTERVENTION_REASON_MANUAL_TRIGGER"] = 5] = "INTERVENTION_REASON_MANUAL_TRIGGER";
24
+ InterventionReason[InterventionReason["INTERVENTION_REASON_BUDGET_EXCEEDED"] = 6] = "INTERVENTION_REASON_BUDGET_EXCEEDED";
25
+ InterventionReason[InterventionReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
26
+ })(InterventionReason || (InterventionReason = {}));
27
+ export function interventionReasonFromJSON(object) {
28
+ switch (object) {
29
+ case 0:
30
+ case "INTERVENTION_REASON_UNSPECIFIED":
31
+ return InterventionReason.INTERVENTION_REASON_UNSPECIFIED;
32
+ case 1:
33
+ case "INTERVENTION_REASON_POLICY_DENY":
34
+ return InterventionReason.INTERVENTION_REASON_POLICY_DENY;
35
+ case 2:
36
+ case "INTERVENTION_REASON_APPROVAL_NEEDED":
37
+ return InterventionReason.INTERVENTION_REASON_APPROVAL_NEEDED;
38
+ case 3:
39
+ case "INTERVENTION_REASON_EVIDENCE_GAP":
40
+ return InterventionReason.INTERVENTION_REASON_EVIDENCE_GAP;
41
+ case 4:
42
+ case "INTERVENTION_REASON_RISK_THRESHOLD":
43
+ return InterventionReason.INTERVENTION_REASON_RISK_THRESHOLD;
44
+ case 5:
45
+ case "INTERVENTION_REASON_MANUAL_TRIGGER":
46
+ return InterventionReason.INTERVENTION_REASON_MANUAL_TRIGGER;
47
+ case 6:
48
+ case "INTERVENTION_REASON_BUDGET_EXCEEDED":
49
+ return InterventionReason.INTERVENTION_REASON_BUDGET_EXCEEDED;
50
+ case -1:
51
+ case "UNRECOGNIZED":
52
+ default:
53
+ return InterventionReason.UNRECOGNIZED;
54
+ }
55
+ }
56
+ export function interventionReasonToJSON(object) {
57
+ switch (object) {
58
+ case InterventionReason.INTERVENTION_REASON_UNSPECIFIED:
59
+ return "INTERVENTION_REASON_UNSPECIFIED";
60
+ case InterventionReason.INTERVENTION_REASON_POLICY_DENY:
61
+ return "INTERVENTION_REASON_POLICY_DENY";
62
+ case InterventionReason.INTERVENTION_REASON_APPROVAL_NEEDED:
63
+ return "INTERVENTION_REASON_APPROVAL_NEEDED";
64
+ case InterventionReason.INTERVENTION_REASON_EVIDENCE_GAP:
65
+ return "INTERVENTION_REASON_EVIDENCE_GAP";
66
+ case InterventionReason.INTERVENTION_REASON_RISK_THRESHOLD:
67
+ return "INTERVENTION_REASON_RISK_THRESHOLD";
68
+ case InterventionReason.INTERVENTION_REASON_MANUAL_TRIGGER:
69
+ return "INTERVENTION_REASON_MANUAL_TRIGGER";
70
+ case InterventionReason.INTERVENTION_REASON_BUDGET_EXCEEDED:
71
+ return "INTERVENTION_REASON_BUDGET_EXCEEDED";
72
+ case InterventionReason.UNRECOGNIZED:
73
+ default:
74
+ return "UNRECOGNIZED";
75
+ }
76
+ }
77
+ export var InterventionState;
78
+ (function (InterventionState) {
79
+ InterventionState[InterventionState["INTERVENTION_STATE_UNSPECIFIED"] = 0] = "INTERVENTION_STATE_UNSPECIFIED";
80
+ InterventionState[InterventionState["INTERVENTION_STATE_PENDING"] = 1] = "INTERVENTION_STATE_PENDING";
81
+ InterventionState[InterventionState["INTERVENTION_STATE_ACTIVE"] = 2] = "INTERVENTION_STATE_ACTIVE";
82
+ InterventionState[InterventionState["INTERVENTION_STATE_RESOLVED"] = 3] = "INTERVENTION_STATE_RESOLVED";
83
+ InterventionState[InterventionState["INTERVENTION_STATE_EXPIRED"] = 4] = "INTERVENTION_STATE_EXPIRED";
84
+ InterventionState[InterventionState["INTERVENTION_STATE_CANCELED"] = 5] = "INTERVENTION_STATE_CANCELED";
85
+ InterventionState[InterventionState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
86
+ })(InterventionState || (InterventionState = {}));
87
+ export function interventionStateFromJSON(object) {
88
+ switch (object) {
89
+ case 0:
90
+ case "INTERVENTION_STATE_UNSPECIFIED":
91
+ return InterventionState.INTERVENTION_STATE_UNSPECIFIED;
92
+ case 1:
93
+ case "INTERVENTION_STATE_PENDING":
94
+ return InterventionState.INTERVENTION_STATE_PENDING;
95
+ case 2:
96
+ case "INTERVENTION_STATE_ACTIVE":
97
+ return InterventionState.INTERVENTION_STATE_ACTIVE;
98
+ case 3:
99
+ case "INTERVENTION_STATE_RESOLVED":
100
+ return InterventionState.INTERVENTION_STATE_RESOLVED;
101
+ case 4:
102
+ case "INTERVENTION_STATE_EXPIRED":
103
+ return InterventionState.INTERVENTION_STATE_EXPIRED;
104
+ case 5:
105
+ case "INTERVENTION_STATE_CANCELED":
106
+ return InterventionState.INTERVENTION_STATE_CANCELED;
107
+ case -1:
108
+ case "UNRECOGNIZED":
109
+ default:
110
+ return InterventionState.UNRECOGNIZED;
111
+ }
112
+ }
113
+ export function interventionStateToJSON(object) {
114
+ switch (object) {
115
+ case InterventionState.INTERVENTION_STATE_UNSPECIFIED:
116
+ return "INTERVENTION_STATE_UNSPECIFIED";
117
+ case InterventionState.INTERVENTION_STATE_PENDING:
118
+ return "INTERVENTION_STATE_PENDING";
119
+ case InterventionState.INTERVENTION_STATE_ACTIVE:
120
+ return "INTERVENTION_STATE_ACTIVE";
121
+ case InterventionState.INTERVENTION_STATE_RESOLVED:
122
+ return "INTERVENTION_STATE_RESOLVED";
123
+ case InterventionState.INTERVENTION_STATE_EXPIRED:
124
+ return "INTERVENTION_STATE_EXPIRED";
125
+ case InterventionState.INTERVENTION_STATE_CANCELED:
126
+ return "INTERVENTION_STATE_CANCELED";
127
+ case InterventionState.UNRECOGNIZED:
128
+ default:
129
+ return "UNRECOGNIZED";
130
+ }
131
+ }
132
+ export var InterventionDecision;
133
+ (function (InterventionDecision) {
134
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_UNSPECIFIED"] = 0] = "INTERVENTION_DECISION_UNSPECIFIED";
135
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_APPROVE"] = 1] = "INTERVENTION_DECISION_APPROVE";
136
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_DENY"] = 2] = "INTERVENTION_DECISION_DENY";
137
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_MODIFY"] = 3] = "INTERVENTION_DECISION_MODIFY";
138
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_ESCALATE"] = 4] = "INTERVENTION_DECISION_ESCALATE";
139
+ InterventionDecision[InterventionDecision["INTERVENTION_DECISION_CANCEL"] = 5] = "INTERVENTION_DECISION_CANCEL";
140
+ InterventionDecision[InterventionDecision["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
141
+ })(InterventionDecision || (InterventionDecision = {}));
142
+ export function interventionDecisionFromJSON(object) {
143
+ switch (object) {
144
+ case 0:
145
+ case "INTERVENTION_DECISION_UNSPECIFIED":
146
+ return InterventionDecision.INTERVENTION_DECISION_UNSPECIFIED;
147
+ case 1:
148
+ case "INTERVENTION_DECISION_APPROVE":
149
+ return InterventionDecision.INTERVENTION_DECISION_APPROVE;
150
+ case 2:
151
+ case "INTERVENTION_DECISION_DENY":
152
+ return InterventionDecision.INTERVENTION_DECISION_DENY;
153
+ case 3:
154
+ case "INTERVENTION_DECISION_MODIFY":
155
+ return InterventionDecision.INTERVENTION_DECISION_MODIFY;
156
+ case 4:
157
+ case "INTERVENTION_DECISION_ESCALATE":
158
+ return InterventionDecision.INTERVENTION_DECISION_ESCALATE;
159
+ case 5:
160
+ case "INTERVENTION_DECISION_CANCEL":
161
+ return InterventionDecision.INTERVENTION_DECISION_CANCEL;
162
+ case -1:
163
+ case "UNRECOGNIZED":
164
+ default:
165
+ return InterventionDecision.UNRECOGNIZED;
166
+ }
167
+ }
168
+ export function interventionDecisionToJSON(object) {
169
+ switch (object) {
170
+ case InterventionDecision.INTERVENTION_DECISION_UNSPECIFIED:
171
+ return "INTERVENTION_DECISION_UNSPECIFIED";
172
+ case InterventionDecision.INTERVENTION_DECISION_APPROVE:
173
+ return "INTERVENTION_DECISION_APPROVE";
174
+ case InterventionDecision.INTERVENTION_DECISION_DENY:
175
+ return "INTERVENTION_DECISION_DENY";
176
+ case InterventionDecision.INTERVENTION_DECISION_MODIFY:
177
+ return "INTERVENTION_DECISION_MODIFY";
178
+ case InterventionDecision.INTERVENTION_DECISION_ESCALATE:
179
+ return "INTERVENTION_DECISION_ESCALATE";
180
+ case InterventionDecision.INTERVENTION_DECISION_CANCEL:
181
+ return "INTERVENTION_DECISION_CANCEL";
182
+ case InterventionDecision.UNRECOGNIZED:
183
+ default:
184
+ return "UNRECOGNIZED";
185
+ }
186
+ }
187
+ function createBaseInterventionScope() {
188
+ return { targetResources: [], targetActions: [], maxBudget: 0, jurisdiction: "" };
189
+ }
190
+ export const InterventionScope = {
191
+ encode(message, writer = new BinaryWriter()) {
192
+ for (const v of message.targetResources) {
193
+ writer.uint32(10).string(v);
194
+ }
195
+ for (const v of message.targetActions) {
196
+ writer.uint32(18).string(v);
197
+ }
198
+ if (message.maxBudget !== 0) {
199
+ writer.uint32(25).double(message.maxBudget);
200
+ }
201
+ if (message.jurisdiction !== "") {
202
+ writer.uint32(34).string(message.jurisdiction);
203
+ }
204
+ return writer;
205
+ },
206
+ decode(input, length) {
207
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
208
+ const end = length === undefined ? reader.len : reader.pos + length;
209
+ const message = createBaseInterventionScope();
210
+ while (reader.pos < end) {
211
+ const tag = reader.uint32();
212
+ switch (tag >>> 3) {
213
+ case 1: {
214
+ if (tag !== 10) {
215
+ break;
216
+ }
217
+ message.targetResources.push(reader.string());
218
+ continue;
219
+ }
220
+ case 2: {
221
+ if (tag !== 18) {
222
+ break;
223
+ }
224
+ message.targetActions.push(reader.string());
225
+ continue;
226
+ }
227
+ case 3: {
228
+ if (tag !== 25) {
229
+ break;
230
+ }
231
+ message.maxBudget = reader.double();
232
+ continue;
233
+ }
234
+ case 4: {
235
+ if (tag !== 34) {
236
+ break;
237
+ }
238
+ message.jurisdiction = reader.string();
239
+ continue;
240
+ }
241
+ }
242
+ if ((tag & 7) === 4 || tag === 0) {
243
+ break;
244
+ }
245
+ reader.skip(tag & 7);
246
+ }
247
+ return message;
248
+ },
249
+ fromJSON(object) {
250
+ return {
251
+ targetResources: globalThis.Array.isArray(object?.targetResources)
252
+ ? object.targetResources.map((e) => globalThis.String(e))
253
+ : globalThis.Array.isArray(object?.target_resources)
254
+ ? object.target_resources.map((e) => globalThis.String(e))
255
+ : [],
256
+ targetActions: globalThis.Array.isArray(object?.targetActions)
257
+ ? object.targetActions.map((e) => globalThis.String(e))
258
+ : globalThis.Array.isArray(object?.target_actions)
259
+ ? object.target_actions.map((e) => globalThis.String(e))
260
+ : [],
261
+ maxBudget: isSet(object.maxBudget)
262
+ ? globalThis.Number(object.maxBudget)
263
+ : isSet(object.max_budget)
264
+ ? globalThis.Number(object.max_budget)
265
+ : 0,
266
+ jurisdiction: isSet(object.jurisdiction) ? globalThis.String(object.jurisdiction) : "",
267
+ };
268
+ },
269
+ toJSON(message) {
270
+ const obj = {};
271
+ if (message.targetResources?.length) {
272
+ obj.targetResources = message.targetResources;
273
+ }
274
+ if (message.targetActions?.length) {
275
+ obj.targetActions = message.targetActions;
276
+ }
277
+ if (message.maxBudget !== 0) {
278
+ obj.maxBudget = message.maxBudget;
279
+ }
280
+ if (message.jurisdiction !== "") {
281
+ obj.jurisdiction = message.jurisdiction;
282
+ }
283
+ return obj;
284
+ },
285
+ create(base) {
286
+ return InterventionScope.fromPartial(base ?? {});
287
+ },
288
+ fromPartial(object) {
289
+ const message = createBaseInterventionScope();
290
+ message.targetResources = object.targetResources?.map((e) => e) || [];
291
+ message.targetActions = object.targetActions?.map((e) => e) || [];
292
+ message.maxBudget = object.maxBudget ?? 0;
293
+ message.jurisdiction = object.jurisdiction ?? "";
294
+ return message;
295
+ },
296
+ };
297
+ function createBaseInterventionOption() {
298
+ return { optionId: "", label: "", description: "", type: "" };
299
+ }
300
+ export const InterventionOption = {
301
+ encode(message, writer = new BinaryWriter()) {
302
+ if (message.optionId !== "") {
303
+ writer.uint32(10).string(message.optionId);
304
+ }
305
+ if (message.label !== "") {
306
+ writer.uint32(18).string(message.label);
307
+ }
308
+ if (message.description !== "") {
309
+ writer.uint32(26).string(message.description);
310
+ }
311
+ if (message.type !== "") {
312
+ writer.uint32(34).string(message.type);
313
+ }
314
+ return writer;
315
+ },
316
+ decode(input, length) {
317
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
318
+ const end = length === undefined ? reader.len : reader.pos + length;
319
+ const message = createBaseInterventionOption();
320
+ while (reader.pos < end) {
321
+ const tag = reader.uint32();
322
+ switch (tag >>> 3) {
323
+ case 1: {
324
+ if (tag !== 10) {
325
+ break;
326
+ }
327
+ message.optionId = reader.string();
328
+ continue;
329
+ }
330
+ case 2: {
331
+ if (tag !== 18) {
332
+ break;
333
+ }
334
+ message.label = reader.string();
335
+ continue;
336
+ }
337
+ case 3: {
338
+ if (tag !== 26) {
339
+ break;
340
+ }
341
+ message.description = reader.string();
342
+ continue;
343
+ }
344
+ case 4: {
345
+ if (tag !== 34) {
346
+ break;
347
+ }
348
+ message.type = reader.string();
349
+ continue;
350
+ }
351
+ }
352
+ if ((tag & 7) === 4 || tag === 0) {
353
+ break;
354
+ }
355
+ reader.skip(tag & 7);
356
+ }
357
+ return message;
358
+ },
359
+ fromJSON(object) {
360
+ return {
361
+ optionId: isSet(object.optionId)
362
+ ? globalThis.String(object.optionId)
363
+ : isSet(object.option_id)
364
+ ? globalThis.String(object.option_id)
365
+ : "",
366
+ label: isSet(object.label) ? globalThis.String(object.label) : "",
367
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
368
+ type: isSet(object.type) ? globalThis.String(object.type) : "",
369
+ };
370
+ },
371
+ toJSON(message) {
372
+ const obj = {};
373
+ if (message.optionId !== "") {
374
+ obj.optionId = message.optionId;
375
+ }
376
+ if (message.label !== "") {
377
+ obj.label = message.label;
378
+ }
379
+ if (message.description !== "") {
380
+ obj.description = message.description;
381
+ }
382
+ if (message.type !== "") {
383
+ obj.type = message.type;
384
+ }
385
+ return obj;
386
+ },
387
+ create(base) {
388
+ return InterventionOption.fromPartial(base ?? {});
389
+ },
390
+ fromPartial(object) {
391
+ const message = createBaseInterventionOption();
392
+ message.optionId = object.optionId ?? "";
393
+ message.label = object.label ?? "";
394
+ message.description = object.description ?? "";
395
+ message.type = object.type ?? "";
396
+ return message;
397
+ },
398
+ };
399
+ function createBaseInterventionObject() {
400
+ return {
401
+ interventionId: "",
402
+ executionId: "",
403
+ principalId: "",
404
+ reason: 0,
405
+ state: 0,
406
+ description: "",
407
+ effectTypes: [],
408
+ policyEpoch: "",
409
+ scope: undefined,
410
+ options: [],
411
+ createdAt: undefined,
412
+ expiresAt: undefined,
413
+ contentHash: "",
414
+ };
415
+ }
416
+ export const InterventionObject = {
417
+ encode(message, writer = new BinaryWriter()) {
418
+ if (message.interventionId !== "") {
419
+ writer.uint32(10).string(message.interventionId);
420
+ }
421
+ if (message.executionId !== "") {
422
+ writer.uint32(18).string(message.executionId);
423
+ }
424
+ if (message.principalId !== "") {
425
+ writer.uint32(26).string(message.principalId);
426
+ }
427
+ if (message.reason !== 0) {
428
+ writer.uint32(32).int32(message.reason);
429
+ }
430
+ if (message.state !== 0) {
431
+ writer.uint32(40).int32(message.state);
432
+ }
433
+ if (message.description !== "") {
434
+ writer.uint32(50).string(message.description);
435
+ }
436
+ for (const v of message.effectTypes) {
437
+ writer.uint32(58).string(v);
438
+ }
439
+ if (message.policyEpoch !== "") {
440
+ writer.uint32(66).string(message.policyEpoch);
441
+ }
442
+ if (message.scope !== undefined) {
443
+ InterventionScope.encode(message.scope, writer.uint32(74).fork()).join();
444
+ }
445
+ for (const v of message.options) {
446
+ InterventionOption.encode(v, writer.uint32(82).fork()).join();
447
+ }
448
+ if (message.createdAt !== undefined) {
449
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(90).fork()).join();
450
+ }
451
+ if (message.expiresAt !== undefined) {
452
+ Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(98).fork()).join();
453
+ }
454
+ if (message.contentHash !== "") {
455
+ writer.uint32(106).string(message.contentHash);
456
+ }
457
+ return writer;
458
+ },
459
+ decode(input, length) {
460
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
461
+ const end = length === undefined ? reader.len : reader.pos + length;
462
+ const message = createBaseInterventionObject();
463
+ while (reader.pos < end) {
464
+ const tag = reader.uint32();
465
+ switch (tag >>> 3) {
466
+ case 1: {
467
+ if (tag !== 10) {
468
+ break;
469
+ }
470
+ message.interventionId = reader.string();
471
+ continue;
472
+ }
473
+ case 2: {
474
+ if (tag !== 18) {
475
+ break;
476
+ }
477
+ message.executionId = reader.string();
478
+ continue;
479
+ }
480
+ case 3: {
481
+ if (tag !== 26) {
482
+ break;
483
+ }
484
+ message.principalId = reader.string();
485
+ continue;
486
+ }
487
+ case 4: {
488
+ if (tag !== 32) {
489
+ break;
490
+ }
491
+ message.reason = reader.int32();
492
+ continue;
493
+ }
494
+ case 5: {
495
+ if (tag !== 40) {
496
+ break;
497
+ }
498
+ message.state = reader.int32();
499
+ continue;
500
+ }
501
+ case 6: {
502
+ if (tag !== 50) {
503
+ break;
504
+ }
505
+ message.description = reader.string();
506
+ continue;
507
+ }
508
+ case 7: {
509
+ if (tag !== 58) {
510
+ break;
511
+ }
512
+ message.effectTypes.push(reader.string());
513
+ continue;
514
+ }
515
+ case 8: {
516
+ if (tag !== 66) {
517
+ break;
518
+ }
519
+ message.policyEpoch = reader.string();
520
+ continue;
521
+ }
522
+ case 9: {
523
+ if (tag !== 74) {
524
+ break;
525
+ }
526
+ message.scope = InterventionScope.decode(reader, reader.uint32());
527
+ continue;
528
+ }
529
+ case 10: {
530
+ if (tag !== 82) {
531
+ break;
532
+ }
533
+ message.options.push(InterventionOption.decode(reader, reader.uint32()));
534
+ continue;
535
+ }
536
+ case 11: {
537
+ if (tag !== 90) {
538
+ break;
539
+ }
540
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
541
+ continue;
542
+ }
543
+ case 12: {
544
+ if (tag !== 98) {
545
+ break;
546
+ }
547
+ message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
548
+ continue;
549
+ }
550
+ case 13: {
551
+ if (tag !== 106) {
552
+ break;
553
+ }
554
+ message.contentHash = reader.string();
555
+ continue;
556
+ }
557
+ }
558
+ if ((tag & 7) === 4 || tag === 0) {
559
+ break;
560
+ }
561
+ reader.skip(tag & 7);
562
+ }
563
+ return message;
564
+ },
565
+ fromJSON(object) {
566
+ return {
567
+ interventionId: isSet(object.interventionId)
568
+ ? globalThis.String(object.interventionId)
569
+ : isSet(object.intervention_id)
570
+ ? globalThis.String(object.intervention_id)
571
+ : "",
572
+ executionId: isSet(object.executionId)
573
+ ? globalThis.String(object.executionId)
574
+ : isSet(object.execution_id)
575
+ ? globalThis.String(object.execution_id)
576
+ : "",
577
+ principalId: isSet(object.principalId)
578
+ ? globalThis.String(object.principalId)
579
+ : isSet(object.principal_id)
580
+ ? globalThis.String(object.principal_id)
581
+ : "",
582
+ reason: isSet(object.reason) ? interventionReasonFromJSON(object.reason) : 0,
583
+ state: isSet(object.state) ? interventionStateFromJSON(object.state) : 0,
584
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
585
+ effectTypes: globalThis.Array.isArray(object?.effectTypes)
586
+ ? object.effectTypes.map((e) => globalThis.String(e))
587
+ : globalThis.Array.isArray(object?.effect_types)
588
+ ? object.effect_types.map((e) => globalThis.String(e))
589
+ : [],
590
+ policyEpoch: isSet(object.policyEpoch)
591
+ ? globalThis.String(object.policyEpoch)
592
+ : isSet(object.policy_epoch)
593
+ ? globalThis.String(object.policy_epoch)
594
+ : "",
595
+ scope: isSet(object.scope) ? InterventionScope.fromJSON(object.scope) : undefined,
596
+ options: globalThis.Array.isArray(object?.options)
597
+ ? object.options.map((e) => InterventionOption.fromJSON(e))
598
+ : [],
599
+ createdAt: isSet(object.createdAt)
600
+ ? fromJsonTimestamp(object.createdAt)
601
+ : isSet(object.created_at)
602
+ ? fromJsonTimestamp(object.created_at)
603
+ : undefined,
604
+ expiresAt: isSet(object.expiresAt)
605
+ ? fromJsonTimestamp(object.expiresAt)
606
+ : isSet(object.expires_at)
607
+ ? fromJsonTimestamp(object.expires_at)
608
+ : undefined,
609
+ contentHash: isSet(object.contentHash)
610
+ ? globalThis.String(object.contentHash)
611
+ : isSet(object.content_hash)
612
+ ? globalThis.String(object.content_hash)
613
+ : "",
614
+ };
615
+ },
616
+ toJSON(message) {
617
+ const obj = {};
618
+ if (message.interventionId !== "") {
619
+ obj.interventionId = message.interventionId;
620
+ }
621
+ if (message.executionId !== "") {
622
+ obj.executionId = message.executionId;
623
+ }
624
+ if (message.principalId !== "") {
625
+ obj.principalId = message.principalId;
626
+ }
627
+ if (message.reason !== 0) {
628
+ obj.reason = interventionReasonToJSON(message.reason);
629
+ }
630
+ if (message.state !== 0) {
631
+ obj.state = interventionStateToJSON(message.state);
632
+ }
633
+ if (message.description !== "") {
634
+ obj.description = message.description;
635
+ }
636
+ if (message.effectTypes?.length) {
637
+ obj.effectTypes = message.effectTypes;
638
+ }
639
+ if (message.policyEpoch !== "") {
640
+ obj.policyEpoch = message.policyEpoch;
641
+ }
642
+ if (message.scope !== undefined) {
643
+ obj.scope = InterventionScope.toJSON(message.scope);
644
+ }
645
+ if (message.options?.length) {
646
+ obj.options = message.options.map((e) => InterventionOption.toJSON(e));
647
+ }
648
+ if (message.createdAt !== undefined) {
649
+ obj.createdAt = message.createdAt.toISOString();
650
+ }
651
+ if (message.expiresAt !== undefined) {
652
+ obj.expiresAt = message.expiresAt.toISOString();
653
+ }
654
+ if (message.contentHash !== "") {
655
+ obj.contentHash = message.contentHash;
656
+ }
657
+ return obj;
658
+ },
659
+ create(base) {
660
+ return InterventionObject.fromPartial(base ?? {});
661
+ },
662
+ fromPartial(object) {
663
+ const message = createBaseInterventionObject();
664
+ message.interventionId = object.interventionId ?? "";
665
+ message.executionId = object.executionId ?? "";
666
+ message.principalId = object.principalId ?? "";
667
+ message.reason = object.reason ?? 0;
668
+ message.state = object.state ?? 0;
669
+ message.description = object.description ?? "";
670
+ message.effectTypes = object.effectTypes?.map((e) => e) || [];
671
+ message.policyEpoch = object.policyEpoch ?? "";
672
+ message.scope = (object.scope !== undefined && object.scope !== null)
673
+ ? InterventionScope.fromPartial(object.scope)
674
+ : undefined;
675
+ message.options = object.options?.map((e) => InterventionOption.fromPartial(e)) || [];
676
+ message.createdAt = object.createdAt ?? undefined;
677
+ message.expiresAt = object.expiresAt ?? undefined;
678
+ message.contentHash = object.contentHash ?? "";
679
+ return message;
680
+ },
681
+ };
682
+ function createBaseInterventionReceipt() {
683
+ return {
684
+ receiptId: "",
685
+ interventionId: "",
686
+ deciderId: "",
687
+ deciderType: "",
688
+ decision: 0,
689
+ selectedOption: "",
690
+ rationale: "",
691
+ conditions: [],
692
+ policyEpoch: "",
693
+ issuedAt: undefined,
694
+ signature: "",
695
+ signerPublicKey: "",
696
+ contentHash: "",
697
+ };
698
+ }
699
+ export const InterventionReceipt = {
700
+ encode(message, writer = new BinaryWriter()) {
701
+ if (message.receiptId !== "") {
702
+ writer.uint32(10).string(message.receiptId);
703
+ }
704
+ if (message.interventionId !== "") {
705
+ writer.uint32(18).string(message.interventionId);
706
+ }
707
+ if (message.deciderId !== "") {
708
+ writer.uint32(26).string(message.deciderId);
709
+ }
710
+ if (message.deciderType !== "") {
711
+ writer.uint32(34).string(message.deciderType);
712
+ }
713
+ if (message.decision !== 0) {
714
+ writer.uint32(40).int32(message.decision);
715
+ }
716
+ if (message.selectedOption !== "") {
717
+ writer.uint32(50).string(message.selectedOption);
718
+ }
719
+ if (message.rationale !== "") {
720
+ writer.uint32(58).string(message.rationale);
721
+ }
722
+ for (const v of message.conditions) {
723
+ writer.uint32(66).string(v);
724
+ }
725
+ if (message.policyEpoch !== "") {
726
+ writer.uint32(74).string(message.policyEpoch);
727
+ }
728
+ if (message.issuedAt !== undefined) {
729
+ Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(82).fork()).join();
730
+ }
731
+ if (message.signature !== "") {
732
+ writer.uint32(90).string(message.signature);
733
+ }
734
+ if (message.signerPublicKey !== "") {
735
+ writer.uint32(98).string(message.signerPublicKey);
736
+ }
737
+ if (message.contentHash !== "") {
738
+ writer.uint32(106).string(message.contentHash);
739
+ }
740
+ return writer;
741
+ },
742
+ decode(input, length) {
743
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
744
+ const end = length === undefined ? reader.len : reader.pos + length;
745
+ const message = createBaseInterventionReceipt();
746
+ while (reader.pos < end) {
747
+ const tag = reader.uint32();
748
+ switch (tag >>> 3) {
749
+ case 1: {
750
+ if (tag !== 10) {
751
+ break;
752
+ }
753
+ message.receiptId = reader.string();
754
+ continue;
755
+ }
756
+ case 2: {
757
+ if (tag !== 18) {
758
+ break;
759
+ }
760
+ message.interventionId = reader.string();
761
+ continue;
762
+ }
763
+ case 3: {
764
+ if (tag !== 26) {
765
+ break;
766
+ }
767
+ message.deciderId = reader.string();
768
+ continue;
769
+ }
770
+ case 4: {
771
+ if (tag !== 34) {
772
+ break;
773
+ }
774
+ message.deciderType = reader.string();
775
+ continue;
776
+ }
777
+ case 5: {
778
+ if (tag !== 40) {
779
+ break;
780
+ }
781
+ message.decision = reader.int32();
782
+ continue;
783
+ }
784
+ case 6: {
785
+ if (tag !== 50) {
786
+ break;
787
+ }
788
+ message.selectedOption = reader.string();
789
+ continue;
790
+ }
791
+ case 7: {
792
+ if (tag !== 58) {
793
+ break;
794
+ }
795
+ message.rationale = reader.string();
796
+ continue;
797
+ }
798
+ case 8: {
799
+ if (tag !== 66) {
800
+ break;
801
+ }
802
+ message.conditions.push(reader.string());
803
+ continue;
804
+ }
805
+ case 9: {
806
+ if (tag !== 74) {
807
+ break;
808
+ }
809
+ message.policyEpoch = reader.string();
810
+ continue;
811
+ }
812
+ case 10: {
813
+ if (tag !== 82) {
814
+ break;
815
+ }
816
+ message.issuedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
817
+ continue;
818
+ }
819
+ case 11: {
820
+ if (tag !== 90) {
821
+ break;
822
+ }
823
+ message.signature = reader.string();
824
+ continue;
825
+ }
826
+ case 12: {
827
+ if (tag !== 98) {
828
+ break;
829
+ }
830
+ message.signerPublicKey = reader.string();
831
+ continue;
832
+ }
833
+ case 13: {
834
+ if (tag !== 106) {
835
+ break;
836
+ }
837
+ message.contentHash = reader.string();
838
+ continue;
839
+ }
840
+ }
841
+ if ((tag & 7) === 4 || tag === 0) {
842
+ break;
843
+ }
844
+ reader.skip(tag & 7);
845
+ }
846
+ return message;
847
+ },
848
+ fromJSON(object) {
849
+ return {
850
+ receiptId: isSet(object.receiptId)
851
+ ? globalThis.String(object.receiptId)
852
+ : isSet(object.receipt_id)
853
+ ? globalThis.String(object.receipt_id)
854
+ : "",
855
+ interventionId: isSet(object.interventionId)
856
+ ? globalThis.String(object.interventionId)
857
+ : isSet(object.intervention_id)
858
+ ? globalThis.String(object.intervention_id)
859
+ : "",
860
+ deciderId: isSet(object.deciderId)
861
+ ? globalThis.String(object.deciderId)
862
+ : isSet(object.decider_id)
863
+ ? globalThis.String(object.decider_id)
864
+ : "",
865
+ deciderType: isSet(object.deciderType)
866
+ ? globalThis.String(object.deciderType)
867
+ : isSet(object.decider_type)
868
+ ? globalThis.String(object.decider_type)
869
+ : "",
870
+ decision: isSet(object.decision) ? interventionDecisionFromJSON(object.decision) : 0,
871
+ selectedOption: isSet(object.selectedOption)
872
+ ? globalThis.String(object.selectedOption)
873
+ : isSet(object.selected_option)
874
+ ? globalThis.String(object.selected_option)
875
+ : "",
876
+ rationale: isSet(object.rationale) ? globalThis.String(object.rationale) : "",
877
+ conditions: globalThis.Array.isArray(object?.conditions)
878
+ ? object.conditions.map((e) => globalThis.String(e))
879
+ : [],
880
+ policyEpoch: isSet(object.policyEpoch)
881
+ ? globalThis.String(object.policyEpoch)
882
+ : isSet(object.policy_epoch)
883
+ ? globalThis.String(object.policy_epoch)
884
+ : "",
885
+ issuedAt: isSet(object.issuedAt)
886
+ ? fromJsonTimestamp(object.issuedAt)
887
+ : isSet(object.issued_at)
888
+ ? fromJsonTimestamp(object.issued_at)
889
+ : undefined,
890
+ signature: isSet(object.signature) ? globalThis.String(object.signature) : "",
891
+ signerPublicKey: isSet(object.signerPublicKey)
892
+ ? globalThis.String(object.signerPublicKey)
893
+ : isSet(object.signer_public_key)
894
+ ? globalThis.String(object.signer_public_key)
895
+ : "",
896
+ contentHash: isSet(object.contentHash)
897
+ ? globalThis.String(object.contentHash)
898
+ : isSet(object.content_hash)
899
+ ? globalThis.String(object.content_hash)
900
+ : "",
901
+ };
902
+ },
903
+ toJSON(message) {
904
+ const obj = {};
905
+ if (message.receiptId !== "") {
906
+ obj.receiptId = message.receiptId;
907
+ }
908
+ if (message.interventionId !== "") {
909
+ obj.interventionId = message.interventionId;
910
+ }
911
+ if (message.deciderId !== "") {
912
+ obj.deciderId = message.deciderId;
913
+ }
914
+ if (message.deciderType !== "") {
915
+ obj.deciderType = message.deciderType;
916
+ }
917
+ if (message.decision !== 0) {
918
+ obj.decision = interventionDecisionToJSON(message.decision);
919
+ }
920
+ if (message.selectedOption !== "") {
921
+ obj.selectedOption = message.selectedOption;
922
+ }
923
+ if (message.rationale !== "") {
924
+ obj.rationale = message.rationale;
925
+ }
926
+ if (message.conditions?.length) {
927
+ obj.conditions = message.conditions;
928
+ }
929
+ if (message.policyEpoch !== "") {
930
+ obj.policyEpoch = message.policyEpoch;
931
+ }
932
+ if (message.issuedAt !== undefined) {
933
+ obj.issuedAt = message.issuedAt.toISOString();
934
+ }
935
+ if (message.signature !== "") {
936
+ obj.signature = message.signature;
937
+ }
938
+ if (message.signerPublicKey !== "") {
939
+ obj.signerPublicKey = message.signerPublicKey;
940
+ }
941
+ if (message.contentHash !== "") {
942
+ obj.contentHash = message.contentHash;
943
+ }
944
+ return obj;
945
+ },
946
+ create(base) {
947
+ return InterventionReceipt.fromPartial(base ?? {});
948
+ },
949
+ fromPartial(object) {
950
+ const message = createBaseInterventionReceipt();
951
+ message.receiptId = object.receiptId ?? "";
952
+ message.interventionId = object.interventionId ?? "";
953
+ message.deciderId = object.deciderId ?? "";
954
+ message.deciderType = object.deciderType ?? "";
955
+ message.decision = object.decision ?? 0;
956
+ message.selectedOption = object.selectedOption ?? "";
957
+ message.rationale = object.rationale ?? "";
958
+ message.conditions = object.conditions?.map((e) => e) || [];
959
+ message.policyEpoch = object.policyEpoch ?? "";
960
+ message.issuedAt = object.issuedAt ?? undefined;
961
+ message.signature = object.signature ?? "";
962
+ message.signerPublicKey = object.signerPublicKey ?? "";
963
+ message.contentHash = object.contentHash ?? "";
964
+ return message;
965
+ },
966
+ };
967
+ function toTimestamp(date) {
968
+ const seconds = Math.trunc(date.getTime() / 1_000);
969
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
970
+ return { seconds, nanos };
971
+ }
972
+ function fromTimestamp(t) {
973
+ let millis = (t.seconds || 0) * 1_000;
974
+ millis += (t.nanos || 0) / 1_000_000;
975
+ return new globalThis.Date(millis);
976
+ }
977
+ function fromJsonTimestamp(o) {
978
+ if (o instanceof globalThis.Date) {
979
+ return o;
980
+ }
981
+ else if (typeof o === "string") {
982
+ return new globalThis.Date(o);
983
+ }
984
+ else {
985
+ return fromTimestamp(Timestamp.fromJSON(o));
986
+ }
987
+ }
988
+ function isSet(value) {
989
+ return value !== null && value !== undefined;
990
+ }