@dawn-ai/core

Use this when

Route authors normally use @dawn-ai/sdk, not Core. Use @dawn-ai/core when you build a Dawn integration around configuration, capabilities, static type generation, or route metadata. Use /node for filesystem discovery and compiler-backed extraction. Do not build application code on /internal/compiler.

Install and import

bash
pnpm add @dawn-ai/core
ts
import { config, renderDawnTypes } from "@dawn-ai/core"
import { discoverRoutes } from "@dawn-ai/core/node"

Compatibility and audience

SurfaceRuntimePurityAudienceStability
@dawn-ai/coreedge-safenot-claimedintegrationlow-level
@dawn-ai/core/nodenode-onlynot-claimedintegrationlow-level
@dawn-ai/core/internal/compilernode-onlynot-claimedinternalinternal

Importing /node registers the disk-backed dawn.config.ts loader. The root remains free of that filesystem-loader edge so a static runtime can seed configuration instead.

Public exports

@dawn-ai/core

ExportResponsibility
ThreadsStoreRe-export the @dawn-ai/sqlite-storage thread-store contract; its deep reference is deferred.
createAgentsMdMarkerCreate the AGENTS.md capability marker.
createMemoryMarkerCreate the typed-memory capability marker.
createMemoryMdMarkerCreate the memory.md capability marker.
RuntimeTodoDescribe one runtime plan item.
createPlanningMarkerCreate the planning capability marker.
createSkillsMarkerCreate the skills capability marker.
createSubagentsMarkerCreate the subagents capability marker.
createWorkspaceMarkerCreate the workspace capability marker.
BUILT_IN_TOOL_NAMESList built-in capability tool names.
MemorySupersedeDetailDescribe a gated memory supersede.
SubagentGateRequestDescribe a gated subagent operation.
gateMemorySupersedeGate a memory supersede operation.
gateSubagentOpGate a subagent operation.
gateToolOpGate a tool operation.
wrapToolWithApprovalWrap a tool with approval handling.
wrapToolWithConstraintWrap a tool with argument constraints.
AppliedContributionRecord an applied capability contribution.
ApplyResultReturn contributions and capability errors.
CapabilityErrorDescribe capability detection or load failure.
CapabilityRegistryHold capability markers.
applyCapabilitiesDetect and load registered capabilities.
createCapabilityRegistryConstruct a capability registry.
BrowseFilterLikeDefine a memory browse filter boundary.
BrowsePageLikeDefine a memory browse page boundary.
BrowseQueryLikeDefine a memory browse query boundary.
BrowseSortEntryLikeDefine a memory sort entry boundary.
BrowseSortFieldLikeName memory browse sort fields.
CapabilityContributionDescribe capability-provided runtime features.
CapabilityMarkerDefine capability detection and loading.
CapabilityMarkerContextProvide capability marker context.
DawnToolDefinitionDescribe a contributed Dawn tool.
EmbedderDefine the memory embedding seam.
MarkerFsDefine capability filesystem operations.
MemoryContextProvide memory tool context.
MemoryKindLikeName memory kinds at the Core boundary.
MemoryRecordLikeDescribe a memory record at the Core boundary.
MemorySourceTypeLikeName memory source types.
MemoryStatusLikeName memory statuses.
MemoryStoreLikeDefine the runtime memory-store boundary.
MemoryWritesModeConfigure runtime memory writes.
PromptFragmentDescribe capability prompt text.
StreamTransformerTransform runtime stream chunks.
StreamTransformerInputDescribe a stream-transform input.
StreamTransformerOutputDescribe a stream-transform output.
CreateWorkspaceFsOptionsConfigure workspace filesystem creation.
createWorkspaceFsCreate a workspace filesystem facade.
DawnConfigLoaderDefine the configuration loader seam.
__clearDawnConfigCacheForTestsClear the config memo in tests.
loadDawnConfigLoad or read a memoized app configuration.
registerConfigLoaderRegister a runtime-specific config loader.
seedDawnConfigSeed configuration for a static runtime.
configPreserve types for a Dawn config object.
isPrivateSegmentTest whether a route segment is private.
isRouteGroupSegmentTest whether a route segment is a group.
toRouteSegmentsParse filesystem route segments.
RuntimeEnvDescribe seeded runtime environment values.
__clearSeededRuntimeEnvForTestsClear seeded environment values in tests.
readRuntimeEnvRead process or seeded environment values.
seedRuntimeEnvSeed environment values for a static runtime.
ResolveStateFieldsOptionsConfigure state-field resolution.
resolveStateFieldsNormalize state defaults and reducers.
GuardedSubagentResultRepresent a gated subagent result.
ResolveGuardedSubagentArgsConfigure guarded subagent resolution.
resolveGuardedSubagentResolve a subagent under policy.
ResolveSubagentRegistryArgsConfigure subagent registry resolution.
dispatchableSubagentsList subagents eligible for dispatch.
resolveSubagentRegistryResolve local and conventional subagents.
DescriptorRouteIndexIndex route descriptors for subagents.
ResolvedDelegationRuleRepresent a resolved delegation rule.
ResolvedSubagentRepresent one resolved subagent.
ScopeInputConfigure route tool scoping.
ToolOriginIdentify where a tool came from.
resolveToolScopeApply route tool policy.
toolOriginRead a tool's origin.
renderDawnTypesRender the complete generated route module.
renderRouteTypesRender route path and parameter types.
renderScenarioTypesRender scenario map augmentation.
SCENARIO_TYPES_FILEName the generated scenario declaration file.
RouteStateFieldsDescribe generated state fields for one route.
renderStateTypesRender route state types.
renderToolTypesRender route tool types.
DawnConfigConfigure a Dawn application.
DiscoveredDawnAppDescribe a located Dawn application.
DiscoverRoutesOptionsConfigure route discovery.
ExtractedToolSchemaDescribe one extracted JSON tool schema.
ExtractedToolTypeDescribe one extracted tool type.
FindDawnAppOptionsConfigure application-root discovery.
JsonSchemaPropertyDescribe a JSON Schema property.
LoadDawnConfigOptionsSelect the application whose config is loaded.
LoadedDawnConfigReturn config, root, and config path.
NormalizedRouteModuleDescribe a normalized route module.
ResolvedStateFieldDescribe a normalized state field.
RouteDefinitionDescribe one discovered route.
RouteKindRe-export the @dawn-ai/sdk route-kind type.
RouteManifestDescribe all routes in an application.
RouteSegmentDescribe a static or dynamic route segment.
RouteToolSchemasGroup extracted schemas by route.
RouteToolTypesGroup extracted tool types by route.
StateFieldReducerName a built-in state reducer.

@dawn-ai/core/node

ExportResponsibility
loadDawnConfigUncachedLoad dawn.config.ts directly from disk.
registerNodeConfigLoaderRegister the disk-backed config loader.
registerTsxLoaderRegister TypeScript module loading.
discoverRoutesDiscover filesystem routes.
assertDawnRoutesDirValidate the routes directory.
findDawnAppLocate a Dawn application root.
nodeMarkerFsProvide Node filesystem operations to capability markers.
ExtractToolSchemasOptionsConfigure compiler-backed schema extraction.
extractToolSchemasForRouteExtract tool schemas for a route.
ExtractToolTypesOptionsConfigure compiler-backed type extraction.
extractToolTypesForRouteExtract tool types for a route.

@dawn-ai/core/internal/compiler

This discoverable subpath is internal. It has no application compatibility promise; the CLI owns its use during type generation.

Key contracts

loadDawnConfig()

Use this low-level seam when an integration owns configuration loading. Most Node callers import /node to register disk loading; static runtimes seed config instead.

ts
export declare function loadDawnConfig(options: LoadDawnConfigOptions): Promise<LoadedDawnConfig>

Behavior contract core.load-config.failed-load-eviction

loadDawnConfig memoizes per app root. A failed in-flight load is evicted only while that same promise remains cached, so a seed written during the load survives its later rejection.

resolveStateFields()

This low-level helper turns state defaults and optional reducer overrides into the normalized fields consumed by type generation and runtime state assembly.

ts
export declare function resolveStateFields(
  options: ResolveStateFieldsOptions,
): readonly ResolvedStateField[]

Behavior contract core.state.reducer-resolution

resolveStateFields infers append for array defaults and replace for scalar defaults, honors explicit reducer overrides, and sorts fields by name.

Configuration ownership

Use Configuration Reference for the full DawnConfig schema. The root loader is a runtime seam: Node callers import /node to register disk loading, while edge callers seed an already-constructed config.

ts
import { config } from "@dawn-ai/core"
 
export default config({
  appDir: "src/app",
  build: { targets: ["node"] },
})

Continue with Configuration Reference, Routes, State, and dawn:routes.