server
26 modules
server/backend_action_types.gen.ts
server/backend_action_types.ts
server/backend_actions_api.ts
server/backend_provider_chatgpt.ts
server/backend_provider_claude.ts
server/backend_provider_gemini.ts
server/backend_provider_ollama.ts
server/backend_provider.ts
server/backend_pty_manager.ts
server/backend.ts
server/constants.ts
Server-side constants (Deno-compile-safe).
Mirror of
src/lib/constants.tsfor modules in the Deno compile chain. Must not import$env/static/publicor any SvelteKit build-time module — those don't exist in Deno and crashgro build/deno compile.server/create_zzz_app.ts
Runtime-agnostic zzz app factory.
Creates the full application by combining fuz_app's
create_app_backendandcreate_app_serverwith zzz's domain Backend, AI providers, and WebSocket endpoint. Called by the server entry point (server/server.ts).server/db/zzz_schema.ts
Database schema initialization for zzz.
Runs fuz_app auth migrations. No zzz-specific DDL yet (all domain state is in-memory via Cells).
server/helpers.ts
server/pty_ffi.ts
server/register_websocket_actions.ts
WebSocket endpoint wiring — thin wrapper over fuz_app's
register_ws_endpoint.zzz supplies the action tuples (spec + handler) and the per-request DB handle; fuz_app owns the upgrade middleware stack (origin check, auth, authorization phase that builds
RequestContext), dispatch, validation, and transport bookkeeping. Domain deps flow throughcreate_zzz_action_handlers(backend)— the factory closes over the Backend, so handlers receive the unifiedActionContextdirectly.The shared
protocol_actionsbundle (heartbeat + cancel pre-paired with their handlers) is spread first so disconnect detection and per-request cancellation are identical across every fuz_app consumer.server/scoped_fs.ts
server/security.ts
Host header validation middleware for DNS rebinding defense-in-depth.
Validates that the Host header matches expected local hostnames. Requests without a Host header are allowed (HTTP/1.0, CLI tools).
server/server_env.ts
Server environment configuration.
Extends
BaseServerEnvfrom fuz_app with zzz-specific fields. Usesload_envfrom fuz_app for schema-validated loading.server/server.ts
Deno server entry point for zzz.
Single entry point for both dev mode (
gro devviagro_plugin_deno_server) and production (zzz daemon start). Uses the shared create_zzz_app factory for the Hono app with fuz_app auth stack, then binds withDeno.serveand handles daemon lifecycle.server/testing_server_core.ts
Runtime-agnostic test-binary core for the TS canonical zzz server.
Shared by the Deno (
testing_server_deno.ts) and Node (testing_server_node.ts) test-binary adapters: same create_zzz_app factory, same_testing_resetregistration, samereset_stateclosure, same daemon-info + shutdown discipline. The two runtime adapters only supply the boundary primitives that diverge between Deno and Node (HTTP serve, WS upgrade construction, signal registration, pid, exit).Production stays on Deno (
server.ts). Both test entries register_testing_resetfrom fuz_app'screate_testing_actionsfactory with a zzzreset_stateclosure that closes all workspaces, kills terminals viaPtyManager.kill_all, and wipes the optionalZZZ_TESTING_SCRATCH_DIRtree.NEVER ship in a release. The module reaches into fuz_app's
testing/cross_backend/modules which throw at production-bundle load viaassert_dev_env. Thetesting_filename prefix mirrors the Rusttesting_zzz_serverconvention and is enforced for the Rust side bycargo xtask check-release's dep-graph audit.server/testing_server_deno.ts
Deno test-binary adapter for the TS canonical zzz server.
Thin adapter over
testing_server_core.ts: bindsDeno.serveandhono/deno's module-levelupgradeWebSocketfor the WS upgrade path. The shared core owns env loading,_testing_resetregistration, daemon-info lifecycle, and shutdown coordination.Counterpart to
testing_server_node.ts— both spawn the same create_zzz_app factory and register_testing_resetagainst it. The split exists so cross-process integration suites can compare runtime-level behavior on identical TS canonical surfaces:- Deno vs Node JS-runtime perf (V8 in both, but distinct I/O loops, fetch impls, HTTP servers). - Wire-shape parity between the two TS runtimes (a divergence here would mean fuz_app's runtime-agnosticism slipped).
The Rust
testing_zzz_servercovers the cross-language axis (TS vs Rust); these two cover the cross-runtime axis on the same TS surface.NEVER ship this in a release. See
testing_server_core.tsfor the production-safety contract.Run with: deno run --allow-net --allow-read --allow-env --allow-write --allow-sys src/lib/server/testing_server_deno.ts
Or via the npm script (recommended — bundles the permissions flags): npm run test:server:deno
Env vars: see
testing_server_core.ts.server/testing_server_node.ts
Node/bun-runnable test-binary adapter for the TS canonical zzz server.
Thin adapter over
testing_server_core.ts: bindsDeno.serve's counterpart@hono/node-server'sserve()and@hono/node-ws'screateNodeWebSocket(app)for the WS upgrade path. The shared core owns env loading,_testing_resetregistration, daemon-info lifecycle, and shutdown coordination.NEVER ship this in a release. See
testing_server_core.tsfor the production-safety contract.Run with: gro run src/lib/server/testing_server_node.ts bun src/lib/server/testing_server_node.ts
Env vars: see
testing_server_core.ts.server/zzz_action_handlers.ts
Unified action handler factory for zzz.
create_zzz_action_handlers(backend)is the single source of truth for all 23 request_response handlers. Both HTTP RPC and WebSocket dispatch call into the same map. The Backend is closed over at construction time — handlers receive fuz_app's unifiedActionContext(auth, db, request_id, notify, signal) without any context extension.server/zzz_route_specs.ts
Shared zzz route spec factory.
Used by the production server, integration tests, and attack surface helpers. Does NOT include bootstrap routes (factory-managed by
create_app_server).server/zzz_rpc_actions.ts
RPC actions for zzz — thin adapter from unified handlers to fuz_app's
RpcActionformat.Binds
create_zzz_action_handlers(backend)once and pairs each handler with its spec forcreate_rpc_endpoint. All business logic lives in server/zzz_action_handlers.ts.