Interfaces
PyricOptions
Properties
| Property | Type | Description |
|---|---|---|
ai? | PyricAiOptions | Dev-server-level AI configuration for pyric/ai (the sanctioned replacement for threading engine through every app getAI(...) call, which is first-call-wins and easy to get wrong). pyric({ ai: { model: ‘llama3.2’, proxyUpstream: ‘http://localhost:11434/v1’, // your Ollama }, }) - model is the simple OpenAI-compatible path. It uses the same-origin proxy and becomes the catch-all upstream model. PYRIC_AI_MODEL selects the same path when neither model nor engine is explicit. - engine is pyric/ai’s EngineConfig (scripted |
bridge? | | boolean | { disableAuditLog?: boolean; project?: string; } | Mount the MCP bridge on Vite’s dev origin so an external agent (Claude Code, Cursor) can drive this sandbox over MCP — POST /__pyric/mcp + GET /__pyric/health + WS /__pyric/sandbox, all on Vite’s port. true is shorthand for {}. The agent and the page share ONE sandbox. Does NOT change the sandbox topology: on the default SharedWorker path the page dials the bridge WS and relays agent tool-calls THROUGH the worker (connectBridgePeer), so multi-tab stays on. The in-page fallback engages only when the worker bundle itself fails, bridge or not. |
capture? | boolean | Write the live session fixture to .pyric/last-session.json (for pyric verify). Default true; pass false to suppress. |
fresh? | boolean | With persist: discard any existing state file and re-seed from scratch. |
functions? | | false | { instance?: string; region?: string; watch?: boolean; } | RTDB-triggered Cloud Functions under this dev server (the pyric dev parity fold). By default a functions block in firebase.json is discovered automatically: its onValueCreated triggers run in an isolated node child against the shared sandbox (other trigger kinds warn and are skipped), and the discovered codebase turns the MCP bridge mount on (the child dials the sandbox over the bridge WS — the page’s sandbox topology is unchanged, see bridge). functions: false is the off switch: no discovery, no child, no functions-forced bridge mount. Field precedence: explicit option > env var > firebase files > default. - region: the trigger location. Beats PYRIC_FUNCTIONS_RTDB_REGION; default us-central1. - instance: the RTDB instance name. Default <projectId>-default-rtdb, where projectId is PYRIC_PROJECT, else .firebaserc’s default project, else demo-project. - watch: hot-reload the functions source (default true, matching rules). A save under the functions source dir stops the child and respawns it — redeploy semantics: in-flight executions in the old child may drop, and writes landing during the swap gap are consumed as the new child’s baseline (they do not fire). Unlike rules, a broken save cannot keep last-good live — the old child is already gone — so functions stay down until the next good save. |
persist? | boolean | Persist sandbox state to .pyric/state/state.json so data + test users survive reloads/restarts. Off by default (ephemeral). |
root? | string | Project dir for firebase.json / rules discovery. Default: Vite’s root. |
rules? | string | Firestore rules path (relative to root). Default discovery prefers an authored firestore.modules.rules, then firebase.json, then firestore.rules in the project root. |
runtimeChip? | PyricRuntimeChipOption | Inject the collapsed Pyric runtime chip into the app during sandbox Vite dev/builds. On by default. Pass false to hide it, or { initiallyOpen: true } when actively debugging runtime errors. |
seed? | string | Seed file: a "collection/doc" → fields JSON map, or a pyric snapshot state-file envelope. Applied at page init (state wins once it exists). |
swapInBuild? | boolean | Force whether vite build runs the firebase→pyric swap, overriding the mode default. Unset (default): swap for any NON-production mode, keep real firebase for mode production. true = always produce a sandbox build; false = never swap in build (real firebase regardless of mode). vite dev is unaffected — the swap is always on there. |
ui? | boolean | Serve the Pyric Studio app at /__pyric/ui/ on Vite’s dev origin (the pyric dev --ui equivalent). Mounts the disk-backed workspace/project routes Studio’s local mode talks to AND serves the unified Astro site (vendored in this package at dist/serve/site-ui). On by default, including under bridge (the bridge peer routes through the SharedWorker, so app, Studio, and agent all observe the one sandbox); pass ui: false to disable. |
Type Aliases
PyricRuntimeChipOption
type PyricRuntimeChipOption =
| boolean
| {
initiallyOpen?: boolean;
};
Variables
NODE_BUILTIN_RE
const NODE_BUILTIN_RE: RegExp;
The node builtins pyric’s browser graph reaches for (via the rules module
resolver). Bare and node:-prefixed both match.
NODE_BUILTIN_SHIMS
const NODE_BUILTIN_SHIMS: Record<string, string>;
Benign browser shim SOURCE per builtin (see header — droppable only when
pyric breaks the firestore/index → rules/tools → modules/resolver static
chain, #553). Exported so the Vite plugin (./vite) reuses the SAME shims
through its own resolveId/load + optimizeDeps esbuild pass, instead of
re-deriving them.
Functions
pyric()
function pyric(options?: PyricOptions): Plugin;
The dev-only Vite plugin. Add to vite.config:
import { pyric } from ‘@pyric/cli/vite’; export default defineConfig({ plugins: [pyric()] });
Parameters
| Parameter | Type |
|---|---|
options? | PyricOptions |
Returns
Plugin