nanocodex 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +944 -78
  2. package/actions/events.mjs +14 -25
  3. package/actions/index.d.mts +1 -0
  4. package/actions/index.mjs +11 -1
  5. package/actions/session.d.mts +29 -1
  6. package/actions/session.mjs +22 -0
  7. package/actions/turn.d.mts +15 -6
  8. package/actions/turn.mjs +10 -0
  9. package/actions/voice.d.mts +26 -0
  10. package/actions/voice.mjs +54 -0
  11. package/browser/Agent.d.mts +41 -24
  12. package/browser/Agent.mjs +7 -84
  13. package/browser/ChatGptSubscription.d.mts +7 -0
  14. package/browser/ChatGptSubscription.mjs +19 -0
  15. package/browser/InlineAgent.mjs +267 -0
  16. package/browser/Transport.d.mts +80 -0
  17. package/browser/Transport.mjs +63 -0
  18. package/browser/Voice.d.mts +86 -0
  19. package/browser/Voice.mjs +316 -0
  20. package/browser/VoiceSession.mjs +763 -0
  21. package/browser/WorkerAgent.d.mts +65 -0
  22. package/browser/WorkerAgent.mjs +1467 -0
  23. package/browser/agent.worker.mjs +3 -0
  24. package/browser/config.d.mts +36 -0
  25. package/browser/config.mjs +439 -0
  26. package/browser/engine.mjs +13 -0
  27. package/browser/harness.mjs +55 -0
  28. package/browser/host.d.mts +33 -5
  29. package/browser/host.mjs +320 -26
  30. package/browser/hostManagedWebSocket.d.mts +14 -0
  31. package/browser/hostManagedWebSocket.mjs +110 -0
  32. package/browser/index.d.mts +64 -1
  33. package/browser/index.mjs +22 -1
  34. package/browser/indexeddb-durability-store.mjs +210 -0
  35. package/browser/workspace.d.mts +16 -0
  36. package/browser/workspace.mjs +107 -0
  37. package/cloud/Client.d.mts +83 -0
  38. package/cloud/Client.mjs +231 -0
  39. package/cloud/Decorator.d.mts +31 -0
  40. package/cloud/Decorator.mjs +37 -0
  41. package/cloud/Dialog.d.mts +113 -0
  42. package/cloud/Dialog.mjs +366 -0
  43. package/cloud/Errors.d.mts +22 -0
  44. package/cloud/Errors.mjs +39 -0
  45. package/cloud/Principal.d.mts +26 -0
  46. package/cloud/Principal.mjs +88 -0
  47. package/cloud/RemoteProvider.mjs +88 -0
  48. package/cloud/Transport.d.mts +47 -0
  49. package/cloud/Transport.mjs +454 -0
  50. package/cloud/actions/account.d.mts +9 -0
  51. package/cloud/actions/account.mjs +19 -0
  52. package/cloud/actions/agent.d.mts +18 -0
  53. package/cloud/actions/agent.mjs +429 -0
  54. package/cloud/actions/connection.d.mts +133 -0
  55. package/cloud/actions/connection.mjs +580 -0
  56. package/cloud/actions/grant.d.mts +10 -0
  57. package/cloud/actions/grant.mjs +12 -0
  58. package/cloud/actions/index.d.mts +7 -0
  59. package/cloud/actions/index.mjs +7 -0
  60. package/cloud/actions/machineUsd.d.mts +23 -0
  61. package/cloud/actions/machineUsd.mjs +37 -0
  62. package/cloud/actions/model.d.mts +12 -0
  63. package/cloud/actions/model.mjs +50 -0
  64. package/cloud/actions/mpp.d.mts +28 -0
  65. package/cloud/actions/mpp.mjs +39 -0
  66. package/cloud/index.d.mts +30 -0
  67. package/cloud/index.mjs +9 -0
  68. package/cloud/internal.mjs +533 -0
  69. package/cloud/mercator.mjs +108 -0
  70. package/cloud/server/HostPrincipal.d.mts +34 -0
  71. package/cloud/server/HostPrincipal.mjs +202 -0
  72. package/cloud/server/index.d.mts +1 -0
  73. package/cloud/server/index.mjs +1 -0
  74. package/cloud/types.d.mts +212 -0
  75. package/cloudflare/Agent.d.mts +136 -0
  76. package/cloudflare/Agent.mjs +784 -0
  77. package/cloudflare/egress-subject.mjs +19 -0
  78. package/cloudflare/egress.d.mts +41 -0
  79. package/cloudflare/egress.mjs +119 -0
  80. package/cloudflare/event-socket.mjs +316 -0
  81. package/cloudflare/index.d.mts +7 -0
  82. package/cloudflare/index.mjs +6 -0
  83. package/host/Agent.d.mts +55 -0
  84. package/host/Agent.mjs +1 -0
  85. package/host/index.d.mts +71 -0
  86. package/host/index.mjs +10 -0
  87. package/index.d.mts +46 -0
  88. package/index.mjs +11 -0
  89. package/internal.mjs +673 -61
  90. package/managed/Agent.d.mts +459 -0
  91. package/managed/Agent.mjs +1824 -0
  92. package/managed/ManagedError.d.mts +9 -0
  93. package/managed/ManagedError.mjs +8 -0
  94. package/managed/README.md +244 -0
  95. package/managed/Voice.mjs +209 -0
  96. package/managed/index.d.mts +22 -0
  97. package/managed/index.mjs +2 -0
  98. package/managed/internal.mjs +119 -0
  99. package/node/Agent.d.mts +35 -8
  100. package/node/Agent.mjs +116 -25
  101. package/node/ChatGptSubscription.d.mts +9 -0
  102. package/node/ChatGptSubscription.mjs +17 -0
  103. package/node/Transport.d.mts +41 -0
  104. package/node/Transport.mjs +46 -0
  105. package/node/host.mjs +99 -17
  106. package/node/index.d.mts +45 -1
  107. package/node/index.mjs +16 -1
  108. package/node/workspace.d.mts +10 -0
  109. package/node/workspace.mjs +198 -0
  110. package/package.json +145 -11
  111. package/pkg-node/nanocodex.d.ts +523 -11
  112. package/pkg-node/nanocodex.js +2038 -179
  113. package/pkg-node/nanocodex_bg.wasm.d.ts +100 -29
  114. package/pkg-web/.nanocodex-bindgen-stamp +6 -0
  115. package/pkg-web/nanocodex-build.json +1 -0
  116. package/pkg-web/nanocodex.d.ts +623 -40
  117. package/pkg-web/nanocodex.js +2031 -178
  118. package/pkg-web/nanocodex_bg.js +2667 -0
  119. package/pkg-web/nanocodex_bg.wasm +0 -0
  120. package/pkg-web/nanocodex_bg.wasm.d.ts +100 -29
  121. package/pkg-web/nanocodex_worker.js +9 -0
  122. package/runtime/chatgpt-subscription.mjs +212 -0
  123. package/runtime/cloudflare-durability-store.d.mts +26 -0
  124. package/runtime/cloudflare-durability-store.mjs +14 -0
  125. package/runtime/code-evaluator.worker.mjs +137 -0
  126. package/runtime/code-runtime.mjs +1 -243
  127. package/runtime/durability-store.d.mts +85 -0
  128. package/runtime/durability-store.mjs +752 -0
  129. package/runtime/durability.mjs +174 -0
  130. package/runtime/managed-transport.mjs +461 -0
  131. package/runtime/mcp-runtime.mjs +534 -0
  132. package/runtime/postgres-durability-store.d.mts +64 -0
  133. package/runtime/postgres-durability-store.mjs +581 -0
  134. package/runtime/quickjs-evaluator.d.mts +17 -0
  135. package/runtime/quickjs-evaluator.mjs +236 -0
  136. package/runtime/response-controls.mjs +42 -0
  137. package/runtime/response-lanes.mjs +72 -0
  138. package/runtime/responses-transport.mjs +22 -0
  139. package/runtime/subagents.d.mts +107 -0
  140. package/runtime/subagents.mjs +54 -0
  141. package/runtime/subscription-store.d.mts +8 -0
  142. package/runtime/subscription-store.mjs +42 -0
  143. package/runtime/tempo-provider.d.mts +125 -0
  144. package/runtime/tempo-provider.mjs +264 -0
  145. package/runtime/tool-configuration.mjs +1 -0
  146. package/runtime/tool-router.mjs +1 -0
  147. package/runtime/utf8.mjs +1 -0
  148. package/runtime/worker-evaluator.mjs +162 -0
  149. package/runtime/workspace.d.mts +1 -0
  150. package/runtime/workspace.mjs +1 -0
  151. package/tools/Tools.d.mts +56 -0
  152. package/tools/Tools.mjs +136 -0
  153. package/tools/artifact.d.mts +1 -0
  154. package/tools/artifact.mjs +1 -0
  155. package/tools/attachment.mjs +1 -0
  156. package/tools/bash.d.mts +1 -0
  157. package/tools/bash.mjs +1 -0
  158. package/tools/browser/accountInfo.mjs +795 -0
  159. package/tools/browser/browserBuffer.mjs +18 -0
  160. package/tools/browser/browserCompiler.mjs +155 -0
  161. package/tools/browser/browserEgress.mjs +161 -0
  162. package/tools/browser/browserPython.mjs +133 -0
  163. package/tools/browser/browserShell.mjs +1075 -0
  164. package/tools/browser/browserSprintf.mjs +4 -0
  165. package/tools/browser/browserSsh.mjs +201 -0
  166. package/tools/browser/browserZlib.mjs +136 -0
  167. package/tools/browser/compiler.worker.mjs +160 -0
  168. package/tools/browser/devTunnelsSshBrowser.mjs +13 -0
  169. package/tools/browser/index.d.mts +209 -0
  170. package/tools/browser/index.mjs +174 -0
  171. package/tools/browser/opfsGit.mjs +248 -0
  172. package/tools/browser/python.worker.mjs +114 -0
  173. package/tools/browser/threadGit.mjs +197 -0
  174. package/tools/browser/unsupportedNodeRsa.mjs +5 -0
  175. package/tools/browser/workspace.mjs +83 -0
  176. package/tools/dataset.d.mts +1 -0
  177. package/tools/dataset.mjs +1 -0
  178. package/tools/datasetContract.mjs +1 -0
  179. package/tools/datasetEngine.mjs +1 -0
  180. package/tools/hostedCatalog.d.mts +1 -0
  181. package/tools/hostedCatalog.mjs +1 -0
  182. package/tools/index.d.mts +49 -0
  183. package/tools/index.mjs +19 -0
  184. package/tools/namedTool.mjs +1 -0
  185. package/tools/repository-workspace.d.mts +1 -0
  186. package/tools/repository-workspace.mjs +1 -0
  187. package/tools/ssh.d.mts +1 -0
  188. package/tools/ssh.mjs +1 -0
  189. package/tools/standard.mjs +1 -0
  190. package/tools/standardDescriptions.mjs +1 -0
  191. package/types.d.mts +431 -16
  192. package/worker/ChatGptSubscription.d.mts +9 -0
  193. package/worker/ChatGptSubscription.mjs +29 -0
  194. package/worker/index.d.mts +18 -0
  195. package/worker/index.mjs +5 -0
  196. package/pkg-node/nanocodex_bg.wasm +0 -0
@@ -1,5 +1,1228 @@
1
1
  /* @ts-self-types="./nanocodex.d.ts" */
2
2
 
3
+ /**
4
+ * Rust-owned Codex browser voice protocol and Agent bridge.
5
+ */
6
+ export class BrowserVoice {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(BrowserVoice.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ BrowserVoiceFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ BrowserVoiceFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_browservoice_free(ptr, 0);
22
+ }
23
+ /**
24
+ * Applies one typed Agent event to the Rust-owned handoff stream.
25
+ *
26
+ * # Errors
27
+ *
28
+ * Rejects only when effects cannot be serialized.
29
+ * @param {string} envelope
30
+ * @returns {string}
31
+ */
32
+ agentEvent(envelope) {
33
+ let deferred3_0;
34
+ let deferred3_1;
35
+ try {
36
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
37
+ const ptr0 = passStringToWasm0(envelope, wasm.__wbindgen_export, wasm.__wbindgen_export2);
38
+ const len0 = WASM_VECTOR_LEN;
39
+ wasm.browservoice_agentEvent(retptr, this.__wbg_ptr, ptr0, len0);
40
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
41
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
42
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
43
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
44
+ var ptr2 = r0;
45
+ var len2 = r1;
46
+ if (r3) {
47
+ ptr2 = 0; len2 = 0;
48
+ throw takeObject(r2);
49
+ }
50
+ deferred3_0 = ptr2;
51
+ deferred3_1 = len2;
52
+ return getStringFromWasm0(ptr2, len2);
53
+ } finally {
54
+ wasm.__wbindgen_add_to_stack_pointer(16);
55
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
56
+ }
57
+ }
58
+ /**
59
+ * Adds background context without requesting speech or consuming a delegation.
60
+ *
61
+ * # Errors
62
+ * Rejects an inactive session or invalid text.
63
+ * @param {string} text
64
+ * @returns {string}
65
+ */
66
+ appendContext(text) {
67
+ let deferred3_0;
68
+ let deferred3_1;
69
+ try {
70
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
71
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
72
+ const len0 = WASM_VECTOR_LEN;
73
+ wasm.browservoice_appendContext(retptr, this.__wbg_ptr, ptr0, len0);
74
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
75
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
76
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
77
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
78
+ var ptr2 = r0;
79
+ var len2 = r1;
80
+ if (r3) {
81
+ ptr2 = 0; len2 = 0;
82
+ throw takeObject(r2);
83
+ }
84
+ deferred3_0 = ptr2;
85
+ deferred3_1 = len2;
86
+ return getStringFromWasm0(ptr2, len2);
87
+ } finally {
88
+ wasm.__wbindgen_add_to_stack_pointer(16);
89
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
90
+ }
91
+ }
92
+ /**
93
+ * Queues explicitly speakable text in the current conversation.
94
+ *
95
+ * # Errors
96
+ * Rejects inactive sessions, invalid text, or a full output queue.
97
+ * @param {string} text
98
+ * @returns {string}
99
+ */
100
+ appendSpeech(text) {
101
+ let deferred3_0;
102
+ let deferred3_1;
103
+ try {
104
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
105
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ wasm.browservoice_appendSpeech(retptr, this.__wbg_ptr, ptr0, len0);
108
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
111
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
112
+ var ptr2 = r0;
113
+ var len2 = r1;
114
+ if (r3) {
115
+ ptr2 = 0; len2 = 0;
116
+ throw takeObject(r2);
117
+ }
118
+ deferred3_0 = ptr2;
119
+ deferred3_1 = len2;
120
+ return getStringFromWasm0(ptr2, len2);
121
+ } finally {
122
+ wasm.__wbindgen_add_to_stack_pointer(16);
123
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
124
+ }
125
+ }
126
+ /**
127
+ * Appends text through Codex's subscription context adapter.
128
+ *
129
+ * # Errors
130
+ * Rejects inactive sessions, invalid roles/text, or a full output queue.
131
+ * @param {string} role
132
+ * @param {string} text
133
+ * @returns {string}
134
+ */
135
+ appendText(role, text) {
136
+ let deferred4_0;
137
+ let deferred4_1;
138
+ try {
139
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
140
+ const ptr0 = passStringToWasm0(role, wasm.__wbindgen_export, wasm.__wbindgen_export2);
141
+ const len0 = WASM_VECTOR_LEN;
142
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
143
+ const len1 = WASM_VECTOR_LEN;
144
+ wasm.browservoice_appendText(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
147
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
148
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
149
+ var ptr3 = r0;
150
+ var len3 = r1;
151
+ if (r3) {
152
+ ptr3 = 0; len3 = 0;
153
+ throw takeObject(r2);
154
+ }
155
+ deferred4_0 = ptr3;
156
+ deferred4_1 = len3;
157
+ return getStringFromWasm0(ptr3, len3);
158
+ } finally {
159
+ wasm.__wbindgen_add_to_stack_pointer(16);
160
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
161
+ }
162
+ }
163
+ /**
164
+ * Encodes the complete same-origin call request after the browser creates its SDP offer.
165
+ *
166
+ * # Errors
167
+ *
168
+ * Rejects calls made before [`Self::start`] or an empty SDP offer.
169
+ * @param {string} sdp
170
+ * @returns {string}
171
+ */
172
+ callBody(sdp) {
173
+ let deferred3_0;
174
+ let deferred3_1;
175
+ try {
176
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
177
+ const ptr0 = passStringToWasm0(sdp, wasm.__wbindgen_export, wasm.__wbindgen_export2);
178
+ const len0 = WASM_VECTOR_LEN;
179
+ wasm.browservoice_callBody(retptr, this.__wbg_ptr, ptr0, len0);
180
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
181
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
182
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
183
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
184
+ var ptr2 = r0;
185
+ var len2 = r1;
186
+ if (r3) {
187
+ ptr2 = 0; len2 = 0;
188
+ throw takeObject(r2);
189
+ }
190
+ deferred3_0 = ptr2;
191
+ deferred3_1 = len2;
192
+ return getStringFromWasm0(ptr2, len2);
193
+ } finally {
194
+ wasm.__wbindgen_add_to_stack_pointer(16);
195
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
196
+ }
197
+ }
198
+ /**
199
+ * Cancels only the active coding turn, never merely the voice transport.
200
+ *
201
+ * # Errors
202
+ *
203
+ * Rejects when the active turn cannot be cancelled.
204
+ * @returns {Promise<boolean>}
205
+ */
206
+ cancel() {
207
+ const ret = wasm.browservoice_cancel(this.__wbg_ptr);
208
+ return takeObject(ret);
209
+ }
210
+ /**
211
+ * Decodes Codex's provider response body and Location header in Rust.
212
+ *
213
+ * # Errors
214
+ *
215
+ * Rejects an empty SDP answer or a Location without a Codex call identity.
216
+ * @param {string} response_body
217
+ * @param {string} location
218
+ * @returns {string}
219
+ */
220
+ completeCall(response_body, location) {
221
+ let deferred4_0;
222
+ let deferred4_1;
223
+ try {
224
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
225
+ const ptr0 = passStringToWasm0(response_body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ const ptr1 = passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
228
+ const len1 = WASM_VECTOR_LEN;
229
+ wasm.browservoice_completeCall(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
232
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
233
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
234
+ var ptr3 = r0;
235
+ var len3 = r1;
236
+ if (r3) {
237
+ ptr3 = 0; len3 = 0;
238
+ throw takeObject(r2);
239
+ }
240
+ deferred4_0 = ptr3;
241
+ deferred4_1 = len3;
242
+ return getStringFromWasm0(ptr3, len3);
243
+ } finally {
244
+ wasm.__wbindgen_add_to_stack_pointer(16);
245
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
246
+ }
247
+ }
248
+ /**
249
+ * Sets subscription voice preferences before starting a call.
250
+ *
251
+ * # Errors
252
+ * Rejects invalid settings or changes to an active call.
253
+ * @param {string} settings_json
254
+ */
255
+ configure(settings_json) {
256
+ try {
257
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
258
+ const ptr0 = passStringToWasm0(settings_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ wasm.browservoice_configure(retptr, this.__wbg_ptr, ptr0, len0);
261
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
262
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
263
+ if (r1) {
264
+ throw takeObject(r0);
265
+ }
266
+ } finally {
267
+ wasm.__wbindgen_add_to_stack_pointer(16);
268
+ }
269
+ }
270
+ /**
271
+ * Drains one Codex-paced streamed or final Agent handoff chunk.
272
+ *
273
+ * # Errors
274
+ *
275
+ * Rejects only when effects cannot be serialized.
276
+ * @param {boolean} final_chunk
277
+ * @returns {string}
278
+ */
279
+ flush(final_chunk) {
280
+ let deferred2_0;
281
+ let deferred2_1;
282
+ try {
283
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
284
+ wasm.browservoice_flush(retptr, this.__wbg_ptr, final_chunk);
285
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
286
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
287
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
288
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
289
+ var ptr1 = r0;
290
+ var len1 = r1;
291
+ if (r3) {
292
+ ptr1 = 0; len1 = 0;
293
+ throw takeObject(r2);
294
+ }
295
+ deferred2_0 = ptr1;
296
+ deferred2_1 = len1;
297
+ return getStringFromWasm0(ptr1, len1);
298
+ } finally {
299
+ wasm.__wbindgen_add_to_stack_pointer(16);
300
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
301
+ }
302
+ }
303
+ /**
304
+ * Acknowledges frames written by the browser WebSocket effect executor.
305
+ * @param {number} count
306
+ */
307
+ framesSent(count) {
308
+ wasm.browservoice_framesSent(this.__wbg_ptr, count);
309
+ }
310
+ /**
311
+ * Fences speech before the embedding submits typed input.
312
+ *
313
+ * # Errors
314
+ * Rejects only when effects cannot be serialized.
315
+ * @returns {string}
316
+ */
317
+ noteTypedInput() {
318
+ let deferred2_0;
319
+ let deferred2_1;
320
+ try {
321
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
322
+ wasm.browservoice_noteTypedInput(retptr, this.__wbg_ptr);
323
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
324
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
325
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
326
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
327
+ var ptr1 = r0;
328
+ var len1 = r1;
329
+ if (r3) {
330
+ ptr1 = 0; len1 = 0;
331
+ throw takeObject(r2);
332
+ }
333
+ deferred2_0 = ptr1;
334
+ deferred2_1 = len1;
335
+ return getStringFromWasm0(ptr1, len1);
336
+ } finally {
337
+ wasm.__wbindgen_add_to_stack_pointer(16);
338
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
339
+ }
340
+ }
341
+ /**
342
+ * Selects Codex's preferred physical input from browser device labels.
343
+ *
344
+ * # Errors
345
+ *
346
+ * Rejects malformed label JSON.
347
+ * @param {string} current_label
348
+ * @param {string} labels_json
349
+ * @returns {number | undefined}
350
+ */
351
+ preferredPhysicalInput(current_label, labels_json) {
352
+ try {
353
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
354
+ const ptr0 = passStringToWasm0(current_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
355
+ const len0 = WASM_VECTOR_LEN;
356
+ const ptr1 = passStringToWasm0(labels_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
+ const len1 = WASM_VECTOR_LEN;
358
+ wasm.browservoice_preferredPhysicalInput(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
359
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
360
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
361
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
362
+ if (r3) {
363
+ throw takeObject(r2);
364
+ }
365
+ return r0 === Number.MAX_SAFE_INTEGER ? undefined : r0;
366
+ } finally {
367
+ wasm.__wbindgen_add_to_stack_pointer(16);
368
+ }
369
+ }
370
+ /**
371
+ * Applies one Frameless sideband event and routes any delegation through the Rust Agent.
372
+ *
373
+ * # Errors
374
+ *
375
+ * Rejects when delegated Agent work cannot be accepted or steered.
376
+ * @param {string} payload
377
+ * @returns {Promise<string>}
378
+ */
379
+ realtimeMessage(payload) {
380
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ const ret = wasm.browservoice_realtimeMessage(this.__wbg_ptr, ptr0, len0);
383
+ return takeObject(ret);
384
+ }
385
+ /**
386
+ * Reports whether one Rust-decoded sideband event can admit Agent work.
387
+ * @param {string} payload
388
+ * @returns {boolean}
389
+ */
390
+ requiresAgentAdmission(payload) {
391
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
392
+ const len0 = WASM_VECTOR_LEN;
393
+ const ret = wasm.browservoice_requiresAgentAdmission(this.__wbg_ptr, ptr0, len0);
394
+ return ret !== 0;
395
+ }
396
+ /**
397
+ * Applies Codex's Rust-owned Frameless reconnect policy after transport loss.
398
+ *
399
+ * # Errors
400
+ *
401
+ * Rejects only when effects cannot be serialized.
402
+ * @param {number} connected_ms
403
+ * @returns {string}
404
+ */
405
+ sidebandClosed(connected_ms) {
406
+ let deferred2_0;
407
+ let deferred2_1;
408
+ try {
409
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
410
+ wasm.browservoice_sidebandClosed(retptr, this.__wbg_ptr, connected_ms);
411
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
412
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
413
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
414
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
415
+ var ptr1 = r0;
416
+ var len1 = r1;
417
+ if (r3) {
418
+ ptr1 = 0; len1 = 0;
419
+ throw takeObject(r2);
420
+ }
421
+ deferred2_0 = ptr1;
422
+ deferred2_1 = len1;
423
+ return getStringFromWasm0(ptr1, len1);
424
+ } finally {
425
+ wasm.__wbindgen_add_to_stack_pointer(16);
426
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
427
+ }
428
+ }
429
+ /**
430
+ * Replays Rust-retained outbound frames after a sideband connects.
431
+ *
432
+ * # Errors
433
+ *
434
+ * Rejects only when effects cannot be serialized.
435
+ * @returns {string}
436
+ */
437
+ sidebandOpened() {
438
+ let deferred2_0;
439
+ let deferred2_1;
440
+ try {
441
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
442
+ wasm.browservoice_sidebandOpened(retptr, this.__wbg_ptr);
443
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
444
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
445
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
446
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
447
+ var ptr1 = r0;
448
+ var len1 = r1;
449
+ if (r3) {
450
+ ptr1 = 0; len1 = 0;
451
+ throw takeObject(r2);
452
+ }
453
+ deferred2_0 = ptr1;
454
+ deferred2_1 = len1;
455
+ return getStringFromWasm0(ptr1, len1);
456
+ } finally {
457
+ wasm.__wbindgen_add_to_stack_pointer(16);
458
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
459
+ }
460
+ }
461
+ /**
462
+ * Builds the same-origin sideband URL with Codex's Rust-owned request identity.
463
+ *
464
+ * # Errors
465
+ *
466
+ * Rejects a malformed provider call identity.
467
+ * @param {string} call_id
468
+ * @returns {string}
469
+ */
470
+ sidebandUrl(call_id) {
471
+ let deferred3_0;
472
+ let deferred3_1;
473
+ try {
474
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
475
+ const ptr0 = passStringToWasm0(call_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ wasm.browservoice_sidebandUrl(retptr, this.__wbg_ptr, ptr0, len0);
478
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
479
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
480
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
481
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
482
+ var ptr2 = r0;
483
+ var len2 = r1;
484
+ if (r3) {
485
+ ptr2 = 0; len2 = 0;
486
+ throw takeObject(r2);
487
+ }
488
+ deferred3_0 = ptr2;
489
+ deferred3_1 = len2;
490
+ return getStringFromWasm0(ptr2, len2);
491
+ } finally {
492
+ wasm.__wbindgen_add_to_stack_pointer(16);
493
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
494
+ }
495
+ }
496
+ /**
497
+ * Begins Codex's Realtime lifecycle without injecting startup context.
498
+ *
499
+ * # Errors
500
+ *
501
+ * Rejects when the Agent driver has stopped.
502
+ * @returns {Promise<void>}
503
+ */
504
+ start() {
505
+ const ret = wasm.browservoice_start(this.__wbg_ptr);
506
+ return takeObject(ret);
507
+ }
508
+ /**
509
+ * Flushes any final transcript tail and ends Codex's Realtime lifecycle.
510
+ *
511
+ * # Errors
512
+ *
513
+ * Rejects when the Agent driver stops.
514
+ * @returns {Promise<string>}
515
+ */
516
+ stop() {
517
+ const ret = wasm.browservoice_stop(this.__wbg_ptr);
518
+ return takeObject(ret);
519
+ }
520
+ }
521
+ if (Symbol.dispose) BrowserVoice.prototype[Symbol.dispose] = BrowserVoice.prototype.free;
522
+
523
+ /**
524
+ * JavaScript binding over the Rust-owned hosted ChatGPT credential lifecycle.
525
+ */
526
+ export class ChatGptSubscription {
527
+ static __wrap(ptr) {
528
+ const obj = Object.create(ChatGptSubscription.prototype);
529
+ obj.__wbg_ptr = ptr;
530
+ ChatGptSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
531
+ return obj;
532
+ }
533
+ __destroy_into_raw() {
534
+ const ptr = this.__wbg_ptr;
535
+ this.__wbg_ptr = 0;
536
+ ChatGptSubscriptionFinalization.unregister(this);
537
+ return ptr;
538
+ }
539
+ free() {
540
+ const ptr = this.__destroy_into_raw();
541
+ wasm.__wbg_chatgptsubscription_free(ptr, 0);
542
+ }
543
+ /**
544
+ * Resolves one credential generation for a host-owned outbound request.
545
+ * @returns {Promise<string>}
546
+ */
547
+ credential() {
548
+ const ret = wasm.chatgptsubscription_credential(this.__wbg_ptr);
549
+ return takeObject(ret);
550
+ }
551
+ /**
552
+ * Clears the persisted credential and pending login.
553
+ * @returns {Promise<void>}
554
+ */
555
+ logout() {
556
+ const ret = wasm.chatgptsubscription_logout(this.__wbg_ptr);
557
+ return takeObject(ret);
558
+ }
559
+ /**
560
+ * Opens a subscription over the currently registered generic host capabilities.
561
+ * @param {string} config_json
562
+ * @returns {Promise<ChatGptSubscription>}
563
+ */
564
+ static open(config_json) {
565
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
566
+ const len0 = WASM_VECTOR_LEN;
567
+ const ret = wasm.chatgptsubscription_open(ptr0, len0);
568
+ return takeObject(ret);
569
+ }
570
+ /**
571
+ * Refreshes a rejected generation and returns the credential now current.
572
+ * @param {string} rejected_revision
573
+ * @returns {Promise<string>}
574
+ */
575
+ recover(rejected_revision) {
576
+ const ptr0 = passStringToWasm0(rejected_revision, wasm.__wbindgen_export, wasm.__wbindgen_export2);
577
+ const len0 = WASM_VECTOR_LEN;
578
+ const ret = wasm.chatgptsubscription_recover(this.__wbg_ptr, ptr0, len0);
579
+ return takeObject(ret);
580
+ }
581
+ /**
582
+ * Starts a ChatGPT device login and returns public pending state as JSON.
583
+ * @returns {Promise<string>}
584
+ */
585
+ startLogin() {
586
+ const ret = wasm.chatgptsubscription_startLogin(this.__wbg_ptr);
587
+ return takeObject(ret);
588
+ }
589
+ /**
590
+ * Polls device login and returns public state as JSON.
591
+ * @returns {Promise<string>}
592
+ */
593
+ status() {
594
+ const ret = wasm.chatgptsubscription_status(this.__wbg_ptr);
595
+ return takeObject(ret);
596
+ }
597
+ }
598
+ if (Symbol.dispose) ChatGptSubscription.prototype[Symbol.dispose] = ChatGptSubscription.prototype.free;
599
+
600
+ /**
601
+ * Standalone Rust-owned browser voice protocol for a remote managed Agent.
602
+ *
603
+ * This core owns only Realtime protocol state. The caller owns media,
604
+ * transports, the managed Agent lifecycle, and routing returned delegations.
605
+ */
606
+ export class ManagedBrowserVoice {
607
+ __destroy_into_raw() {
608
+ const ptr = this.__wbg_ptr;
609
+ this.__wbg_ptr = 0;
610
+ ManagedBrowserVoiceFinalization.unregister(this);
611
+ return ptr;
612
+ }
613
+ free() {
614
+ const ptr = this.__destroy_into_raw();
615
+ wasm.__wbg_managedbrowservoice_free(ptr, 0);
616
+ }
617
+ /**
618
+ * Applies one canonical raw `AgentEvent` JSON value to the handoff stream.
619
+ *
620
+ * # Errors
621
+ *
622
+ * Rejects only when effects cannot be serialized.
623
+ * @param {string} event_json
624
+ * @returns {string}
625
+ */
626
+ agentEvent(event_json) {
627
+ let deferred3_0;
628
+ let deferred3_1;
629
+ try {
630
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
631
+ const ptr0 = passStringToWasm0(event_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ wasm.managedbrowservoice_agentEvent(retptr, this.__wbg_ptr, ptr0, len0);
634
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
635
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
636
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
637
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
638
+ var ptr2 = r0;
639
+ var len2 = r1;
640
+ if (r3) {
641
+ ptr2 = 0; len2 = 0;
642
+ throw takeObject(r2);
643
+ }
644
+ deferred3_0 = ptr2;
645
+ deferred3_1 = len2;
646
+ return getStringFromWasm0(ptr2, len2);
647
+ } finally {
648
+ wasm.__wbindgen_add_to_stack_pointer(16);
649
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
650
+ }
651
+ }
652
+ /**
653
+ * Adds background context without requesting speech or consuming a delegation.
654
+ *
655
+ * # Errors
656
+ * Rejects an inactive session or invalid text.
657
+ * @param {string} text
658
+ * @returns {string}
659
+ */
660
+ appendContext(text) {
661
+ let deferred3_0;
662
+ let deferred3_1;
663
+ try {
664
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
665
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
666
+ const len0 = WASM_VECTOR_LEN;
667
+ wasm.managedbrowservoice_appendContext(retptr, this.__wbg_ptr, ptr0, len0);
668
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
669
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
670
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
671
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
672
+ var ptr2 = r0;
673
+ var len2 = r1;
674
+ if (r3) {
675
+ ptr2 = 0; len2 = 0;
676
+ throw takeObject(r2);
677
+ }
678
+ deferred3_0 = ptr2;
679
+ deferred3_1 = len2;
680
+ return getStringFromWasm0(ptr2, len2);
681
+ } finally {
682
+ wasm.__wbindgen_add_to_stack_pointer(16);
683
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
684
+ }
685
+ }
686
+ /**
687
+ * Queues explicitly speakable text in the current conversation.
688
+ *
689
+ * # Errors
690
+ * Rejects inactive sessions, invalid text, or a full output queue.
691
+ * @param {string} text
692
+ * @returns {string}
693
+ */
694
+ appendSpeech(text) {
695
+ let deferred3_0;
696
+ let deferred3_1;
697
+ try {
698
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
699
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
700
+ const len0 = WASM_VECTOR_LEN;
701
+ wasm.managedbrowservoice_appendSpeech(retptr, this.__wbg_ptr, ptr0, len0);
702
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
703
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
704
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
705
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
706
+ var ptr2 = r0;
707
+ var len2 = r1;
708
+ if (r3) {
709
+ ptr2 = 0; len2 = 0;
710
+ throw takeObject(r2);
711
+ }
712
+ deferred3_0 = ptr2;
713
+ deferred3_1 = len2;
714
+ return getStringFromWasm0(ptr2, len2);
715
+ } finally {
716
+ wasm.__wbindgen_add_to_stack_pointer(16);
717
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
718
+ }
719
+ }
720
+ /**
721
+ * Appends text through Codex's subscription context adapter.
722
+ *
723
+ * # Errors
724
+ * Rejects inactive sessions, invalid roles/text, or a full output queue.
725
+ * @param {string} role
726
+ * @param {string} text
727
+ * @returns {string}
728
+ */
729
+ appendText(role, text) {
730
+ let deferred4_0;
731
+ let deferred4_1;
732
+ try {
733
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
734
+ const ptr0 = passStringToWasm0(role, wasm.__wbindgen_export, wasm.__wbindgen_export2);
735
+ const len0 = WASM_VECTOR_LEN;
736
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
737
+ const len1 = WASM_VECTOR_LEN;
738
+ wasm.managedbrowservoice_appendText(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
739
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
740
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
741
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
742
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
743
+ var ptr3 = r0;
744
+ var len3 = r1;
745
+ if (r3) {
746
+ ptr3 = 0; len3 = 0;
747
+ throw takeObject(r2);
748
+ }
749
+ deferred4_0 = ptr3;
750
+ deferred4_1 = len3;
751
+ return getStringFromWasm0(ptr3, len3);
752
+ } finally {
753
+ wasm.__wbindgen_add_to_stack_pointer(16);
754
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
755
+ }
756
+ }
757
+ /**
758
+ * Encodes the managed same-origin call request after the browser creates its SDP offer.
759
+ *
760
+ * # Errors
761
+ *
762
+ * Rejects invalid session IDs or empty SDP offers. Admission can complete
763
+ * after this request; its context is then sent over the control channel.
764
+ * @param {string} sdp
765
+ * @param {string} managed_session_id
766
+ * @returns {string}
767
+ */
768
+ callBody(sdp, managed_session_id) {
769
+ let deferred4_0;
770
+ let deferred4_1;
771
+ try {
772
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
773
+ const ptr0 = passStringToWasm0(sdp, wasm.__wbindgen_export, wasm.__wbindgen_export2);
774
+ const len0 = WASM_VECTOR_LEN;
775
+ const ptr1 = passStringToWasm0(managed_session_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
776
+ const len1 = WASM_VECTOR_LEN;
777
+ wasm.managedbrowservoice_callBody(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
778
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
779
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
780
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
781
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
782
+ var ptr3 = r0;
783
+ var len3 = r1;
784
+ if (r3) {
785
+ ptr3 = 0; len3 = 0;
786
+ throw takeObject(r2);
787
+ }
788
+ deferred4_0 = ptr3;
789
+ deferred4_1 = len3;
790
+ return getStringFromWasm0(ptr3, len3);
791
+ } finally {
792
+ wasm.__wbindgen_add_to_stack_pointer(16);
793
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
794
+ }
795
+ }
796
+ /**
797
+ * Decodes Codex's provider response body and Location header in Rust.
798
+ *
799
+ * # Errors
800
+ *
801
+ * Rejects an empty SDP answer or a Location without a Codex call identity.
802
+ * @param {string} response_body
803
+ * @param {string} location
804
+ * @returns {string}
805
+ */
806
+ completeCall(response_body, location) {
807
+ let deferred4_0;
808
+ let deferred4_1;
809
+ try {
810
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
811
+ const ptr0 = passStringToWasm0(response_body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
812
+ const len0 = WASM_VECTOR_LEN;
813
+ const ptr1 = passStringToWasm0(location, wasm.__wbindgen_export, wasm.__wbindgen_export2);
814
+ const len1 = WASM_VECTOR_LEN;
815
+ wasm.managedbrowservoice_completeCall(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
816
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
817
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
818
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
819
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
820
+ var ptr3 = r0;
821
+ var len3 = r1;
822
+ if (r3) {
823
+ ptr3 = 0; len3 = 0;
824
+ throw takeObject(r2);
825
+ }
826
+ deferred4_0 = ptr3;
827
+ deferred4_1 = len3;
828
+ return getStringFromWasm0(ptr3, len3);
829
+ } finally {
830
+ wasm.__wbindgen_add_to_stack_pointer(16);
831
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
832
+ }
833
+ }
834
+ /**
835
+ * Sets subscription voice preferences before starting a call.
836
+ *
837
+ * # Errors
838
+ * Rejects invalid settings or changes to an active call.
839
+ * @param {string} settings_json
840
+ */
841
+ configure(settings_json) {
842
+ try {
843
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
844
+ const ptr0 = passStringToWasm0(settings_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
845
+ const len0 = WASM_VECTOR_LEN;
846
+ wasm.managedbrowservoice_configure(retptr, this.__wbg_ptr, ptr0, len0);
847
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
848
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
849
+ if (r1) {
850
+ throw takeObject(r0);
851
+ }
852
+ } finally {
853
+ wasm.__wbindgen_add_to_stack_pointer(16);
854
+ }
855
+ }
856
+ /**
857
+ * Drains one Codex-paced streamed or final managed Agent handoff chunk.
858
+ *
859
+ * # Errors
860
+ *
861
+ * Rejects only when effects cannot be serialized.
862
+ * @param {boolean} final_chunk
863
+ * @returns {string}
864
+ */
865
+ flush(final_chunk) {
866
+ let deferred2_0;
867
+ let deferred2_1;
868
+ try {
869
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
870
+ wasm.managedbrowservoice_flush(retptr, this.__wbg_ptr, final_chunk);
871
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
872
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
873
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
874
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
875
+ var ptr1 = r0;
876
+ var len1 = r1;
877
+ if (r3) {
878
+ ptr1 = 0; len1 = 0;
879
+ throw takeObject(r2);
880
+ }
881
+ deferred2_0 = ptr1;
882
+ deferred2_1 = len1;
883
+ return getStringFromWasm0(ptr1, len1);
884
+ } finally {
885
+ wasm.__wbindgen_add_to_stack_pointer(16);
886
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
887
+ }
888
+ }
889
+ /**
890
+ * Acknowledges frames written by the caller's WebSocket effect executor.
891
+ * @param {number} count
892
+ */
893
+ framesSent(count) {
894
+ wasm.managedbrowservoice_framesSent(this.__wbg_ptr, count);
895
+ }
896
+ /**
897
+ * Applies a scoped managed context envelope using the shared Rust queue.
898
+ *
899
+ * # Errors
900
+ * Rejects malformed JSON or effects that cannot be serialized.
901
+ * @param {string} envelope_json
902
+ * @returns {string}
903
+ */
904
+ managedEvent(envelope_json) {
905
+ let deferred3_0;
906
+ let deferred3_1;
907
+ try {
908
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
909
+ const ptr0 = passStringToWasm0(envelope_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
910
+ const len0 = WASM_VECTOR_LEN;
911
+ wasm.managedbrowservoice_managedEvent(retptr, this.__wbg_ptr, ptr0, len0);
912
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
913
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
914
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
915
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
916
+ var ptr2 = r0;
917
+ var len2 = r1;
918
+ if (r3) {
919
+ ptr2 = 0; len2 = 0;
920
+ throw takeObject(r2);
921
+ }
922
+ deferred3_0 = ptr2;
923
+ deferred3_1 = len2;
924
+ return getStringFromWasm0(ptr2, len2);
925
+ } finally {
926
+ wasm.__wbindgen_add_to_stack_pointer(16);
927
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
928
+ }
929
+ }
930
+ /**
931
+ * Creates an idle managed browser voice protocol core.
932
+ *
933
+ * # Errors
934
+ *
935
+ * Rejects voices outside Codex's ChatGPT V3 catalog.
936
+ * @param {string} voice
937
+ */
938
+ constructor(voice) {
939
+ try {
940
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
941
+ const ptr0 = passStringToWasm0(voice, wasm.__wbindgen_export, wasm.__wbindgen_export2);
942
+ const len0 = WASM_VECTOR_LEN;
943
+ wasm.managedbrowservoice_new(retptr, ptr0, len0);
944
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
945
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
946
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
947
+ if (r2) {
948
+ throw takeObject(r1);
949
+ }
950
+ this.__wbg_ptr = r0;
951
+ ManagedBrowserVoiceFinalization.register(this, this.__wbg_ptr, this);
952
+ return this;
953
+ } finally {
954
+ wasm.__wbindgen_add_to_stack_pointer(16);
955
+ }
956
+ }
957
+ /**
958
+ * Fences speech before the embedding submits typed input.
959
+ *
960
+ * # Errors
961
+ * Rejects only when effects cannot be serialized.
962
+ * @returns {string}
963
+ */
964
+ noteTypedInput() {
965
+ let deferred2_0;
966
+ let deferred2_1;
967
+ try {
968
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
969
+ wasm.managedbrowservoice_noteTypedInput(retptr, this.__wbg_ptr);
970
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
971
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
972
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
973
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
974
+ var ptr1 = r0;
975
+ var len1 = r1;
976
+ if (r3) {
977
+ ptr1 = 0; len1 = 0;
978
+ throw takeObject(r2);
979
+ }
980
+ deferred2_0 = ptr1;
981
+ deferred2_1 = len1;
982
+ return getStringFromWasm0(ptr1, len1);
983
+ } finally {
984
+ wasm.__wbindgen_add_to_stack_pointer(16);
985
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
986
+ }
987
+ }
988
+ /**
989
+ * Selects Codex's preferred physical input from browser device labels.
990
+ *
991
+ * # Errors
992
+ *
993
+ * Rejects malformed label JSON.
994
+ * @param {string} current_label
995
+ * @param {string} labels_json
996
+ * @returns {number | undefined}
997
+ */
998
+ preferredPhysicalInput(current_label, labels_json) {
999
+ try {
1000
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1001
+ const ptr0 = passStringToWasm0(current_label, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1002
+ const len0 = WASM_VECTOR_LEN;
1003
+ const ptr1 = passStringToWasm0(labels_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1004
+ const len1 = WASM_VECTOR_LEN;
1005
+ wasm.managedbrowservoice_preferredPhysicalInput(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1006
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
1007
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1008
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1009
+ if (r3) {
1010
+ throw takeObject(r2);
1011
+ }
1012
+ return r0 === Number.MAX_SAFE_INTEGER ? undefined : r0;
1013
+ } finally {
1014
+ wasm.__wbindgen_add_to_stack_pointer(16);
1015
+ }
1016
+ }
1017
+ /**
1018
+ * Applies one sideband event and returns effects plus canonical delegation text.
1019
+ *
1020
+ * The caller must route returned delegation text through its remote managed Agent.
1021
+ *
1022
+ * # Errors
1023
+ *
1024
+ * Rejects only when the update cannot be serialized.
1025
+ * @param {string} payload
1026
+ * @returns {string}
1027
+ */
1028
+ realtimeMessage(payload) {
1029
+ let deferred3_0;
1030
+ let deferred3_1;
1031
+ try {
1032
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1033
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1034
+ const len0 = WASM_VECTOR_LEN;
1035
+ wasm.managedbrowservoice_realtimeMessage(retptr, this.__wbg_ptr, ptr0, len0);
1036
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1037
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1038
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1039
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1040
+ var ptr2 = r0;
1041
+ var len2 = r1;
1042
+ if (r3) {
1043
+ ptr2 = 0; len2 = 0;
1044
+ throw takeObject(r2);
1045
+ }
1046
+ deferred3_0 = ptr2;
1047
+ deferred3_1 = len2;
1048
+ return getStringFromWasm0(ptr2, len2);
1049
+ } finally {
1050
+ wasm.__wbindgen_add_to_stack_pointer(16);
1051
+ wasm.__wbindgen_export5(deferred3_0, deferred3_1, 1);
1052
+ }
1053
+ }
1054
+ /**
1055
+ * Reports whether one sideband event may produce a managed Agent delegation.
1056
+ * @param {string} payload
1057
+ * @returns {boolean}
1058
+ */
1059
+ requiresAgentAdmission(payload) {
1060
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1061
+ const len0 = WASM_VECTOR_LEN;
1062
+ const ret = wasm.managedbrowservoice_requiresAgentAdmission(this.__wbg_ptr, ptr0, len0);
1063
+ return ret !== 0;
1064
+ }
1065
+ /**
1066
+ * Applies Codex's bounded reconnect policy after sideband transport loss.
1067
+ *
1068
+ * # Errors
1069
+ *
1070
+ * Rejects only when effects cannot be serialized.
1071
+ * @param {number} connected_ms
1072
+ * @returns {string}
1073
+ */
1074
+ sidebandClosed(connected_ms) {
1075
+ let deferred2_0;
1076
+ let deferred2_1;
1077
+ try {
1078
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1079
+ wasm.managedbrowservoice_sidebandClosed(retptr, this.__wbg_ptr, connected_ms);
1080
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1081
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1082
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1083
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1084
+ var ptr1 = r0;
1085
+ var len1 = r1;
1086
+ if (r3) {
1087
+ ptr1 = 0; len1 = 0;
1088
+ throw takeObject(r2);
1089
+ }
1090
+ deferred2_0 = ptr1;
1091
+ deferred2_1 = len1;
1092
+ return getStringFromWasm0(ptr1, len1);
1093
+ } finally {
1094
+ wasm.__wbindgen_add_to_stack_pointer(16);
1095
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
1096
+ }
1097
+ }
1098
+ /**
1099
+ * Replays Rust-retained outbound frames after a sideband connects.
1100
+ *
1101
+ * # Errors
1102
+ *
1103
+ * Rejects only when effects cannot be serialized.
1104
+ * @returns {string}
1105
+ */
1106
+ sidebandOpened() {
1107
+ let deferred2_0;
1108
+ let deferred2_1;
1109
+ try {
1110
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1111
+ wasm.managedbrowservoice_sidebandOpened(retptr, this.__wbg_ptr);
1112
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1113
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1114
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1115
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1116
+ var ptr1 = r0;
1117
+ var len1 = r1;
1118
+ if (r3) {
1119
+ ptr1 = 0; len1 = 0;
1120
+ throw takeObject(r2);
1121
+ }
1122
+ deferred2_0 = ptr1;
1123
+ deferred2_1 = len1;
1124
+ return getStringFromWasm0(ptr1, len1);
1125
+ } finally {
1126
+ wasm.__wbindgen_add_to_stack_pointer(16);
1127
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
1128
+ }
1129
+ }
1130
+ /**
1131
+ * Builds the managed same-origin sideband URL for a provider call identity.
1132
+ *
1133
+ * # Errors
1134
+ *
1135
+ * Rejects malformed provider call or managed session identities.
1136
+ * @param {string} call_id
1137
+ * @param {string} managed_session_id
1138
+ * @returns {string}
1139
+ */
1140
+ sidebandUrl(call_id, managed_session_id) {
1141
+ let deferred4_0;
1142
+ let deferred4_1;
1143
+ try {
1144
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1145
+ const ptr0 = passStringToWasm0(call_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1146
+ const len0 = WASM_VECTOR_LEN;
1147
+ const ptr1 = passStringToWasm0(managed_session_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1148
+ const len1 = WASM_VECTOR_LEN;
1149
+ wasm.managedbrowservoice_sidebandUrl(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1150
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1151
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1152
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1153
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1154
+ var ptr3 = r0;
1155
+ var len3 = r1;
1156
+ if (r3) {
1157
+ ptr3 = 0; len3 = 0;
1158
+ throw takeObject(r2);
1159
+ }
1160
+ deferred4_0 = ptr3;
1161
+ deferred4_1 = len3;
1162
+ return getStringFromWasm0(ptr3, len3);
1163
+ } finally {
1164
+ wasm.__wbindgen_add_to_stack_pointer(16);
1165
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
1166
+ }
1167
+ }
1168
+ /**
1169
+ * Starts the protocol from the managed Agent's authoritative serialized context.
1170
+ *
1171
+ * # Errors
1172
+ *
1173
+ * Rejects malformed `AgentSessionContext` JSON.
1174
+ * @param {string} context_json
1175
+ */
1176
+ start(context_json) {
1177
+ try {
1178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1179
+ const ptr0 = passStringToWasm0(context_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1180
+ const len0 = WASM_VECTOR_LEN;
1181
+ wasm.managedbrowservoice_start(retptr, this.__wbg_ptr, ptr0, len0);
1182
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1183
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1184
+ if (r1) {
1185
+ throw takeObject(r0);
1186
+ }
1187
+ } finally {
1188
+ wasm.__wbindgen_add_to_stack_pointer(16);
1189
+ }
1190
+ }
1191
+ /**
1192
+ * Stops the protocol and returns final transcript delegation plus close effects.
1193
+ *
1194
+ * # Errors
1195
+ *
1196
+ * Rejects only when the update cannot be serialized.
1197
+ * @returns {string}
1198
+ */
1199
+ stop() {
1200
+ let deferred2_0;
1201
+ let deferred2_1;
1202
+ try {
1203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1204
+ wasm.managedbrowservoice_stop(retptr, this.__wbg_ptr);
1205
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1206
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1207
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1208
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1209
+ var ptr1 = r0;
1210
+ var len1 = r1;
1211
+ if (r3) {
1212
+ ptr1 = 0; len1 = 0;
1213
+ throw takeObject(r2);
1214
+ }
1215
+ deferred2_0 = ptr1;
1216
+ deferred2_1 = len1;
1217
+ return getStringFromWasm0(ptr1, len1);
1218
+ } finally {
1219
+ wasm.__wbindgen_add_to_stack_pointer(16);
1220
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
1221
+ }
1222
+ }
1223
+ }
1224
+ if (Symbol.dispose) ManagedBrowserVoice.prototype[Symbol.dispose] = ManagedBrowserVoice.prototype.free;
1225
+
3
1226
  /**
4
1227
  * JavaScript binding over the shared Rust agent lifecycle.
5
1228
  */
@@ -16,9 +1239,83 @@ export class Nanocodex {
16
1239
  NanocodexFinalization.unregister(this);
17
1240
  return ptr;
18
1241
  }
19
- free() {
20
- const ptr = this.__destroy_into_raw();
21
- wasm.__wbg_nanocodex_free(ptr, 0);
1242
+ free() {
1243
+ const ptr = this.__destroy_into_raw();
1244
+ wasm.__wbg_nanocodex_free(ptr, 0);
1245
+ }
1246
+ /**
1247
+ * Returns the stable Agent identity.
1248
+ * @returns {string}
1249
+ */
1250
+ get agentId() {
1251
+ let deferred1_0;
1252
+ let deferred1_1;
1253
+ try {
1254
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1255
+ wasm.nanocodex_agentId(retptr, this.__wbg_ptr);
1256
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1257
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1258
+ deferred1_0 = r0;
1259
+ deferred1_1 = r1;
1260
+ return getStringFromWasm0(r0, r1);
1261
+ } finally {
1262
+ wasm.__wbindgen_add_to_stack_pointer(16);
1263
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1264
+ }
1265
+ }
1266
+ /**
1267
+ * Appends adapter-owned developer context at the next safe model boundary.
1268
+ *
1269
+ * Returns the complete read-only session context captured at that boundary.
1270
+ *
1271
+ * # Errors
1272
+ *
1273
+ * Rejects empty text or a stopped driver.
1274
+ * @param {string} text
1275
+ * @returns {Promise<string>}
1276
+ */
1277
+ appendDeveloperMessage(text) {
1278
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1279
+ const len0 = WASM_VECTOR_LEN;
1280
+ const ret = wasm.nanocodex_appendDeveloperMessage(this.__wbg_ptr, ptr0, len0);
1281
+ return takeObject(ret);
1282
+ }
1283
+ /**
1284
+ * Creates the Rust-owned Codex browser voice controller for this agent.
1285
+ *
1286
+ * # Errors
1287
+ *
1288
+ * Rejects voices outside Codex's ChatGPT V3 catalog.
1289
+ * @param {string} voice
1290
+ * @returns {BrowserVoice}
1291
+ */
1292
+ browserVoice(voice) {
1293
+ try {
1294
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1295
+ const ptr0 = passStringToWasm0(voice, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1296
+ const len0 = WASM_VECTOR_LEN;
1297
+ wasm.nanocodex_browserVoice(retptr, this.__wbg_ptr, ptr0, len0);
1298
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1299
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1300
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1301
+ if (r2) {
1302
+ throw takeObject(r1);
1303
+ }
1304
+ return BrowserVoice.__wrap(r0);
1305
+ } finally {
1306
+ wasm.__wbindgen_add_to_stack_pointer(16);
1307
+ }
1308
+ }
1309
+ /**
1310
+ * Closes one canonical task-tree child and its descendants.
1311
+ * @param {string} task
1312
+ * @returns {Promise<string>}
1313
+ */
1314
+ closeSubagent(task) {
1315
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1316
+ const len0 = WASM_VECTOR_LEN;
1317
+ const ret = wasm.nanocodex_closeSubagent(this.__wbg_ptr, ptr0, len0);
1318
+ return takeObject(ret);
22
1319
  }
23
1320
  /**
24
1321
  * Compacts retained history immediately without fabricating a user prompt.
@@ -30,7 +1327,59 @@ export class Nanocodex {
30
1327
  */
31
1328
  compact() {
32
1329
  const ret = wasm.nanocodex_compact(this.__wbg_ptr);
33
- return ret;
1330
+ return takeObject(ret);
1331
+ }
1332
+ /**
1333
+ * Returns complete read-only session context at the latest safe boundary.
1334
+ *
1335
+ * # Errors
1336
+ *
1337
+ * Rejects after the driver stops or when context serialization fails.
1338
+ * @returns {Promise<string>}
1339
+ */
1340
+ context() {
1341
+ const ret = wasm.nanocodex_context(this.__wbg_ptr);
1342
+ return takeObject(ret);
1343
+ }
1344
+ /**
1345
+ * Builds an agent from its JavaScript JSON configuration.
1346
+ *
1347
+ * # Errors
1348
+ *
1349
+ * Throws when the JSON or agent policy is invalid.
1350
+ * @param {string} config_json
1351
+ * @returns {Promise<Nanocodex>}
1352
+ */
1353
+ static create(config_json) {
1354
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1355
+ const len0 = WASM_VECTOR_LEN;
1356
+ const ret = wasm.nanocodex_create(ptr0, len0);
1357
+ return takeObject(ret);
1358
+ }
1359
+ /**
1360
+ * Builds an agent whose ChatGPT credential lifecycle is owned by Rust.
1361
+ * @param {string} config_json
1362
+ * @param {ChatGptSubscription} subscription
1363
+ * @returns {Promise<Nanocodex>}
1364
+ */
1365
+ static createWithChatGpt(config_json, subscription) {
1366
+ const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1367
+ const len0 = WASM_VECTOR_LEN;
1368
+ _assertClass(subscription, ChatGptSubscription);
1369
+ const ret = wasm.nanocodex_createWithChatGpt(ptr0, len0, subscription.__wbg_ptr);
1370
+ return takeObject(ret);
1371
+ }
1372
+ /**
1373
+ * Ends the canonical Codex Realtime adapter lifecycle.
1374
+ *
1375
+ * # Errors
1376
+ *
1377
+ * Rejects when the agent driver has stopped or context serialization fails.
1378
+ * @returns {Promise<string>}
1379
+ */
1380
+ endRealtimeConversation() {
1381
+ const ret = wasm.nanocodex_endRealtimeConversation(this.__wbg_ptr);
1382
+ return takeObject(ret);
34
1383
  }
35
1384
  /**
36
1385
  * Forks the latest safe committed model boundary.
@@ -42,7 +1391,7 @@ export class Nanocodex {
42
1391
  */
43
1392
  fork() {
44
1393
  const ret = wasm.nanocodex_fork(this.__wbg_ptr);
45
- return ret;
1394
+ return takeObject(ret);
46
1395
  }
47
1396
  /**
48
1397
  * Forks from an exact completed historical turn.
@@ -56,26 +1405,29 @@ export class Nanocodex {
56
1405
  forkFrom(result) {
57
1406
  _assertClass(result, TurnResult);
58
1407
  const ret = wasm.nanocodex_forkFrom(this.__wbg_ptr, result.__wbg_ptr);
59
- return ret;
1408
+ return takeObject(ret);
60
1409
  }
61
1410
  /**
62
- * Builds an agent from its JavaScript JSON configuration.
63
- *
64
- * # Errors
65
- *
66
- * Throws when the JSON or agent policy is invalid.
67
- * @param {string} config_json
1411
+ * Interrupts one canonical task-tree child while keeping it reusable.
1412
+ * @param {string} task
1413
+ * @returns {Promise<string>}
68
1414
  */
69
- constructor(config_json) {
70
- const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1415
+ interruptSubagent(task) {
1416
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
71
1417
  const len0 = WASM_VECTOR_LEN;
72
- const ret = wasm.nanocodex_new(ptr0, len0);
73
- if (ret[2]) {
74
- throw takeFromExternrefTable0(ret[1]);
75
- }
76
- this.__wbg_ptr = ret[0];
77
- NanocodexFinalization.register(this, this.__wbg_ptr, this);
78
- return this;
1418
+ const ret = wasm.nanocodex_interruptSubagent(this.__wbg_ptr, ptr0, len0);
1419
+ return takeObject(ret);
1420
+ }
1421
+ /**
1422
+ * Lists the canonical task-tree directory visible to the owning root.
1423
+ * @param {string} task
1424
+ * @returns {Promise<string>}
1425
+ */
1426
+ listSubagents(task) {
1427
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1428
+ const len0 = WASM_VECTOR_LEN;
1429
+ const ret = wasm.nanocodex_listSubagents(this.__wbg_ptr, ptr0, len0);
1430
+ return takeObject(ret);
79
1431
  }
80
1432
  /**
81
1433
  * Accepts a text prompt and returns its independently awaitable turn.
@@ -84,16 +1436,28 @@ export class Nanocodex {
84
1436
  *
85
1437
  * Throws when the prompt is empty.
86
1438
  * @param {string} instruction
1439
+ * @param {string | null} [operation_id]
1440
+ * @param {boolean | null} [cancel_on_admission]
87
1441
  * @returns {Turn}
88
1442
  */
89
- prompt(instruction) {
90
- const ptr0 = passStringToWasm0(instruction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
91
- const len0 = WASM_VECTOR_LEN;
92
- const ret = wasm.nanocodex_prompt(this.__wbg_ptr, ptr0, len0);
93
- if (ret[2]) {
94
- throw takeFromExternrefTable0(ret[1]);
1443
+ prompt(instruction, operation_id, cancel_on_admission) {
1444
+ try {
1445
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1446
+ const ptr0 = passStringToWasm0(instruction, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1447
+ const len0 = WASM_VECTOR_LEN;
1448
+ var ptr1 = isLikeNone(operation_id) ? 0 : passStringToWasm0(operation_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1449
+ var len1 = WASM_VECTOR_LEN;
1450
+ wasm.nanocodex_prompt(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(cancel_on_admission) ? 0xFFFFFF : cancel_on_admission ? 1 : 0);
1451
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1452
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1453
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1454
+ if (r2) {
1455
+ throw takeObject(r1);
1456
+ }
1457
+ return Turn.__wrap(r0);
1458
+ } finally {
1459
+ wasm.__wbindgen_add_to_stack_pointer(16);
95
1460
  }
96
- return Turn.__wrap(ret[0]);
97
1461
  }
98
1462
  /**
99
1463
  * Accepts browser-safe multimodal input encoded as JSON.
@@ -102,16 +1466,146 @@ export class Nanocodex {
102
1466
  *
103
1467
  * Throws for malformed, empty, or local-filesystem input.
104
1468
  * @param {string} content_json
1469
+ * @param {string | null} [operation_id]
1470
+ * @param {boolean | null} [cancel_on_admission]
105
1471
  * @returns {Turn}
106
1472
  */
107
- promptContent(content_json) {
108
- const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
109
- const len0 = WASM_VECTOR_LEN;
110
- const ret = wasm.nanocodex_promptContent(this.__wbg_ptr, ptr0, len0);
111
- if (ret[2]) {
112
- throw takeFromExternrefTable0(ret[1]);
1473
+ promptContent(content_json, operation_id, cancel_on_admission) {
1474
+ try {
1475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1476
+ const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1477
+ const len0 = WASM_VECTOR_LEN;
1478
+ var ptr1 = isLikeNone(operation_id) ? 0 : passStringToWasm0(operation_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1479
+ var len1 = WASM_VECTOR_LEN;
1480
+ wasm.nanocodex_promptContent(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(cancel_on_admission) ? 0xFFFFFF : cancel_on_admission ? 1 : 0);
1481
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1482
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1483
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1484
+ if (r2) {
1485
+ throw takeObject(r1);
1486
+ }
1487
+ return Turn.__wrap(r0);
1488
+ } finally {
1489
+ wasm.__wbindgen_add_to_stack_pointer(16);
1490
+ }
1491
+ }
1492
+ /**
1493
+ * Formats one structured Realtime delegation using canonical Codex markers.
1494
+ *
1495
+ * # Errors
1496
+ *
1497
+ * Rejects malformed transcript JSON.
1498
+ * @param {string} input
1499
+ * @param {string} transcript
1500
+ * @returns {string}
1501
+ */
1502
+ realtimeDelegation(input, transcript) {
1503
+ let deferred4_0;
1504
+ let deferred4_1;
1505
+ try {
1506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1507
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1508
+ const len0 = WASM_VECTOR_LEN;
1509
+ const ptr1 = passStringToWasm0(transcript, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1510
+ const len1 = WASM_VECTOR_LEN;
1511
+ wasm.nanocodex_realtimeDelegation(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
1512
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1513
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1514
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1515
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1516
+ var ptr3 = r0;
1517
+ var len3 = r1;
1518
+ if (r3) {
1519
+ ptr3 = 0; len3 = 0;
1520
+ throw takeObject(r2);
1521
+ }
1522
+ deferred4_0 = ptr3;
1523
+ deferred4_1 = len3;
1524
+ return getStringFromWasm0(ptr3, len3);
1525
+ } finally {
1526
+ wasm.__wbindgen_add_to_stack_pointer(16);
1527
+ wasm.__wbindgen_export5(deferred4_0, deferred4_1, 1);
1528
+ }
1529
+ }
1530
+ /**
1531
+ * Formats an unconsumed Realtime transcript tail using canonical Codex markers.
1532
+ *
1533
+ * # Errors
1534
+ *
1535
+ * Rejects malformed transcript JSON.
1536
+ * @param {string} transcript
1537
+ * @returns {string | undefined}
1538
+ */
1539
+ realtimeTailDelegation(transcript) {
1540
+ try {
1541
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1542
+ const ptr0 = passStringToWasm0(transcript, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1543
+ const len0 = WASM_VECTOR_LEN;
1544
+ wasm.nanocodex_realtimeTailDelegation(retptr, this.__wbg_ptr, ptr0, len0);
1545
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1546
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1547
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1548
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1549
+ if (r3) {
1550
+ throw takeObject(r2);
1551
+ }
1552
+ let v2;
1553
+ if (r0 !== 0) {
1554
+ v2 = getStringFromWasm0(r0, r1).slice();
1555
+ wasm.__wbindgen_export5(r0, r1 * 1, 1);
1556
+ }
1557
+ return v2;
1558
+ } finally {
1559
+ wasm.__wbindgen_add_to_stack_pointer(16);
113
1560
  }
114
- return Turn.__wrap(ret[0]);
1561
+ }
1562
+ /**
1563
+ * Restores persisted logical children after the JavaScript owner acquires
1564
+ * its durability generation and activates the replacement host.
1565
+ *
1566
+ * # Errors
1567
+ *
1568
+ * Rejects malformed descriptors, disabled subagents, duplicate restoration,
1569
+ * or an invalid persisted topology.
1570
+ * @param {string} descriptors_json
1571
+ * @param {string | null} [host_contexts_json]
1572
+ * @returns {Promise<void>}
1573
+ */
1574
+ restoreSubagents(descriptors_json, host_contexts_json) {
1575
+ const ptr0 = passStringToWasm0(descriptors_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1576
+ const len0 = WASM_VECTOR_LEN;
1577
+ var ptr1 = isLikeNone(host_contexts_json) ? 0 : passStringToWasm0(host_contexts_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1578
+ var len1 = WASM_VECTOR_LEN;
1579
+ const ret = wasm.nanocodex_restoreSubagents(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1580
+ return takeObject(ret);
1581
+ }
1582
+ /**
1583
+ * Atomically steers the active turn or starts a new independently awaitable turn.
1584
+ *
1585
+ * Returns `undefined` when the input was steered into an active turn.
1586
+ *
1587
+ * # Errors
1588
+ *
1589
+ * Rejects empty input, a full steering queue, or a stopped driver.
1590
+ * @param {string} instruction
1591
+ * @returns {Promise<Turn | undefined>}
1592
+ */
1593
+ routePrompt(instruction) {
1594
+ const ptr0 = passStringToWasm0(instruction, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1595
+ const len0 = WASM_VECTOR_LEN;
1596
+ const ret = wasm.nanocodex_routePrompt(this.__wbg_ptr, ptr0, len0);
1597
+ return takeObject(ret);
1598
+ }
1599
+ /**
1600
+ * Sends one canonical directed task-tree message from the owning root.
1601
+ * @param {string} task
1602
+ * @returns {Promise<string>}
1603
+ */
1604
+ sendSubagentMessage(task) {
1605
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1606
+ const len0 = WASM_VECTOR_LEN;
1607
+ const ret = wasm.nanocodex_sendSubagentMessage(this.__wbg_ptr, ptr0, len0);
1608
+ return takeObject(ret);
115
1609
  }
116
1610
  /**
117
1611
  * Returns the stable `UUIDv7` session identity.
@@ -121,14 +1615,25 @@ export class Nanocodex {
121
1615
  let deferred1_0;
122
1616
  let deferred1_1;
123
1617
  try {
124
- const ret = wasm.nanocodex_sessionId(this.__wbg_ptr);
125
- deferred1_0 = ret[0];
126
- deferred1_1 = ret[1];
127
- return getStringFromWasm0(ret[0], ret[1]);
1618
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1619
+ wasm.nanocodex_sessionId(retptr, this.__wbg_ptr);
1620
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1621
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1622
+ deferred1_0 = r0;
1623
+ deferred1_1 = r1;
1624
+ return getStringFromWasm0(r0, r1);
128
1625
  } finally {
129
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1626
+ wasm.__wbindgen_add_to_stack_pointer(16);
1627
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
130
1628
  }
131
1629
  }
1630
+ /**
1631
+ * Enables or disables the optional JavaScript event crossing for this handle.
1632
+ * @param {boolean} enabled
1633
+ */
1634
+ setEventForwarding(enabled) {
1635
+ wasm.nanocodex_setEventForwarding(this.__wbg_ptr, enabled);
1636
+ }
132
1637
  /**
133
1638
  * Enables or disables priority processing for subsequently accepted turns.
134
1639
  *
@@ -140,7 +1645,23 @@ export class Nanocodex {
140
1645
  */
141
1646
  setFastMode(enabled) {
142
1647
  const ret = wasm.nanocodex_setFastMode(this.__wbg_ptr, enabled);
143
- return ret;
1648
+ return takeObject(ret);
1649
+ }
1650
+ /**
1651
+ * Changes the model before the first turn is accepted.
1652
+ *
1653
+ * # Errors
1654
+ *
1655
+ * Rejects an invalid model, an incompatible thinking level, conversation
1656
+ * activity, or a stopped driver.
1657
+ * @param {string} model
1658
+ * @returns {Promise<void>}
1659
+ */
1660
+ setModel(model) {
1661
+ const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1662
+ const len0 = WASM_VECTOR_LEN;
1663
+ const ret = wasm.nanocodex_setModel(this.__wbg_ptr, ptr0, len0);
1664
+ return takeObject(ret);
144
1665
  }
145
1666
  /**
146
1667
  * Changes the reasoning effort for subsequently accepted turns.
@@ -152,10 +1673,10 @@ export class Nanocodex {
152
1673
  * @returns {Promise<void>}
153
1674
  */
154
1675
  setThinking(thinking) {
155
- const ptr0 = passStringToWasm0(thinking, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1676
+ const ptr0 = passStringToWasm0(thinking, wasm.__wbindgen_export, wasm.__wbindgen_export2);
156
1677
  const len0 = WASM_VECTOR_LEN;
157
1678
  const ret = wasm.nanocodex_setThinking(this.__wbg_ptr, ptr0, len0);
158
- return ret;
1679
+ return takeObject(ret);
159
1680
  }
160
1681
  /**
161
1682
  * Gracefully stops the driver and joins every resource owned by this agent.
@@ -167,7 +1688,7 @@ export class Nanocodex {
167
1688
  */
168
1689
  shutdown() {
169
1690
  const ret = wasm.nanocodex_shutdown(this.__wbg_ptr);
170
- return ret;
1691
+ return takeObject(ret);
171
1692
  }
172
1693
  /**
173
1694
  * Starts a clean sibling with the same private agent policy.
@@ -179,7 +1700,57 @@ export class Nanocodex {
179
1700
  */
180
1701
  spawn() {
181
1702
  const ret = wasm.nanocodex_spawn(this.__wbg_ptr);
182
- return ret;
1703
+ return takeObject(ret);
1704
+ }
1705
+ /**
1706
+ * Starts one canonical Rust task-tree child and returns its descriptor.
1707
+ * @param {string} task
1708
+ * @returns {Promise<string>}
1709
+ */
1710
+ spawnSubagent(task) {
1711
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1712
+ const len0 = WASM_VECTOR_LEN;
1713
+ const ret = wasm.nanocodex_spawnSubagent(this.__wbg_ptr, ptr0, len0);
1714
+ return takeObject(ret);
1715
+ }
1716
+ /**
1717
+ * Starts an ordered batch of canonical subagents in the same task tree.
1718
+ *
1719
+ * # Errors
1720
+ *
1721
+ * Rejects malformed tasks, agents without subagent tools, a stopped
1722
+ * parent, or a batch that cannot be reserved in full.
1723
+ * @param {string} tasks_json
1724
+ * @returns {Promise<string>}
1725
+ */
1726
+ spawnSubagents(tasks_json) {
1727
+ const ptr0 = passStringToWasm0(tasks_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1728
+ const len0 = WASM_VECTOR_LEN;
1729
+ const ret = wasm.nanocodex_spawnSubagents(this.__wbg_ptr, ptr0, len0);
1730
+ return takeObject(ret);
1731
+ }
1732
+ /**
1733
+ * Starts the canonical Codex Realtime adapter lifecycle.
1734
+ *
1735
+ * # Errors
1736
+ *
1737
+ * Rejects when the agent driver has stopped or context serialization fails.
1738
+ * @returns {Promise<string>}
1739
+ */
1740
+ startRealtimeConversation() {
1741
+ const ret = wasm.nanocodex_startRealtimeConversation(this.__wbg_ptr);
1742
+ return takeObject(ret);
1743
+ }
1744
+ /**
1745
+ * Waits for any selected canonical task-tree child to become terminal.
1746
+ * @param {string} task
1747
+ * @returns {Promise<string>}
1748
+ */
1749
+ waitSubagents(task) {
1750
+ const ptr0 = passStringToWasm0(task, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1751
+ const len0 = WASM_VECTOR_LEN;
1752
+ const ret = wasm.nanocodex_waitSubagents(this.__wbg_ptr, ptr0, len0);
1753
+ return takeObject(ret);
183
1754
  }
184
1755
  }
185
1756
  if (Symbol.dispose) Nanocodex.prototype[Symbol.dispose] = Nanocodex.prototype.free;
@@ -204,6 +1775,21 @@ export class Turn {
204
1775
  const ptr = this.__destroy_into_raw();
205
1776
  wasm.__wbg_turn_free(ptr, 0);
206
1777
  }
1778
+ /**
1779
+ * Waits until the Rust driver has durably admitted this turn.
1780
+ *
1781
+ * Returns the durable request identity selected during admission, or
1782
+ * `undefined` when the agent has no execution policy.
1783
+ *
1784
+ * # Errors
1785
+ *
1786
+ * Rejects with a stable `code` describing an admission failure.
1787
+ * @returns {Promise<string | undefined>}
1788
+ */
1789
+ accepted() {
1790
+ const ret = wasm.turn_accepted(this.__wbg_ptr);
1791
+ return takeObject(ret);
1792
+ }
207
1793
  /**
208
1794
  * Cancels this exact active or queued turn.
209
1795
  *
@@ -214,19 +1800,19 @@ export class Turn {
214
1800
  */
215
1801
  cancel() {
216
1802
  const ret = wasm.turn_cancel(this.__wbg_ptr);
217
- return ret;
1803
+ return takeObject(ret);
218
1804
  }
219
1805
  /**
220
1806
  * Waits for the final assistant message.
221
1807
  *
222
1808
  * # Errors
223
1809
  *
224
- * Rejects when the model run or driver fails.
1810
+ * Rejects with a stable `code` when the model run or driver fails.
225
1811
  * @returns {Promise<TurnResult>}
226
1812
  */
227
1813
  result() {
228
1814
  const ret = wasm.turn_result(this.__wbg_ptr);
229
- return ret;
1815
+ return takeObject(ret);
230
1816
  }
231
1817
  /**
232
1818
  * Injects text input at the active turn's next safe model boundary.
@@ -235,13 +1821,16 @@ export class Turn {
235
1821
  *
236
1822
  * Rejects if the turn is not active or its driver stopped.
237
1823
  * @param {string} instruction
1824
+ * @param {string | null} [message_id]
238
1825
  * @returns {Promise<void>}
239
1826
  */
240
- steer(instruction) {
241
- const ptr0 = passStringToWasm0(instruction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1827
+ steer(instruction, message_id) {
1828
+ const ptr0 = passStringToWasm0(instruction, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
1829
  const len0 = WASM_VECTOR_LEN;
243
- const ret = wasm.turn_steer(this.__wbg_ptr, ptr0, len0);
244
- return ret;
1830
+ var ptr1 = isLikeNone(message_id) ? 0 : passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1831
+ var len1 = WASM_VECTOR_LEN;
1832
+ const ret = wasm.turn_steer(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1833
+ return takeObject(ret);
245
1834
  }
246
1835
  /**
247
1836
  * Injects browser-safe multimodal input at the active turn's next boundary.
@@ -250,13 +1839,32 @@ export class Turn {
250
1839
  *
251
1840
  * Rejects malformed input or a turn that is no longer active.
252
1841
  * @param {string} content_json
1842
+ * @param {string | null} [message_id]
253
1843
  * @returns {Promise<void>}
254
1844
  */
255
- steerContent(content_json) {
256
- const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1845
+ steerContent(content_json, message_id) {
1846
+ const ptr0 = passStringToWasm0(content_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1847
+ const len0 = WASM_VECTOR_LEN;
1848
+ var ptr1 = isLikeNone(message_id) ? 0 : passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1849
+ var len1 = WASM_VECTOR_LEN;
1850
+ const ret = wasm.turn_steerContent(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1851
+ return takeObject(ret);
1852
+ }
1853
+ /**
1854
+ * Removes the latest identified steer while it is still pending.
1855
+ * Returns false after successful turn completion.
1856
+ *
1857
+ * # Errors
1858
+ *
1859
+ * Rejects if the driver has stopped or withdrawal is unsupported.
1860
+ * @param {string} message_id
1861
+ * @returns {Promise<boolean>}
1862
+ */
1863
+ withdrawSteer(message_id) {
1864
+ const ptr0 = passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
257
1865
  const len0 = WASM_VECTOR_LEN;
258
- const ret = wasm.turn_steerContent(this.__wbg_ptr, ptr0, len0);
259
- return ret;
1866
+ const ret = wasm.turn_withdrawSteer(this.__wbg_ptr, ptr0, len0);
1867
+ return takeObject(ret);
260
1868
  }
261
1869
  }
262
1870
  if (Symbol.dispose) Turn.prototype[Symbol.dispose] = Turn.prototype.free;
@@ -289,12 +1897,16 @@ export class TurnResult {
289
1897
  let deferred1_0;
290
1898
  let deferred1_1;
291
1899
  try {
292
- const ret = wasm.turnresult_finalMessage(this.__wbg_ptr);
293
- deferred1_0 = ret[0];
294
- deferred1_1 = ret[1];
295
- return getStringFromWasm0(ret[0], ret[1]);
1900
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1901
+ wasm.turnresult_finalMessage(retptr, this.__wbg_ptr);
1902
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1903
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1904
+ deferred1_0 = r0;
1905
+ deferred1_1 = r1;
1906
+ return getStringFromWasm0(r0, r1);
296
1907
  } finally {
297
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1908
+ wasm.__wbindgen_add_to_stack_pointer(16);
1909
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
298
1910
  }
299
1911
  }
300
1912
  /**
@@ -309,18 +1921,24 @@ export class TurnResult {
309
1921
  let deferred2_0;
310
1922
  let deferred2_1;
311
1923
  try {
312
- const ret = wasm.turnresult_snapshot(this.__wbg_ptr);
313
- var ptr1 = ret[0];
314
- var len1 = ret[1];
315
- if (ret[3]) {
1924
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1925
+ wasm.turnresult_snapshot(retptr, this.__wbg_ptr);
1926
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1927
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1928
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1929
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1930
+ var ptr1 = r0;
1931
+ var len1 = r1;
1932
+ if (r3) {
316
1933
  ptr1 = 0; len1 = 0;
317
- throw takeFromExternrefTable0(ret[2]);
1934
+ throw takeObject(r2);
318
1935
  }
319
1936
  deferred2_0 = ptr1;
320
1937
  deferred2_1 = len1;
321
1938
  return getStringFromWasm0(ptr1, len1);
322
1939
  } finally {
323
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1940
+ wasm.__wbindgen_add_to_stack_pointer(16);
1941
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
324
1942
  }
325
1943
  }
326
1944
  /**
@@ -335,44 +1953,112 @@ export class TurnResult {
335
1953
  let deferred2_0;
336
1954
  let deferred2_1;
337
1955
  try {
338
- const ret = wasm.turnresult_usage(this.__wbg_ptr);
339
- var ptr1 = ret[0];
340
- var len1 = ret[1];
341
- if (ret[3]) {
1956
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1957
+ wasm.turnresult_usage(retptr, this.__wbg_ptr);
1958
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1959
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1960
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1961
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1962
+ var ptr1 = r0;
1963
+ var len1 = r1;
1964
+ if (r3) {
342
1965
  ptr1 = 0; len1 = 0;
343
- throw takeFromExternrefTable0(ret[2]);
1966
+ throw takeObject(r2);
344
1967
  }
345
1968
  deferred2_0 = ptr1;
346
1969
  deferred2_1 = len1;
347
1970
  return getStringFromWasm0(ptr1, len1);
348
1971
  } finally {
349
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1972
+ wasm.__wbindgen_add_to_stack_pointer(16);
1973
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
350
1974
  }
351
1975
  }
352
1976
  }
353
1977
  if (Symbol.dispose) TurnResult.prototype[Symbol.dispose] = TurnResult.prototype.free;
1978
+
1979
+ /**
1980
+ * Applies a browser-workspace patch through the canonical Rust planner.
1981
+ *
1982
+ * The browser host uses this internal binding for nested Code Mode calls so
1983
+ * they share the direct `apply_patch` tool's verification and mutation path.
1984
+ * @param {string} patch
1985
+ * @param {string} session_id
1986
+ * @returns {Promise<string>}
1987
+ */
1988
+ export function applyBrowserPatch(patch, session_id) {
1989
+ const ptr0 = passStringToWasm0(patch, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1990
+ const len0 = WASM_VECTOR_LEN;
1991
+ const ptr1 = passStringToWasm0(session_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1992
+ const len1 = WASM_VECTOR_LEN;
1993
+ const ret = wasm.applyBrowserPatch(ptr0, len0, ptr1, len1);
1994
+ return takeObject(ret);
1995
+ }
1996
+
1997
+ /**
1998
+ * Returns the shared bounded first-prompt retrieval plan for a managed host.
1999
+ * @param {string} input
2000
+ * @returns {string}
2001
+ */
2002
+ export function managedBootstrapPlan(input) {
2003
+ let deferred2_0;
2004
+ let deferred2_1;
2005
+ try {
2006
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2007
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2008
+ const len0 = WASM_VECTOR_LEN;
2009
+ wasm.managedBootstrapPlan(retptr, ptr0, len0);
2010
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2011
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2012
+ deferred2_0 = r0;
2013
+ deferred2_1 = r1;
2014
+ return getStringFromWasm0(r0, r1);
2015
+ } finally {
2016
+ wasm.__wbindgen_add_to_stack_pointer(16);
2017
+ wasm.__wbindgen_export5(deferred2_0, deferred2_1, 1);
2018
+ }
2019
+ }
2020
+
2021
+ /**
2022
+ * Prunes old replay receipts before the full Agent runtime is constructed.
2023
+ * @param {string} durability_host_id
2024
+ * @param {string} durability_id
2025
+ * @param {number} terminal_receipt_limit
2026
+ * @returns {Promise<void>}
2027
+ */
2028
+ export function pruneDurableReceipts(durability_host_id, durability_id, terminal_receipt_limit) {
2029
+ const ptr0 = passStringToWasm0(durability_host_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2030
+ const len0 = WASM_VECTOR_LEN;
2031
+ const ptr1 = passStringToWasm0(durability_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2032
+ const len1 = WASM_VECTOR_LEN;
2033
+ const ret = wasm.pruneDurableReceipts(ptr0, len0, ptr1, len1, terminal_receipt_limit);
2034
+ return takeObject(ret);
2035
+ }
354
2036
  function __wbg_get_imports() {
355
2037
  const import0 = {
356
2038
  __proto__: null,
357
2039
  __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
358
- const ret = debugString(arg1);
359
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2040
+ const ret = debugString(getObject(arg1));
2041
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
360
2042
  const len1 = WASM_VECTOR_LEN;
361
2043
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
362
2044
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
363
2045
  },
364
2046
  __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
365
- const ret = typeof(arg0) === 'function';
2047
+ const ret = typeof(getObject(arg0)) === 'function';
2048
+ return ret;
2049
+ },
2050
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
2051
+ const ret = getObject(arg0) === null;
366
2052
  return ret;
367
2053
  },
368
2054
  __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
369
- const ret = arg0 === undefined;
2055
+ const ret = getObject(arg0) === undefined;
370
2056
  return ret;
371
2057
  },
372
2058
  __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
373
- const obj = arg1;
2059
+ const obj = getObject(arg1);
374
2060
  const ret = typeof(obj) === 'string' ? obj : undefined;
375
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2061
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
376
2062
  var len1 = WASM_VECTOR_LEN;
377
2063
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
378
2064
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -381,72 +2067,148 @@ function __wbg_get_imports() {
381
2067
  throw new Error(getStringFromWasm0(arg0, arg1));
382
2068
  },
383
2069
  __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
384
- arg0._wbg_cb_unref();
2070
+ getObject(arg0)._wbg_cb_unref();
2071
+ },
2072
+ __wbg_beginCodeTurn_562e43a4d024e969: function(arg0, arg1) {
2073
+ globalThis.nanocodexHost.beginCodeTurn(getStringFromWasm0(arg0, arg1));
385
2074
  },
2075
+ __wbg_bindSubagentSession_0739d749b1a66d55: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
2076
+ globalThis.nanocodexHost.bindSubagentSession(arg0 >>> 0, getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6), arg7 === 0 ? undefined : getStringFromWasm0(arg7, arg8));
2077
+ }, arguments); },
2078
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
2079
+ const ret = getObject(arg0).call(getObject(arg1));
2080
+ return addHeapObject(ret);
2081
+ }, arguments); },
386
2082
  __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
387
- const ret = arg0.call(arg1, arg2);
388
- return ret;
2083
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2084
+ return addHeapObject(ret);
389
2085
  }, arguments); },
390
- __wbg_close_01cad5fe38e81c86: function(arg0) {
2086
+ __wbg_cancelCodeTurn_0289eab94b547fa9: function(arg0, arg1) {
2087
+ globalThis.nanocodexHost.cancelCodeTurn(getStringFromWasm0(arg0, arg1));
2088
+ },
2089
+ __wbg_cancelCode_34a11a338ededbe2: function(arg0, arg1) {
2090
+ globalThis.nanocodexHost.cancelCode(getStringFromWasm0(arg0, arg1));
2091
+ },
2092
+ __wbg_chatgptsubscription_new: function(arg0) {
2093
+ const ret = ChatGptSubscription.__wrap(arg0);
2094
+ return addHeapObject(ret);
2095
+ },
2096
+ __wbg_close_e47f7852ba6527a3: function(arg0) {
391
2097
  globalThis.nanocodexHost.close(arg0 >>> 0);
392
2098
  },
393
- __wbg_connect_5611ecc28eb874ce: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
394
- const ret = globalThis.nanocodexHost.connect(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5), arg6 !== 0, getStringFromWasm0(arg7, arg8), arg9 === 0 ? undefined : getStringFromWasm0(arg9, arg10));
395
- return ret;
2099
+ __wbg_connect_f17b2b140b3402d3: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) {
2100
+ const ret = globalThis.nanocodexHost.connect(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5), arg6 !== 0, getStringFromWasm0(arg7, arg8), getStringFromWasm0(arg9, arg10), arg11 === 0 ? undefined : getStringFromWasm0(arg11, arg12));
2101
+ return addHeapObject(ret);
396
2102
  }, arguments); },
397
- __wbg_emitEvent_3feefd1f718bb4db: function(arg0, arg1) {
398
- globalThis.nanocodexHost.emitEvent(getStringFromWasm0(arg0, arg1));
399
- },
400
- __wbg_executeCode_8137943d0e1986eb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
401
- const ret = globalThis.nanocodexHost.executeCode(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
402
- return ret;
2103
+ __wbg_durabilityAcquire_f93999e2fde26eb1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2104
+ const ret = globalThis.nanocodexHost.durabilityAcquire(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
2105
+ return addHeapObject(ret);
403
2106
  }, arguments); },
404
- __wbg_executeTool_e4208b9be8ad5132: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
405
- const ret = globalThis.nanocodexHost.executeTool(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
406
- return ret;
2107
+ __wbg_durabilityReadRecord_a95f9c0591d8bdd7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2108
+ const ret = globalThis.nanocodexHost.durabilityReadRecord(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
2109
+ return addHeapObject(ret);
2110
+ }, arguments); },
2111
+ __wbg_durabilityReadRecords_55154229140c587c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2112
+ const ret = globalThis.nanocodexHost.durabilityReadRecords(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
2113
+ return addHeapObject(ret);
2114
+ }, arguments); },
2115
+ __wbg_durabilityReplace_c4b92bb6e96144af: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) {
2116
+ const ret = globalThis.nanocodexHost.durabilityReplace(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9), getStringFromWasm0(arg10, arg11), getStringFromWasm0(arg12, arg13));
2117
+ return addHeapObject(ret);
2118
+ }, arguments); },
2119
+ __wbg_emitEvent_117683c6b324c5d7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
2120
+ globalThis.nanocodexHost.emitEvent(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 >>> 0, arg5 === 0 ? undefined : getStringFromWasm0(arg5, arg6));
2121
+ }, arguments); },
2122
+ __wbg_error_142f90eed0c7cc75: function() { return handleError(function (arg0, arg1, arg2) {
2123
+ console.error(getStringFromWasm0(arg0, arg1), getObject(arg2));
2124
+ }, arguments); },
2125
+ __wbg_executeCode_c07d50da74c407df: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
2126
+ const ret = globalThis.nanocodexHost.executeCode(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
2127
+ return addHeapObject(ret);
2128
+ }, arguments); },
2129
+ __wbg_executeTool_86d627717b7b04d6: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
2130
+ const ret = globalThis.nanocodexHost.executeTool(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9));
2131
+ return addHeapObject(ret);
2132
+ }, arguments); },
2133
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
2134
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
407
2135
  }, arguments); },
408
2136
  __wbg_getRandomValues_ceb34d8ffce7e87f: function() { return handleError(function (arg0, arg1) {
409
2137
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
410
2138
  }, arguments); },
411
2139
  __wbg_getTime_d6f070c088c9b5ed: function(arg0) {
412
- const ret = arg0.getTime();
2140
+ const ret = getObject(arg0).getTime();
413
2141
  return ret;
414
2142
  },
415
2143
  __wbg_getTimezoneOffset_dc9862c79e5a81a3: function(arg0) {
416
- const ret = arg0.getTimezoneOffset();
2144
+ const ret = getObject(arg0).getTimezoneOffset();
417
2145
  return ret;
418
2146
  },
419
2147
  __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
420
- const ret = Reflect.get(arg0, arg1);
421
- return ret;
2148
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2149
+ return addHeapObject(ret);
422
2150
  }, arguments); },
2151
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
2152
+ const ret = getObject(arg0)[arg1 >>> 0];
2153
+ return addHeapObject(ret);
2154
+ },
2155
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
2156
+ let result;
2157
+ try {
2158
+ result = getObject(arg0) instanceof Uint8Array;
2159
+ } catch (_) {
2160
+ result = false;
2161
+ }
2162
+ const ret = result;
2163
+ return ret;
2164
+ },
2165
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
2166
+ const ret = Array.isArray(getObject(arg0));
2167
+ return ret;
2168
+ },
2169
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
2170
+ const ret = getObject(arg0).length;
2171
+ return ret;
2172
+ },
2173
+ __wbg_length_370319915dc99107: function(arg0) {
2174
+ const ret = getObject(arg0).length;
2175
+ return ret;
2176
+ },
423
2177
  __wbg_nanocodex_new: function(arg0) {
424
2178
  const ret = Nanocodex.__wrap(arg0);
425
- return ret;
2179
+ return addHeapObject(ret);
426
2180
  },
427
2181
  __wbg_new_0_3da9e97f24fc69be: function() {
428
2182
  const ret = new Date();
429
- return ret;
2183
+ return addHeapObject(ret);
430
2184
  },
431
2185
  __wbg_new_32b398fb48b6d94a: function() {
432
2186
  const ret = new Array();
433
- return ret;
2187
+ return addHeapObject(ret);
434
2188
  },
435
2189
  __wbg_new_b667d279fd5aa943: function(arg0, arg1) {
436
2190
  const ret = new Error(getStringFromWasm0(arg0, arg1));
437
- return ret;
2191
+ return addHeapObject(ret);
438
2192
  },
439
2193
  __wbg_new_cbb95886ce0eb0cb: function(arg0, arg1) {
440
- const ret = new Intl.DateTimeFormat(arg0, arg1);
441
- return ret;
2194
+ const ret = new Intl.DateTimeFormat(getObject(arg0), getObject(arg1));
2195
+ return addHeapObject(ret);
442
2196
  },
443
2197
  __wbg_new_cc984128914cfc6f: function(arg0) {
444
- const ret = new Date(arg0);
445
- return ret;
2198
+ const ret = new Date(getObject(arg0));
2199
+ return addHeapObject(ret);
2200
+ },
2201
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
2202
+ const ret = new Uint8Array(getObject(arg0));
2203
+ return addHeapObject(ret);
446
2204
  },
447
2205
  __wbg_new_da52cf8fe3429cb2: function() {
448
2206
  const ret = new Object();
449
- return ret;
2207
+ return addHeapObject(ret);
2208
+ },
2209
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
2210
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2211
+ return addHeapObject(ret);
450
2212
  },
451
2213
  __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
452
2214
  try {
@@ -455,23 +2217,31 @@ function __wbg_get_imports() {
455
2217
  const a = state0.a;
456
2218
  state0.a = 0;
457
2219
  try {
458
- return wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined_______true_(a, state0.b, arg0, arg1);
2220
+ return __wasm_bindgen_func_elem_19793(a, state0.b, arg0, arg1);
459
2221
  } finally {
460
2222
  state0.a = a;
461
2223
  }
462
2224
  };
463
2225
  const ret = new Promise(cb0);
464
- return ret;
2226
+ return addHeapObject(ret);
465
2227
  } finally {
466
2228
  state0.a = 0;
467
2229
  }
468
2230
  },
469
- __wbg_next_ad2796bd351c174b: function() { return handleError(function (arg0, arg1) {
470
- const ret = globalThis.nanocodexHost.next(arg0 >>> 0, arg1 >>> 0);
471
- return ret;
2231
+ __wbg_nextCodeUpdate_81e642d6973d8080: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2232
+ const ret = globalThis.nanocodexHost.nextCodeUpdate(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
2233
+ return addHeapObject(ret);
472
2234
  }, arguments); },
2235
+ __wbg_next_a97247e133bb6188: function() { return handleError(function (arg0) {
2236
+ const ret = globalThis.nanocodexHost.next(arg0 >>> 0);
2237
+ return addHeapObject(ret);
2238
+ }, arguments); },
2239
+ __wbg_now_86c0d4ba3fa605b8: function() {
2240
+ const ret = Date.now();
2241
+ return ret;
2242
+ },
473
2243
  __wbg_now_e7c6795a7f81e10f: function(arg0) {
474
- const ret = arg0.now();
2244
+ const ret = getObject(arg0).now();
475
2245
  return ret;
476
2246
  },
477
2247
  __wbg_now_f663ab0a5177b799: function() { return handleError(function () {
@@ -479,97 +2249,146 @@ function __wbg_get_imports() {
479
2249
  return ret;
480
2250
  }, arguments); },
481
2251
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
482
- const ret = arg0.performance;
483
- return ret;
2252
+ const ret = getObject(arg0).performance;
2253
+ return addHeapObject(ret);
2254
+ },
2255
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
2256
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
484
2257
  },
485
2258
  __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
486
- const ret = arg0.queueMicrotask;
487
- return ret;
2259
+ const ret = getObject(arg0).queueMicrotask;
2260
+ return addHeapObject(ret);
488
2261
  },
489
2262
  __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
490
- queueMicrotask(arg0);
2263
+ queueMicrotask(getObject(arg0));
491
2264
  },
2265
+ __wbg_readWorkspaceFile_ce1dfa978e09347b: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2266
+ const ret = globalThis.nanocodexHost.readWorkspaceFile(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
2267
+ return addHeapObject(ret);
2268
+ }, arguments); },
2269
+ __wbg_releaseSubagentSession_3b41b91262fb7b84: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2270
+ globalThis.nanocodexHost.releaseSubagentSession(arg0 >>> 0, getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
2271
+ }, arguments); },
2272
+ __wbg_removeWorkspaceFile_913543277dc3d8a6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2273
+ const ret = globalThis.nanocodexHost.removeWorkspaceFile(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
2274
+ return addHeapObject(ret);
2275
+ }, arguments); },
492
2276
  __wbg_resolve_2191a4dfe481c25b: function(arg0) {
493
- const ret = Promise.resolve(arg0);
494
- return ret;
2277
+ const ret = Promise.resolve(getObject(arg0));
2278
+ return addHeapObject(ret);
495
2279
  },
496
2280
  __wbg_resolvedOptions_ce0ede387898d6bd: function(arg0) {
497
- const ret = arg0.resolvedOptions();
498
- return ret;
2281
+ const ret = getObject(arg0).resolvedOptions();
2282
+ return addHeapObject(ret);
499
2283
  },
500
- __wbg_send_864d9417bda59954: function() { return handleError(function (arg0, arg1, arg2) {
2284
+ __wbg_send_7e40303b2078ba70: function() { return handleError(function (arg0, arg1, arg2) {
501
2285
  const ret = globalThis.nanocodexHost.send(arg0 >>> 0, getStringFromWasm0(arg1, arg2));
2286
+ return addHeapObject(ret);
2287
+ }, arguments); },
2288
+ __wbg_setTimeout_5a8020b9bc901945: function(arg0, arg1) {
2289
+ const ret = globalThis.setTimeout(getObject(arg0), arg1);
2290
+ return addHeapObject(ret);
2291
+ },
2292
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
2293
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
502
2294
  return ret;
503
2295
  }, arguments); },
504
- __wbg_sleep_926d4c81d29ad90a: function() { return handleError(function (arg0, arg1, arg2) {
2296
+ __wbg_sleep_f8472ee57dd033c4: function() { return handleError(function (arg0, arg1, arg2) {
505
2297
  const ret = globalThis.nanocodexHost.sleep(getStringFromWasm0(arg0, arg1), arg2 >>> 0);
506
- return ret;
2298
+ return addHeapObject(ret);
507
2299
  }, arguments); },
508
2300
  __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
509
2301
  const ret = typeof global === 'undefined' ? null : global;
510
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2302
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
511
2303
  },
512
2304
  __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
513
2305
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
514
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2306
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
515
2307
  },
516
2308
  __wbg_static_accessor_SELF_146583524fe1469b: function() {
517
2309
  const ret = typeof self === 'undefined' ? null : self;
518
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2310
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
519
2311
  },
520
2312
  __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
521
2313
  const ret = typeof window === 'undefined' ? null : window;
522
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2314
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
523
2315
  },
2316
+ __wbg_subscriptionCompareAndSwap_314b83b503c547e4: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2317
+ const ret = globalThis.nanocodexHost.subscriptionCompareAndSwap(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
2318
+ return addHeapObject(ret);
2319
+ }, arguments); },
2320
+ __wbg_subscriptionLoad_ba70514eb107cef9: function() { return handleError(function (arg0, arg1) {
2321
+ const ret = globalThis.nanocodexHost.subscriptionLoad(getStringFromWasm0(arg0, arg1));
2322
+ return addHeapObject(ret);
2323
+ }, arguments); },
2324
+ __wbg_subscriptionRequest_a13061bc25f3b48c: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2325
+ const ret = globalThis.nanocodexHost.subscriptionRequest(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
2326
+ return addHeapObject(ret);
2327
+ }, arguments); },
524
2328
  __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
525
- const ret = arg0.then(arg1, arg2);
526
- return ret;
2329
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
2330
+ return addHeapObject(ret);
527
2331
  },
528
2332
  __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
529
- const ret = arg0.then(arg1);
530
- return ret;
2333
+ const ret = getObject(arg0).then(getObject(arg1));
2334
+ return addHeapObject(ret);
531
2335
  },
532
- __wbg_toolDefinitions_fc0bd1da5e037164: function() { return handleError(function (arg0, arg1, arg2) {
533
- const ret = globalThis.nanocodexHost.toolDefinitions(getStringFromWasm0(arg1, arg2));
534
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2336
+ __wbg_toolDefinitions_1b7c861eb298b0f7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
2337
+ const ret = globalThis.nanocodexHost.toolDefinitions(arg1 >>> 0, getStringFromWasm0(arg2, arg3));
2338
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
535
2339
  const len1 = WASM_VECTOR_LEN;
536
2340
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
537
2341
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
538
2342
  }, arguments); },
539
- __wbg_toolMode_4ce2699746be96ac: function(arg0, arg1, arg2) {
540
- const ret = globalThis.nanocodexHost.toolMode(getStringFromWasm0(arg1, arg2));
541
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2343
+ __wbg_toolMode_e724941f28c8358d: function(arg0, arg1, arg2, arg3) {
2344
+ const ret = globalThis.nanocodexHost.toolMode(arg1 >>> 0, getStringFromWasm0(arg2, arg3));
2345
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
542
2346
  const len1 = WASM_VECTOR_LEN;
543
2347
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
544
2348
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
545
2349
  },
2350
+ __wbg_turn_new: function(arg0) {
2351
+ const ret = Turn.__wrap(arg0);
2352
+ return addHeapObject(ret);
2353
+ },
546
2354
  __wbg_turnresult_new: function(arg0) {
547
2355
  const ret = TurnResult.__wrap(arg0);
548
- return ret;
2356
+ return addHeapObject(ret);
549
2357
  },
2358
+ __wbg_waitCode_643e87f0ee663a3f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2359
+ const ret = globalThis.nanocodexHost.waitCode(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
2360
+ return addHeapObject(ret);
2361
+ }, arguments); },
2362
+ __wbg_writeWorkspaceFile_28ef4bf3f8930a6f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2363
+ const ret = globalThis.nanocodexHost.writeWorkspaceFile(getStringFromWasm0(arg0, arg1), getObject(arg2), getStringFromWasm0(arg3, arg4));
2364
+ return addHeapObject(ret);
2365
+ }, arguments); },
550
2366
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
551
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 455, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
552
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___wasm_bindgen_6c97e59ea7837008___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_6c97e59ea7837008___JsError___true_);
553
- return ret;
2367
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2813, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2368
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19791);
2369
+ return addHeapObject(ret);
2370
+ },
2371
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2372
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 508, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2373
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4593);
2374
+ return addHeapObject(ret);
554
2375
  },
555
- __wbindgen_cast_0000000000000002: function(arg0) {
2376
+ __wbindgen_cast_0000000000000003: function(arg0) {
556
2377
  // Cast intrinsic for `F64 -> Externref`.
557
2378
  const ret = arg0;
558
- return ret;
2379
+ return addHeapObject(ret);
559
2380
  },
560
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2381
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
561
2382
  // Cast intrinsic for `Ref(String) -> Externref`.
562
2383
  const ret = getStringFromWasm0(arg0, arg1);
563
- return ret;
2384
+ return addHeapObject(ret);
564
2385
  },
565
- __wbindgen_init_externref_table: function() {
566
- const table = wasm.__wbindgen_externrefs;
567
- const offset = table.grow(4);
568
- table.set(0, undefined);
569
- table.set(offset + 0, undefined);
570
- table.set(offset + 1, null);
571
- table.set(offset + 2, true);
572
- table.set(offset + 3, false);
2386
+ __wbindgen_object_clone_ref: function(arg0) {
2387
+ const ret = getObject(arg0);
2388
+ return addHeapObject(ret);
2389
+ },
2390
+ __wbindgen_object_drop_ref: function(arg0) {
2391
+ takeObject(arg0);
573
2392
  },
574
2393
  };
575
2394
  return {
@@ -578,17 +2397,37 @@ function __wbg_get_imports() {
578
2397
  };
579
2398
  }
580
2399
 
581
- function wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___wasm_bindgen_6c97e59ea7837008___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_6c97e59ea7837008___JsError___true_(arg0, arg1, arg2) {
582
- const ret = wasm.wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___wasm_bindgen_6c97e59ea7837008___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_6c97e59ea7837008___JsError___true_(arg0, arg1, arg2);
583
- if (ret[1]) {
584
- throw takeFromExternrefTable0(ret[0]);
2400
+ function __wasm_bindgen_func_elem_4593(arg0, arg1) {
2401
+ wasm.__wasm_bindgen_func_elem_4593(arg0, arg1);
2402
+ }
2403
+
2404
+ function __wasm_bindgen_func_elem_19791(arg0, arg1, arg2) {
2405
+ try {
2406
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2407
+ wasm.__wasm_bindgen_func_elem_19791(retptr, arg0, arg1, addHeapObject(arg2));
2408
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2409
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2410
+ if (r1) {
2411
+ throw takeObject(r0);
2412
+ }
2413
+ } finally {
2414
+ wasm.__wbindgen_add_to_stack_pointer(16);
585
2415
  }
586
2416
  }
587
2417
 
588
- function wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
589
- wasm.wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
2418
+ function __wasm_bindgen_func_elem_19793(arg0, arg1, arg2, arg3) {
2419
+ wasm.__wasm_bindgen_func_elem_19793(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
590
2420
  }
591
2421
 
2422
+ const BrowserVoiceFinalization = (typeof FinalizationRegistry === 'undefined')
2423
+ ? { register: () => {}, unregister: () => {} }
2424
+ : new FinalizationRegistry(ptr => wasm.__wbg_browservoice_free(ptr, 1));
2425
+ const ChatGptSubscriptionFinalization = (typeof FinalizationRegistry === 'undefined')
2426
+ ? { register: () => {}, unregister: () => {} }
2427
+ : new FinalizationRegistry(ptr => wasm.__wbg_chatgptsubscription_free(ptr, 1));
2428
+ const ManagedBrowserVoiceFinalization = (typeof FinalizationRegistry === 'undefined')
2429
+ ? { register: () => {}, unregister: () => {} }
2430
+ : new FinalizationRegistry(ptr => wasm.__wbg_managedbrowservoice_free(ptr, 1));
592
2431
  const NanocodexFinalization = (typeof FinalizationRegistry === 'undefined')
593
2432
  ? { register: () => {}, unregister: () => {} }
594
2433
  : new FinalizationRegistry(ptr => wasm.__wbg_nanocodex_free(ptr, 1));
@@ -599,9 +2438,12 @@ const TurnResultFinalization = (typeof FinalizationRegistry === 'undefined')
599
2438
  ? { register: () => {}, unregister: () => {} }
600
2439
  : new FinalizationRegistry(ptr => wasm.__wbg_turnresult_free(ptr, 1));
601
2440
 
602
- function addToExternrefTable0(obj) {
603
- const idx = wasm.__externref_table_alloc();
604
- wasm.__wbindgen_externrefs.set(idx, obj);
2441
+ function addHeapObject(obj) {
2442
+ if (heap_next === heap.length) heap.push(heap.length + 1);
2443
+ const idx = heap_next;
2444
+ heap_next = heap[idx];
2445
+
2446
+ heap[idx] = obj;
605
2447
  return idx;
606
2448
  }
607
2449
 
@@ -613,7 +2455,7 @@ function _assertClass(instance, klass) {
613
2455
 
614
2456
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
615
2457
  ? { register: () => {}, unregister: () => {} }
616
- : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
2458
+ : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
617
2459
 
618
2460
  function debugString(val) {
619
2461
  // primitive types
@@ -680,9 +2522,15 @@ function debugString(val) {
680
2522
  return className;
681
2523
  }
682
2524
 
2525
+ function dropObject(idx) {
2526
+ if (idx < 1028) return;
2527
+ heap[idx] = heap_next;
2528
+ heap_next = idx;
2529
+ }
2530
+
683
2531
  function getArrayU8FromWasm0(ptr, len) {
684
2532
  ptr = ptr >>> 0;
685
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2533
+ return new Uint8Array(wasm.memory.buffer, ptr, len);
686
2534
  }
687
2535
 
688
2536
  let cachedDataViewMemory0 = null;
@@ -705,15 +2553,21 @@ function getUint8ArrayMemory0() {
705
2553
  return cachedUint8ArrayMemory0;
706
2554
  }
707
2555
 
2556
+ function getObject(idx) { return heap[idx]; }
2557
+
708
2558
  function handleError(f, args) {
709
2559
  try {
710
2560
  return f.apply(this, args);
711
2561
  } catch (e) {
712
- const idx = addToExternrefTable0(e);
713
- wasm.__wbindgen_exn_store(idx);
2562
+ wasm.__wbindgen_export3(addHeapObject(e));
714
2563
  }
715
2564
  }
716
2565
 
2566
+ let heap = new Array(1024).fill(undefined);
2567
+ heap.push(undefined, null, true, false);
2568
+
2569
+ let heap_next = heap.length;
2570
+
717
2571
  function isLikeNone(x) {
718
2572
  return x === undefined || x === null;
719
2573
  }
@@ -737,7 +2591,7 @@ function makeMutClosure(arg0, arg1, f) {
737
2591
  };
738
2592
  real._wbg_cb_unref = () => {
739
2593
  if (--state.cnt === 0) {
740
- wasm.__wbindgen_destroy_closure(state.a, state.b);
2594
+ wasm.__wbindgen_export4(state.a, state.b);
741
2595
  state.a = 0;
742
2596
  CLOSURE_DTORS.unregister(state);
743
2597
  }
@@ -750,7 +2604,7 @@ function passStringToWasm0(arg, malloc, realloc) {
750
2604
  if (realloc === undefined) {
751
2605
  const buf = cachedTextEncoder.encode(arg);
752
2606
  const ptr = malloc(buf.length, 1) >>> 0;
753
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2607
+ new Uint8Array(wasm.memory.buffer, ptr, buf.length).set(buf);
754
2608
  WASM_VECTOR_LEN = buf.length;
755
2609
  return ptr;
756
2610
  }
@@ -772,7 +2626,7 @@ function passStringToWasm0(arg, malloc, realloc) {
772
2626
  arg = arg.slice(offset);
773
2627
  }
774
2628
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
775
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2629
+ const view = new Uint8Array(wasm.memory.buffer, ptr + offset, len - offset);
776
2630
  const ret = cachedTextEncoder.encodeInto(arg, view);
777
2631
 
778
2632
  offset += ret.written;
@@ -783,10 +2637,10 @@ function passStringToWasm0(arg, malloc, realloc) {
783
2637
  return ptr;
784
2638
  }
785
2639
 
786
- function takeFromExternrefTable0(idx) {
787
- const value = wasm.__wbindgen_externrefs.get(idx);
788
- wasm.__externref_table_dealloc(idx);
789
- return value;
2640
+ function takeObject(idx) {
2641
+ const ret = getObject(idx);
2642
+ dropObject(idx);
2643
+ return ret;
790
2644
  }
791
2645
 
792
2646
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -800,7 +2654,7 @@ function decodeText(ptr, len) {
800
2654
  cachedTextDecoder.decode();
801
2655
  numBytesDecoded = len;
802
2656
  }
803
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2657
+ return cachedTextDecoder.decode(new Uint8Array(wasm.memory.buffer, ptr, len));
804
2658
  }
805
2659
 
806
2660
  const cachedTextEncoder = new TextEncoder();
@@ -825,7 +2679,6 @@ function __wbg_finalize_init(instance, module) {
825
2679
  wasmModule = module;
826
2680
  cachedDataViewMemory0 = null;
827
2681
  cachedUint8ArrayMemory0 = null;
828
- wasm.__wbindgen_start();
829
2682
  return wasm;
830
2683
  }
831
2684