ADR-0004 — TypeScript monorepo, runtime-agnostic core, Hono
- Status: accepted (owner, 2026-10-16)
- Date: 2026-10-16
- Related: ARCHITECTURE.md §2, P0-01, L-095, L-102
Context
Section titled “Context”The same server must run as a local stdio process started by an MCP client, as a self-hosted Node/Docker HTTP server, and as a Cloudflare Worker. Duplicating the logic per runtime would multiply bugs and security review effort.
Decision
Section titled “Decision”- A pnpm monorepo in TypeScript (strict mode,
exactOptionalPropertyTypes,noUncheckedIndexedAccess). - Packages
core,auth,http-app,admin-ui(andstorageinterfaces) use web-standard APIs only:fetch, WebCrypto,URL, streams,TextEncoder. A lint rule and a CI script refusenode:*imports,processandBufferthere. Clock, randomness, storage and outboundfetchare injected. - Runtime-specific code lives only in adapters and apps:
storage-sqlite(Node), the D1 adapter,apps/cli(Node: stdio,serve, management commands) andapps/worker(Cloudflare). - Hono is the HTTP layer (runs on Workers and on Node through
@hono/node-server). - The admin panel is server-rendered Hono JSX with auto-escaping only and minimal static JavaScript (no inline scripts or styles, strict CSP).
- Tooling: Biome (lint/format), Vitest, tsdown (bundling), Changesets, Lefthook. Exact versions are pinned in P0-01.
Consequences
Section titled “Consequences”- One implementation of tools, access control, output shaping and audit for every deployment mode.
- Some Node conveniences (e.g. custom TLS agents) must be injected from the Node app into the core through interfaces (see ADR-0014 for custom CA bundles).
- Only one package (
agility-bridge, the CLI) is published to npm at first; internal packages stay private until their contracts are stable.
Alternatives considered
Section titled “Alternatives considered”- Node-only core with a separate Worker port: rejected; two implementations drift.
- Another language (Java, Go, Python): rejected for this project; the MCP TypeScript SDK v2 and Workers support are the reference implementations for the transports we need.
agility-bridge is an unofficial, community project. It is not affiliated with, endorsed by, or supported by Digital.ai. Digital.ai, Agility and VersionOne are trademarks of their respective owners.