Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/agentos/src/shell-replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ interface GhosttyModule {
): HeadlessTerminal;
}

interface WebAssemblyRuntime {
instantiate(
bytes: Uint8Array,
imports: Record<string, Record<string, () => void>>,
): Promise<{ instance: object }>;
}

interface GhosttyCell {
codepoint: number;
fg_r: number;
Expand Down Expand Up @@ -75,10 +82,19 @@ async function loadGhostty(): Promise<GhosttyModule> {
const bytes = await readFile(
require.resolve("ghostty-web/ghostty-vt.wasm"),
);
const { instance } = await WebAssembly.instantiate(bytes, {
const webAssembly = Reflect.get(globalThis, "WebAssembly") as
| WebAssemblyRuntime
| undefined;
if (!webAssembly) {
throw new Error("WebAssembly is unavailable in this runtime");
}
const { instance } = await webAssembly.instantiate(bytes, {
env: { log: () => {} },
});
return new Ghostty(instance) as unknown as GhosttyModule;
const GhosttyConstructor = Ghostty as unknown as new (
instance: object,
) => GhosttyModule;
return new GhosttyConstructor(instance);
})();
return ghosttyPromise;
}
Expand Down
7 changes: 0 additions & 7 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ packages:
- examples/*/*
- experiments/gigacode
- scripts/publish
# LOCAL WORKAROUND (do not commit): `website` needs @rivet-dev/docs-theme
# symlinked into website/vendor/theme, which isn't set up here and blocks
# `pnpm install` workspace-wide. Excluded to build/run the demo locally.
- website
- website/vendor/theme
- website/vendor/theme/vendor/components
- website/vendor/theme/vendor/icons

ignoredBuiltDependencies:
- '@clerk/shared'
Expand Down
Loading