@pi-oxide/pi-host-web 0.3.0 → 0.4.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.
- package/package.json +36 -5
- package/pi_host_web.d.ts +98 -197
- package/pi_host_web.js +224 -97
- package/pi_host_web_bg.wasm +0 -0
- package/sdk/agent.ts +274 -0
- package/sdk/artifacts.ts +35 -0
- package/sdk/context.ts +4 -0
- package/sdk/errors.ts +24 -0
- package/sdk/events.ts +52 -0
- package/sdk/index.d.ts +17 -39
- package/sdk/index.js +86 -191
- package/sdk/index.ts +53 -0
- package/sdk/init.ts +58 -0
- package/sdk/internal/engine.ts +614 -0
- package/sdk/internal/events.ts +241 -0
- package/sdk/internal/providers/anthropic.ts +440 -0
- package/sdk/internal/providers/openai.ts +177 -0
- package/sdk/internal/providers/types.ts +64 -0
- package/sdk/internal/stores/indexedDb.ts +24 -0
- package/sdk/internal/stores/persistence.ts +71 -0
- package/sdk/internal/tools/artifact.ts +24 -0
- package/sdk/internal/tools/browser.ts +449 -0
- package/sdk/internal/tools/browserRuntime.ts +48 -0
- package/sdk/internal/tools/liveRuntime.ts +151 -0
- package/sdk/internal/tools/registry.ts +174 -0
- package/sdk/internal/tools/service.ts +157 -0
- package/sdk/model.ts +35 -0
- package/sdk/react/index.ts +1 -0
- package/sdk/react/useAgent.ts +334 -0
- package/sdk/snapshot.ts +25 -0
- package/sdk/stores.ts +72 -0
- package/sdk/tools.ts +47 -0
- package/sdk/types.ts +252 -0
package/pi_host_web.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
/* @ts-self-types="./pi_host_web.d.ts" */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
6
|
-
* @returns {
|
|
4
|
+
* @param {AgentOptions} options
|
|
5
|
+
* @param {ContextProjectionBudget} budget
|
|
6
|
+
* @returns {CreateHostAgentResult}
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
const ret = wasm.
|
|
8
|
+
export function createHostAgent(options, budget) {
|
|
9
|
+
const ret = wasm.createHostAgent(options, budget);
|
|
10
10
|
return ret;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @param {
|
|
15
|
-
* @returns {
|
|
14
|
+
* @param {ContextProjectionBudget} _budget
|
|
15
|
+
* @returns {CreateHostStateResult}
|
|
16
|
+
*/
|
|
17
|
+
export function createHostState(_budget) {
|
|
18
|
+
const ret = wasm.createHostState(_budget);
|
|
19
|
+
return ret;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {number} handle
|
|
24
|
+
* @returns {EmptyResult}
|
|
16
25
|
*/
|
|
17
|
-
export function
|
|
18
|
-
const ret = wasm.
|
|
26
|
+
export function destroyHostAgent(handle) {
|
|
27
|
+
const ret = wasm.destroyHostAgent(handle);
|
|
19
28
|
return ret;
|
|
20
29
|
}
|
|
21
30
|
|
|
@@ -23,8 +32,8 @@ export function createAgent(options) {
|
|
|
23
32
|
* @param {number} handle
|
|
24
33
|
* @returns {EmptyResult}
|
|
25
34
|
*/
|
|
26
|
-
export function
|
|
27
|
-
const ret = wasm.
|
|
35
|
+
export function destroyHostState(handle) {
|
|
36
|
+
const ret = wasm.destroyHostState(handle);
|
|
28
37
|
return ret;
|
|
29
38
|
}
|
|
30
39
|
|
|
@@ -49,193 +58,218 @@ export function estimateTokensForText(text) {
|
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
/**
|
|
52
|
-
* @param {
|
|
53
|
-
* @returns {
|
|
61
|
+
* @param {number} handle
|
|
62
|
+
* @returns {HostStatePersistDataResult}
|
|
54
63
|
*/
|
|
55
|
-
export function
|
|
56
|
-
const
|
|
57
|
-
const len0 = WASM_VECTOR_LEN;
|
|
58
|
-
const ret = wasm.fallbackStrategy(ptr0, len0);
|
|
64
|
+
export function getHostAgentPersistData(handle) {
|
|
65
|
+
const ret = wasm.getHostAgentPersistData(handle);
|
|
59
66
|
return ret;
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
/**
|
|
63
70
|
* @param {number} handle
|
|
64
|
-
* @
|
|
65
|
-
* @returns {EventsResult}
|
|
71
|
+
* @returns {HostStatePersistDataResult}
|
|
66
72
|
*/
|
|
67
|
-
export function
|
|
68
|
-
const ret = wasm.
|
|
73
|
+
export function getHostStatePersistData(handle) {
|
|
74
|
+
const ret = wasm.getHostStatePersistData(handle);
|
|
69
75
|
return ret;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
/**
|
|
73
79
|
* @param {number} handle
|
|
74
|
-
* @
|
|
75
|
-
* @returns {EmptyResult}
|
|
80
|
+
* @returns {TurnResultResult}
|
|
76
81
|
*/
|
|
77
|
-
export function
|
|
78
|
-
const ret = wasm.
|
|
82
|
+
export function hostAbort(handle) {
|
|
83
|
+
const ret = wasm.hostAbort(handle);
|
|
79
84
|
return ret;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
/**
|
|
83
88
|
* @param {number} handle
|
|
84
|
-
* @
|
|
89
|
+
* @param {string} summary
|
|
90
|
+
* @param {string[]} _compacted_entry_ids
|
|
91
|
+
* @returns {TurnResultResult}
|
|
85
92
|
*/
|
|
86
|
-
export function
|
|
87
|
-
const
|
|
93
|
+
export function hostAcceptCompaction(handle, summary, _compacted_entry_ids) {
|
|
94
|
+
const ptr0 = passStringToWasm0(summary, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
95
|
+
const len0 = WASM_VECTOR_LEN;
|
|
96
|
+
const ptr1 = passArrayJsValueToWasm0(_compacted_entry_ids, wasm.__wbindgen_malloc);
|
|
97
|
+
const len1 = WASM_VECTOR_LEN;
|
|
98
|
+
const ret = wasm.hostAcceptCompaction(handle, ptr0, len0, ptr1, len1);
|
|
88
99
|
return ret;
|
|
89
100
|
}
|
|
90
101
|
|
|
91
102
|
/**
|
|
92
103
|
* @param {number} handle
|
|
93
|
-
* @returns {
|
|
104
|
+
* @returns {TurnResultResult}
|
|
94
105
|
*/
|
|
95
|
-
export function
|
|
96
|
-
const ret = wasm.
|
|
106
|
+
export function hostContinueTurn(handle) {
|
|
107
|
+
const ret = wasm.hostContinueTurn(handle);
|
|
97
108
|
return ret;
|
|
98
109
|
}
|
|
99
110
|
|
|
100
111
|
/**
|
|
101
112
|
* @param {number} handle
|
|
102
|
-
* @param {
|
|
103
|
-
* @
|
|
104
|
-
* @returns {MoveToResult}
|
|
113
|
+
* @param {LlmChunk} chunk
|
|
114
|
+
* @returns {TurnResultResult}
|
|
105
115
|
*/
|
|
106
|
-
export function
|
|
107
|
-
const
|
|
108
|
-
const len0 = WASM_VECTOR_LEN;
|
|
109
|
-
const ret = wasm.moveTo(handle, ptr0, len0, isLikeNone(summary) ? 0 : addToExternrefTable0(summary));
|
|
116
|
+
export function hostFeedLlmChunk(handle, chunk) {
|
|
117
|
+
const ret = wasm.hostFeedLlmChunk(handle, chunk);
|
|
110
118
|
return ret;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
122
|
* @param {number} handle
|
|
115
123
|
* @param {LlmResult} result
|
|
116
|
-
* @returns {
|
|
124
|
+
* @returns {TurnResultResult}
|
|
117
125
|
*/
|
|
118
|
-
export function
|
|
119
|
-
const ret = wasm.
|
|
126
|
+
export function hostLlmDone(handle, result) {
|
|
127
|
+
const ret = wasm.hostLlmDone(handle, result);
|
|
120
128
|
return ret;
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
/**
|
|
124
132
|
* @param {number} handle
|
|
125
|
-
* @param {string}
|
|
126
|
-
* @
|
|
127
|
-
* @returns {StepResult}
|
|
133
|
+
* @param {string} artifact_id
|
|
134
|
+
* @returns {string}
|
|
128
135
|
*/
|
|
129
|
-
export function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
export function hostReadArtifact(handle, artifact_id) {
|
|
137
|
+
let deferred3_0;
|
|
138
|
+
let deferred3_1;
|
|
139
|
+
try {
|
|
140
|
+
const ptr0 = passStringToWasm0(artifact_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ret = wasm.hostReadArtifact(handle, ptr0, len0);
|
|
143
|
+
var ptr2 = ret[0];
|
|
144
|
+
var len2 = ret[1];
|
|
145
|
+
if (ret[3]) {
|
|
146
|
+
ptr2 = 0; len2 = 0;
|
|
147
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
148
|
+
}
|
|
149
|
+
deferred3_0 = ptr2;
|
|
150
|
+
deferred3_1 = len2;
|
|
151
|
+
return getStringFromWasm0(ptr2, len2);
|
|
152
|
+
} finally {
|
|
153
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
154
|
+
}
|
|
134
155
|
}
|
|
135
156
|
|
|
136
157
|
/**
|
|
137
158
|
* @param {number} handle
|
|
138
|
-
* @
|
|
139
|
-
* @param {ToolDonePayload} payload
|
|
140
|
-
* @returns {StepResult}
|
|
159
|
+
* @returns {EmptyResult}
|
|
141
160
|
*/
|
|
142
|
-
export function
|
|
143
|
-
const
|
|
144
|
-
const len0 = WASM_VECTOR_LEN;
|
|
145
|
-
const ret = wasm.onToolDone(handle, ptr0, len0, payload);
|
|
161
|
+
export function hostReset(handle) {
|
|
162
|
+
const ret = wasm.hostReset(handle);
|
|
146
163
|
return ret;
|
|
147
164
|
}
|
|
148
165
|
|
|
149
166
|
/**
|
|
150
167
|
* @param {number} handle
|
|
151
|
-
* @param {string}
|
|
152
|
-
* @returns {
|
|
168
|
+
* @param {string} query
|
|
169
|
+
* @returns {ArtifactSearchResults}
|
|
153
170
|
*/
|
|
154
|
-
export function
|
|
155
|
-
const ptr0 = passStringToWasm0(
|
|
171
|
+
export function hostSearchArtifacts(handle, query) {
|
|
172
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
156
173
|
const len0 = WASM_VECTOR_LEN;
|
|
157
|
-
const ret = wasm.
|
|
158
|
-
|
|
174
|
+
const ret = wasm.hostSearchArtifacts(handle, ptr0, len0);
|
|
175
|
+
if (ret[2]) {
|
|
176
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
177
|
+
}
|
|
178
|
+
return takeFromExternrefTable0(ret[0]);
|
|
159
179
|
}
|
|
160
180
|
|
|
161
181
|
/**
|
|
162
182
|
* @param {number} handle
|
|
163
|
-
* @param {
|
|
164
|
-
* @returns {
|
|
183
|
+
* @param {AgentMessage} message
|
|
184
|
+
* @returns {TurnResultResult}
|
|
165
185
|
*/
|
|
166
|
-
export function
|
|
167
|
-
const ret = wasm.
|
|
186
|
+
export function hostSteer(handle, message) {
|
|
187
|
+
const ret = wasm.hostSteer(handle, message);
|
|
168
188
|
return ret;
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
/**
|
|
172
|
-
* @param {
|
|
173
|
-
* @
|
|
192
|
+
* @param {number} handle
|
|
193
|
+
* @param {string} tool_call_id
|
|
194
|
+
* @param {CancelReason} reason
|
|
195
|
+
* @returns {TurnResultResult}
|
|
174
196
|
*/
|
|
175
|
-
export function
|
|
176
|
-
const
|
|
197
|
+
export function hostToolCancelled(handle, tool_call_id, reason) {
|
|
198
|
+
const ptr0 = passStringToWasm0(tool_call_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
200
|
+
const ret = wasm.hostToolCancelled(handle, ptr0, len0, reason);
|
|
177
201
|
return ret;
|
|
178
202
|
}
|
|
179
203
|
|
|
180
204
|
/**
|
|
181
205
|
* @param {number} handle
|
|
182
|
-
* @param {
|
|
183
|
-
* @
|
|
206
|
+
* @param {ToolCallId} id
|
|
207
|
+
* @param {ToolResult} result
|
|
208
|
+
* @returns {TurnResultResult}
|
|
184
209
|
*/
|
|
185
|
-
export function
|
|
186
|
-
const ret = wasm.
|
|
210
|
+
export function hostToolDone(handle, id, result) {
|
|
211
|
+
const ret = wasm.hostToolDone(handle, id, result);
|
|
187
212
|
return ret;
|
|
188
213
|
}
|
|
189
214
|
|
|
190
215
|
/**
|
|
191
|
-
* @param {
|
|
192
|
-
* @
|
|
216
|
+
* @param {AgentOptions} options
|
|
217
|
+
* @param {PersistData} data
|
|
218
|
+
* @returns {CreateHostAgentResult}
|
|
193
219
|
*/
|
|
194
|
-
export function
|
|
195
|
-
const ret = wasm.
|
|
220
|
+
export function restoreHostAgent(options, data) {
|
|
221
|
+
const ret = wasm.restoreHostAgent(options, data);
|
|
196
222
|
return ret;
|
|
197
223
|
}
|
|
198
224
|
|
|
199
225
|
/**
|
|
200
|
-
* @param {
|
|
226
|
+
* @param {PersistData} data
|
|
227
|
+
* @returns {CreateHostStateResult}
|
|
201
228
|
*/
|
|
202
|
-
export function
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
wasm.setLogLevel(ptr0, len0);
|
|
229
|
+
export function restoreHostState(data) {
|
|
230
|
+
const ret = wasm.restoreHostState(data);
|
|
231
|
+
return ret;
|
|
206
232
|
}
|
|
207
233
|
|
|
208
234
|
/**
|
|
209
|
-
* @param {
|
|
210
|
-
* @
|
|
211
|
-
* @returns {EmptyResult}
|
|
235
|
+
* @param {string} json
|
|
236
|
+
* @returns {CreateHostStateResult}
|
|
212
237
|
*/
|
|
213
|
-
export function
|
|
214
|
-
const
|
|
238
|
+
export function restoreHostStateFromJson(json) {
|
|
239
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
240
|
+
const len0 = WASM_VECTOR_LEN;
|
|
241
|
+
const ret = wasm.restoreHostStateFromJson(ptr0, len0);
|
|
215
242
|
return ret;
|
|
216
243
|
}
|
|
217
244
|
|
|
218
245
|
/**
|
|
219
|
-
* @param {
|
|
220
|
-
* @returns {StateResult}
|
|
246
|
+
* @param {string} level
|
|
221
247
|
*/
|
|
222
|
-
export function
|
|
223
|
-
const
|
|
224
|
-
|
|
248
|
+
export function setLogLevel(level) {
|
|
249
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
251
|
+
wasm.setLogLevel(ptr0, len0);
|
|
225
252
|
}
|
|
226
253
|
|
|
227
254
|
/**
|
|
228
255
|
* @param {number} handle
|
|
229
|
-
* @param {
|
|
230
|
-
* @returns {
|
|
256
|
+
* @param {StartTurnInput} input
|
|
257
|
+
* @returns {TurnResultResult}
|
|
231
258
|
*/
|
|
232
|
-
export function
|
|
233
|
-
const ret = wasm.
|
|
259
|
+
export function startTurn(handle, input) {
|
|
260
|
+
const ret = wasm.startTurn(handle, input);
|
|
234
261
|
return ret;
|
|
235
262
|
}
|
|
236
263
|
function __wbg_get_imports() {
|
|
237
264
|
const import0 = {
|
|
238
265
|
__proto__: null,
|
|
266
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
267
|
+
const ret = debugString(arg1);
|
|
268
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
269
|
+
const len1 = WASM_VECTOR_LEN;
|
|
270
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
271
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
272
|
+
},
|
|
239
273
|
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
240
274
|
const ret = arg0 === undefined;
|
|
241
275
|
return ret;
|
|
@@ -307,10 +341,17 @@ function __wbg_get_imports() {
|
|
|
307
341
|
const ret = new Error();
|
|
308
342
|
return ret;
|
|
309
343
|
},
|
|
344
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
345
|
+
const ret = new Object();
|
|
346
|
+
return ret;
|
|
347
|
+
},
|
|
310
348
|
__wbg_parse_03863847d06c4e89: function() { return handleError(function (arg0, arg1) {
|
|
311
349
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
312
350
|
return ret;
|
|
313
351
|
}, arguments); },
|
|
352
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
353
|
+
arg0[arg1] = arg2;
|
|
354
|
+
},
|
|
314
355
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
315
356
|
const ret = arg1.stack;
|
|
316
357
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -322,6 +363,11 @@ function __wbg_get_imports() {
|
|
|
322
363
|
const ret = JSON.stringify(arg0);
|
|
323
364
|
return ret;
|
|
324
365
|
}, arguments); },
|
|
366
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
367
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
368
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
369
|
+
return ret;
|
|
370
|
+
},
|
|
325
371
|
__wbindgen_init_externref_table: function() {
|
|
326
372
|
const table = wasm.__wbindgen_externrefs;
|
|
327
373
|
const offset = table.grow(4);
|
|
@@ -344,6 +390,71 @@ function addToExternrefTable0(obj) {
|
|
|
344
390
|
return idx;
|
|
345
391
|
}
|
|
346
392
|
|
|
393
|
+
function debugString(val) {
|
|
394
|
+
// primitive types
|
|
395
|
+
const type = typeof val;
|
|
396
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
397
|
+
return `${val}`;
|
|
398
|
+
}
|
|
399
|
+
if (type == 'string') {
|
|
400
|
+
return `"${val}"`;
|
|
401
|
+
}
|
|
402
|
+
if (type == 'symbol') {
|
|
403
|
+
const description = val.description;
|
|
404
|
+
if (description == null) {
|
|
405
|
+
return 'Symbol';
|
|
406
|
+
} else {
|
|
407
|
+
return `Symbol(${description})`;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (type == 'function') {
|
|
411
|
+
const name = val.name;
|
|
412
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
413
|
+
return `Function(${name})`;
|
|
414
|
+
} else {
|
|
415
|
+
return 'Function';
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
// objects
|
|
419
|
+
if (Array.isArray(val)) {
|
|
420
|
+
const length = val.length;
|
|
421
|
+
let debug = '[';
|
|
422
|
+
if (length > 0) {
|
|
423
|
+
debug += debugString(val[0]);
|
|
424
|
+
}
|
|
425
|
+
for(let i = 1; i < length; i++) {
|
|
426
|
+
debug += ', ' + debugString(val[i]);
|
|
427
|
+
}
|
|
428
|
+
debug += ']';
|
|
429
|
+
return debug;
|
|
430
|
+
}
|
|
431
|
+
// Test for built-in
|
|
432
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
433
|
+
let className;
|
|
434
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
435
|
+
className = builtInMatches[1];
|
|
436
|
+
} else {
|
|
437
|
+
// Failed to match the standard '[object ClassName]'
|
|
438
|
+
return toString.call(val);
|
|
439
|
+
}
|
|
440
|
+
if (className == 'Object') {
|
|
441
|
+
// we're a user defined class or Object
|
|
442
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
443
|
+
// easier than looping through ownProperties of `val`.
|
|
444
|
+
try {
|
|
445
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
446
|
+
} catch (_) {
|
|
447
|
+
return 'Object';
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// errors
|
|
451
|
+
if (val instanceof Error) {
|
|
452
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
453
|
+
}
|
|
454
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
455
|
+
return className;
|
|
456
|
+
}
|
|
457
|
+
|
|
347
458
|
let cachedDataViewMemory0 = null;
|
|
348
459
|
function getDataViewMemory0() {
|
|
349
460
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -377,6 +488,16 @@ function isLikeNone(x) {
|
|
|
377
488
|
return x === undefined || x === null;
|
|
378
489
|
}
|
|
379
490
|
|
|
491
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
492
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
493
|
+
for (let i = 0; i < array.length; i++) {
|
|
494
|
+
const add = addToExternrefTable0(array[i]);
|
|
495
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
496
|
+
}
|
|
497
|
+
WASM_VECTOR_LEN = array.length;
|
|
498
|
+
return ptr;
|
|
499
|
+
}
|
|
500
|
+
|
|
380
501
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
381
502
|
if (realloc === undefined) {
|
|
382
503
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -414,6 +535,12 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
414
535
|
return ptr;
|
|
415
536
|
}
|
|
416
537
|
|
|
538
|
+
function takeFromExternrefTable0(idx) {
|
|
539
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
540
|
+
wasm.__externref_table_dealloc(idx);
|
|
541
|
+
return value;
|
|
542
|
+
}
|
|
543
|
+
|
|
417
544
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
418
545
|
cachedTextDecoder.decode();
|
|
419
546
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
package/pi_host_web_bg.wasm
CHANGED
|
Binary file
|