@dawn-ai/cli

Use this when

Most application developers use the dawn command to develop, test, build, and serve an app. Import the package root only to embed the Node server. Use /fetch when an edge adapter supplies generated modules and the durable stores its routes need; it may also supply an already-constructed configuration, while omitted configuration uses runtime defaults. /runtime is low-level tooling; /testing is a deprecated compatibility alias.

Install and import

For command-only development, install the CLI as a development dependency:

bash
pnpm add -D @dawn-ai/cli
pnpm exec dawn dev

Install it as a runtime dependency when production code or a generated server imports the package:

bash
pnpm add @dawn-ai/cli
ts
import { serveRuntime } from "@dawn-ai/cli"
import { createRuntimeFetchHandler } from "@dawn-ai/cli/fetch"

Compatibility and audience

SurfaceRuntimePurityAudienceStability
@dawn-ai/clinode-onlynot-claimedapplicationsupported
@dawn-ai/cli/fetchedge-safenot-claimedintegrationsupported
@dawn-ai/cli/runtimenode-onlynot-claimedtoolinglow-level
@dawn-ai/cli/testingnode-onlynot-claimedtestingsupported
bin:dawnnode-onlyn/atoolingsupported

Public exports

@dawn-ai/cli

ExportResponsibility
DawnStaticModulesMap generated route modules for runtime boot.
ServeRuntimeHandleControl an embedded server.
ServeRuntimeOptionsConfigure an embedded Node server.
StaticRouteModuleDescribe one generated route module.
configRe-export @dawn-ai/core configuration typing.
createProgramConstruct the command program for custom I/O.
isExecutedAsMainDetect direct executable invocation.
loadStaticModulesLoad generated static route modules.
renderErrorFormat a CLI-facing error.
runRun the command program with explicit arguments.
serveRuntimeStart the production Node runtime server.

@dawn-ai/cli/fetch

ExportResponsibility
BootResolvedInstancesHold stores resolved before request handling.
DawnStaticModulesMap generated route modules.
RequestStoresSupply request-scoped durable stores.
RuntimeBootFallbacksDefine optional runtime boot fallbacks.
RuntimeEnvRe-export the @dawn-ai/core runtime environment type.
RuntimeFetchHandlerHandle a web-standard runtime request.
StartRuntimeServerOptionsShare runtime assembly inputs.
StaticRouteModuleDescribe one materialized route module.
StaticRouteModuleInputDescribe a generated route-module input.
StaticToolModuleInputDescribe a generated tool-module input.
StreamChunkRepresent one runtime stream chunk.
buildStaticRouteModuleBuild one route module without filesystem discovery.
createRuntimeFetchHandlerAssemble a web-standard request handler.
normalizeMiddlewareModuleNormalize generated middleware exports.
normalizeThreadAccessModuleNormalize generated thread-access policy exports.
readRuntimeEnvRe-export @dawn-ai/core environment lookup.
seedDawnConfigRe-export @dawn-ai/core static configuration seeding.
seedModelImporterRe-export the @dawn-ai/langchain static importer seam; its deep reference is deferred.
seedRuntimeEnvRe-export @dawn-ai/core environment seeding.

@dawn-ai/cli/runtime

ExportResponsibility
DawnResumeEntryDescribe one submitted interrupt decision.
normalizeThreadAccessResultCoerce a policy's return value into a decision the runtime can act on.
DawnStaticModulesMap generated route modules.
MaterializeResolvedRouteGraphOptionsConfigure route graph materialization.
PendingInterruptDescribe a pending human decision.
PendingInterruptSnapshotSnapshot pending decisions for a thread.
PermissionDecisionRepresent a human permission decision.
PreparedRouteModulesHold prepared modules for a route.
ResumeResolutionRepresent resolved resume input.
RuntimeFetchHandlerHandle runtime fetch requests.
RuntimeRegistryResolve materialized routes.
RuntimeRequestListenerHandle Node HTTP requests.
SandboxManagerManage runtime sandboxes.
ServeRuntimeHandleControl a running server.
ServeRuntimeOptionsConfigure production server boot.
StartRuntimeServerOptionsConfigure low-level server assembly.
StaticRouteModuleDescribe a generated route module.
StaticRouteModuleInputDescribe a route-module input.
StaticToolModuleInputDescribe a tool-module input.
StreamChunkRepresent one stream chunk.
__resetMaterializedAgentsForTestsReset LangChain materialization caches in tests.
__resetRouteLoadCachesForTestsReset route-loader caches in tests.
buildStaticRouteModuleBuild a static route module.
createRuntimeFetchHandlerAssemble the Node fetch handler.
createRuntimeRegistryConstruct a runtime route registry.
createRuntimeRequestListenerConstruct a Node request listener.
executeResolvedRouteExecute a resolved route.
invokeResolvedRouteInvoke a resolved route graph.
loadStaticModulesLoad generated route modules.
materializeResolvedRouteGraphMaterialize a resolved graph.
normalizeMiddlewareModuleNormalize middleware exports.
normalizeThreadAccessModuleNormalize thread-access policy exports.
readPendingInterruptsRead pending human decisions.
resolveCheckpointerResolve the configured checkpointer.
resolvePendingResumeResolve submitted interrupt decisions.
resolveSandboxManagerResolve the server sandbox manager.
resolveThreadsStoreResolve the configured thread store.
runMemoryCommandRun the low-level memory command implementation.
runTypegenGenerate application route declarations.
seedPreparedRouteModulesSeed prepared route modules.
serveRuntimeStart the production runtime server.
startRuntimeServerAssemble and start the Node server.
streamResolvedRouteStream a resolved route.

These exports exist for framework tooling and test harnesses. Application code should prefer root serveRuntime or the edge-safe /fetch entry.

@dawn-ai/cli/testing

ExportResponsibility
expectErrorDeprecated alias of @dawn-ai/sdk/testing expectError.
expectMetaDeprecated alias of @dawn-ai/sdk/testing expectMeta.
expectOutputDeprecated alias of @dawn-ai/sdk/testing expectOutput.

New scenario files should import these aliases from @dawn-ai/sdk/testing.

bin:dawn

bin:dawn is the executable target, not a TypeScript subpath. It runs the add, build, check, dev, docs, eval, inspect, memory, routes, run, start, test, typegen, and verify commands. See the CLI Reference for command syntax.

Key contracts

serveRuntime()

Use this root export to embed Dawn's production Node server. It starts once, returns a close handle, and does not watch the filesystem.

ts
export declare function serveRuntime(opts: ServeRuntimeOptions): Promise<ServeRuntimeHandle>
ts
export interface ServeRuntimeOptions {
  readonly appRoot: string
  readonly host?: string
  readonly port?: number
  readonly installSignalHandlers?: boolean
  readonly modules?: DawnStaticModules
  readonly config?: DawnConfig
  readonly checkpointer?: BaseCheckpointSaver
  readonly threadsStore?: ThreadsStore
  readonly permissionsStore?: PermissionsStore | (() => Promise<PermissionsStore>)
  readonly memoryStore?: () => Promise<MemoryStore>
  readonly middleware?: DawnMiddleware
}

Fields: @dawn-ai/cli#.:ServeRuntimeOptions

FieldTypeRequiredDescription
readonly appRootstringyesSelect the Dawn application root.
readonly hoststringnoOverride the listen host.
readonly portnumbernoOverride the listen port.
readonly installSignalHandlersbooleannoOpt into SIGTERM and SIGINT shutdown handlers.
readonly modulesDawnStaticModulesnoSupply build-time generated route modules.
readonly configDawnConfignoSupply an already-constructed application configuration.
readonly checkpointerBaseCheckpointSavernoSupply the boot-resolved checkpointer.
readonly threadsStoreThreadsStorenoSupply the boot-resolved thread store.
readonly permissionsStorePermissionsStore | (() => Promise<PermissionsStore>)noSupply a permissions store or its async factory.
readonly memoryStore() => Promise<MemoryStore>noSupply the lazy memory-store factory.
readonly middlewareDawnMiddlewarenoSupply preloaded middleware.

Behavior contract cli.serve.production-boot

serveRuntime starts without running type generation or writing .dawn artifacts.

Behavior contract cli.serve-runtime.port-precedence

serveRuntime uses an explicit port first, then a numeric PORT value, then 8000. Empty or non-numeric PORT values also fall back to 8000; an explicit 0 still requests a random port.

Runtime ownership

serveRuntime() starts once and does not watch files or run type generation at boot. The /fetch handler has no filesystem fallback for its module map or for applicable required stores, so an edge host must inject them. Configuration may be supplied already constructed; when omitted, runtime defaults apply.

Behavior contract cli.fetch.request-store-lifecycle

A requestStores factory creates and disposes stores per request. Disposal waits for an SSE body to finish. close() waits for in-flight disposal while its bounded shutdown drain remains open; after the 30-second default deadline it warns and proceeds.

ts
import { serveRuntime } from "@dawn-ai/cli"
 
const server = await serveRuntime({ appRoot: process.cwd(), port: 8000 })
console.log(server.url)

Continue with CLI Reference, Embed the Runtime, Edge and Hono, and Deployment Options.