Skip to content

Ports ​

Ports are TypeScript types (and tiny aliases) under app/src/ports/. They are the only place application code names an infrastructure capability.

Catalog ​

PortFileImplemented byWhy it exists
Clockclock.tsadapters/system/clock.tsDeterministic tests; ISO timestamps
FileSystemfilesystem.tsadapters/system/filesystem.tsTiny exists/read/write used by supervisor
ProcessRuntimeprocess-runtime.tsProcessManagerSpawn, stop, runOnce, containers
HealthChecker / HealthCheckerFactoryhealth-checker.tsadapters/health/health.ts + pluginsHTTP/TCP/process/command/gRPC (+ custom types)
LogStorelog-store.tsworker-log-store.ts / in-process LogManagerRing + persist + page + redact
SpanStorespan-store.tsadapters/storage/spans.tsTrace trees
LlmCallStorellm-call-store.tsadapters/llm/store.tsInspector ring
LlmSource / factoryllm-source.tsadapters/llm/factory.ts, LiteLLM + proxy drivers, pluginsPull (spend logs) or push (proxy capture) sources
LlmCaptureSinkllm-capture.tsadapters/llm/proxy-capture.tsProxy tees completion bodies into the LLM store without importing the llm package
TrafficCallStoretraffic-call-store.tsadapters/traffic/store.tsTraffic inspector ring
TrafficCaptureSinktraffic-capture.tsadapters/traffic/capture.tsHTTP/gRPC proxies tee bodies into the traffic store without importing the traffic package
HttpRecipeRuntimehttp-recipe-runtime.tsadapters/http/runtime.tsNamed outbound fetches + cache
DoctorRunnerdoctor-runner.tsadapters/doctor/doctor.tsDiagnostics without adapter types in application
McpHost / McpListener / factorymcp-host.tsSupervisor facade + McpHttpServerMCP tools call this, not Supervisor
WebListener / factoryweb-host.tsWebHttpServerSame host API, HTML/JSON
Updateupdate.tsadapters/update/update.tsGitHub release check/apply
CredentialProvidercredential-provider.ts(reserved)Future token-provider split; unused; Knip-ignored
DaemonCommandHost / DaemonCommandsdaemon-commands.tsSupervisor + commandsForHostRPC/commands without importing application from adapters
ServiceOrchestratorPort / HealthControllerorchestrator.tsServiceOrchestrator / HealthMonitorSupervisor holds a port, not a concrete import of application internals beyond bind
LifecycleSession / HealthHostlifecycle-session.tsSupervisor object literalOrchestrator callbacks into daemon-owned state

ports/daemon.ts re-exports orchestrator + command host types for a single import path.

ProcessRuntime contract ​

ts
start(spec) / startContainer(spec) / stop(name, graceMs)
runOnce(spec)          // tasks, hooks, exec, doctor commands
isRunning / get / all

ProcessSpec includes shell, graceMs, line and exit callbacks. Containers have image, volumes, limits, mapped ports.

LifecycleSession ​

The orchestrator’s view of the daemon. Notable fields:

  • runtimes, ports, clientEnv, processMeta, serviceProfile
  • prepareServiceIdentity, resolveServiceExecution, ensureHttpRecipes
  • claimIfAlreadyUp, assignPendingPorts, releasePorts, forgetService
  • detectGoogle, startProxy, proxySuppressed
  • setState, persistState, fail, log

When you need a new capability during startOne, add it here (and on the supervisor’s lifecycleSession() object). Do not pass Supervisor into the orchestrator.

McpHost ​

Subset of daemon operations MCP and the web UI share: status, logs page, LLM, traffic, config, validate text, start/stop/restart, reload, doctor, exec, tasks, proxy, traces. config() for MCP is a redacted summary via tools; full config_snapshot stays RPC-only.

Do not add ​

  • IOrchestratorService wrapping ServiceOrchestrator — the class already implements a port.
  • Ports for every adapter function. TokenManager is still a concrete class injected at bootstrap; Google stays behind that class and detectGoogle function types on the supervisor deps.

Released under the MIT License. Use at your own risk.