Skip to content

Commit 2858eca

Browse files
committed
chore: consume @actcore/web-runtime (renamed from @actcore/host)
1 parent 031c13f commit 2858eca

8 files changed

Lines changed: 32 additions & 30 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- uses: actions/checkout@v4
2626
with:
27-
repository: actcore/host-browser
27+
repository: actcore/web-runtime
2828
path: host-browser
2929

3030
- uses: actions/setup-node@v4
@@ -39,7 +39,7 @@ jobs:
3939
chmod +x "$RUNNER_TEMP/wkg"
4040
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
4141
42-
- name: Build @actcore/host
42+
- name: Build @actcore/web-runtime
4343
working-directory: host-browser
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -48,7 +48,7 @@ jobs:
4848
npm run sync-wit
4949
npm run build
5050
51-
- name: Install actcore.dev deps (resolves @actcore/host via file:../host-browser)
51+
- name: Install actcore.dev deps (resolves @actcore/web-runtime via file:../host-browser)
5252
working-directory: actcore.dev
5353
run: npm install
5454

astro.config.mjs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ import { fileURLToPath } from 'node:url';
99

1010
import sitemap from '@astrojs/sitemap';
1111

12-
// @actcore/host imports jco's in-browser transpiler from a vendored bindgen at
12+
// @actcore/web-runtime imports jco's in-browser transpiler from a vendored bindgen at
1313
// this subpath, which jco-transpile does not list in its package `exports`, so
1414
// Vite/Rollup's resolver can't reach it — alias to the concrete file.
1515
//
16-
// TEMPORARY: point at a locally-built LTO bindgen instead of node_modules. The
17-
// published jco-transpile ships a non-LTO bindgen (release CI reused a build
18-
// cache; fixed upstream in bytecodealliance/jco#1737 but not yet released),
19-
// which is 8.9 MiB / ~56s vs this 3.1 MiB / ~7.5s. Revert to the node_modules
20-
// path once a fixed jco-transpile (> 0.4.1) publishes. See
21-
// vendor/jco-bindgen-lto/README.md.
16+
// TEMPORARY: point at a locally-built bindgen instead of node_modules. The
17+
// published jco-transpile ships the *debug* js-component-bindgen (wasm-opt'd)
18+
// instead of the release build — a debug/release obj/ filename collision in
19+
// jco's build:release clobbers the release component with the 132 MiB debug one.
20+
// Result: 8.9 MiB / ~56s vs this 3.1 MiB / ~7.5s. Revert to the node_modules
21+
// path once upstream fixes the collision and republishes. See
22+
// vendor/jco-bindgen-lto/README.md for the verified root cause + rebuild recipe.
2223
const jcoBindgen = fileURLToPath(
2324
new URL(
2425
'./vendor/jco-bindgen-lto/js-component-bindgen-component.js',
@@ -39,7 +40,7 @@ export default defineConfig({
3940
jcoBindgen,
4041
},
4142
},
42-
// @actcore/host runs jco's transpiler in a module Web Worker that
43+
// @actcore/web-runtime runs jco's transpiler in a module Web Worker that
4344
// dynamic-imports the bindgen core wasm — needs ES worker format.
4445
worker: { format: 'es' },
4546
// The vendored bindgen is a ~9MB minified module; sourcemap generation
@@ -48,9 +49,9 @@ export default defineConfig({
4849
build: { sourcemap: false },
4950
esbuild: { sourcemap: false },
5051
optimizeDeps: {
51-
exclude: ['@actcore/host', '@bytecodealliance/jco-transpile'],
52+
exclude: ['@actcore/web-runtime', '@bytecodealliance/jco-transpile'],
5253
},
53-
// @actcore/host is a linked dep (file:../host-browser) outside root; its
54+
// @actcore/web-runtime is a linked dep (file:../host-browser) outside root; its
5455
// worker entry is fetched at runtime in dev.
5556
server: { fs: { allow: ['..'] } },
5657
},

package-lock.json

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"astro": "astro"
1414
},
1515
"dependencies": {
16-
"@actcore/host": "file:../host-browser",
16+
"@actcore/web-runtime": "file:../host-browser",
1717
"@astrojs/rss": "^4.0.19",
1818
"@astrojs/sitemap": "^3.7.3",
1919
"@astrojs/starlight": "^0.41.2",

public/host/shims/sockets.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Browser wasi:sockets shim for @actcore/host.
2+
* Browser wasi:sockets shim for @actcore/web-runtime.
33
*
44
* preview2-shim's browser build ships wasi:sockets as method-only stub objects
55
* that OMIT the resource-class constructors (ResolveAddressStream, Network,

public/host/shims/sockets.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/copy-engine-assets.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// can serve them same-origin:
33
// • preview2-shim/ — @bytecodealliance/preview2-shim browser build
44
// (wasi:cli/clocks/filesystem/io/random)
5-
// • host/shims/ — @actcore/host's own wasi:http + wasi:sockets shims
5+
// • host/shims/ — @actcore/web-runtime's own wasi:http + wasi:sockets shims
66
// (the sockets shim carries the resource classes the
77
// preview2-shim browser build omits — now upstream in
88
// host-browser, so nothing is patched here)
@@ -38,13 +38,13 @@ async function main() {
3838
console.warn('WARN: preview2-shim browser build not found; run npm install first');
3939
}
4040

41-
const hostShims = R('node_modules/@actcore/host/dist/shims');
41+
const hostShims = R('node_modules/@actcore/web-runtime/dist/shims');
4242
if (await exists(hostShims)) {
4343
await mkdir(R('public/host'), { recursive: true });
4444
await cp(hostShims, R('public/host/shims'), { recursive: true });
4545
console.log('copied host shims (wasi-http + sockets)');
4646
} else {
47-
console.warn('WARN: @actcore/host dist/shims not found; is host-browser built?');
47+
console.warn('WARN: @actcore/web-runtime dist/shims not found; is host-browser built?');
4848
}
4949
}
5050

src/lib/act-engine.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Real engine for the python.astro demo.
33
*
4-
* Wires the ACT browser host (@actcore/host) + WebLLM into three operations the
4+
* Wires the ACT browser host (@actcore/web-runtime) + WebLLM into three operations the
55
* PythonPlayground.svelte component drives:
66
* 1. loadComponent() — fetch + instantiate python-env in a WASI sandbox, open
77
* a session, and inject the sample CSV so `pd.read_csv("sample.csv")` works
@@ -10,12 +10,12 @@
1010
* 3. loadModel() / askModel() — a small local LLM (WebLLM) that WRITES pandas
1111
* and calls the SAME `exec` tool via prompt-based tool dispatch.
1212
*
13-
* NOTE on load performance: this uses @actcore/host's in-tab transpile. The
13+
* NOTE on load performance: this uses @actcore/web-runtime's in-tab transpile. The
1414
* ~100MB component transpile is CPU-heavy on first load (see ACT-150 for the AOT
1515
* pre-transpile that removes the freeze). Everything here is real: real
1616
* numpy/pandas, real capability sandbox, real local model.
1717
*/
18-
import { runComponent } from '@actcore/host';
18+
import { runComponent } from '@actcore/web-runtime';
1919
import { encode as cborEncode } from 'cbor2';
2020
import {
2121
CreateMLCEngine,
@@ -68,7 +68,7 @@ export const DEFAULT_CODE =
6868
// `pandas` and `image` are pure local compute. `install` demonstrates a real
6969
// `install`-from-PyPI over wasi:http — re-enabled after fixing ACT-153: jco's
7070
// `_lowerFlatOption` treated an empty trailers option (`undefined`) as `some`,
71-
// crashing wasi:http body completion (patched in @actcore/host's patches.ts,
71+
// crashing wasi:http body completion (patched in @actcore/web-runtime's patches.ts,
7272
// pending bytecodealliance/jco#1722), plus a per-byte body-drain throughput fix
7373
// in host-browser's wasi:http shim (43 KB body: an effective hang → ~70 ms).
7474
//

0 commit comments

Comments
 (0)