@pi-oxide/pi-host-web 0.3.1 → 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 +35 -4
- package/pi_host_web.d.ts +97 -202
- package/pi_host_web.js +218 -109
- 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 -43
- package/sdk/index.js +86 -220
- 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,39 +1,30 @@
|
|
|
1
1
|
/* @ts-self-types="./pi_host_web.d.ts" */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
4
|
+
* @param {AgentOptions} options
|
|
5
|
+
* @param {ContextProjectionBudget} budget
|
|
6
|
+
* @returns {CreateHostAgentResult}
|
|
6
7
|
*/
|
|
7
|
-
export function
|
|
8
|
-
const ret = wasm.
|
|
8
|
+
export function createHostAgent(options, budget) {
|
|
9
|
+
const ret = wasm.createHostAgent(options, budget);
|
|
9
10
|
return ret;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
* @param {
|
|
14
|
-
* @
|
|
15
|
-
* @returns {EmptyResult}
|
|
14
|
+
* @param {ContextProjectionBudget} _budget
|
|
15
|
+
* @returns {CreateHostStateResult}
|
|
16
16
|
*/
|
|
17
|
-
export function
|
|
18
|
-
const ret = wasm.
|
|
17
|
+
export function createHostState(_budget) {
|
|
18
|
+
const ret = wasm.createHostState(_budget);
|
|
19
19
|
return ret;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @param {number} handle
|
|
24
|
-
* @returns {
|
|
25
|
-
*/
|
|
26
|
-
export function continueTurn(handle) {
|
|
27
|
-
const ret = wasm.continueTurn(handle);
|
|
28
|
-
return ret;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {AgentOptions} options
|
|
33
|
-
* @returns {CreateAgentResult}
|
|
24
|
+
* @returns {EmptyResult}
|
|
34
25
|
*/
|
|
35
|
-
export function
|
|
36
|
-
const ret = wasm.
|
|
26
|
+
export function destroyHostAgent(handle) {
|
|
27
|
+
const ret = wasm.destroyHostAgent(handle);
|
|
37
28
|
return ret;
|
|
38
29
|
}
|
|
39
30
|
|
|
@@ -41,8 +32,8 @@ export function createAgent(options) {
|
|
|
41
32
|
* @param {number} handle
|
|
42
33
|
* @returns {EmptyResult}
|
|
43
34
|
*/
|
|
44
|
-
export function
|
|
45
|
-
const ret = wasm.
|
|
35
|
+
export function destroyHostState(handle) {
|
|
36
|
+
const ret = wasm.destroyHostState(handle);
|
|
46
37
|
return ret;
|
|
47
38
|
}
|
|
48
39
|
|
|
@@ -67,193 +58,218 @@ export function estimateTokensForText(text) {
|
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
/**
|
|
70
|
-
* @param {
|
|
71
|
-
* @returns {
|
|
61
|
+
* @param {number} handle
|
|
62
|
+
* @returns {HostStatePersistDataResult}
|
|
72
63
|
*/
|
|
73
|
-
export function
|
|
74
|
-
const
|
|
75
|
-
const len0 = WASM_VECTOR_LEN;
|
|
76
|
-
const ret = wasm.fallbackStrategy(ptr0, len0);
|
|
64
|
+
export function getHostAgentPersistData(handle) {
|
|
65
|
+
const ret = wasm.getHostAgentPersistData(handle);
|
|
77
66
|
return ret;
|
|
78
67
|
}
|
|
79
68
|
|
|
80
69
|
/**
|
|
81
70
|
* @param {number} handle
|
|
82
|
-
* @
|
|
83
|
-
* @returns {EventsResult}
|
|
71
|
+
* @returns {HostStatePersistDataResult}
|
|
84
72
|
*/
|
|
85
|
-
export function
|
|
86
|
-
const ret = wasm.
|
|
73
|
+
export function getHostStatePersistData(handle) {
|
|
74
|
+
const ret = wasm.getHostStatePersistData(handle);
|
|
87
75
|
return ret;
|
|
88
76
|
}
|
|
89
77
|
|
|
90
78
|
/**
|
|
91
79
|
* @param {number} handle
|
|
92
|
-
* @
|
|
93
|
-
* @returns {EmptyResult}
|
|
80
|
+
* @returns {TurnResultResult}
|
|
94
81
|
*/
|
|
95
|
-
export function
|
|
96
|
-
const ret = wasm.
|
|
82
|
+
export function hostAbort(handle) {
|
|
83
|
+
const ret = wasm.hostAbort(handle);
|
|
97
84
|
return ret;
|
|
98
85
|
}
|
|
99
86
|
|
|
100
87
|
/**
|
|
101
88
|
* @param {number} handle
|
|
102
|
-
* @
|
|
89
|
+
* @param {string} summary
|
|
90
|
+
* @param {string[]} _compacted_entry_ids
|
|
91
|
+
* @returns {TurnResultResult}
|
|
103
92
|
*/
|
|
104
|
-
export function
|
|
105
|
-
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);
|
|
106
99
|
return ret;
|
|
107
100
|
}
|
|
108
101
|
|
|
109
102
|
/**
|
|
110
103
|
* @param {number} handle
|
|
111
|
-
* @returns {
|
|
104
|
+
* @returns {TurnResultResult}
|
|
112
105
|
*/
|
|
113
|
-
export function
|
|
114
|
-
const ret = wasm.
|
|
106
|
+
export function hostContinueTurn(handle) {
|
|
107
|
+
const ret = wasm.hostContinueTurn(handle);
|
|
115
108
|
return ret;
|
|
116
109
|
}
|
|
117
110
|
|
|
118
111
|
/**
|
|
119
112
|
* @param {number} handle
|
|
120
|
-
* @param {
|
|
121
|
-
* @
|
|
122
|
-
* @returns {MoveToResult}
|
|
113
|
+
* @param {LlmChunk} chunk
|
|
114
|
+
* @returns {TurnResultResult}
|
|
123
115
|
*/
|
|
124
|
-
export function
|
|
125
|
-
const
|
|
126
|
-
const len0 = WASM_VECTOR_LEN;
|
|
127
|
-
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);
|
|
128
118
|
return ret;
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
/**
|
|
132
122
|
* @param {number} handle
|
|
133
123
|
* @param {LlmResult} result
|
|
134
|
-
* @returns {
|
|
124
|
+
* @returns {TurnResultResult}
|
|
135
125
|
*/
|
|
136
|
-
export function
|
|
137
|
-
const ret = wasm.
|
|
126
|
+
export function hostLlmDone(handle, result) {
|
|
127
|
+
const ret = wasm.hostLlmDone(handle, result);
|
|
138
128
|
return ret;
|
|
139
129
|
}
|
|
140
130
|
|
|
141
131
|
/**
|
|
142
132
|
* @param {number} handle
|
|
143
|
-
* @param {string}
|
|
144
|
-
* @
|
|
145
|
-
* @returns {StepResult}
|
|
133
|
+
* @param {string} artifact_id
|
|
134
|
+
* @returns {string}
|
|
146
135
|
*/
|
|
147
|
-
export function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
+
}
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
/**
|
|
155
158
|
* @param {number} handle
|
|
156
|
-
* @
|
|
157
|
-
* @param {ToolDonePayload} payload
|
|
158
|
-
* @returns {StepResult}
|
|
159
|
+
* @returns {EmptyResult}
|
|
159
160
|
*/
|
|
160
|
-
export function
|
|
161
|
-
const
|
|
162
|
-
const len0 = WASM_VECTOR_LEN;
|
|
163
|
-
const ret = wasm.onToolDone(handle, ptr0, len0, payload);
|
|
161
|
+
export function hostReset(handle) {
|
|
162
|
+
const ret = wasm.hostReset(handle);
|
|
164
163
|
return ret;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
/**
|
|
168
167
|
* @param {number} handle
|
|
169
|
-
* @param {string}
|
|
170
|
-
* @returns {
|
|
168
|
+
* @param {string} query
|
|
169
|
+
* @returns {ArtifactSearchResults}
|
|
171
170
|
*/
|
|
172
|
-
export function
|
|
173
|
-
const ptr0 = passStringToWasm0(
|
|
171
|
+
export function hostSearchArtifacts(handle, query) {
|
|
172
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
174
173
|
const len0 = WASM_VECTOR_LEN;
|
|
175
|
-
const ret = wasm.
|
|
176
|
-
|
|
174
|
+
const ret = wasm.hostSearchArtifacts(handle, ptr0, len0);
|
|
175
|
+
if (ret[2]) {
|
|
176
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
177
|
+
}
|
|
178
|
+
return takeFromExternrefTable0(ret[0]);
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
/**
|
|
180
182
|
* @param {number} handle
|
|
181
|
-
* @param {
|
|
182
|
-
* @returns {
|
|
183
|
+
* @param {AgentMessage} message
|
|
184
|
+
* @returns {TurnResultResult}
|
|
183
185
|
*/
|
|
184
|
-
export function
|
|
185
|
-
const ret = wasm.
|
|
186
|
+
export function hostSteer(handle, message) {
|
|
187
|
+
const ret = wasm.hostSteer(handle, message);
|
|
186
188
|
return ret;
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
/**
|
|
190
|
-
* @param {
|
|
191
|
-
* @
|
|
192
|
+
* @param {number} handle
|
|
193
|
+
* @param {string} tool_call_id
|
|
194
|
+
* @param {CancelReason} reason
|
|
195
|
+
* @returns {TurnResultResult}
|
|
192
196
|
*/
|
|
193
|
-
export function
|
|
194
|
-
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);
|
|
195
201
|
return ret;
|
|
196
202
|
}
|
|
197
203
|
|
|
198
204
|
/**
|
|
199
205
|
* @param {number} handle
|
|
200
|
-
* @param {
|
|
201
|
-
* @
|
|
206
|
+
* @param {ToolCallId} id
|
|
207
|
+
* @param {ToolResult} result
|
|
208
|
+
* @returns {TurnResultResult}
|
|
202
209
|
*/
|
|
203
|
-
export function
|
|
204
|
-
const ret = wasm.
|
|
210
|
+
export function hostToolDone(handle, id, result) {
|
|
211
|
+
const ret = wasm.hostToolDone(handle, id, result);
|
|
205
212
|
return ret;
|
|
206
213
|
}
|
|
207
214
|
|
|
208
215
|
/**
|
|
209
|
-
* @param {
|
|
210
|
-
* @
|
|
216
|
+
* @param {AgentOptions} options
|
|
217
|
+
* @param {PersistData} data
|
|
218
|
+
* @returns {CreateHostAgentResult}
|
|
211
219
|
*/
|
|
212
|
-
export function
|
|
213
|
-
const ret = wasm.
|
|
220
|
+
export function restoreHostAgent(options, data) {
|
|
221
|
+
const ret = wasm.restoreHostAgent(options, data);
|
|
214
222
|
return ret;
|
|
215
223
|
}
|
|
216
224
|
|
|
217
225
|
/**
|
|
218
|
-
* @param {
|
|
226
|
+
* @param {PersistData} data
|
|
227
|
+
* @returns {CreateHostStateResult}
|
|
219
228
|
*/
|
|
220
|
-
export function
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
wasm.setLogLevel(ptr0, len0);
|
|
229
|
+
export function restoreHostState(data) {
|
|
230
|
+
const ret = wasm.restoreHostState(data);
|
|
231
|
+
return ret;
|
|
224
232
|
}
|
|
225
233
|
|
|
226
234
|
/**
|
|
227
|
-
* @param {
|
|
228
|
-
* @
|
|
229
|
-
* @returns {EmptyResult}
|
|
235
|
+
* @param {string} json
|
|
236
|
+
* @returns {CreateHostStateResult}
|
|
230
237
|
*/
|
|
231
|
-
export function
|
|
232
|
-
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);
|
|
233
242
|
return ret;
|
|
234
243
|
}
|
|
235
244
|
|
|
236
245
|
/**
|
|
237
|
-
* @param {
|
|
238
|
-
* @returns {StateResult}
|
|
246
|
+
* @param {string} level
|
|
239
247
|
*/
|
|
240
|
-
export function
|
|
241
|
-
const
|
|
242
|
-
|
|
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);
|
|
243
252
|
}
|
|
244
253
|
|
|
245
254
|
/**
|
|
246
255
|
* @param {number} handle
|
|
247
|
-
* @param {
|
|
248
|
-
* @returns {
|
|
256
|
+
* @param {StartTurnInput} input
|
|
257
|
+
* @returns {TurnResultResult}
|
|
249
258
|
*/
|
|
250
|
-
export function
|
|
251
|
-
const ret = wasm.
|
|
259
|
+
export function startTurn(handle, input) {
|
|
260
|
+
const ret = wasm.startTurn(handle, input);
|
|
252
261
|
return ret;
|
|
253
262
|
}
|
|
254
263
|
function __wbg_get_imports() {
|
|
255
264
|
const import0 = {
|
|
256
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
|
+
},
|
|
257
273
|
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
258
274
|
const ret = arg0 === undefined;
|
|
259
275
|
return ret;
|
|
@@ -325,10 +341,17 @@ function __wbg_get_imports() {
|
|
|
325
341
|
const ret = new Error();
|
|
326
342
|
return ret;
|
|
327
343
|
},
|
|
344
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
345
|
+
const ret = new Object();
|
|
346
|
+
return ret;
|
|
347
|
+
},
|
|
328
348
|
__wbg_parse_03863847d06c4e89: function() { return handleError(function (arg0, arg1) {
|
|
329
349
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
330
350
|
return ret;
|
|
331
351
|
}, arguments); },
|
|
352
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
353
|
+
arg0[arg1] = arg2;
|
|
354
|
+
},
|
|
332
355
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
333
356
|
const ret = arg1.stack;
|
|
334
357
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -340,6 +363,11 @@ function __wbg_get_imports() {
|
|
|
340
363
|
const ret = JSON.stringify(arg0);
|
|
341
364
|
return ret;
|
|
342
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
|
+
},
|
|
343
371
|
__wbindgen_init_externref_table: function() {
|
|
344
372
|
const table = wasm.__wbindgen_externrefs;
|
|
345
373
|
const offset = table.grow(4);
|
|
@@ -362,6 +390,71 @@ function addToExternrefTable0(obj) {
|
|
|
362
390
|
return idx;
|
|
363
391
|
}
|
|
364
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
|
+
|
|
365
458
|
let cachedDataViewMemory0 = null;
|
|
366
459
|
function getDataViewMemory0() {
|
|
367
460
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -395,6 +488,16 @@ function isLikeNone(x) {
|
|
|
395
488
|
return x === undefined || x === null;
|
|
396
489
|
}
|
|
397
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
|
+
|
|
398
501
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
399
502
|
if (realloc === undefined) {
|
|
400
503
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -432,6 +535,12 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
432
535
|
return ptr;
|
|
433
536
|
}
|
|
434
537
|
|
|
538
|
+
function takeFromExternrefTable0(idx) {
|
|
539
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
540
|
+
wasm.__externref_table_dealloc(idx);
|
|
541
|
+
return value;
|
|
542
|
+
}
|
|
543
|
+
|
|
435
544
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
436
545
|
cachedTextDecoder.decode();
|
|
437
546
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
package/pi_host_web_bg.wasm
CHANGED
|
Binary file
|