entroly-wasm 1.0.78 → 1.0.80

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.
@@ -1,5 +1,176 @@
1
1
  /* @ts-self-types="./entroly_wasm.d.ts" */
2
2
 
3
+ class WasmCognitiveBus {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ WasmCognitiveBusFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_wasmcognitivebus_free(ptr, 0);
13
+ }
14
+ /**
15
+ * Full event shape: `id`, `source_agent`, `event_type`, `content`,
16
+ * `timestamp`, `emotional_tag`, `salience`, `is_spike`.
17
+ * @param {string} agent_id
18
+ * @param {number | null} [limit]
19
+ * @returns {string}
20
+ */
21
+ drainJSON(agent_id, limit) {
22
+ let deferred3_0;
23
+ let deferred3_1;
24
+ try {
25
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
26
+ const len0 = WASM_VECTOR_LEN;
27
+ const ret = wasm.wasmcognitivebus_drainJSON(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? 0x100000001 : (limit) >>> 0);
28
+ var ptr2 = ret[0];
29
+ var len2 = ret[1];
30
+ if (ret[3]) {
31
+ ptr2 = 0; len2 = 0;
32
+ throw takeFromExternrefTable0(ret[2]);
33
+ }
34
+ deferred3_0 = ptr2;
35
+ deferred3_1 = len2;
36
+ return getStringFromWasm0(ptr2, len2);
37
+ } finally {
38
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
39
+ }
40
+ }
41
+ /**
42
+ * Hippocampus bridge shape: `content`, `source`, `salience`,
43
+ * `emotional_tag`, `event_type`. Deliberately narrower than `drainJSON`.
44
+ * @returns {string}
45
+ */
46
+ drainMemoryBridgeJSON() {
47
+ let deferred2_0;
48
+ let deferred2_1;
49
+ try {
50
+ const ret = wasm.wasmcognitivebus_drainMemoryBridgeJSON(this.__wbg_ptr);
51
+ var ptr1 = ret[0];
52
+ var len1 = ret[1];
53
+ if (ret[3]) {
54
+ ptr1 = 0; len1 = 0;
55
+ throw takeFromExternrefTable0(ret[2]);
56
+ }
57
+ deferred2_0 = ptr1;
58
+ deferred2_1 = len1;
59
+ return getStringFromWasm0(ptr1, len1);
60
+ } finally {
61
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
62
+ }
63
+ }
64
+ /**
65
+ * `memorySalienceThreshold` matches the PyO3 default of 50.0.
66
+ * @param {number | null} [memory_salience_threshold]
67
+ */
68
+ constructor(memory_salience_threshold) {
69
+ const ret = wasm.wasmcognitivebus_new(!isLikeNone(memory_salience_threshold), isLikeNone(memory_salience_threshold) ? 0 : memory_salience_threshold);
70
+ this.__wbg_ptr = ret >>> 0;
71
+ WasmCognitiveBusFinalization.register(this, this.__wbg_ptr, this);
72
+ return this;
73
+ }
74
+ /**
75
+ * Returns the number of subscribers the event was routed to, exactly as
76
+ * the PyO3 `publish` does.
77
+ * @param {string} source_agent
78
+ * @param {string} event_type
79
+ * @param {string} content
80
+ * @param {number | null} [emotional_tag]
81
+ * @param {number | null} [salience]
82
+ * @returns {number}
83
+ */
84
+ publish(source_agent, event_type, content, emotional_tag, salience) {
85
+ const ptr0 = passStringToWasm0(source_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
86
+ const len0 = WASM_VECTOR_LEN;
87
+ const ptr1 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len1 = WASM_VECTOR_LEN;
89
+ const ptr2 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
90
+ const len2 = WASM_VECTOR_LEN;
91
+ const ret = wasm.wasmcognitivebus_publish(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(emotional_tag) ? 0xFFFFFF : emotional_tag, !isLikeNone(salience), isLikeNone(salience) ? 0 : salience);
92
+ return ret >>> 0;
93
+ }
94
+ /**
95
+ * @param {string} agent_id
96
+ * @returns {number}
97
+ */
98
+ queueDepth(agent_id) {
99
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
100
+ const len0 = WASM_VECTOR_LEN;
101
+ const ret = wasm.wasmcognitivebus_queueDepth(this.__wbg_ptr, ptr0, len0);
102
+ return ret >>> 0;
103
+ }
104
+ /**
105
+ * @param {string} agent_id
106
+ * @param {string} task_text
107
+ */
108
+ setTaskContext(agent_id, task_text) {
109
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
110
+ const len0 = WASM_VECTOR_LEN;
111
+ const ptr1 = passStringToWasm0(task_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
112
+ const len1 = WASM_VECTOR_LEN;
113
+ wasm.wasmcognitivebus_setTaskContext(this.__wbg_ptr, ptr0, len0, ptr1, len1);
114
+ }
115
+ /**
116
+ * @param {number} tick
117
+ */
118
+ setTick(tick) {
119
+ wasm.wasmcognitivebus_setTick(this.__wbg_ptr, tick);
120
+ }
121
+ /**
122
+ * @returns {string}
123
+ */
124
+ statsJSON() {
125
+ let deferred2_0;
126
+ let deferred2_1;
127
+ try {
128
+ const ret = wasm.wasmcognitivebus_statsJSON(this.__wbg_ptr);
129
+ var ptr1 = ret[0];
130
+ var len1 = ret[1];
131
+ if (ret[3]) {
132
+ ptr1 = 0; len1 = 0;
133
+ throw takeFromExternrefTable0(ret[2]);
134
+ }
135
+ deferred2_0 = ptr1;
136
+ deferred2_1 = len1;
137
+ return getStringFromWasm0(ptr1, len1);
138
+ } finally {
139
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
140
+ }
141
+ }
142
+ /**
143
+ * `eventTypesJSON` is a JSON array of event-type strings. Passing them as
144
+ * JSON rather than a `Box<[JsString]>` keeps one decoding path shared with
145
+ * every other binding here.
146
+ * @param {string} agent_id
147
+ * @param {string} event_types_json
148
+ */
149
+ subscribe(agent_id, event_types_json) {
150
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
151
+ const len0 = WASM_VECTOR_LEN;
152
+ const ptr1 = passStringToWasm0(event_types_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
153
+ const len1 = WASM_VECTOR_LEN;
154
+ const ret = wasm.wasmcognitivebus_subscribe(this.__wbg_ptr, ptr0, len0, ptr1, len1);
155
+ if (ret[1]) {
156
+ throw takeFromExternrefTable0(ret[0]);
157
+ }
158
+ }
159
+ tick() {
160
+ wasm.wasmcognitivebus_tick(this.__wbg_ptr);
161
+ }
162
+ /**
163
+ * @param {string} agent_id
164
+ */
165
+ unsubscribe(agent_id) {
166
+ const ptr0 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
167
+ const len0 = WASM_VECTOR_LEN;
168
+ wasm.wasmcognitivebus_unsubscribe(this.__wbg_ptr, ptr0, len0);
169
+ }
170
+ }
171
+ if (Symbol.dispose) WasmCognitiveBus.prototype[Symbol.dispose] = WasmCognitiveBus.prototype.free;
172
+ exports.WasmCognitiveBus = WasmCognitiveBus;
173
+
3
174
  class WasmEntrolyEngine {
4
175
  __destroy_into_raw() {
5
176
  const ptr = this.__wbg_ptr;
@@ -436,6 +607,723 @@ class WasmEntrolyEngine {
436
607
  if (Symbol.dispose) WasmEntrolyEngine.prototype[Symbol.dispose] = WasmEntrolyEngine.prototype.free;
437
608
  exports.WasmEntrolyEngine = WasmEntrolyEngine;
438
609
 
610
+ class WasmNkbeAllocator {
611
+ __destroy_into_raw() {
612
+ const ptr = this.__wbg_ptr;
613
+ this.__wbg_ptr = 0;
614
+ WasmNkbeAllocatorFinalization.unregister(this);
615
+ return ptr;
616
+ }
617
+ free() {
618
+ const ptr = this.__destroy_into_raw();
619
+ wasm.__wbg_wasmnkbeallocator_free(ptr, 0);
620
+ }
621
+ /**
622
+ * Returns false when the agent is unknown, matching PyO3.
623
+ * @param {string} agent_name
624
+ * @param {string} fragment_id
625
+ * @param {number} relevance
626
+ * @param {number} token_cost
627
+ * @returns {boolean}
628
+ */
629
+ addFragment(agent_name, fragment_id, relevance, token_cost) {
630
+ const ptr0 = passStringToWasm0(agent_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
631
+ const len0 = WASM_VECTOR_LEN;
632
+ const ptr1 = passStringToWasm0(fragment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
633
+ const len1 = WASM_VECTOR_LEN;
634
+ const ret = wasm.wasmnkbeallocator_addFragment(this.__wbg_ptr, ptr0, len0, ptr1, len1, relevance, token_cost);
635
+ return ret !== 0;
636
+ }
637
+ /**
638
+ * `{agent_name: {budget, weight, utility}}`, as the engine builds it.
639
+ * @returns {string}
640
+ */
641
+ allocateJSON() {
642
+ let deferred2_0;
643
+ let deferred2_1;
644
+ try {
645
+ const ret = wasm.wasmnkbeallocator_allocateJSON(this.__wbg_ptr);
646
+ var ptr1 = ret[0];
647
+ var len1 = ret[1];
648
+ if (ret[3]) {
649
+ ptr1 = 0; len1 = 0;
650
+ throw takeFromExternrefTable0(ret[2]);
651
+ }
652
+ deferred2_0 = ptr1;
653
+ deferred2_1 = len1;
654
+ return getStringFromWasm0(ptr1, len1);
655
+ } finally {
656
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
657
+ }
658
+ }
659
+ /**
660
+ * Defaults mirror the PyO3 constructor exactly: 128000 / 0.1 / 1e-4 / 30 /
661
+ * 5 / 0.01. Divergent defaults would be a parity break that no test on
662
+ * either side would notice.
663
+ * @param {number | null} [global_budget]
664
+ * @param {number | null} [tau]
665
+ * @param {number | null} [epsilon]
666
+ * @param {number | null} [max_iter]
667
+ * @param {number | null} [nash_iterations]
668
+ * @param {number | null} [learning_rate]
669
+ */
670
+ constructor(global_budget, tau, epsilon, max_iter, nash_iterations, learning_rate) {
671
+ const ret = wasm.wasmnkbeallocator_new(isLikeNone(global_budget) ? 0x100000001 : (global_budget) >>> 0, !isLikeNone(tau), isLikeNone(tau) ? 0 : tau, !isLikeNone(epsilon), isLikeNone(epsilon) ? 0 : epsilon, isLikeNone(max_iter) ? 0x100000001 : (max_iter) >>> 0, isLikeNone(nash_iterations) ? 0x100000001 : (nash_iterations) >>> 0, !isLikeNone(learning_rate), isLikeNone(learning_rate) ? 0 : learning_rate);
672
+ this.__wbg_ptr = ret >>> 0;
673
+ WasmNkbeAllocatorFinalization.register(this, this.__wbg_ptr, this);
674
+ return this;
675
+ }
676
+ /**
677
+ * @param {string} name
678
+ * @param {number} weight
679
+ * @param {number} min_budget
680
+ */
681
+ registerAgent(name, weight, min_budget) {
682
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
+ const len0 = WASM_VECTOR_LEN;
684
+ wasm.wasmnkbeallocator_registerAgent(this.__wbg_ptr, ptr0, len0, weight, min_budget);
685
+ }
686
+ /**
687
+ * @param {string} outcomes_json
688
+ * @returns {boolean}
689
+ */
690
+ reinforce(outcomes_json) {
691
+ const ptr0 = passStringToWasm0(outcomes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
692
+ const len0 = WASM_VECTOR_LEN;
693
+ const ret = wasm.wasmnkbeallocator_reinforce(this.__wbg_ptr, ptr0, len0);
694
+ return ret !== 0;
695
+ }
696
+ /**
697
+ * @returns {string}
698
+ */
699
+ statsJSON() {
700
+ let deferred2_0;
701
+ let deferred2_1;
702
+ try {
703
+ const ret = wasm.wasmnkbeallocator_statsJSON(this.__wbg_ptr);
704
+ var ptr1 = ret[0];
705
+ var len1 = ret[1];
706
+ if (ret[3]) {
707
+ ptr1 = 0; len1 = 0;
708
+ throw takeFromExternrefTable0(ret[2]);
709
+ }
710
+ deferred2_0 = ptr1;
711
+ deferred2_1 = len1;
712
+ return getStringFromWasm0(ptr1, len1);
713
+ } finally {
714
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
715
+ }
716
+ }
717
+ }
718
+ if (Symbol.dispose) WasmNkbeAllocator.prototype[Symbol.dispose] = WasmNkbeAllocator.prototype.free;
719
+ exports.WasmNkbeAllocator = WasmNkbeAllocator;
720
+
721
+ class WasmTrustEngine {
722
+ __destroy_into_raw() {
723
+ const ptr = this.__wbg_ptr;
724
+ this.__wbg_ptr = 0;
725
+ WasmTrustEngineFinalization.unregister(this);
726
+ return ptr;
727
+ }
728
+ free() {
729
+ const ptr = this.__destroy_into_raw();
730
+ wasm.__wbg_wasmtrustengine_free(ptr, 0);
731
+ }
732
+ /**
733
+ * @param {string} evidence
734
+ * @param {string} claim
735
+ * @returns {string}
736
+ */
737
+ assessClaimJSON(evidence, claim) {
738
+ let deferred4_0;
739
+ let deferred4_1;
740
+ try {
741
+ const ptr0 = passStringToWasm0(evidence, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
742
+ const len0 = WASM_VECTOR_LEN;
743
+ const ptr1 = passStringToWasm0(claim, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
744
+ const len1 = WASM_VECTOR_LEN;
745
+ const ret = wasm.wasmtrustengine_assessClaimJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1);
746
+ var ptr3 = ret[0];
747
+ var len3 = ret[1];
748
+ if (ret[3]) {
749
+ ptr3 = 0; len3 = 0;
750
+ throw takeFromExternrefTable0(ret[2]);
751
+ }
752
+ deferred4_0 = ptr3;
753
+ deferred4_1 = len3;
754
+ return getStringFromWasm0(ptr3, len3);
755
+ } finally {
756
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
757
+ }
758
+ }
759
+ /**
760
+ * @param {string} path
761
+ * @returns {string}
762
+ */
763
+ fileCriticality(path) {
764
+ let deferred2_0;
765
+ let deferred2_1;
766
+ try {
767
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
768
+ const len0 = WASM_VECTOR_LEN;
769
+ const ret = wasm.wasmtrustengine_fileCriticality(this.__wbg_ptr, ptr0, len0);
770
+ deferred2_0 = ret[0];
771
+ deferred2_1 = ret[1];
772
+ return getStringFromWasm0(ret[0], ret[1]);
773
+ } finally {
774
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
775
+ }
776
+ }
777
+ /**
778
+ * @param {string} content
779
+ * @returns {boolean}
780
+ */
781
+ hasSafetySignal(content) {
782
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
783
+ const len0 = WASM_VECTOR_LEN;
784
+ const ret = wasm.wasmtrustengine_hasSafetySignal(this.__wbg_ptr, ptr0, len0);
785
+ return ret !== 0;
786
+ }
787
+ /**
788
+ * @param {string} profile
789
+ */
790
+ constructor(profile) {
791
+ const ptr0 = passStringToWasm0(profile, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
792
+ const len0 = WASM_VECTOR_LEN;
793
+ const ret = wasm.wasmtrustengine_new(ptr0, len0);
794
+ if (ret[2]) {
795
+ throw takeFromExternrefTable0(ret[1]);
796
+ }
797
+ this.__wbg_ptr = ret[0] >>> 0;
798
+ WasmTrustEngineFinalization.register(this, this.__wbg_ptr, this);
799
+ return this;
800
+ }
801
+ }
802
+ if (Symbol.dispose) WasmTrustEngine.prototype[Symbol.dispose] = WasmTrustEngine.prototype.free;
803
+ exports.WasmTrustEngine = WasmTrustEngine;
804
+
805
+ class WasmWorkGraph {
806
+ static __wrap(ptr) {
807
+ ptr = ptr >>> 0;
808
+ const obj = Object.create(WasmWorkGraph.prototype);
809
+ obj.__wbg_ptr = ptr;
810
+ WasmWorkGraphFinalization.register(obj, obj.__wbg_ptr, obj);
811
+ return obj;
812
+ }
813
+ __destroy_into_raw() {
814
+ const ptr = this.__wbg_ptr;
815
+ this.__wbg_ptr = 0;
816
+ WasmWorkGraphFinalization.unregister(this);
817
+ return ptr;
818
+ }
819
+ free() {
820
+ const ptr = this.__destroy_into_raw();
821
+ wasm.__wbg_wasmworkgraph_free(ptr, 0);
822
+ }
823
+ /**
824
+ * @param {string} json_text
825
+ * @returns {string}
826
+ */
827
+ applyEventJSON(json_text) {
828
+ let deferred3_0;
829
+ let deferred3_1;
830
+ try {
831
+ const ptr0 = passStringToWasm0(json_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
832
+ const len0 = WASM_VECTOR_LEN;
833
+ const ret = wasm.wasmworkgraph_applyEventJSON(this.__wbg_ptr, ptr0, len0);
834
+ var ptr2 = ret[0];
835
+ var len2 = ret[1];
836
+ if (ret[3]) {
837
+ ptr2 = 0; len2 = 0;
838
+ throw takeFromExternrefTable0(ret[2]);
839
+ }
840
+ deferred3_0 = ptr2;
841
+ deferred3_1 = len2;
842
+ return getStringFromWasm0(ptr2, len2);
843
+ } finally {
844
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
845
+ }
846
+ }
847
+ /**
848
+ * @param {string | null | undefined} workstream_id
849
+ * @param {number} max_evidence
850
+ * @param {boolean} pretty
851
+ * @returns {string}
852
+ */
853
+ contextScopeJSON(workstream_id, max_evidence, pretty) {
854
+ let deferred3_0;
855
+ let deferred3_1;
856
+ try {
857
+ var ptr0 = isLikeNone(workstream_id) ? 0 : passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
858
+ var len0 = WASM_VECTOR_LEN;
859
+ const ret = wasm.wasmworkgraph_contextScopeJSON(this.__wbg_ptr, ptr0, len0, max_evidence, pretty);
860
+ var ptr2 = ret[0];
861
+ var len2 = ret[1];
862
+ if (ret[3]) {
863
+ ptr2 = 0; len2 = 0;
864
+ throw takeFromExternrefTable0(ret[2]);
865
+ }
866
+ deferred3_0 = ptr2;
867
+ deferred3_1 = len2;
868
+ return getStringFromWasm0(ptr2, len2);
869
+ } finally {
870
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
871
+ }
872
+ }
873
+ /**
874
+ * @param {string} handoff_json
875
+ * @param {string} manifest_json
876
+ * @returns {string}
877
+ */
878
+ continuationProofJSON(handoff_json, manifest_json) {
879
+ let deferred4_0;
880
+ let deferred4_1;
881
+ try {
882
+ const ptr0 = passStringToWasm0(handoff_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
883
+ const len0 = WASM_VECTOR_LEN;
884
+ const ptr1 = passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
885
+ const len1 = WASM_VECTOR_LEN;
886
+ const ret = wasm.wasmworkgraph_continuationProofJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1);
887
+ var ptr3 = ret[0];
888
+ var len3 = ret[1];
889
+ if (ret[3]) {
890
+ ptr3 = 0; len3 = 0;
891
+ throw takeFromExternrefTable0(ret[2]);
892
+ }
893
+ deferred4_0 = ptr3;
894
+ deferred4_1 = len3;
895
+ return getStringFromWasm0(ptr3, len3);
896
+ } finally {
897
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
898
+ }
899
+ }
900
+ /**
901
+ * @param {number} now_ms
902
+ * @param {boolean} pretty
903
+ * @returns {string}
904
+ */
905
+ coordinationJSON(now_ms, pretty) {
906
+ let deferred2_0;
907
+ let deferred2_1;
908
+ try {
909
+ const ret = wasm.wasmworkgraph_coordinationJSON(this.__wbg_ptr, now_ms, pretty);
910
+ var ptr1 = ret[0];
911
+ var len1 = ret[1];
912
+ if (ret[3]) {
913
+ ptr1 = 0; len1 = 0;
914
+ throw takeFromExternrefTable0(ret[2]);
915
+ }
916
+ deferred2_0 = ptr1;
917
+ deferred2_1 = len1;
918
+ return getStringFromWasm0(ptr1, len1);
919
+ } finally {
920
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
921
+ }
922
+ }
923
+ /**
924
+ * @returns {number}
925
+ */
926
+ get eventCount() {
927
+ const ret = wasm.wasmworkgraph_eventCount(this.__wbg_ptr);
928
+ return ret >>> 0;
929
+ }
930
+ /**
931
+ * @param {boolean} pretty
932
+ * @returns {string}
933
+ */
934
+ exportJSON(pretty) {
935
+ let deferred2_0;
936
+ let deferred2_1;
937
+ try {
938
+ const ret = wasm.wasmworkgraph_exportJSON(this.__wbg_ptr, pretty);
939
+ var ptr1 = ret[0];
940
+ var len1 = ret[1];
941
+ if (ret[3]) {
942
+ ptr1 = 0; len1 = 0;
943
+ throw takeFromExternrefTable0(ret[2]);
944
+ }
945
+ deferred2_0 = ptr1;
946
+ deferred2_1 = len1;
947
+ return getStringFromWasm0(ptr1, len1);
948
+ } finally {
949
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
950
+ }
951
+ }
952
+ /**
953
+ * @param {string} json_text
954
+ * @returns {WasmWorkGraph}
955
+ */
956
+ static fromJSON(json_text) {
957
+ const ptr0 = passStringToWasm0(json_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
958
+ const len0 = WASM_VECTOR_LEN;
959
+ const ret = wasm.wasmworkgraph_fromJSON(ptr0, len0);
960
+ if (ret[2]) {
961
+ throw takeFromExternrefTable0(ret[1]);
962
+ }
963
+ return WasmWorkGraph.__wrap(ret[0]);
964
+ }
965
+ /**
966
+ * @returns {string}
967
+ */
968
+ get graphCommitment() {
969
+ let deferred1_0;
970
+ let deferred1_1;
971
+ try {
972
+ const ret = wasm.wasmworkgraph_graphCommitment(this.__wbg_ptr);
973
+ deferred1_0 = ret[0];
974
+ deferred1_1 = ret[1];
975
+ return getStringFromWasm0(ret[0], ret[1]);
976
+ } finally {
977
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
978
+ }
979
+ }
980
+ /**
981
+ * @param {string} workstream_id
982
+ * @param {string} from_agent
983
+ * @param {string} to_agent
984
+ * @param {number} generated_at_ms
985
+ * @param {boolean} pretty
986
+ * @returns {string}
987
+ */
988
+ handoffJSON(workstream_id, from_agent, to_agent, generated_at_ms, pretty) {
989
+ let deferred5_0;
990
+ let deferred5_1;
991
+ try {
992
+ const ptr0 = passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
+ const len0 = WASM_VECTOR_LEN;
994
+ const ptr1 = passStringToWasm0(from_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
995
+ const len1 = WASM_VECTOR_LEN;
996
+ const ptr2 = passStringToWasm0(to_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
997
+ const len2 = WASM_VECTOR_LEN;
998
+ const ret = wasm.wasmworkgraph_handoffJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, generated_at_ms, pretty);
999
+ var ptr4 = ret[0];
1000
+ var len4 = ret[1];
1001
+ if (ret[3]) {
1002
+ ptr4 = 0; len4 = 0;
1003
+ throw takeFromExternrefTable0(ret[2]);
1004
+ }
1005
+ deferred5_0 = ptr4;
1006
+ deferred5_1 = len4;
1007
+ return getStringFromWasm0(ptr4, len4);
1008
+ } finally {
1009
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1010
+ }
1011
+ }
1012
+ /**
1013
+ * @param {string} json_text
1014
+ * @returns {number}
1015
+ */
1016
+ mergeJSON(json_text) {
1017
+ const ptr0 = passStringToWasm0(json_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1018
+ const len0 = WASM_VECTOR_LEN;
1019
+ const ret = wasm.wasmworkgraph_mergeJSON(this.__wbg_ptr, ptr0, len0);
1020
+ if (ret[2]) {
1021
+ throw takeFromExternrefTable0(ret[1]);
1022
+ }
1023
+ return ret[0] >>> 0;
1024
+ }
1025
+ /**
1026
+ * @param {string} repo_id
1027
+ */
1028
+ constructor(repo_id) {
1029
+ const ptr0 = passStringToWasm0(repo_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1030
+ const len0 = WASM_VECTOR_LEN;
1031
+ const ret = wasm.wasmworkgraph_new(ptr0, len0);
1032
+ if (ret[2]) {
1033
+ throw takeFromExternrefTable0(ret[1]);
1034
+ }
1035
+ this.__wbg_ptr = ret[0] >>> 0;
1036
+ WasmWorkGraphFinalization.register(this, this.__wbg_ptr, this);
1037
+ return this;
1038
+ }
1039
+ /**
1040
+ * @param {string} json_text
1041
+ * @returns {string}
1042
+ */
1043
+ observeRepositoryJSON(json_text) {
1044
+ let deferred3_0;
1045
+ let deferred3_1;
1046
+ try {
1047
+ const ptr0 = passStringToWasm0(json_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1048
+ const len0 = WASM_VECTOR_LEN;
1049
+ const ret = wasm.wasmworkgraph_observeRepositoryJSON(this.__wbg_ptr, ptr0, len0);
1050
+ var ptr2 = ret[0];
1051
+ var len2 = ret[1];
1052
+ if (ret[3]) {
1053
+ ptr2 = 0; len2 = 0;
1054
+ throw takeFromExternrefTable0(ret[2]);
1055
+ }
1056
+ deferred3_0 = ptr2;
1057
+ deferred3_1 = len2;
1058
+ return getStringFromWasm0(ptr2, len2);
1059
+ } finally {
1060
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1061
+ }
1062
+ }
1063
+ /**
1064
+ * @param {string} workstream_id
1065
+ * @param {string} to_agent
1066
+ * @param {string} manifest_json
1067
+ * @returns {string}
1068
+ */
1069
+ reconstructedContinuationProofJSON(workstream_id, to_agent, manifest_json) {
1070
+ let deferred5_0;
1071
+ let deferred5_1;
1072
+ try {
1073
+ const ptr0 = passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1074
+ const len0 = WASM_VECTOR_LEN;
1075
+ const ptr1 = passStringToWasm0(to_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1076
+ const len1 = WASM_VECTOR_LEN;
1077
+ const ptr2 = passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1078
+ const len2 = WASM_VECTOR_LEN;
1079
+ const ret = wasm.wasmworkgraph_reconstructedContinuationProofJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1080
+ var ptr4 = ret[0];
1081
+ var len4 = ret[1];
1082
+ if (ret[3]) {
1083
+ ptr4 = 0; len4 = 0;
1084
+ throw takeFromExternrefTable0(ret[2]);
1085
+ }
1086
+ deferred5_0 = ptr4;
1087
+ deferred5_1 = len4;
1088
+ return getStringFromWasm0(ptr4, len4);
1089
+ } finally {
1090
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1091
+ }
1092
+ }
1093
+ /**
1094
+ * @param {string} receipt_json
1095
+ * @param {string} agent_id
1096
+ * @param {string} session_id
1097
+ * @returns {string}
1098
+ */
1099
+ recordContextReceiptJSON(receipt_json, agent_id, session_id) {
1100
+ let deferred5_0;
1101
+ let deferred5_1;
1102
+ try {
1103
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1104
+ const len0 = WASM_VECTOR_LEN;
1105
+ const ptr1 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1106
+ const len1 = WASM_VECTOR_LEN;
1107
+ const ptr2 = passStringToWasm0(session_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1108
+ const len2 = WASM_VECTOR_LEN;
1109
+ const ret = wasm.wasmworkgraph_recordContextReceiptJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1110
+ var ptr4 = ret[0];
1111
+ var len4 = ret[1];
1112
+ if (ret[3]) {
1113
+ ptr4 = 0; len4 = 0;
1114
+ throw takeFromExternrefTable0(ret[2]);
1115
+ }
1116
+ deferred5_0 = ptr4;
1117
+ deferred5_1 = len4;
1118
+ return getStringFromWasm0(ptr4, len4);
1119
+ } finally {
1120
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1121
+ }
1122
+ }
1123
+ /**
1124
+ * @param {string} route_json
1125
+ * @param {string} outcome_json
1126
+ * @param {string} verification_json
1127
+ * @param {string | null} [invalidated_commitments_json]
1128
+ * @returns {string}
1129
+ */
1130
+ recordExecutionChainJSON(route_json, outcome_json, verification_json, invalidated_commitments_json) {
1131
+ let deferred6_0;
1132
+ let deferred6_1;
1133
+ try {
1134
+ const ptr0 = passStringToWasm0(route_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1135
+ const len0 = WASM_VECTOR_LEN;
1136
+ const ptr1 = passStringToWasm0(outcome_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1137
+ const len1 = WASM_VECTOR_LEN;
1138
+ const ptr2 = passStringToWasm0(verification_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1139
+ const len2 = WASM_VECTOR_LEN;
1140
+ var ptr3 = isLikeNone(invalidated_commitments_json) ? 0 : passStringToWasm0(invalidated_commitments_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1141
+ var len3 = WASM_VECTOR_LEN;
1142
+ const ret = wasm.wasmworkgraph_recordExecutionChainJSON(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1143
+ var ptr5 = ret[0];
1144
+ var len5 = ret[1];
1145
+ if (ret[3]) {
1146
+ ptr5 = 0; len5 = 0;
1147
+ throw takeFromExternrefTable0(ret[2]);
1148
+ }
1149
+ deferred6_0 = ptr5;
1150
+ deferred6_1 = len5;
1151
+ return getStringFromWasm0(ptr5, len5);
1152
+ } finally {
1153
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
1154
+ }
1155
+ }
1156
+ /**
1157
+ * @param {string} memory_json
1158
+ * @param {number} now_ms
1159
+ * @param {string | null} [superseded_ids_json]
1160
+ * @returns {string}
1161
+ */
1162
+ recordMemoryJSON(memory_json, now_ms, superseded_ids_json) {
1163
+ let deferred4_0;
1164
+ let deferred4_1;
1165
+ try {
1166
+ const ptr0 = passStringToWasm0(memory_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1167
+ const len0 = WASM_VECTOR_LEN;
1168
+ var ptr1 = isLikeNone(superseded_ids_json) ? 0 : passStringToWasm0(superseded_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1169
+ var len1 = WASM_VECTOR_LEN;
1170
+ const ret = wasm.wasmworkgraph_recordMemoryJSON(this.__wbg_ptr, ptr0, len0, now_ms, ptr1, len1);
1171
+ var ptr3 = ret[0];
1172
+ var len3 = ret[1];
1173
+ if (ret[3]) {
1174
+ ptr3 = 0; len3 = 0;
1175
+ throw takeFromExternrefTable0(ret[2]);
1176
+ }
1177
+ deferred4_0 = ptr3;
1178
+ deferred4_1 = len3;
1179
+ return getStringFromWasm0(ptr3, len3);
1180
+ } finally {
1181
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1182
+ }
1183
+ }
1184
+ /**
1185
+ * @returns {string}
1186
+ */
1187
+ get repoId() {
1188
+ let deferred1_0;
1189
+ let deferred1_1;
1190
+ try {
1191
+ const ret = wasm.wasmworkgraph_repoId(this.__wbg_ptr);
1192
+ deferred1_0 = ret[0];
1193
+ deferred1_1 = ret[1];
1194
+ return getStringFromWasm0(ret[0], ret[1]);
1195
+ } finally {
1196
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1197
+ }
1198
+ }
1199
+ /**
1200
+ * @param {string | null | undefined} workstream_id
1201
+ * @param {number} max_evidence
1202
+ * @param {boolean} pretty
1203
+ * @returns {string}
1204
+ */
1205
+ resumeJSON(workstream_id, max_evidence, pretty) {
1206
+ let deferred3_0;
1207
+ let deferred3_1;
1208
+ try {
1209
+ var ptr0 = isLikeNone(workstream_id) ? 0 : passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1210
+ var len0 = WASM_VECTOR_LEN;
1211
+ const ret = wasm.wasmworkgraph_resumeJSON(this.__wbg_ptr, ptr0, len0, max_evidence, pretty);
1212
+ var ptr2 = ret[0];
1213
+ var len2 = ret[1];
1214
+ if (ret[3]) {
1215
+ ptr2 = 0; len2 = 0;
1216
+ throw takeFromExternrefTable0(ret[2]);
1217
+ }
1218
+ deferred3_0 = ptr2;
1219
+ deferred3_1 = len2;
1220
+ return getStringFromWasm0(ptr2, len2);
1221
+ } finally {
1222
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1223
+ }
1224
+ }
1225
+ /**
1226
+ * @returns {bigint}
1227
+ */
1228
+ get revision() {
1229
+ const ret = wasm.wasmworkgraph_revision(this.__wbg_ptr);
1230
+ return BigInt.asUintN(64, ret);
1231
+ }
1232
+ /**
1233
+ * @param {boolean} pretty
1234
+ * @returns {string}
1235
+ */
1236
+ snapshotJSON(pretty) {
1237
+ let deferred2_0;
1238
+ let deferred2_1;
1239
+ try {
1240
+ const ret = wasm.wasmworkgraph_snapshotJSON(this.__wbg_ptr, pretty);
1241
+ var ptr1 = ret[0];
1242
+ var len1 = ret[1];
1243
+ if (ret[3]) {
1244
+ ptr1 = 0; len1 = 0;
1245
+ throw takeFromExternrefTable0(ret[2]);
1246
+ }
1247
+ deferred2_0 = ptr1;
1248
+ deferred2_1 = len1;
1249
+ return getStringFromWasm0(ptr1, len1);
1250
+ } finally {
1251
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1252
+ }
1253
+ }
1254
+ /**
1255
+ * @returns {string}
1256
+ */
1257
+ summaryJSON() {
1258
+ let deferred2_0;
1259
+ let deferred2_1;
1260
+ try {
1261
+ const ret = wasm.wasmworkgraph_summaryJSON(this.__wbg_ptr);
1262
+ var ptr1 = ret[0];
1263
+ var len1 = ret[1];
1264
+ if (ret[3]) {
1265
+ ptr1 = 0; len1 = 0;
1266
+ throw takeFromExternrefTable0(ret[2]);
1267
+ }
1268
+ deferred2_0 = ptr1;
1269
+ deferred2_1 = len1;
1270
+ return getStringFromWasm0(ptr1, len1);
1271
+ } finally {
1272
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1273
+ }
1274
+ }
1275
+ /**
1276
+ * @param {boolean} pretty
1277
+ * @returns {string}
1278
+ */
1279
+ unfinishedJSON(pretty) {
1280
+ let deferred2_0;
1281
+ let deferred2_1;
1282
+ try {
1283
+ const ret = wasm.wasmworkgraph_unfinishedJSON(this.__wbg_ptr, pretty);
1284
+ var ptr1 = ret[0];
1285
+ var len1 = ret[1];
1286
+ if (ret[3]) {
1287
+ ptr1 = 0; len1 = 0;
1288
+ throw takeFromExternrefTable0(ret[2]);
1289
+ }
1290
+ deferred2_0 = ptr1;
1291
+ deferred2_1 = len1;
1292
+ return getStringFromWasm0(ptr1, len1);
1293
+ } finally {
1294
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1295
+ }
1296
+ }
1297
+ /**
1298
+ * @param {string} receipt_json
1299
+ * @returns {boolean}
1300
+ */
1301
+ static verifyHandoffIntegrityJSON(receipt_json) {
1302
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1303
+ const len0 = WASM_VECTOR_LEN;
1304
+ const ret = wasm.wasmworkgraph_verifyHandoffIntegrityJSON(ptr0, len0);
1305
+ if (ret[2]) {
1306
+ throw takeFromExternrefTable0(ret[1]);
1307
+ }
1308
+ return ret[0] !== 0;
1309
+ }
1310
+ /**
1311
+ * @param {string} receipt_json
1312
+ * @returns {boolean}
1313
+ */
1314
+ verifyHandoffJSON(receipt_json) {
1315
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1316
+ const len0 = WASM_VECTOR_LEN;
1317
+ const ret = wasm.wasmworkgraph_verifyHandoffJSON(this.__wbg_ptr, ptr0, len0);
1318
+ if (ret[2]) {
1319
+ throw takeFromExternrefTable0(ret[1]);
1320
+ }
1321
+ return ret[0] !== 0;
1322
+ }
1323
+ }
1324
+ if (Symbol.dispose) WasmWorkGraph.prototype[Symbol.dispose] = WasmWorkGraph.prototype.free;
1325
+ exports.WasmWorkGraph = WasmWorkGraph;
1326
+
439
1327
  /**
440
1328
  * @param {string} query
441
1329
  * @returns {string}
@@ -474,8 +1362,369 @@ function classify_query_transition(prev_hash, current_query, elapsed_s, time_win
474
1362
  exports.classify_query_transition = classify_query_transition;
475
1363
 
476
1364
  /**
477
- * @param {string} episodes_json
478
- * @returns {any}
1365
+ * Build a canonical receipt envelope and return it as canonical JSON.
1366
+ *
1367
+ * Reference lists arrive as JSON arrays rather than `Box<[JsString]>` so there
1368
+ * is one decoding path shared with the other bindings here, and so an empty
1369
+ * list is expressed the same way in both runtimes.
1370
+ * @param {string} repository_id
1371
+ * @param {string} repository_commitment
1372
+ * @param {string} graph_commitment
1373
+ * @param {string} work_scope_id
1374
+ * @param {string | null} [source_commitment]
1375
+ * @param {string | null} [selected_refs_json]
1376
+ * @param {string | null} [omitted_refs_json]
1377
+ * @param {string | null} [pinned_refs_json]
1378
+ * @param {string | null} [recoverable_refs_json]
1379
+ * @param {string | null} [recovery_handles_json]
1380
+ * @param {string | null} [evidence_ids_json]
1381
+ * @param {number | null} [budget_tokens]
1382
+ * @param {string | null} [selection_policy]
1383
+ * @param {string | null} [execution_id]
1384
+ * @param {number | null} [created_at_ms]
1385
+ * @returns {string}
1386
+ */
1387
+ function contextReceiptBuildJSON(repository_id, repository_commitment, graph_commitment, work_scope_id, source_commitment, selected_refs_json, omitted_refs_json, pinned_refs_json, recoverable_refs_json, recovery_handles_json, evidence_ids_json, budget_tokens, selection_policy, execution_id, created_at_ms) {
1388
+ let deferred15_0;
1389
+ let deferred15_1;
1390
+ try {
1391
+ const ptr0 = passStringToWasm0(repository_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1392
+ const len0 = WASM_VECTOR_LEN;
1393
+ const ptr1 = passStringToWasm0(repository_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1394
+ const len1 = WASM_VECTOR_LEN;
1395
+ const ptr2 = passStringToWasm0(graph_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1396
+ const len2 = WASM_VECTOR_LEN;
1397
+ const ptr3 = passStringToWasm0(work_scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1398
+ const len3 = WASM_VECTOR_LEN;
1399
+ var ptr4 = isLikeNone(source_commitment) ? 0 : passStringToWasm0(source_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1400
+ var len4 = WASM_VECTOR_LEN;
1401
+ var ptr5 = isLikeNone(selected_refs_json) ? 0 : passStringToWasm0(selected_refs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1402
+ var len5 = WASM_VECTOR_LEN;
1403
+ var ptr6 = isLikeNone(omitted_refs_json) ? 0 : passStringToWasm0(omitted_refs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1404
+ var len6 = WASM_VECTOR_LEN;
1405
+ var ptr7 = isLikeNone(pinned_refs_json) ? 0 : passStringToWasm0(pinned_refs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1406
+ var len7 = WASM_VECTOR_LEN;
1407
+ var ptr8 = isLikeNone(recoverable_refs_json) ? 0 : passStringToWasm0(recoverable_refs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1408
+ var len8 = WASM_VECTOR_LEN;
1409
+ var ptr9 = isLikeNone(recovery_handles_json) ? 0 : passStringToWasm0(recovery_handles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1410
+ var len9 = WASM_VECTOR_LEN;
1411
+ var ptr10 = isLikeNone(evidence_ids_json) ? 0 : passStringToWasm0(evidence_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1412
+ var len10 = WASM_VECTOR_LEN;
1413
+ var ptr11 = isLikeNone(selection_policy) ? 0 : passStringToWasm0(selection_policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1414
+ var len11 = WASM_VECTOR_LEN;
1415
+ var ptr12 = isLikeNone(execution_id) ? 0 : passStringToWasm0(execution_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1416
+ var len12 = WASM_VECTOR_LEN;
1417
+ const ret = wasm.contextReceiptBuildJSON(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, isLikeNone(budget_tokens) ? 0x100000001 : (budget_tokens) >>> 0, ptr11, len11, ptr12, len12, !isLikeNone(created_at_ms), isLikeNone(created_at_ms) ? 0 : created_at_ms);
1418
+ var ptr14 = ret[0];
1419
+ var len14 = ret[1];
1420
+ if (ret[3]) {
1421
+ ptr14 = 0; len14 = 0;
1422
+ throw takeFromExternrefTable0(ret[2]);
1423
+ }
1424
+ deferred15_0 = ptr14;
1425
+ deferred15_1 = len14;
1426
+ return getStringFromWasm0(ptr14, len14);
1427
+ } finally {
1428
+ wasm.__wbindgen_free(deferred15_0, deferred15_1, 1);
1429
+ }
1430
+ }
1431
+ exports.contextReceiptBuildJSON = contextReceiptBuildJSON;
1432
+
1433
+ /**
1434
+ * The commitment carried by a verified envelope.
1435
+ * @param {string} receipt_json
1436
+ * @returns {string}
1437
+ */
1438
+ function contextReceiptCommitment(receipt_json) {
1439
+ let deferred3_0;
1440
+ let deferred3_1;
1441
+ try {
1442
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1443
+ const len0 = WASM_VECTOR_LEN;
1444
+ const ret = wasm.contextReceiptCommitment(ptr0, len0);
1445
+ var ptr2 = ret[0];
1446
+ var len2 = ret[1];
1447
+ if (ret[3]) {
1448
+ ptr2 = 0; len2 = 0;
1449
+ throw takeFromExternrefTable0(ret[2]);
1450
+ }
1451
+ deferred3_0 = ptr2;
1452
+ deferred3_1 = len2;
1453
+ return getStringFromWasm0(ptr2, len2);
1454
+ } finally {
1455
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1456
+ }
1457
+ }
1458
+ exports.contextReceiptCommitment = contextReceiptCommitment;
1459
+
1460
+ /**
1461
+ * Project a verified envelope into the Work Graph reference form, as JSON.
1462
+ * @param {string} receipt_json
1463
+ * @param {string} workstream_id
1464
+ * @param {string} agent_id
1465
+ * @param {string} session_id
1466
+ * @returns {string}
1467
+ */
1468
+ function contextReceiptGraphRefJSON(receipt_json, workstream_id, agent_id, session_id) {
1469
+ let deferred6_0;
1470
+ let deferred6_1;
1471
+ try {
1472
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1473
+ const len0 = WASM_VECTOR_LEN;
1474
+ const ptr1 = passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1475
+ const len1 = WASM_VECTOR_LEN;
1476
+ const ptr2 = passStringToWasm0(agent_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1477
+ const len2 = WASM_VECTOR_LEN;
1478
+ const ptr3 = passStringToWasm0(session_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1479
+ const len3 = WASM_VECTOR_LEN;
1480
+ const ret = wasm.contextReceiptGraphRefJSON(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1481
+ var ptr5 = ret[0];
1482
+ var len5 = ret[1];
1483
+ if (ret[3]) {
1484
+ ptr5 = 0; len5 = 0;
1485
+ throw takeFromExternrefTable0(ret[2]);
1486
+ }
1487
+ deferred6_0 = ptr5;
1488
+ deferred6_1 = len5;
1489
+ return getStringFromWasm0(ptr5, len5);
1490
+ } finally {
1491
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
1492
+ }
1493
+ }
1494
+ exports.contextReceiptGraphRefJSON = contextReceiptGraphRefJSON;
1495
+
1496
+ /**
1497
+ * Schema version this build implements.
1498
+ * @returns {number}
1499
+ */
1500
+ function contextReceiptSchemaVersion() {
1501
+ const ret = wasm.contextReceiptSchemaVersion();
1502
+ return ret >>> 0;
1503
+ }
1504
+ exports.contextReceiptSchemaVersion = contextReceiptSchemaVersion;
1505
+
1506
+ /**
1507
+ * Parse and verify an envelope, returning its canonical JSON.
1508
+ *
1509
+ * Fails closed on a commitment that does not recompute and on an unrecognised
1510
+ * schema version — a caller cannot obtain an unverified envelope here.
1511
+ * @param {string} receipt_json
1512
+ * @returns {string}
1513
+ */
1514
+ function contextReceiptVerifyJSON(receipt_json) {
1515
+ let deferred3_0;
1516
+ let deferred3_1;
1517
+ try {
1518
+ const ptr0 = passStringToWasm0(receipt_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1519
+ const len0 = WASM_VECTOR_LEN;
1520
+ const ret = wasm.contextReceiptVerifyJSON(ptr0, len0);
1521
+ var ptr2 = ret[0];
1522
+ var len2 = ret[1];
1523
+ if (ret[3]) {
1524
+ ptr2 = 0; len2 = 0;
1525
+ throw takeFromExternrefTable0(ret[2]);
1526
+ }
1527
+ deferred3_0 = ptr2;
1528
+ deferred3_1 = len2;
1529
+ return getStringFromWasm0(ptr2, len2);
1530
+ } finally {
1531
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1532
+ }
1533
+ }
1534
+ exports.contextReceiptVerifyJSON = contextReceiptVerifyJSON;
1535
+
1536
+ /**
1537
+ * May this memory be injected, and why.
1538
+ *
1539
+ * No score parameter, by design — section 10's "do not let similarity score
1540
+ * imply truth" is enforced by the signature in both runtimes alike.
1541
+ * @param {string} record_json
1542
+ * @param {number} now_ms
1543
+ * @param {string | null} [superseded_ids_json]
1544
+ * @returns {string}
1545
+ */
1546
+ function memoryRecordAdmissibility(record_json, now_ms, superseded_ids_json) {
1547
+ let deferred4_0;
1548
+ let deferred4_1;
1549
+ try {
1550
+ const ptr0 = passStringToWasm0(record_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1551
+ const len0 = WASM_VECTOR_LEN;
1552
+ var ptr1 = isLikeNone(superseded_ids_json) ? 0 : passStringToWasm0(superseded_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1553
+ var len1 = WASM_VECTOR_LEN;
1554
+ const ret = wasm.memoryRecordAdmissibility(ptr0, len0, now_ms, ptr1, len1);
1555
+ var ptr3 = ret[0];
1556
+ var len3 = ret[1];
1557
+ if (ret[3]) {
1558
+ ptr3 = 0; len3 = 0;
1559
+ throw takeFromExternrefTable0(ret[2]);
1560
+ }
1561
+ deferred4_0 = ptr3;
1562
+ deferred4_1 = len3;
1563
+ return getStringFromWasm0(ptr3, len3);
1564
+ } finally {
1565
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1566
+ }
1567
+ }
1568
+ exports.memoryRecordAdmissibility = memoryRecordAdmissibility;
1569
+
1570
+ /**
1571
+ * Build a memory record and return it as canonical JSON.
1572
+ * @param {string} repository_id
1573
+ * @param {string} content_reference
1574
+ * @param {string} trust_state
1575
+ * @param {string | null} [task_id]
1576
+ * @param {string | null} [workstream_id]
1577
+ * @param {string | null} [source_agent]
1578
+ * @param {string | null} [source_session]
1579
+ * @param {string | null} [source_execution]
1580
+ * @param {string | null} [content_commitment]
1581
+ * @param {string | null} [evidence_ids_json]
1582
+ * @param {number | null} [created_at_ms]
1583
+ * @param {number | null} [observed_at_ms]
1584
+ * @param {number | null} [valid_until_ms]
1585
+ * @param {string | null} [supersedes_json]
1586
+ * @param {string | null} [contradicted_by_json]
1587
+ * @param {string | null} [recovery_handle]
1588
+ * @returns {string}
1589
+ */
1590
+ function memoryRecordBuildJSON(repository_id, content_reference, trust_state, task_id, workstream_id, source_agent, source_session, source_execution, content_commitment, evidence_ids_json, created_at_ms, observed_at_ms, valid_until_ms, supersedes_json, contradicted_by_json, recovery_handle) {
1591
+ let deferred15_0;
1592
+ let deferred15_1;
1593
+ try {
1594
+ const ptr0 = passStringToWasm0(repository_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1595
+ const len0 = WASM_VECTOR_LEN;
1596
+ const ptr1 = passStringToWasm0(content_reference, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1597
+ const len1 = WASM_VECTOR_LEN;
1598
+ const ptr2 = passStringToWasm0(trust_state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1599
+ const len2 = WASM_VECTOR_LEN;
1600
+ var ptr3 = isLikeNone(task_id) ? 0 : passStringToWasm0(task_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1601
+ var len3 = WASM_VECTOR_LEN;
1602
+ var ptr4 = isLikeNone(workstream_id) ? 0 : passStringToWasm0(workstream_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1603
+ var len4 = WASM_VECTOR_LEN;
1604
+ var ptr5 = isLikeNone(source_agent) ? 0 : passStringToWasm0(source_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1605
+ var len5 = WASM_VECTOR_LEN;
1606
+ var ptr6 = isLikeNone(source_session) ? 0 : passStringToWasm0(source_session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1607
+ var len6 = WASM_VECTOR_LEN;
1608
+ var ptr7 = isLikeNone(source_execution) ? 0 : passStringToWasm0(source_execution, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1609
+ var len7 = WASM_VECTOR_LEN;
1610
+ var ptr8 = isLikeNone(content_commitment) ? 0 : passStringToWasm0(content_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1611
+ var len8 = WASM_VECTOR_LEN;
1612
+ var ptr9 = isLikeNone(evidence_ids_json) ? 0 : passStringToWasm0(evidence_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1613
+ var len9 = WASM_VECTOR_LEN;
1614
+ var ptr10 = isLikeNone(supersedes_json) ? 0 : passStringToWasm0(supersedes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1615
+ var len10 = WASM_VECTOR_LEN;
1616
+ var ptr11 = isLikeNone(contradicted_by_json) ? 0 : passStringToWasm0(contradicted_by_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1617
+ var len11 = WASM_VECTOR_LEN;
1618
+ var ptr12 = isLikeNone(recovery_handle) ? 0 : passStringToWasm0(recovery_handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1619
+ var len12 = WASM_VECTOR_LEN;
1620
+ const ret = wasm.memoryRecordBuildJSON(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, !isLikeNone(created_at_ms), isLikeNone(created_at_ms) ? 0 : created_at_ms, !isLikeNone(observed_at_ms), isLikeNone(observed_at_ms) ? 0 : observed_at_ms, !isLikeNone(valid_until_ms), isLikeNone(valid_until_ms) ? 0 : valid_until_ms, ptr10, len10, ptr11, len11, ptr12, len12);
1621
+ var ptr14 = ret[0];
1622
+ var len14 = ret[1];
1623
+ if (ret[3]) {
1624
+ ptr14 = 0; len14 = 0;
1625
+ throw takeFromExternrefTable0(ret[2]);
1626
+ }
1627
+ deferred15_0 = ptr14;
1628
+ deferred15_1 = len14;
1629
+ return getStringFromWasm0(ptr14, len14);
1630
+ } finally {
1631
+ wasm.__wbindgen_free(deferred15_0, deferred15_1, 1);
1632
+ }
1633
+ }
1634
+ exports.memoryRecordBuildJSON = memoryRecordBuildJSON;
1635
+
1636
+ /**
1637
+ * Schema version this build implements for memory records.
1638
+ * @returns {number}
1639
+ */
1640
+ function memoryRecordSchemaVersion() {
1641
+ const ret = wasm.memoryRecordSchemaVersion();
1642
+ return ret >>> 0;
1643
+ }
1644
+ exports.memoryRecordSchemaVersion = memoryRecordSchemaVersion;
1645
+
1646
+ /**
1647
+ * Parse and check a memory record, returning its canonical JSON.
1648
+ * @param {string} record_json
1649
+ * @returns {string}
1650
+ */
1651
+ function memoryRecordVerifyJSON(record_json) {
1652
+ let deferred3_0;
1653
+ let deferred3_1;
1654
+ try {
1655
+ const ptr0 = passStringToWasm0(record_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1656
+ const len0 = WASM_VECTOR_LEN;
1657
+ const ret = wasm.memoryRecordVerifyJSON(ptr0, len0);
1658
+ var ptr2 = ret[0];
1659
+ var len2 = ret[1];
1660
+ if (ret[3]) {
1661
+ ptr2 = 0; len2 = 0;
1662
+ throw takeFromExternrefTable0(ret[2]);
1663
+ }
1664
+ deferred3_0 = ptr2;
1665
+ deferred3_1 = len2;
1666
+ return getStringFromWasm0(ptr2, len2);
1667
+ } finally {
1668
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1669
+ }
1670
+ }
1671
+ exports.memoryRecordVerifyJSON = memoryRecordVerifyJSON;
1672
+
1673
+ /**
1674
+ * @param {string} input_json
1675
+ * @returns {string}
1676
+ */
1677
+ function modelExecutionOutcomeBuildJSON(input_json) {
1678
+ let deferred3_0;
1679
+ let deferred3_1;
1680
+ try {
1681
+ const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1682
+ const len0 = WASM_VECTOR_LEN;
1683
+ const ret = wasm.modelExecutionOutcomeBuildJSON(ptr0, len0);
1684
+ var ptr2 = ret[0];
1685
+ var len2 = ret[1];
1686
+ if (ret[3]) {
1687
+ ptr2 = 0; len2 = 0;
1688
+ throw takeFromExternrefTable0(ret[2]);
1689
+ }
1690
+ deferred3_0 = ptr2;
1691
+ deferred3_1 = len2;
1692
+ return getStringFromWasm0(ptr2, len2);
1693
+ } finally {
1694
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1695
+ }
1696
+ }
1697
+ exports.modelExecutionOutcomeBuildJSON = modelExecutionOutcomeBuildJSON;
1698
+
1699
+ /**
1700
+ * @param {string} value_json
1701
+ * @returns {string}
1702
+ */
1703
+ function modelExecutionOutcomeVerifyJSON(value_json) {
1704
+ let deferred3_0;
1705
+ let deferred3_1;
1706
+ try {
1707
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1708
+ const len0 = WASM_VECTOR_LEN;
1709
+ const ret = wasm.modelExecutionOutcomeVerifyJSON(ptr0, len0);
1710
+ var ptr2 = ret[0];
1711
+ var len2 = ret[1];
1712
+ if (ret[3]) {
1713
+ ptr2 = 0; len2 = 0;
1714
+ throw takeFromExternrefTable0(ret[2]);
1715
+ }
1716
+ deferred3_0 = ptr2;
1717
+ deferred3_1 = len2;
1718
+ return getStringFromWasm0(ptr2, len2);
1719
+ } finally {
1720
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1721
+ }
1722
+ }
1723
+ exports.modelExecutionOutcomeVerifyJSON = modelExecutionOutcomeVerifyJSON;
1724
+
1725
+ /**
1726
+ * @param {string} episodes_json
1727
+ * @returns {any}
479
1728
  */
480
1729
  function optimize_task_profiles(episodes_json) {
481
1730
  const ptr0 = passStringToWasm0(episodes_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -567,6 +1816,128 @@ function qccr_select(fragments_json, token_budget, query, overrides_json, prefer
567
1816
  }
568
1817
  exports.qccr_select = qccr_select;
569
1818
 
1819
+ /**
1820
+ * Build a recovery handle and return it as canonical JSON.
1821
+ *
1822
+ * Throws when a disposition promises recovery without the means to honour it.
1823
+ * @param {string} repository_id
1824
+ * @param {string} receipt_id
1825
+ * @param {string} disposition
1826
+ * @param {string | null} [source_ref]
1827
+ * @param {string | null} [source_commitment]
1828
+ * @param {string | null} [fragment_commitment]
1829
+ * @param {number | null} [byte_start]
1830
+ * @param {number | null} [byte_end]
1831
+ * @param {string | null} [version]
1832
+ * @param {string | null} [storage_locator]
1833
+ * @param {number | null} [observed_at_ms]
1834
+ * @returns {string}
1835
+ */
1836
+ function recoveryHandleBuildJSON(repository_id, receipt_id, disposition, source_ref, source_commitment, fragment_commitment, byte_start, byte_end, version, storage_locator, observed_at_ms) {
1837
+ let deferred10_0;
1838
+ let deferred10_1;
1839
+ try {
1840
+ const ptr0 = passStringToWasm0(repository_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1841
+ const len0 = WASM_VECTOR_LEN;
1842
+ const ptr1 = passStringToWasm0(receipt_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1843
+ const len1 = WASM_VECTOR_LEN;
1844
+ const ptr2 = passStringToWasm0(disposition, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1845
+ const len2 = WASM_VECTOR_LEN;
1846
+ var ptr3 = isLikeNone(source_ref) ? 0 : passStringToWasm0(source_ref, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1847
+ var len3 = WASM_VECTOR_LEN;
1848
+ var ptr4 = isLikeNone(source_commitment) ? 0 : passStringToWasm0(source_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1849
+ var len4 = WASM_VECTOR_LEN;
1850
+ var ptr5 = isLikeNone(fragment_commitment) ? 0 : passStringToWasm0(fragment_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1851
+ var len5 = WASM_VECTOR_LEN;
1852
+ var ptr6 = isLikeNone(version) ? 0 : passStringToWasm0(version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1853
+ var len6 = WASM_VECTOR_LEN;
1854
+ var ptr7 = isLikeNone(storage_locator) ? 0 : passStringToWasm0(storage_locator, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1855
+ var len7 = WASM_VECTOR_LEN;
1856
+ const ret = wasm.recoveryHandleBuildJSON(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, !isLikeNone(byte_start), isLikeNone(byte_start) ? 0 : byte_start, !isLikeNone(byte_end), isLikeNone(byte_end) ? 0 : byte_end, ptr6, len6, ptr7, len7, !isLikeNone(observed_at_ms), isLikeNone(observed_at_ms) ? 0 : observed_at_ms);
1857
+ var ptr9 = ret[0];
1858
+ var len9 = ret[1];
1859
+ if (ret[3]) {
1860
+ ptr9 = 0; len9 = 0;
1861
+ throw takeFromExternrefTable0(ret[2]);
1862
+ }
1863
+ deferred10_0 = ptr9;
1864
+ deferred10_1 = len9;
1865
+ return getStringFromWasm0(ptr9, len9);
1866
+ } finally {
1867
+ wasm.__wbindgen_free(deferred10_0, deferred10_1, 1);
1868
+ }
1869
+ }
1870
+ exports.recoveryHandleBuildJSON = recoveryHandleBuildJSON;
1871
+
1872
+ /**
1873
+ * Schema version this build implements for recovery handles.
1874
+ * @returns {number}
1875
+ */
1876
+ function recoveryHandleSchemaVersion() {
1877
+ const ret = wasm.recoveryHandleSchemaVersion();
1878
+ return ret >>> 0;
1879
+ }
1880
+ exports.recoveryHandleSchemaVersion = recoveryHandleSchemaVersion;
1881
+
1882
+ /**
1883
+ * Check recovered bytes against the handle's commitment.
1884
+ *
1885
+ * Returns `verified`, `commitment_mismatch` or `not_recoverable`.
1886
+ * @param {string} handle_json
1887
+ * @param {Uint8Array} payload
1888
+ * @returns {string}
1889
+ */
1890
+ function recoveryHandleVerifyBytes(handle_json, payload) {
1891
+ let deferred4_0;
1892
+ let deferred4_1;
1893
+ try {
1894
+ const ptr0 = passStringToWasm0(handle_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1895
+ const len0 = WASM_VECTOR_LEN;
1896
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1897
+ const len1 = WASM_VECTOR_LEN;
1898
+ const ret = wasm.recoveryHandleVerifyBytes(ptr0, len0, ptr1, len1);
1899
+ var ptr3 = ret[0];
1900
+ var len3 = ret[1];
1901
+ if (ret[3]) {
1902
+ ptr3 = 0; len3 = 0;
1903
+ throw takeFromExternrefTable0(ret[2]);
1904
+ }
1905
+ deferred4_0 = ptr3;
1906
+ deferred4_1 = len3;
1907
+ return getStringFromWasm0(ptr3, len3);
1908
+ } finally {
1909
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1910
+ }
1911
+ }
1912
+ exports.recoveryHandleVerifyBytes = recoveryHandleVerifyBytes;
1913
+
1914
+ /**
1915
+ * Parse and check a handle, returning its canonical JSON.
1916
+ * @param {string} handle_json
1917
+ * @returns {string}
1918
+ */
1919
+ function recoveryHandleVerifyJSON(handle_json) {
1920
+ let deferred3_0;
1921
+ let deferred3_1;
1922
+ try {
1923
+ const ptr0 = passStringToWasm0(handle_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1924
+ const len0 = WASM_VECTOR_LEN;
1925
+ const ret = wasm.recoveryHandleVerifyJSON(ptr0, len0);
1926
+ var ptr2 = ret[0];
1927
+ var len2 = ret[1];
1928
+ if (ret[3]) {
1929
+ ptr2 = 0; len2 = 0;
1930
+ throw takeFromExternrefTable0(ret[2]);
1931
+ }
1932
+ deferred3_0 = ptr2;
1933
+ deferred3_1 = len2;
1934
+ return getStringFromWasm0(ptr2, len2);
1935
+ } finally {
1936
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1937
+ }
1938
+ }
1939
+ exports.recoveryHandleVerifyJSON = recoveryHandleVerifyJSON;
1940
+
570
1941
  /**
571
1942
  * @param {string} episodes_json
572
1943
  * @param {string} current_weights_json
@@ -585,6 +1956,324 @@ function reward_weighted_optimize(episodes_json, current_weights_json) {
585
1956
  }
586
1957
  exports.reward_weighted_optimize = reward_weighted_optimize;
587
1958
 
1959
+ /**
1960
+ * @param {string} input_json
1961
+ * @returns {string}
1962
+ */
1963
+ function routingDecisionBuildJSON(input_json) {
1964
+ let deferred3_0;
1965
+ let deferred3_1;
1966
+ try {
1967
+ const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1968
+ const len0 = WASM_VECTOR_LEN;
1969
+ const ret = wasm.routingDecisionBuildJSON(ptr0, len0);
1970
+ var ptr2 = ret[0];
1971
+ var len2 = ret[1];
1972
+ if (ret[3]) {
1973
+ ptr2 = 0; len2 = 0;
1974
+ throw takeFromExternrefTable0(ret[2]);
1975
+ }
1976
+ deferred3_0 = ptr2;
1977
+ deferred3_1 = len2;
1978
+ return getStringFromWasm0(ptr2, len2);
1979
+ } finally {
1980
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1981
+ }
1982
+ }
1983
+ exports.routingDecisionBuildJSON = routingDecisionBuildJSON;
1984
+
1985
+ /**
1986
+ * @param {string} value_json
1987
+ * @returns {string}
1988
+ */
1989
+ function routingDecisionVerifyJSON(value_json) {
1990
+ let deferred3_0;
1991
+ let deferred3_1;
1992
+ try {
1993
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1994
+ const len0 = WASM_VECTOR_LEN;
1995
+ const ret = wasm.routingDecisionVerifyJSON(ptr0, len0);
1996
+ var ptr2 = ret[0];
1997
+ var len2 = ret[1];
1998
+ if (ret[3]) {
1999
+ ptr2 = 0; len2 = 0;
2000
+ throw takeFromExternrefTable0(ret[2]);
2001
+ }
2002
+ deferred3_0 = ptr2;
2003
+ deferred3_1 = len2;
2004
+ return getStringFromWasm0(ptr2, len2);
2005
+ } finally {
2006
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2007
+ }
2008
+ }
2009
+ exports.routingDecisionVerifyJSON = routingDecisionVerifyJSON;
2010
+
2011
+ /**
2012
+ * @param {string} input_json
2013
+ * @returns {string}
2014
+ */
2015
+ function verificationRecordBuildJSON(input_json) {
2016
+ let deferred3_0;
2017
+ let deferred3_1;
2018
+ try {
2019
+ const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2020
+ const len0 = WASM_VECTOR_LEN;
2021
+ const ret = wasm.verificationRecordBuildJSON(ptr0, len0);
2022
+ var ptr2 = ret[0];
2023
+ var len2 = ret[1];
2024
+ if (ret[3]) {
2025
+ ptr2 = 0; len2 = 0;
2026
+ throw takeFromExternrefTable0(ret[2]);
2027
+ }
2028
+ deferred3_0 = ptr2;
2029
+ deferred3_1 = len2;
2030
+ return getStringFromWasm0(ptr2, len2);
2031
+ } finally {
2032
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2033
+ }
2034
+ }
2035
+ exports.verificationRecordBuildJSON = verificationRecordBuildJSON;
2036
+
2037
+ /**
2038
+ * @param {string} value_json
2039
+ * @param {string} current_repository_commitment
2040
+ * @param {number} now_ms
2041
+ * @param {string | null} [invalidated_commitments_json]
2042
+ * @returns {string}
2043
+ */
2044
+ function verificationRecordFreshness(value_json, current_repository_commitment, now_ms, invalidated_commitments_json) {
2045
+ let deferred5_0;
2046
+ let deferred5_1;
2047
+ try {
2048
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2049
+ const len0 = WASM_VECTOR_LEN;
2050
+ const ptr1 = passStringToWasm0(current_repository_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2051
+ const len1 = WASM_VECTOR_LEN;
2052
+ var ptr2 = isLikeNone(invalidated_commitments_json) ? 0 : passStringToWasm0(invalidated_commitments_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2053
+ var len2 = WASM_VECTOR_LEN;
2054
+ const ret = wasm.verificationRecordFreshness(ptr0, len0, ptr1, len1, now_ms, ptr2, len2);
2055
+ var ptr4 = ret[0];
2056
+ var len4 = ret[1];
2057
+ if (ret[3]) {
2058
+ ptr4 = 0; len4 = 0;
2059
+ throw takeFromExternrefTable0(ret[2]);
2060
+ }
2061
+ deferred5_0 = ptr4;
2062
+ deferred5_1 = len4;
2063
+ return getStringFromWasm0(ptr4, len4);
2064
+ } finally {
2065
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
2066
+ }
2067
+ }
2068
+ exports.verificationRecordFreshness = verificationRecordFreshness;
2069
+
2070
+ /**
2071
+ * @param {string} value_json
2072
+ * @returns {string}
2073
+ */
2074
+ function verificationRecordVerifyJSON(value_json) {
2075
+ let deferred3_0;
2076
+ let deferred3_1;
2077
+ try {
2078
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2079
+ const len0 = WASM_VECTOR_LEN;
2080
+ const ret = wasm.verificationRecordVerifyJSON(ptr0, len0);
2081
+ var ptr2 = ret[0];
2082
+ var len2 = ret[1];
2083
+ if (ret[3]) {
2084
+ ptr2 = 0; len2 = 0;
2085
+ throw takeFromExternrefTable0(ret[2]);
2086
+ }
2087
+ deferred3_0 = ptr2;
2088
+ deferred3_1 = len2;
2089
+ return getStringFromWasm0(ptr2, len2);
2090
+ } finally {
2091
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2092
+ }
2093
+ }
2094
+ exports.verificationRecordVerifyJSON = verificationRecordVerifyJSON;
2095
+
2096
+ /**
2097
+ * @param {Uint8Array} payload
2098
+ * @param {string} expected_commitment
2099
+ * @returns {string}
2100
+ */
2101
+ function verifiedContextSnapshotVerifyBytes(payload, expected_commitment) {
2102
+ let deferred4_0;
2103
+ let deferred4_1;
2104
+ try {
2105
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2106
+ const len0 = WASM_VECTOR_LEN;
2107
+ const ptr1 = passStringToWasm0(expected_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2108
+ const len1 = WASM_VECTOR_LEN;
2109
+ const ret = wasm.verifiedContextSnapshotVerifyBytes(ptr0, len0, ptr1, len1);
2110
+ var ptr3 = ret[0];
2111
+ var len3 = ret[1];
2112
+ if (ret[3]) {
2113
+ ptr3 = 0; len3 = 0;
2114
+ throw takeFromExternrefTable0(ret[2]);
2115
+ }
2116
+ deferred4_0 = ptr3;
2117
+ deferred4_1 = len3;
2118
+ return getStringFromWasm0(ptr3, len3);
2119
+ } finally {
2120
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2121
+ }
2122
+ }
2123
+ exports.verifiedContextSnapshotVerifyBytes = verifiedContextSnapshotVerifyBytes;
2124
+
2125
+ /**
2126
+ * @param {string} input_json
2127
+ * @returns {string}
2128
+ */
2129
+ function workContinuationProofBuildJSON(input_json) {
2130
+ let deferred3_0;
2131
+ let deferred3_1;
2132
+ try {
2133
+ const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2134
+ const len0 = WASM_VECTOR_LEN;
2135
+ const ret = wasm.workContinuationProofBuildJSON(ptr0, len0);
2136
+ var ptr2 = ret[0];
2137
+ var len2 = ret[1];
2138
+ if (ret[3]) {
2139
+ ptr2 = 0; len2 = 0;
2140
+ throw takeFromExternrefTable0(ret[2]);
2141
+ }
2142
+ deferred3_0 = ptr2;
2143
+ deferred3_1 = len2;
2144
+ return getStringFromWasm0(ptr2, len2);
2145
+ } finally {
2146
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2147
+ }
2148
+ }
2149
+ exports.workContinuationProofBuildJSON = workContinuationProofBuildJSON;
2150
+
2151
+ /**
2152
+ * @param {string} value_json
2153
+ * @param {string} repository_id
2154
+ * @param {number} graph_revision
2155
+ * @param {string} graph_commitment
2156
+ * @returns {string}
2157
+ */
2158
+ function workContinuationProofState(value_json, repository_id, graph_revision, graph_commitment) {
2159
+ let deferred5_0;
2160
+ let deferred5_1;
2161
+ try {
2162
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2163
+ const len0 = WASM_VECTOR_LEN;
2164
+ const ptr1 = passStringToWasm0(repository_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2165
+ const len1 = WASM_VECTOR_LEN;
2166
+ const ptr2 = passStringToWasm0(graph_commitment, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2167
+ const len2 = WASM_VECTOR_LEN;
2168
+ const ret = wasm.workContinuationProofState(ptr0, len0, ptr1, len1, graph_revision, ptr2, len2);
2169
+ var ptr4 = ret[0];
2170
+ var len4 = ret[1];
2171
+ if (ret[3]) {
2172
+ ptr4 = 0; len4 = 0;
2173
+ throw takeFromExternrefTable0(ret[2]);
2174
+ }
2175
+ deferred5_0 = ptr4;
2176
+ deferred5_1 = len4;
2177
+ return getStringFromWasm0(ptr4, len4);
2178
+ } finally {
2179
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
2180
+ }
2181
+ }
2182
+ exports.workContinuationProofState = workContinuationProofState;
2183
+
2184
+ /**
2185
+ * @param {string} value_json
2186
+ * @returns {string}
2187
+ */
2188
+ function workContinuationProofVerifyJSON(value_json) {
2189
+ let deferred3_0;
2190
+ let deferred3_1;
2191
+ try {
2192
+ const ptr0 = passStringToWasm0(value_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2193
+ const len0 = WASM_VECTOR_LEN;
2194
+ const ret = wasm.workContinuationProofVerifyJSON(ptr0, len0);
2195
+ var ptr2 = ret[0];
2196
+ var len2 = ret[1];
2197
+ if (ret[3]) {
2198
+ ptr2 = 0; len2 = 0;
2199
+ throw takeFromExternrefTable0(ret[2]);
2200
+ }
2201
+ deferred3_0 = ptr2;
2202
+ deferred3_1 = len2;
2203
+ return getStringFromWasm0(ptr2, len2);
2204
+ } finally {
2205
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2206
+ }
2207
+ }
2208
+ exports.workContinuationProofVerifyJSON = workContinuationProofVerifyJSON;
2209
+
2210
+ /**
2211
+ * Canonical edge identity. See `workGraphNodeId`.
2212
+ * @param {string} from
2213
+ * @param {string} kind
2214
+ * @param {string} to
2215
+ * @returns {string}
2216
+ */
2217
+ function workGraphEdgeId(from, kind, to) {
2218
+ let deferred5_0;
2219
+ let deferred5_1;
2220
+ try {
2221
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2222
+ const len0 = WASM_VECTOR_LEN;
2223
+ const ptr1 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2224
+ const len1 = WASM_VECTOR_LEN;
2225
+ const ptr2 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2226
+ const len2 = WASM_VECTOR_LEN;
2227
+ const ret = wasm.workGraphEdgeId(ptr0, len0, ptr1, len1, ptr2, len2);
2228
+ var ptr4 = ret[0];
2229
+ var len4 = ret[1];
2230
+ if (ret[3]) {
2231
+ ptr4 = 0; len4 = 0;
2232
+ throw takeFromExternrefTable0(ret[2]);
2233
+ }
2234
+ deferred5_0 = ptr4;
2235
+ deferred5_1 = len4;
2236
+ return getStringFromWasm0(ptr4, len4);
2237
+ } finally {
2238
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
2239
+ }
2240
+ }
2241
+ exports.workGraphEdgeId = workGraphEdgeId;
2242
+
2243
+ /**
2244
+ * Canonical node identity, so Node addresses artifacts exactly as Python and
2245
+ * the graph itself do. Same engine function behind all three.
2246
+ * @param {string} kind
2247
+ * @param {string} repo_id
2248
+ * @param {string} key
2249
+ * @returns {string}
2250
+ */
2251
+ function workGraphNodeId(kind, repo_id, key) {
2252
+ let deferred5_0;
2253
+ let deferred5_1;
2254
+ try {
2255
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2256
+ const len0 = WASM_VECTOR_LEN;
2257
+ const ptr1 = passStringToWasm0(repo_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2258
+ const len1 = WASM_VECTOR_LEN;
2259
+ const ptr2 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2260
+ const len2 = WASM_VECTOR_LEN;
2261
+ const ret = wasm.workGraphNodeId(ptr0, len0, ptr1, len1, ptr2, len2);
2262
+ var ptr4 = ret[0];
2263
+ var len4 = ret[1];
2264
+ if (ret[3]) {
2265
+ ptr4 = 0; len4 = 0;
2266
+ throw takeFromExternrefTable0(ret[2]);
2267
+ }
2268
+ deferred5_0 = ptr4;
2269
+ deferred5_1 = len4;
2270
+ return getStringFromWasm0(ptr4, len4);
2271
+ } finally {
2272
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
2273
+ }
2274
+ }
2275
+ exports.workGraphNodeId = workGraphNodeId;
2276
+
588
2277
  function __wbg_get_imports() {
589
2278
  const import0 = {
590
2279
  __proto__: null,
@@ -624,9 +2313,21 @@ function __wbg_get_imports() {
624
2313
  };
625
2314
  }
626
2315
 
2316
+ const WasmCognitiveBusFinalization = (typeof FinalizationRegistry === 'undefined')
2317
+ ? { register: () => {}, unregister: () => {} }
2318
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmcognitivebus_free(ptr >>> 0, 1));
627
2319
  const WasmEntrolyEngineFinalization = (typeof FinalizationRegistry === 'undefined')
628
2320
  ? { register: () => {}, unregister: () => {} }
629
2321
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmentrolyengine_free(ptr >>> 0, 1));
2322
+ const WasmNkbeAllocatorFinalization = (typeof FinalizationRegistry === 'undefined')
2323
+ ? { register: () => {}, unregister: () => {} }
2324
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmnkbeallocator_free(ptr >>> 0, 1));
2325
+ const WasmTrustEngineFinalization = (typeof FinalizationRegistry === 'undefined')
2326
+ ? { register: () => {}, unregister: () => {} }
2327
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtrustengine_free(ptr >>> 0, 1));
2328
+ const WasmWorkGraphFinalization = (typeof FinalizationRegistry === 'undefined')
2329
+ ? { register: () => {}, unregister: () => {} }
2330
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmworkgraph_free(ptr >>> 0, 1));
630
2331
 
631
2332
  function addToExternrefTable0(obj) {
632
2333
  const idx = wasm.__externref_table_alloc();
@@ -668,6 +2369,13 @@ function isLikeNone(x) {
668
2369
  return x === undefined || x === null;
669
2370
  }
670
2371
 
2372
+ function passArray8ToWasm0(arg, malloc) {
2373
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
2374
+ getUint8ArrayMemory0().set(arg, ptr / 1);
2375
+ WASM_VECTOR_LEN = arg.length;
2376
+ return ptr;
2377
+ }
2378
+
671
2379
  function passArrayJsValueToWasm0(array, malloc) {
672
2380
  const ptr = malloc(array.length * 4, 4) >>> 0;
673
2381
  for (let i = 0; i < array.length; i++) {