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