@actcore/web-runtime 0.1.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 (59) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +148 -0
  3. package/dist/cache.d.ts +70 -0
  4. package/dist/cache.d.ts.map +1 -0
  5. package/dist/cache.js +0 -0
  6. package/dist/cache.js.map +1 -0
  7. package/dist/host-api.d.ts +81 -0
  8. package/dist/host-api.d.ts.map +1 -0
  9. package/dist/host-api.js +46 -0
  10. package/dist/host-api.js.map +1 -0
  11. package/dist/index.d.ts +30 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/locale.d.ts +32 -0
  16. package/dist/locale.d.ts.map +1 -0
  17. package/dist/locale.js +64 -0
  18. package/dist/locale.js.map +1 -0
  19. package/dist/patches.d.ts +38 -0
  20. package/dist/patches.d.ts.map +1 -0
  21. package/dist/patches.js +76 -0
  22. package/dist/patches.js.map +1 -0
  23. package/dist/shims/sockets.d.ts +130 -0
  24. package/dist/shims/sockets.d.ts.map +1 -0
  25. package/dist/shims/sockets.js +128 -0
  26. package/dist/shims/sockets.js.map +1 -0
  27. package/dist/shims/wasi-http-internal.d.ts +7 -0
  28. package/dist/shims/wasi-http-internal.d.ts.map +1 -0
  29. package/dist/shims/wasi-http-internal.js +19 -0
  30. package/dist/shims/wasi-http-internal.js.map +1 -0
  31. package/dist/shims/wasi-http.d.ts +83 -0
  32. package/dist/shims/wasi-http.d.ts.map +1 -0
  33. package/dist/shims/wasi-http.js +452 -0
  34. package/dist/shims/wasi-http.js.map +1 -0
  35. package/dist/streaming-fallback.d.ts +16 -0
  36. package/dist/streaming-fallback.d.ts.map +1 -0
  37. package/dist/streaming-fallback.js +52 -0
  38. package/dist/streaming-fallback.js.map +1 -0
  39. package/dist/timing.d.ts +22 -0
  40. package/dist/timing.d.ts.map +1 -0
  41. package/dist/timing.js +48 -0
  42. package/dist/timing.js.map +1 -0
  43. package/dist/transpile.d.ts +10 -0
  44. package/dist/transpile.d.ts.map +1 -0
  45. package/dist/transpile.js +277 -0
  46. package/dist/transpile.js.map +1 -0
  47. package/dist/transpile.worker.d.ts +36 -0
  48. package/dist/transpile.worker.d.ts.map +1 -0
  49. package/dist/transpile.worker.js +43 -0
  50. package/dist/transpile.worker.js.map +1 -0
  51. package/dist/version.d.ts +2 -0
  52. package/dist/version.d.ts.map +1 -0
  53. package/dist/version.js +5 -0
  54. package/dist/version.js.map +1 -0
  55. package/dist/webmcp.d.ts +92 -0
  56. package/dist/webmcp.d.ts.map +1 -0
  57. package/dist/webmcp.js +189 -0
  58. package/dist/webmcp.js.map +1 -0
  59. package/package.json +69 -0
@@ -0,0 +1,452 @@
1
+ // Implementation of host-view's wasi:http p3 imports. Public API is the union
2
+ // of `client` + `types` exports — these are the symbols jco's transpile pulls
3
+ // off the URL we hand it via `map: ['wasi:http/*', shims/wasi-http.js#*]`.
4
+ //
5
+ // Gen-types (`src/generated/interfaces/wasi-http-{client,types}.d.ts`) drive
6
+ // the public shape; see the conformance check at the bottom of this file.
7
+ import { internalError, FIELD_VALUE_RE, FORBIDDEN, TOKEN_RE, } from './wasi-http-internal.js';
8
+ const TEXT_DECODER = new TextDecoder();
9
+ function decodeFieldValue(v) {
10
+ // FieldValue is Uint8Array per WIT, but be lenient if a string slips in.
11
+ return typeof v === 'string' ? v : TEXT_DECODER.decode(v);
12
+ }
13
+ export class Fields {
14
+ #immutable = false;
15
+ // Preserves insertion order + original casing for `copyAll`.
16
+ #entries = [];
17
+ // Lowercase-keyed view for `get`/`has`/`delete`/`set`. Each bucket holds
18
+ // references to the same tuples stored in `#entries` so we can keep them
19
+ // in sync.
20
+ #table = new Map();
21
+ constructor() { }
22
+ static fromList(entries) {
23
+ const f = new Fields();
24
+ for (const [k, v] of entries)
25
+ f.append(k, v);
26
+ return f;
27
+ }
28
+ get(name) {
29
+ return (this.#table.get(name.toLowerCase()) ?? []).map(([, v]) => v);
30
+ }
31
+ has(name) {
32
+ return this.#table.has(name.toLowerCase());
33
+ }
34
+ set(name, value) {
35
+ if (this.#immutable)
36
+ throw { tag: 'immutable' };
37
+ if (!TOKEN_RE.test(name))
38
+ throw { tag: 'invalid-syntax' };
39
+ const lower = name.toLowerCase();
40
+ if (FORBIDDEN.has(lower))
41
+ throw { tag: 'forbidden' };
42
+ for (const v of value) {
43
+ if (!FIELD_VALUE_RE.test(decodeFieldValue(v))) {
44
+ throw { tag: 'invalid-syntax' };
45
+ }
46
+ }
47
+ // Drop existing entries for this name (preserving insertion order for
48
+ // other names).
49
+ const existing = this.#table.get(lower);
50
+ if (existing && existing.length > 0) {
51
+ this.#entries = this.#entries.filter((e) => !existing.includes(e));
52
+ existing.length = 0;
53
+ }
54
+ else if (!existing) {
55
+ this.#table.set(lower, []);
56
+ }
57
+ const bucket = this.#table.get(lower);
58
+ for (const v of value) {
59
+ const entry = [name, v];
60
+ this.#entries.push(entry);
61
+ bucket.push(entry);
62
+ }
63
+ }
64
+ 'delete'(name) {
65
+ if (this.#immutable)
66
+ throw { tag: 'immutable' };
67
+ const lower = name.toLowerCase();
68
+ const bucket = this.#table.get(lower);
69
+ if (bucket && bucket.length > 0) {
70
+ this.#entries = this.#entries.filter((e) => !bucket.includes(e));
71
+ }
72
+ this.#table.delete(lower);
73
+ }
74
+ getAndDelete(name) {
75
+ const out = this.get(name);
76
+ if (out.length > 0)
77
+ this.delete(name);
78
+ return out;
79
+ }
80
+ append(name, value) {
81
+ if (this.#immutable)
82
+ throw { tag: 'immutable' };
83
+ if (!TOKEN_RE.test(name))
84
+ throw { tag: 'invalid-syntax' };
85
+ if (!FIELD_VALUE_RE.test(decodeFieldValue(value))) {
86
+ throw { tag: 'invalid-syntax' };
87
+ }
88
+ const lower = name.toLowerCase();
89
+ if (FORBIDDEN.has(lower))
90
+ throw { tag: 'forbidden' };
91
+ const entry = [name, value];
92
+ this.#entries.push(entry);
93
+ const bucket = this.#table.get(lower);
94
+ if (bucket)
95
+ bucket.push(entry);
96
+ else
97
+ this.#table.set(lower, [entry]);
98
+ }
99
+ copyAll() {
100
+ return this.#entries.map(([k, v]) => [
101
+ k,
102
+ typeof v === 'string' ? v : v.slice(),
103
+ ]);
104
+ }
105
+ clone() {
106
+ return Fields.fromList(this.#entries);
107
+ }
108
+ // Internal: response headers are immutable per WIT spec.
109
+ _lockInternal() {
110
+ this.#immutable = true;
111
+ }
112
+ }
113
+ export class RequestOptions {
114
+ #connect;
115
+ #firstByte;
116
+ #betweenBytes;
117
+ #immutable = false;
118
+ constructor() { }
119
+ getConnectTimeout() {
120
+ return this.#connect;
121
+ }
122
+ setConnectTimeout(duration) {
123
+ this.#guard();
124
+ this.#connect = duration;
125
+ }
126
+ getFirstByteTimeout() {
127
+ return this.#firstByte;
128
+ }
129
+ setFirstByteTimeout(duration) {
130
+ this.#guard();
131
+ this.#firstByte = duration;
132
+ }
133
+ getBetweenBytesTimeout() {
134
+ return this.#betweenBytes;
135
+ }
136
+ setBetweenBytesTimeout(duration) {
137
+ this.#guard();
138
+ this.#betweenBytes = duration;
139
+ }
140
+ clone() {
141
+ const c = new RequestOptions();
142
+ c.#connect = this.#connect;
143
+ c.#firstByte = this.#firstByte;
144
+ c.#betweenBytes = this.#betweenBytes;
145
+ return c;
146
+ }
147
+ #guard() {
148
+ if (this.#immutable)
149
+ throw { tag: 'immutable' };
150
+ }
151
+ _lockInternal() {
152
+ this.#immutable = true;
153
+ }
154
+ }
155
+ export class Request {
156
+ // Public for shim internals (used by client.send) but jco only touches the
157
+ // setter / getter methods below.
158
+ method = { tag: 'get' };
159
+ pathWithQuery = undefined;
160
+ scheme = undefined;
161
+ authority = undefined;
162
+ headers;
163
+ body = undefined;
164
+ trailers;
165
+ options = undefined;
166
+ // gen-types models the resource constructor as `private constructor()`; the
167
+ // public way to make one is `Request.new(...)`. We can't make the
168
+ // constructor strictly private without breaking the static factory below,
169
+ // but discourage external use by name-prefixing the params.
170
+ constructor(headers, body, trailers, options) {
171
+ this.headers = headers;
172
+ this.body = body;
173
+ this.trailers = trailers;
174
+ this.options = options;
175
+ }
176
+ static 'new'(headers, contents, trailers, options) {
177
+ const req = new Request(headers, contents, trailers, options);
178
+ // Per WIT: headers/options accessed via getters are immutable.
179
+ headers._lockInternal();
180
+ options?._lockInternal();
181
+ // The future resolves to the outcome of transmission. For a freshly
182
+ // constructed request that hasn't been handed off yet, we resolve with
183
+ // ok(); client.send replaces this when it actually sends.
184
+ const future = Promise.resolve({
185
+ tag: 'ok',
186
+ val: undefined,
187
+ });
188
+ return [req, future];
189
+ }
190
+ getMethod() {
191
+ return this.method;
192
+ }
193
+ setMethod(method) {
194
+ this.method = method;
195
+ }
196
+ getPathWithQuery() {
197
+ return this.pathWithQuery;
198
+ }
199
+ setPathWithQuery(pathWithQuery) {
200
+ this.pathWithQuery = pathWithQuery;
201
+ }
202
+ getScheme() {
203
+ return this.scheme;
204
+ }
205
+ setScheme(scheme) {
206
+ this.scheme = scheme;
207
+ }
208
+ getAuthority() {
209
+ return this.authority;
210
+ }
211
+ setAuthority(authority) {
212
+ this.authority = authority;
213
+ }
214
+ getOptions() {
215
+ return this.options;
216
+ }
217
+ getHeaders() {
218
+ return this.headers;
219
+ }
220
+ static consumeBody(this_, _res) {
221
+ const body = this_.body ??
222
+ new ReadableStream({
223
+ start(controller) {
224
+ controller.close();
225
+ },
226
+ });
227
+ return [body, this_.trailers];
228
+ }
229
+ }
230
+ // jco's emitted `_trampoline54` for `[static]response.consume-body` calls
231
+ // `Response.consumeBody(rsc0, futureResult3)`, destructures the returned tuple
232
+ // `[tuple4_0, tuple4_1]`, then probes `tuple4_0` with `symbolAsyncIterator in
233
+ // _`, then `symbolIterator in _`, then `instanceof _PlatformReadableStream`
234
+ // (= `globalThis.ReadableStream`). The chosen branch becomes `readFn5` whose
235
+ // `.next()`/`.read()` results feed `hostWriteEnd.write(values)` — and the
236
+ // inner `lowerFn` is `_lowerFlatU8`, which writes ONE byte per value via
237
+ // `setUint32(ptr, ctx.vals[0], true)`. NOTE: this does NOT require the reader
238
+ // to yield one `number` per read — jco's `PendingValueQueue.appendReadValue`
239
+ // batches array-like values and `drainInto` re-expands them to individual u8s
240
+ // before `_lowerFlatU8`. So `consumeBody` yields the whole `Uint8Array` in one
241
+ // chunk (see ACT-153; the old per-byte enqueue was ~95 B/s). `tuple4_1` is
242
+ // written verbatim to memory as an
243
+ // Int32 — for our purposes a resolved Promise<{tag:'ok'}> is fine, jco's
244
+ // trailers wiring is invoked separately. This is **Branch B** of the Task 7
245
+ // plan: synchronous static method returning [stream, futureValue].
246
+ export class Response {
247
+ statusCode = 200;
248
+ headers;
249
+ body = undefined;
250
+ // Internal buffer populated by `client.send`. The data flow lands here
251
+ // before `consumeBody` lowers it into a `ReadableStream<number>` for jco.
252
+ _bufferedBody = undefined;
253
+ trailers;
254
+ constructor(headers, body, trailers) {
255
+ this.headers = headers;
256
+ this.body = body;
257
+ this.trailers = trailers;
258
+ }
259
+ static 'new'(headers, contents, trailers) {
260
+ const resp = new Response(headers, contents, trailers);
261
+ headers._lockInternal();
262
+ const future = Promise.resolve({
263
+ tag: 'ok',
264
+ val: undefined,
265
+ });
266
+ return [resp, future];
267
+ }
268
+ getStatusCode() {
269
+ return this.statusCode;
270
+ }
271
+ setStatusCode(statusCode) {
272
+ if (statusCode < 100 || statusCode > 999) {
273
+ // WIT spec says "fails if the status-code given is not a valid http
274
+ // status code". Surface as a plain Error since this method has no
275
+ // typed error in the WIT.
276
+ throw new Error('status-code out of range');
277
+ }
278
+ this.statusCode = statusCode;
279
+ }
280
+ getHeaders() {
281
+ return this.headers;
282
+ }
283
+ static consumeBody(this_, _res) {
284
+ // If a body stream was provided directly (synthetic Response in tests),
285
+ // honor it. Otherwise lower the buffered Uint8Array from `client.send`
286
+ // into a ReadableStream<number> — one byte per chunk, because jco's
287
+ // stream lowering invokes `_lowerFlatU8` on each `value` returned from
288
+ // the stream's reader (see the block comment above `class Response`).
289
+ if (this_.body)
290
+ return [this_.body, this_.trailers];
291
+ const bytes = this_._bufferedBody ?? new Uint8Array(0);
292
+ // Enqueue the already-buffered body as ONE chunk. An earlier revision
293
+ // enqueued one byte per chunk on the belief that jco's `_lowerFlatU8`
294
+ // requires each stream value to be a single `number` — that is wrong. jco
295
+ // pulls values via the reader, and `PendingValueQueue.appendReadValue`
296
+ // batches array-like values (Uint8Array included) while `drainInto`
297
+ // re-expands them to individual u8s for `_lowerFlatU8` on the write side.
298
+ // The per-byte path cost a full async-task round-trip PER BYTE (~95 B/s; a
299
+ // 43 KB body took minutes / effectively hung). Whole-buffer enqueue drains
300
+ // the same body in <100 ms, byte-for-byte identical (verified). See ACT-153.
301
+ // The stream is nominally `ReadableStream<number>` per gen-types; the
302
+ // Uint8Array cast is intentional — jco expands it per-u8 (see above).
303
+ let sent = false;
304
+ const body = new ReadableStream({
305
+ pull(controller) {
306
+ if (!sent) {
307
+ sent = true;
308
+ if (bytes.length > 0)
309
+ controller.enqueue(bytes);
310
+ }
311
+ controller.close();
312
+ },
313
+ });
314
+ return [body, this_.trailers];
315
+ }
316
+ }
317
+ export const types = {
318
+ Fields,
319
+ Request,
320
+ RequestOptions,
321
+ Response,
322
+ };
323
+ function methodToString(m) {
324
+ switch (m.tag) {
325
+ case 'get': return 'GET';
326
+ case 'head': return 'HEAD';
327
+ case 'post': return 'POST';
328
+ case 'put': return 'PUT';
329
+ case 'delete': return 'DELETE';
330
+ case 'connect': return 'CONNECT';
331
+ case 'options': return 'OPTIONS';
332
+ case 'trace': return 'TRACE';
333
+ case 'patch': return 'PATCH';
334
+ case 'other': return m.val;
335
+ }
336
+ }
337
+ function schemeToString(s) {
338
+ if (!s)
339
+ return 'https';
340
+ if (s.tag === 'HTTP')
341
+ return 'http';
342
+ if (s.tag === 'HTTPS')
343
+ return 'https';
344
+ return s.val;
345
+ }
346
+ function fetchErrorToCode(e) {
347
+ const msg = e instanceof Error ? e.message : String(e);
348
+ const lower = msg.toLowerCase();
349
+ if (lower.includes('refused'))
350
+ return { tag: 'connection-refused' };
351
+ if (lower.includes('not found') || lower.includes('getaddrinfo')) {
352
+ return { tag: 'destination-not-found' };
353
+ }
354
+ if (lower.includes('timeout'))
355
+ return { tag: 'connection-timeout' };
356
+ return internalError(msg);
357
+ }
358
+ export const client = {
359
+ async send(request) {
360
+ const method = methodToString(request.getMethod());
361
+ const scheme = schemeToString(request.getScheme());
362
+ const authority = request.getAuthority();
363
+ if (!authority)
364
+ throw internalError('request missing authority');
365
+ const path = request.getPathWithQuery() ?? '/';
366
+ const url = `${scheme}://${authority}${path}`;
367
+ // `Headers` is locally aliased to `Fields`; use the global fetch class
368
+ // explicitly to avoid shadowing.
369
+ const fetchHeaders = new globalThis.Headers();
370
+ for (const [name, value] of request.getHeaders().copyAll()) {
371
+ const decoded = typeof value === 'string'
372
+ ? value
373
+ : new TextDecoder().decode(value);
374
+ fetchHeaders.append(name, decoded);
375
+ }
376
+ // Task 6 only exercises bodyless methods (GET / HEAD). Request bodies are
377
+ // a Task 7 problem — `request.body` is a `ReadableStream<number>` (a
378
+ // stream of byte ints, not bytes), and lowering that into a fetch body
379
+ // requires the consume-body wiring we're deferring.
380
+ let nativeResp;
381
+ try {
382
+ nativeResp = await fetch(url, {
383
+ method,
384
+ headers: fetchHeaders,
385
+ });
386
+ }
387
+ catch (e) {
388
+ throw fetchErrorToCode(e);
389
+ }
390
+ // Build the WIT Response. The constructor is private; go through the
391
+ // static `Response.new(...)` factory like callers must. Then attach the
392
+ // buffered body — `_bufferedBody` is Task 6's stopgap until Task 7 wires
393
+ // a real ReadableStream through `consumeBody`.
394
+ const respHeaders = new Fields();
395
+ for (const [name, value] of nativeResp.headers.entries()) {
396
+ // Skip forbidden response headers (e.g. set-cookie isn't forbidden, but
397
+ // host/connection/keep-alive in a response are nonsensical and would
398
+ // throw). undici's MockAgent doesn't synthesise these in our tests but
399
+ // real fetch responses might include `connection: close` etc.
400
+ try {
401
+ respHeaders.append(name, new TextEncoder().encode(value));
402
+ }
403
+ catch (e) {
404
+ // Drop forbidden / invalid-syntax headers silently; the alternative
405
+ // would be to fail the whole response on a peer-controlled header.
406
+ if (typeof e === 'object' && e !== null && 'tag' in e &&
407
+ e.tag === 'forbidden') {
408
+ continue;
409
+ }
410
+ throw e;
411
+ }
412
+ }
413
+ // Task 7 will replace this with the real trailers future from the fetch
414
+ // response (HTTP/2 trailers via response.trailer where available). For
415
+ // Task 6 we resolve with no trailers.
416
+ const noTrailers = Promise.resolve({ tag: 'ok', val: undefined });
417
+ const [wasiResp] = Response.new(respHeaders, undefined, noTrailers);
418
+ wasiResp.statusCode = nativeResp.status;
419
+ wasiResp._bufferedBody = new Uint8Array(await nativeResp.arrayBuffer());
420
+ return wasiResp;
421
+ },
422
+ };
423
+ // `satisfies true` forces the conditional to resolve to `true`. If drift
424
+ // makes the conditional resolve to `never`, the literal `true` is not
425
+ // assignable to `never` and tsc errors at that line.
426
+ //
427
+ // For `client.send` we only check the member exists and is callable —
428
+ // nominal class brands (private constructor() in gen-types' Request /
429
+ // Response) prevent direct param/return assignability even though the
430
+ // runtime objects are the same. The class checks below give us drift
431
+ // detection on the actual shape.
432
+ const _checkClient = true;
433
+ const _checkClientSendArity = true;
434
+ const _checkFieldsInstance = true;
435
+ const _checkFieldsStatic = true;
436
+ const _checkRequestInstance = true;
437
+ const _checkRequestStatic = true;
438
+ const _checkRequestOptionsInstance = true;
439
+ const _checkResponseInstance = true;
440
+ const _checkResponseStatic = true;
441
+ void [
442
+ _checkClient,
443
+ _checkClientSendArity,
444
+ _checkFieldsInstance,
445
+ _checkFieldsStatic,
446
+ _checkRequestInstance,
447
+ _checkRequestStatic,
448
+ _checkRequestOptionsInstance,
449
+ _checkResponseInstance,
450
+ _checkResponseStatic,
451
+ ];
452
+ //# sourceMappingURL=wasi-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasi-http.js","sourceRoot":"","sources":["../../src/shims/wasi-http.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;A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AO,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACjD,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QACpE,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC;QACxC,QAAQ,CAAC,aAAa,GAAG,IAAI,UAAU,CAAC,MAAM,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC;AA+BF,yEAAyE;AACzE,sEAAsE;AACtE,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,sEAAsE;AACtE,qEAAqE;AACrE,iCAAiC;AACjC,MAAM,YAAY,GAAG,IAGpB,CAAC;AACF,MAAM,qBAAqB,GAAG,IAG7B,CAAC;AACF,MAAM,oBAAoB,GAAG,IAM5B,CAAC;AACF,MAAM,kBAAkB,GAAG,IAG1B,CAAC;AACF,MAAM,qBAAqB,GAAG,IAQ7B,CAAC;AACF,MAAM,mBAAmB,GAAG,IAG3B,CAAC;AACF,MAAM,4BAA4B,GAAG,IAQpC,CAAC;AACF,MAAM,sBAAsB,GAAG,IAM9B,CAAC;AACF,MAAM,oBAAoB,GAAG,IAG5B,CAAC;AACF,KAAK;IACH,YAAY;IACZ,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,4BAA4B;IAC5B,sBAAsB;IACtB,oBAAoB;CACrB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * jco's transpiled output (and jco's own bindgen) load wasm via
3
+ * `WebAssembly.compileStreaming(fetch(...))` / `instantiateStreaming`. Chrome's
4
+ * strict MIME check rejects those for blob: URLs and for some dev-server setups
5
+ * (Vite, etc.) where the response Content-Type isn't exactly `application/wasm`.
6
+ * Wrap the streaming APIs with a fallback to the non-streaming variants, which
7
+ * don't MIME-check.
8
+ *
9
+ * Lives in its own module because it must run in two realms: the page (see
10
+ * host-api.ts) and the transpile Web Worker (see transpile.worker.ts), whose
11
+ * bindgen `$init` compiles a ~9 MB core wasm and would otherwise fail in dev.
12
+ *
13
+ * Idempotent — installs at most once per realm.
14
+ */
15
+ export declare function installCompileStreamingFallback(): void;
16
+ //# sourceMappingURL=streaming-fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-fallback.d.ts","sourceRoot":"","sources":["../src/streaming-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAwCtD"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * jco's transpiled output (and jco's own bindgen) load wasm via
3
+ * `WebAssembly.compileStreaming(fetch(...))` / `instantiateStreaming`. Chrome's
4
+ * strict MIME check rejects those for blob: URLs and for some dev-server setups
5
+ * (Vite, etc.) where the response Content-Type isn't exactly `application/wasm`.
6
+ * Wrap the streaming APIs with a fallback to the non-streaming variants, which
7
+ * don't MIME-check.
8
+ *
9
+ * Lives in its own module because it must run in two realms: the page (see
10
+ * host-api.ts) and the transpile Web Worker (see transpile.worker.ts), whose
11
+ * bindgen `$init` compiles a ~9 MB core wasm and would otherwise fail in dev.
12
+ *
13
+ * Idempotent — installs at most once per realm.
14
+ */
15
+ export function installCompileStreamingFallback() {
16
+ const w = WebAssembly;
17
+ if (w.__actcoreStreamingPatched)
18
+ return;
19
+ w.__actcoreStreamingPatched = true;
20
+ const origCompile = w.compileStreaming?.bind(WebAssembly);
21
+ if (origCompile) {
22
+ w.compileStreaming = async function (source) {
23
+ try {
24
+ return await origCompile(source);
25
+ }
26
+ catch (err) {
27
+ const msg = String(err.message || err);
28
+ if (!/MIME|Content-Type/i.test(msg))
29
+ throw err;
30
+ const resp = source instanceof Response ? source : await source;
31
+ return WebAssembly.compile(await resp.arrayBuffer());
32
+ }
33
+ };
34
+ }
35
+ const origInstantiate = w.instantiateStreaming?.bind(WebAssembly);
36
+ if (origInstantiate) {
37
+ w.instantiateStreaming = async function (source, imports) {
38
+ try {
39
+ return await origInstantiate(source, imports);
40
+ }
41
+ catch (err) {
42
+ const msg = String(err.message || err);
43
+ if (!/MIME|Content-Type/i.test(msg))
44
+ throw err;
45
+ const resp = source instanceof Response ? source : await source;
46
+ const buf = await resp.arrayBuffer();
47
+ return WebAssembly.instantiate(buf, imports);
48
+ }
49
+ };
50
+ }
51
+ }
52
+ //# sourceMappingURL=streaming-fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-fallback.js","sourceRoot":"","sources":["../src/streaming-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,+BAA+B;IAC7C,MAAM,CAAC,GAAG,WAOT,CAAC;IACF,IAAI,CAAC,CAAC,yBAAyB;QAAE,OAAO;IACxC,CAAC,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAEnC,MAAM,WAAW,GAAG,CAAC,CAAC,gBAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1D,IAAI,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC,gBAAgB,GAAG,KAAK,WAAW,MAAM;YACzC,IAAI,CAAC;gBACH,OAAO,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,GAAG,GAAG,MAAM,CAAE,GAAa,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;gBAClD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC;oBAAE,MAAM,GAAG,CAAC;gBAC/C,MAAM,IAAI,GAAG,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC;gBAChE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAG,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClE,IAAI,eAAe,EAAE,CAAC;QACpB,CAAC,CAAC,oBAAoB,GAAG,KAAK,WAAW,MAAM,EAAE,OAAO;YACtD,IAAI,CAAC;gBACH,OAAO,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,GAAG,GAAG,MAAM,CAAE,GAAa,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;gBAClD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC;oBAAE,MAAM,GAAG,CAAC;gBAC/C,MAAM,IAAI,GAAG,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC;gBAChE,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrC,OAAO,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared timing helpers for the run pipeline.
3
+ *
4
+ * Every phase logs a `console.debug` line with a duration and records a User
5
+ * Timing `measure` — Baseline, worker-available — so the phase shows in the
6
+ * DevTools Performance panel and is readable via
7
+ * `performance.getEntriesByType('measure')` / a `PerformanceObserver`.
8
+ */
9
+ /** Compact duration: `85ms` under 1s, else `9.2s`. */
10
+ export declare function fmtDuration(ms: number): string;
11
+ /**
12
+ * Record a User Timing `measure` named `name` spanning `start`→now. `labels`
13
+ * become string `detail` fields; `numbers` become numeric `detail` fields and
14
+ * are shown (formatted) as track properties. Best-effort — never throws (an
15
+ * engine may lack `measure`, or reject a `detail` that isn't structured-
16
+ * cloneable); the caller's `console.debug` still carries the duration.
17
+ *
18
+ * `detail.devtools` is Chrome's Performance-panel extensibility API: it groups
19
+ * these into a labeled "@actcore/web-runtime" track. Other engines ignore it.
20
+ */
21
+ export declare function measurePhase(name: string, start: number, labels: Record<string, string>, numbers?: Record<string, number>): void;
22
+ //# sourceMappingURL=timing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,IAAI,CAuBN"}
package/dist/timing.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Shared timing helpers for the run pipeline.
3
+ *
4
+ * Every phase logs a `console.debug` line with a duration and records a User
5
+ * Timing `measure` — Baseline, worker-available — so the phase shows in the
6
+ * DevTools Performance panel and is readable via
7
+ * `performance.getEntriesByType('measure')` / a `PerformanceObserver`.
8
+ */
9
+ /** Compact duration: `85ms` under 1s, else `9.2s`. */
10
+ export function fmtDuration(ms) {
11
+ return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${Math.round(ms)}ms`;
12
+ }
13
+ /**
14
+ * Record a User Timing `measure` named `name` spanning `start`→now. `labels`
15
+ * become string `detail` fields; `numbers` become numeric `detail` fields and
16
+ * are shown (formatted) as track properties. Best-effort — never throws (an
17
+ * engine may lack `measure`, or reject a `detail` that isn't structured-
18
+ * cloneable); the caller's `console.debug` still carries the duration.
19
+ *
20
+ * `detail.devtools` is Chrome's Performance-panel extensibility API: it groups
21
+ * these into a labeled "@actcore/web-runtime" track. Other engines ignore it.
22
+ */
23
+ export function measurePhase(name, start, labels, numbers) {
24
+ try {
25
+ const properties = [
26
+ ...Object.entries(labels),
27
+ ...Object.entries(numbers ?? {}).map(([k, v]) => [k, fmtDuration(v)]),
28
+ ];
29
+ performance.measure(name, {
30
+ start,
31
+ detail: {
32
+ ...labels,
33
+ ...numbers,
34
+ devtools: {
35
+ dataType: 'track-entry',
36
+ track: '@actcore/web-runtime',
37
+ color: 'primary',
38
+ properties,
39
+ tooltipText: name,
40
+ },
41
+ },
42
+ });
43
+ }
44
+ catch {
45
+ // User Timing unavailable or `detail` not cloneable — ignore.
46
+ }
47
+ }
48
+ //# sourceMappingURL=timing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.js","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,sDAAsD;AACtD,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC;AAC3E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,KAAa,EACb,MAA8B,EAC9B,OAAgC;IAEhC,IAAI,CAAC;QACH,MAAM,UAAU,GAA4B;YAC1C,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;YACzB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;SACxF,CAAC;QACF,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE;YACxB,KAAK;YACL,MAAM,EAAE;gBACN,GAAG,MAAM;gBACT,GAAG,OAAO;gBACV,QAAQ,EAAE;oBACR,QAAQ,EAAE,aAAa;oBACvB,KAAK,EAAE,sBAAsB;oBAC7B,KAAK,EAAE,SAAS;oBAChB,UAAU;oBACV,WAAW,EAAE,IAAI;iBAClB;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { RunComponentOptions } from './host-api.js';
2
+ /**
3
+ * Run jco transpile (cached / off-thread), patch the output, and return a blob:
4
+ * URL pointing at the entry ES module. Caller does `await import(url)` to load.
5
+ */
6
+ export declare function transpileToBlobUrl(bytes: Uint8Array, options: RunComponentOptions): Promise<{
7
+ url: string;
8
+ revoke: () => void;
9
+ }>;
10
+ //# sourceMappingURL=transpile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["../src/transpile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAwCzD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CA+C9C"}