Transports
The three shipped transports + how to inspect them via the runtime.
What ships
| Transport | Source | When it's used |
|---|---|---|
dartc | packages/shim/src/transports/webrtc.ts | Primary. DARTC over a WebRTC DataChannel labelled dartc.v0. |
fallback | packages/shim/src/transports/fallback.ts | Owner offline / no WebRTC. WebGPU + transformers.js + Gemma 4. |
direct | packages/shim/src/transports/direct.ts | Dev convenience. HTTP straight to a local Ollama. |
Selector behaviour
selectTransport(config) tries them in fixed order:
dartcifconfig.transport.dartcis set. Wait for the data channel to open.fallbackifconfig.transport.fallbackis set andnavigator.gpuexists. Returned unprepared — the host must callprepare()on a user gesture.directifconfig.transport.directis set.
config.transport.preferred = […] from pod.toml is parsed but not
yet honoured by the selector — it's advisory metadata today.
The selector throws if none succeed; the trace of failures is on
runtime.transport.trace.
Inspecting the active transport
runtime.transport.status; // "idle" | "connecting" | "ready" | "error" | "destroyed"
runtime.transport.name; // "dartc" | "fallback" | "direct"
runtime.transport.trace; // string[] of attempts that failed
runtime.transport.error; // last error message
runtime.transport.dartcEvents; // stage events from the WebRTC ladder
runtime.getTransport(); // the live Transport instanceFor a compact one-liner snapshot suitable for status badges or logs:
import { quickTransportStatus } from "@gemmapod/embed/runtime";
console.log(quickTransportStatus(runtime));
// { phase: "ready", transportName: "dartc", detail: "via dartc" }(quickTransportStatus is also exposed on the IIFE global as
GemmaPod.quickTransportStatus.)
attachBrowserFallbackPrepare
If you want the WebGPU fallback panel rendered into a specific DOM node
without using mountPod's fallbackUi: "default":
import { attachBrowserFallbackPrepare } from "@gemmapod/embed/runtime";
const unmount = attachBrowserFallbackPrepare(myEl, runtime);
// later
unmount();The panel handles model picker, cache state, WebGPU availability, and the explicit prepare button. See in-browser fallback guide for the UX.
Direct access to the FallbackTransport
For a fully custom prepare UI:
import { FallbackTransport } from "@gemmapod/shim";
const t = runtime.getTransport();
if (t instanceof FallbackTransport) {
await t.prepare((progress) => updateProgressBar(progress));
}prepare(), abort(), setModel(), cacheStatus() are the lower-level
hooks the default panel uses internally.