Documentation Index
Fetch the complete documentation index at: https://docs.ixo.world/llms.txt
Use this file to discover all available pages before exploring further.
Overview
createOracleApp(opts: CreateOracleAppOptions): Promise<OracleApp> resolves the plugin set, validates env, populates registries, builds the dynamic RuntimeAppModule, bootstraps NestJS, and returns an OracleApp whose listen() runs beforeListen callbacks then starts the HTTP server.
Matrix init runs in the background — the returned promise resolves as soon as Nest is built. Status flips via onPluginStatusChange.
CreateOracleAppOptions
config
config
- Type:
OracleConfig - Required: yes
name, optional org, optional description, optional prompt. The runtime fills in entityDid from the ORACLE_ENTITY_DID env var, so don’t put it here.features
features
- Type:
Partial<Record<BundledFeatureName | (string & {}), FeatureToggle>>whereFeatureToggle = boolean | 'auto' - Required: no
true (force on), false (force off), 'auto' (run autoDetect(env)). Omitted keys are treated as 'auto'.plugins
plugins
- Type:
OraclePlugin[] - Required: no
new EditorPlugin({ matrixClient }), new CreditsPlugin({ redis, network })). The plugin loader dedupes by name, so an explicit instance overrides the bundled default of the same name.nestModules
nestModules
- Type:
Array<Type | DynamicModule> - Required: no
RuntimeAppModule.imports. They get full DI access to the Tier-0 services (Sessions, Messages, Secrets, UCAN, …) and can declare controllers, providers, OnModuleInit, OnModuleDestroy.authExcludedRoutes
authExcludedRoutes
- Type:
AuthExcludedRoute[] - Required: no
AuthHeaderMiddleware. Use for routes contributed by nestModules (webhooks, OAuth callbacks, public probes). Symmetric with each plugin’s getAuthExcludedRoutes() hook — both lists merge onto the runtime’s built-in exclusions (/health, /docs).bundledPlugins
bundledPlugins
- Type:
OraclePlugin[] - Required: no
createOracleApp without dragging in the full bundled catalog. Production callers should leave this unset.env
env
- Type:
NodeJS.ProcessEnv - Required: no
process.env. Tests use this to inject a clean env. Production code should leave it unset.skipMatrixInit
skipMatrixInit
- Type:
boolean - Required: no
skipGracefulShutdown
skipGracefulShutdown
- Type:
boolean - Required: no
logger
logger
- Type:
Logger - Required: no
Logger.hooks
hooks
- Type:
MainAgentHooks - Required: no
{ checkpointerForUser: ... } here to swap it for an alternate implementation.OracleApp
The resolvedOracleApp exposes:
getNestApp()
getNestApp()
Returns the underlying
INestApplication. Use it to add Express middleware, register global filters, or do anything else NestJS exposes. Mainly an escape hatch — nestModules and beforeListen cover most cases.ambient
ambient
The production
AmbientServices bag — used by MessagesController to build per-request RuntimeContexts before invoking createMainAgent. Forks normally don’t touch this directly.plugins.status()
plugins.status()
Returns a snapshot of loader/exclusion/soft-dep state.
beforeListen(fn)
beforeListen(fn)
Register a callback that runs after Nest is built but before HTTP starts accepting. Multiple registrations run in order, awaiting each.
onError(handler)
onError(handler)
Subscribe to background errors. The runtime currently surfaces Matrix init failures here (with
source: 'matrix-init'). If no handler is registered, errors log to the bootstrap logger.onPluginStatusChange(handler)
onPluginStatusChange(handler)
Subscribe to plugin lifecycle changes. The current emitter is the Matrix init flow:Multiple handlers may register; each is invoked for every event.
listen(port?)
listen(port?)
Start the HTTP server. Honours
beforeListen callbacks first. Port resolution: explicit port arg → PORT env (validated) → 5678 default. Throws if called twice.Behaviour
The function executes these steps in order:- Validates
config(namerequired). - Resolves plugin set: bundled + your plugins, deduped by
name, withfeaturestoggles andautoDetectpredicates applied. Excluded plugins surface inplugins.status().excludedwith their reason. - Topologically sorts by
dependsOn. Cycles or missing hard deps fail boot. - Validates every plugin’s manifest. Hard violations fail boot.
- Composes env schema (base + all loaded plugins’
configSchema) and validatesprocess.env. Missing required vars fail boot with[boot-error] Plugin '<name>' env validation failed for '<field>'. - Cross-field check: the API key for the selected
LLM_PROVIDERis present. (Schema-merge can’t express this.) - Builds the internal
OracleIdentityfromconfig+ validated env. - Populates the six registries (tools, sub-agents, middleware, manifests, configSchema, sharedState).
- Collects
getNestModulesfrom every loaded plugin. - Builds the dynamic
RuntimeAppModuleand bootstraps NestJS (NestFactory.create). CORS enabled with the framework’s allowed headers. Swagger UI mounts at/docs. - Builds
AmbientServices. - Warms the boot caches (each registry runs its boot-time hooks once).
- Wires the default checkpointer (
UserMatrixSqliteSyncService+SqliteSaver), then merges hosthooksover it. - Populates the
OracleRuntimeBundleHoldersoMessagesControllercan read it on each request. - Schedules background Matrix init (unless
skipMatrixInit: true). Registers a graceful-shutdown handler (unlessskipGracefulShutdown: true). - Returns the
OracleApp.
listen() blocks on beforeListen callbacks before starting HTTP.
Throws
Error('createOracleApp: \'config\' is required.')—configmissing.Error('createOracleApp: \'config.name\' is required.')—config.nameempty.- Plugin resolution errors (cycle, missing hard dep, manifest invalid, env invalid). Each error is reported via
logger.errorwith[boot-error] …prefix and a remediation hint. Error('createOracleApp: ORACLE_ENTITY_DID env is required and was empty after validation.')— when the validated env’sORACLE_ENTITY_DIDis empty.Error('OracleApp.listen called twice.')— whenlisten()is called more than once.
Related guides
- Create your oracle — hands-on walkthrough.
- Using bundled plugins — the
featuresfield in detail. - Plugin API reference — what plugin instances must implement.