Deno
Deno is an Agent Package runtime target and a host boundary for Deno-shaped Provider Output. ViteHub keeps Agent Definitions, Schedule Definitions, KV Stores, and Runtime Helpers portable; Deno-specific code stays in generated output and driver configuration.
Deno boundaries
| Concern | ViteHub boundary |
|---|---|
| Agent chat and webhook routes | Agent Package writes .vitehub/agent/deno-server.ts when runtime: 'deno' and hosted Agent Definitions exist. It mounts the conventional chat dispatcher and webhook route; route-enabled Channels select which Agents answer chat requests. |
| Static cron schedules | Schedule Package writes .vitehub/schedule/deno-cron.mjs for Deno Deno.cron wake output. |
| Lightweight state | KV Package can use driver: 'deno-kv' and native Deno.openKv(). |
| Deployment | Deno Deploy owns app entrypoint configuration, environment variables, permissions, logs, and production rollout. |
Deno output boundary
The Agent integration selects Deno when generated Agent routes run through Deno.serve. Other primitives retain their package-owned runtime options.
import { hubAgent } from '@vite-hub/agent/vite'
import { hubKv } from '@vite-hub/kv/vite'
import { hubSchedule } from '@vite-hub/schedule/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
hubAgent({ runtime: 'deno' }),
hubKv(),
hubSchedule(),
],
kv: {
driver: 'deno-kv',
},
})
The generated Agent server imports discovered Agent Definitions and mounts both the webhook route pattern and the conventional /api/_vitehub/agents/[agent]/chat dispatcher.
If Schedule output exists, the generated server loads .vitehub/schedule/deno-cron.mjs before serving requests.
Generated output
A production-shaped build writes the Deno files under .vitehub.
In a Nuxt app, the Agent entrypoint is written under Nuxt's build directory at .nuxt/vitehub/agent/deno-server.ts by default; the Schedule output remains project-owned under .vitehub/schedule.
pnpm build
test -f .vitehub/agent/deno-server.ts
find .vitehub -maxdepth 4 -type f | sort
The generated server runs locally with Deno network permission for the selected port.
deno run --allow-net=127.0.0.1:8787 .vitehub/agent/deno-server.ts --host 127.0.0.1 --port 8787
A route using driver: 'deno-kv' also requires Deno KV support.
deno run --unstable-kv --allow-net=127.0.0.1:8787 .vitehub/agent/deno-server.ts --host 127.0.0.1 --port 8787
For a single discovered support Agent with the default chat route enabled, the generated route accepts the following request. The target Agent must attach a route-enabled webChat() Channel; Agents without one remain unreachable through the dispatcher.
curl -X POST http://127.0.0.1:8787/api/_vitehub/agents/support/chat \
-H 'content-type: application/json' \
-d '{"id":"local","messages":[{"id":"user-1","role":"user","parts":[{"type":"text","text":"ping"}]}]}'
Production notes
Deno Deploy uses .vitehub/agent/deno-server.ts as the generated server entrypoint.
For Nuxt, configure .nuxt/vitehub/agent/deno-server.ts instead, or the equivalent path under a custom buildDir.
Do not import generated files from application code to work around deployment configuration; keep application code on Agent Definitions, Runtime Helpers, and stable ViteHub imports.
Use Deno environment variables for model keys and other Runtime Env.
If you use Deno KV, verify the deployed runtime can call Deno.openKv() and choose an explicit KV Store when local development must not share production state.
Next steps
- Use Runtime and host support for the qualified host boundary.
- Use Provider output for generated artifact boundaries.
- Use Generated files to inspect
.vitehub/**. - Use Config options for Agent
runtimeand KVdriverplacement.