Skip to content

bolt/engine

bolt/engine

Import from @norbital-ai/bolt/engine

One flat, Effect-native engine surface. Hosts own the runtime edge. ── exports: db ──

engine

Ai class

class Ai extends Ai_base {
    private static readonly noSystem1;
    /** Whether the host bound a decision function; provider failures do not change capability presence. */
    static hasSystem1(service: Ai['Service']): boolean;
    /** The intelligence group: each member the host's, or `off`. */
    static fromAbi(ports: {
        readonly system1: AiPort['sys_1'] | Off;
        readonly system2: AiPort['sys_2'] | Off;
        readonly embed: EmbeddingsPort | Off;
    }): Layer.Layer<Ai>;
}

The AI facility: ask is sys_1 (structured decisions from text and resolved images, with a deciders id or the host's own), infer the sys_2 LLM (multimodal; the 20 s idle wall cuts a stream into a cut step), embed the embedding model. models are the classes the host maps; catalog and deciders the models each provider lists.

Members

NameTypeDescription
ask(request: DecisionRequest, model?: string) => Effect.Effect<DecisionResult, PortFailure>
maxChoicesnumber | undefined
decidersEffect.Effect<{ readonly models: readonly AiModel[]; readonly default: string; }, PortFailure>
modelsreadonly string[]
catalogEffect.Effect<{ readonly models: readonly AiModel[]; readonly default: string; }, PortFailure>
infer(request: AiRequest) => Stream.Stream<AiEvent, PortFailure>
embed(inputs: readonly EmbedInput[], model: string, dimensions?: number) => Effect.Effect<readonly (readonly number[])[], PortFailure>

Source: packages/bolt/src/engine/ports.ts:619

ai

AiRequest type

type AiRequest = {
    model: string;
    /** Host usage attribution; omitted for utility inference, set by the conversation engine for chat work. */
    purpose?: 'chat';
    system?: string;
    messages: readonly AiMessage[];
    tools?: readonly {
        name: string;
        description: string;
        input: Json;
    }[];
    output?: Json;
    /** Images and documents for the model to see; `call` is the tool call that opened one, which it follows. */
    files?: readonly {
        mime: string;
        bytes: Uint8Array;
        call?: string;
    }[];
    continuation?: string;
    /** Reasoning effort hint for fast/structured utility calls; omitted uses the provider default. */
    reasoning_effort?: 'low' | 'medium' | 'high';
};

One model call the engine hands the AI port: model, system prompt, messages, tools, optional output schema and files.

Members

NameTypeDescription
modelstring
purpose?'chat'

Host usage attribution; omitted for utility inference, set by the conversation engine for chat work.

system?string
messagesreadonly AiMessage[]
tools?readonly { name: string; description: string; input: Json; }[]
output?Json
files?readonly { mime: string; bytes: Uint8Array; call?: string; }[]

Images and documents for the model to see; call is the tool call that opened one, which it follows.

continuation?string
reasoning_effort?'low' | 'medium' | 'high'

Reasoning effort hint for fast/structured utility calls; omitted uses the provider default.

Source: packages/host-api/src/ai.ts:186

AiResponse type

type AiResponse = typeof AiPortResponseSchema.Type;

The host's system-2 answer (AiPortResponseSchema): content, tool calls, how it finished and its usage.

Members

NameTypeDescription
contentSchema.Codec<Schema.Json, Schema.Json, never, never>
tool_callsSchema.$Array<Schema.Struct<{ readonly id: Schema.String; readonly name: Schema.String; readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>; readonly invalid: Schema.optionalKey<Schema.String>; }>>
finishSchema.Literals<readonly ["stop", "tool", "cut"]>
usageSchema.Struct<{ readonly input: Schema.Number; readonly output: Schema.Number; readonly cost: Schema.optionalKey<Schema.Number>; readonly call: Schema.optionalKey<Schema.String>; readonly provider: Schema.optionalKey<Schema.String>; readonly cached: Schema.optionalKey<Schema.Number>; readonly reasoning: Schema.optionalKey<Schema.Number>; readonly prompt: Schema.optionalKey<Schema.Struct<{ readonl…

Tokens and the call's charge in USD under the provider's call id: a host's provider reports both cost and call for every call (from the endpoint's own charge, else its listed price); only a recorded test answer omits them.

continuation?Schema.optionalKey<Schema.String>
reasoning?Schema.optionalKey<Schema.String>

Source: packages/host-api/src/ai.ts:55

engine

Authority type

type Authority = {
    key: string;
    /** Last checked workspace day for a member whose supplemental grants may expire at midnight. */
    membershipDay?: string;
    actor: EngineActor;
    admin: boolean;
    policies: readonly string[];
    /** Trusted admin preview context, rechecked before an approval decision or proposal replay. */
    preview?: {
        by: string;
        team: string | null;
        impersonate?: true;
    };
    /** Set when compiled for a kiosk's requests: the kiosk whose assigned policies this reads and writes as. */
    kiosk?: string;
    /**
     * Set from a session minted for the agent's browser (`session.mint`'s `agent`): every request made with it is the
     * agent's, acting for this authority's own member in `conversation`. A host holds live-changing work from it.
     */
    agent?: {
        readonly conversation: string;
    };
    /** Set on a render grant's requests (`RenderGrants`): the run's reads, every write and start stripped. */
    render?: true;
    /**
     * Set inside an automation or effect run (runs/index.ts `invoke`): the run's chain depth and the holder it runs as,
     * which the model effects its writes queue run as, one deeper (`writerOf`).
     */
    run?: {
        readonly depth: number;
        readonly holder: Holder;
    };
    models: {
        readonly [model: string]: ModelAuthority;
    };
    automations: readonly string[];
    capabilities: {
        apps: readonly string[];
        syncs: readonl…

Compiled once per key = (actor, affiliation revision, source release).

Members

NameTypeDescription
keystring
membershipDay?string

Last checked workspace day for a member whose supplemental grants may expire at midnight.

actorEngineActor
adminboolean
policiesreadonly string[]
preview?{ by: string; team: string | null; impersonate?: true; }

Trusted admin preview context, rechecked before an approval decision or proposal replay.

kiosk?string

Set when compiled for a kiosk's requests: the kiosk whose assigned policies this reads and writes as.

agent?{ readonly conversation: string; }

Set from a session minted for the agent's browser (session.mint's agent): every request made with it is the agent's, acting for this authority's own member in conversation. A host holds live-changing work from it.

render?true

Set on a render grant's requests (RenderGrants): the run's reads, every write and start stripped.

run?{ readonly depth: number; readonly holder: Holder; }

Set inside an automation or effect run (runs/index.ts invoke): the run's chain depth and the holder it runs as, which the model effects its writes queue run as, one deeper (writerOf).

models{ readonly [model: string]: ModelAuthority; }
automationsreadonly string[]
capabilities{ apps: readonly string[]; syncs: readonly string[]; tools: readonly string[]; mcp: readonly string[]; }
limitsreadonly LimitRule[]
teamTreereadonly string[]

The actor variable actor.team_tree.

Source: packages/bolt/src/engine/contracts.ts:162

protocol

BoltError class

class BoltError extends BoltError_base {
    /** Never throws: a message that is not text (or is blank) becomes the phase's sentence, so `cause` survives. */
    static make(...args: [code: Code, phase: Phase, message: unknown, cause?: unknown]): BoltError;
    /** The Schema class's own form (`new BoltError(props)`), which the static side keeps. */
    static make(...args: [props: BoltErrorProps, options?: Schema.MakeOptions]): BoltError;
}

Every engine failure without a tag of its own.

Members

NameTypeDescription
messagestring
codeSchema.Literals<readonly ["active", "approval_split", "artifact_digest", "bad_answer", "bad_cursor", "behind", "bug", "build_failed", "busy", "check", "conflict", "conflicts", "contract", "corrupt", "cpu_budget", "crossing_budget", "destructive_not_accepted", "expired", "fenced", "files", "forbidden", "guest_error", "guest_refused", "internal", "interrupted", "invalid", "invalid_code", "invalid_c…
phaseSchema.Literals<readonly ["decode", "admission", "guest", "derive", "commit", "facility", "deliver"]>
cause?unknown

Source: packages/bolt/src/protocol/errors.ts:244

engine

Convert class

class Convert extends Convert_base {
    static fromAbi(port: ConvertPort | Off): Layer.Layer<Convert>;
}

The document converter behind ctx.convert.document; targets is what this host serves (none when unavailable). ingest (the agent's read_file, ctx.convert.ingest) is absent when the host's converter does not ingest.

Members

NameTypeDescription
targetsreadonly ConvertTarget[]
convert(source: ConvertSource, to: ConvertTarget, options: ConvertSettings) => Effect.Effect<Uint8Array, PortFailure>
previewPdf?(source: ConvertSource, options: Pick<ConvertSettings, "page" | "landscape">) => Effect.Effect<Uint8Array, PortFailure>
ingest?(file: { readonly sha256: string; readonly name: string; readonly mime: string; readonly bytes?: Uint8Array; readonly key?: string; }, options: Omit<IngestOptions, "for">) => Effect.Effect<Ingested | { readonly unsupported: string; }, PortFailure>

Source: packages/bolt/src/engine/ports.ts:153

integrations

DatabaseRequest const

const DatabaseRequest: Schema.Union<readonly [Schema.Struct<{ readonly max_rows: Schema.optionalKey<Schema.Int>; readonly transaction: Schema.optionalKey<Schema.Literal<"serializable">>; readonly op: Schema.Literal<"values">; readonly values: Schema.$Record<Schema.NonEmptyString, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean, Schema.Null]>>; }>, Schema.Struct<{ readonly max_rows: Schema.optionalKey<Schema.Int>; readonly transaction: Schema.optionalKey<Schema.Literal<"serializable">>; readonly op: Schema.Literal<"read">; readonly table: Schema.Struct<{ readonly schema: Schema.NonEmptyString; re…

Schema of one structured database program a guest sends through a database link (today the SQL Server shape): values, read, call, CDC metadata and pages, and insert_once. The workspace names qualified tables, projected columns, filters, decimal/date formats and its delete policy; the host compiles the native SQL. CDC pages reconcile current rows and tombstones from an inclusive LSN/sequence/operation/key cursor. insert_once takes an immutable key and fingerprint, a five-second native lock and one serializable header/child/procedure batch, and answers an exact receipt; call names a procedure with typed arguments over native RPC. Cancellation, row and byte bounds, TLS identity and network admission apply to every program.

Example

yield* ctx.request(erp, { op: 'read', table: { schema: 'accounting', name: 'products' }, columns: ['code', 'name'],
	where: { active: true }, max_rows: 100 });

Source: packages/host-api/src/integrations.ts:616

DatabaseResult type

DatabaseResult: Schema.Struct<{
    readonly rows: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
}>

Schema of a database link's answer: its rows as JSON column maps.

Members

NameTypeDescription
rowsSchema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>

Source: packages/host-api/src/integrations.ts:619

errors

DbError class

class DbError extends DbError_base {
    static make(...args: [sqlstate: string, message: string, constraint?: string, column?: string]): DbError;
    /** The Schema class's own form (`new DbError(props)`), which the static side keeps. */
    static make(...args: [props: DbErrorProps, options?: Schema.MakeOptions]): DbError;
}

What a Postgres adapter fails with: the SQLSTATE and constraint the write compiler maps to a refusal.

Members

NameTypeDescription
messagestring
sqlstateSchema.String
outcome_unknown?Schema.optionalKey<Schema.Literal<true>>
constraint?Schema.optional<Schema.String>
column?Schema.optional<Schema.String>

Source: packages/host-api/src/errors.ts:51

ai

DecisionResult const

const DecisionResult: Schema.Struct<{ readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly type: Schema.Literal<"noul">; readonly noul: Schema.Finite; }>, Schema.Struct<{ readonly type: Schema.Literal<"choice">; readonly choice: Schema.String; readonly confidence: Schema.Finite; readonly probabilities: Schema.$Record<Schema.String, Schema.Finite>; }>, Schema.Struct<{ readonly type: Schema.Literal<"score">; readonly score: Schema.Finite; readonly level: Schema.Int; readonly confidence: Schema.Finite; readonly probabilities: Schema.$Record<Schema.String, Schema.Finite>; rea…

Schema of a System 1 answer set: one answer per question key, with the provider, model, cost and token usage.

Source: packages/host-api/src/ai.ts:162

integrations

DriverOpen type

type DriverOpen = {
    instance: string;
    /** The instance's integration definition, including its request and credential fields. */
    definition: IntegrationDefinition;
    /** Model read syncs using this instance's definition; `name` is `'<model>.sync.<sync>'`. */
    readonly syncs: readonly {
        readonly name: string;
        /** The configuration field whose values partition this sync, otherwise one default partition. */
        readonly partitions?: string;
    }[];
    /** A personal instance (an owner's own account): it syncs and never sends a message; a command may write back to it. */
    personal: boolean;
    configuration: Json;
    /** Frozen source import boundary; absent or null retains all history. */
    import_start?: ImportStart | null;
    /** This instance's own inbound URL, shown to the operator and registered with the provider where it can. */
    webhook_url: string;
    /**
     * The host's one OAuth redirect URI (`<public URL>/hooks/oauth/callback`), the same for every instance: register it
     * with the OAuth app once. Its callback reaches this link's `webhook` by the `state` it carries, minted by `state()`.
     */
    redirect_url: string;
    /**
     * A fresh, unguessable OAuth `state` that routes its callback back to this instance; the link still checks it is its
     * own. Asynchronous, as every call into the engine: the engine may be in another isolate.
     */
    state(): Promise<string>;
    /** Aborted when the link clos…

What the links manager hands a provider to open one instance's link. Credentials stay host-side, under the opener's epoch.

Members

NameTypeDescription
instancestring
definitionIntegrationDefinition

The instance's integration definition, including its request and credential fields.

syncsreadonly { readonly name: string; /** The configuration field whose values partition this sync, otherwise one default partition. */ readonly partitions?: string; }[]

Model read syncs using this instance's definition; name is '<model>.sync.<sync>'.

personalboolean

A personal instance (an owner's own account): it syncs and never sends a message; a command may write back to it.

configurationJson
import_start?ImportStart | null

Frozen source import boundary; absent or null retains all history.

webhook_urlstring

This instance's own inbound URL, shown to the operator and registered with the provider where it can.

redirect_urlstring

The host's one OAuth redirect URI (<public URL>/hooks/oauth/callback), the same for every instance: register it with the OAuth app once. Its callback reaches this link's webhook by the state it carries, minted by state().

state() => Promise<string>

A fresh, unguessable OAuth state that routes its callback back to this instance; the link still checks it is its own. Asynchronous, as every call into the engine: the engine may be in another isolate.

signalAbortSignal

Aborted when the link closes or is replaced.

fetchtypeof fetch

The fetch to reach the provider with (tests pass a fake).

tcpTcpPort

Raw TCP/TLS to the provider's servers (IMAP, SMTP), under the host's egress policy.

oauth_client(vendor?: OAuthVendor) => Promise<OAuthClient | undefined>

The OAuth client to grant with for vendor: the definition's own (oauth.client, oauth.secret, both set in the workspace's secrets), else the host's (LinkHost.oauth); undefined when neither is configured. Without a vendor, only the definition's own.

credentials{ load(): Promise<ReadonlyMap<string, Json>>; write(changes: ReadonlyMap<string, Json | null>): Promise<void>; }

The instance's credentials as they were when the link opened (provider is the manager's); a write is one fenced statement retried until it lands, and rejects for good once another link opened the instance (fenced) — for a request link, once another call wrote since this one read.

emit(e: DriverEvent) => Promise<void>

Into the engine: resolves after it committed; a rejection means "do not acknowledge", so the provider redelivers.

status(s: LinkStatus) => Promise<void>

The link moved; a durable state (connected, unpaired, error) lands on the instance row when it changed.

pairing(p: Pairing | null) => void

An ephemeral QR or code (or null once it is gone), streamed to the shell and never stored.

Source: packages/host-api/src/integrations.ts:474

engine

EngineManifest const

const EngineManifest: Schema.Struct<{ readonly needs: Schema.$Array<Schema.Literals<readonly ["sms", "phone", "push", "challenge", "system1", "system2", "embed", "webhooks", "outbound"]>>; readonly workspace: Schema.Struct<{ readonly theme: Schema.optionalKey<Schema.Struct<{ readonly palette: Schema.optionalKey<Schema.Literals<readonly ["warm", "neutral", "crisp"]>>; readonly accent: Schema.optionalKey<Schema.String>; readonly radius: Schema.optionalKey<Schema.Literals<readonly ["sharp", "default", "soft"]>>; readonly light: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; readonly dark: Schema.op…

Pure data: declaration literals by path-derived name, bodies stripped (they run in the guest).

Source: packages/bolt/src/engine/manifest.ts:240

Files class

class Files extends Files_base {
    static fromAbi(port: FilesPort): Layer.Layer<Files>;
}

Stored blobs; the sys_file row is the engine's. get answers at most max bytes (more is invalid).

Members

NameTypeDescription
put(bytes: Uint8Array, meta: { readonly name: string; readonly mime: string; }) => Effect.Effect<Blob, PortFailure>
get(key: string, max: number) => Effect.Effect<Uint8Array, PortFailure>
url(key: string, expiresInS: number) => Effect.Effect<string, PortFailure>
remove(key: string) => Effect.Effect<void, PortFailure>
download(url: string) => Effect.Effect<Downloaded, PortFailure>

The host fetches a public media URL and stores it (FilesPort.download); no bytes cross.

Source: packages/bolt/src/engine/ports.ts:116

Geo class

class Geo extends Geo_base {
    static fromAbi(port: GeocoderPort | Off): Layer.Layer<Geo>;
}

The geocoder service behind ctx.geo: place search and reverse lookup; with the port off, both fail as turned off.

Members

NameTypeDescription
search(query: string) => Effect.Effect<readonly GeoHit[], PortFailure>
reverse(point: Point) => Effect.Effect<GeoHit | null, PortFailure>

Source: packages/bolt/src/engine/ports.ts:361

GrantData type

type GrantData = typeof GrantData.Type;

A policy's decoded grant on one model: per-output read scopes and its create, update and delete grants.

Members

NameTypeDescription
create?Schema.optionalKey<Schema.Struct<{ columns: Schema.optionalKey<Schema.$Record<Schema.String, Schema.$Array<Schema.String>>>; verdict: Schema.optionalKey<Schema.Literal<true>>; }>>
update?Schema.optionalKey<Schema.Struct<{ readonly moves: Schema.optionalKey<Schema.Union<readonly [Schema.Literal<"all">, Schema.$Record<Schema.String, Schema.$Array<Schema.String>>]>>; readonly columns: Schema.optionalKey<Schema.$Record<Schema.String, Schema.$Array<Schema.String>>>; readonly verdict: Schema.optionalKey<Schema.Literal<true>>; }>>
delete?Schema.optionalKey<Schema.Struct<{ readonly verdict: Schema.optionalKey<Schema.Literal<true>>; }>>
outputs?Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly scopes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>; readonly history: Schema.optionalKey<Schema.Literal<true>>; }>>>

Source: packages/bolt/src/engine/manifest.ts:50

Http class

class Http extends Http_base {
    static fromAbi(port: HttpPort | Off): Layer.Layer<Http>;
}

Outbound HTTP under the public-network policy (HttpPort); the wall is the caller's.

Members

NameTypeDescription
fetch(request: HttpRequest, options: HttpFetchOptions) => Effect.Effect<HttpResponse, PortFailure>

Source: packages/bolt/src/engine/ports.ts:899

values

Json type

type Json = null | boolean | number | string | readonly Json[] | {
    readonly [key: string]: Json;
};

A JSON value. Structural, so Predicate.isObject narrows it to its object and list arms.

Source: packages/store/src/values.ts:4

engine

LIMITS const

const LIMITS: { readonly crossings: { readonly sync: 40; readonly write: 10; readonly automation: 10000; }; readonly writeChunk: 1000; readonly readBytes: number; readonly readGuards: { readonly count: 256; readonly bytes: number; }; readonly changeSetBytes: number; readonly act: { readonly rows: 10000; readonly inputBytes: number; }; readonly seedChunkBytes: number; readonly changesPerAct: 50000; readonly expandedRowsPerStatement: 100000; readonly writeDepth: 8; readonly page: { readonly max: 10000; readonly all: 50000; readonly allBytes: number; readonly relationArm: 10000; }; readonly statement: { reado…

Every wall and cap as one table; each overrun is a typed BoltError, never a clamp.

Members

NameTypeDescription
crossings{ readonly sync: 40; readonly write: 10; readonly automation: 10000; }

Read crossings per invocation: write for one create/update transform, reading the whole batch; sync for every other synchronous body.

writeChunk1000

Rows per write-callback invocation: a batch of N rows is ⌈N/1000⌉ calls per verb per model, one 3 s budget each.

readBytesnumber
readGuards{ readonly count: 256; readonly bytes: number; }

Coalesced native reads retained between an automation's successful read and its next act.

changeSetBytesnumber
act{ readonly rows: 10000; readonly inputBytes: number; }

A direct act holds its root inputs through the atomic commit.

seedChunkBytesnumber
changesPerAct50000
expandedRowsPerStatement100000
writeDepth8
page{ readonly max: 10000; readonly all: 50000; readonly allBytes: number; readonly relationArm: 10000; }
statement{ readonly shapes: 500; readonly params: 30000; }
fileBytesnumber
waitBytesnumber

A waiting run's row: what it waits on and the answers of the crossings it made before (ctx.wait).

messageAttachmentBytesnumber

An outbound conversation message's attachments together, read for its provider; more refuses the message (permanent).

guestCpuMs3000
guestMemoryMiB256
argsBytesnumber
storedFileBytesnumber
crossingBytesnumber
callMs{ readonly database: 20000; readonly ai: 20000; readonly tool: 20000; readonly http: 20000; readonly web: 20000; readonly image: 20000; readonly other: 20000; readonly ingest: 600000; readonly attachment: 20000; readonly render: 60000; }
runLog{ readonly lines: 100; readonly pollMs: 2000; }

Source: packages/bolt/src/engine/contracts.ts:27

ManifestInvalid class

class ManifestInvalid extends ManifestInvalid_base {
}

An artifact or evaluated manifest that does not decode as an EngineManifest; issues are the decoder's lines.

Members

NameTypeDescription
issuesSchema.$Array<Schema.String>

Source: packages/bolt/src/engine/errors.ts:48

MigrationBundle type

type MigrationBundle = typeof MigrationBundleSchema.Type;

A verified migrations/ folder, as read_migrations returns it.

Members

NameTypeDescription
filesSchema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly sql: Schema.String; }>>
squashesSchema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly sql: Schema.String; }>>
snapshotTextSchema.String
snapshotSchema.Struct<{ readonly tables: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.$Record<Schema.String, Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>>; readonly record_label: Schema.optionalKey<Schema.String>; readonly key: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["uuid", "text", "identity"]>, Schema.Non…
lockSchema.Struct<{ readonly snapshot: Schema.String; readonly files: Schema.$Record<Schema.String, Schema.String>; readonly squashes: Schema.optionalKey<Schema.$Array<Schema.Struct<{ readonly file: Schema.String; readonly checksum: Schema.String; readonly archive: Schema.String; readonly replaces: Schema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly checksum: Schema.String; }>>; read…
physicalSchema.$Record<Schema.String, Schema.$Array<Schema.String>>

Source: packages/bolt/src/engine/schema/migrations.ts:56

MigrationBundleSchema const

const MigrationBundleSchema: Schema.Struct<{ readonly files: Schema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly sql: Schema.String; }>>; readonly squashes: Schema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly sql: Schema.String; }>>; readonly snapshotText: Schema.String; readonly snapshot: Schema.Struct<{ readonly tables: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.$Record<Schema.String, Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>>; readonly record_label: Schema.optionalKey<Schema.String>; readonly key: Schema.optio…

Schema of a workspace's committed migrations/ folder as one bundle: SQL files, squashes, snapshot, lock and physical definitions.

Source: packages/bolt/src/engine/schema/migrations.ts:47

PackJson type

type PackJson = typeof PackSchema.Type;

A seed pack's decoded pack.json: its name, hash, starting automations, row counts per model and asset list.

Members

NameTypeDescription
formatSchema.Literal<1>
nameSchema.String
hashSchema.String
startSchema.$Array<Schema.String>
rowsSchema.$Record<Schema.String, Schema.Int>
assetsSchema.$Array<Schema.Struct<{ readonly path: Schema.String; readonly sha256: Schema.String; readonly bytes: Schema.Int; readonly content_type: Schema.String; }>>

Source: packages/bolt/src/engine/write/pack.ts:27

port

Port const

const Port: { call: (facility: string, wallMs: number, message?: string) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | FacilityFailure, R>; fromPromise: <A, RD>(f: (signal: AbortSignal) => PromiseLike<unknown>, decode: Schema.Decoder<A, RD>, facility?: string) => Effect.Effect<A, PortFailure, RD>; attempt: <A>(facility: string, f: (signal: AbortSignal) => PromiseLike<A>) => Effect.Effect<A, PortFailure>; failure: typeof failureOf; unavailable: (facility: string, reason?: string) => Effect.Effect<never, Unavailable>; }

Helpers that run host port calls under a wall and turn a port's throw or bad answer into a typed PortFailure.

Members

NameTypeDescription
call(facility: string, wallMs: number, message?: string) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | FacilityFailure, R>

Bounds one port call by its wall: past wallMs the call is interrupted and fails timeout.

fromPromise<A, RD>(f: (signal: AbortSignal) => PromiseLike<unknown>, decode: Schema.Decoder<A, RD>, facility?: string) => Effect.Effect<A, PortFailure, RD>

A Promise port call: interruption aborts signal; a throw is the call's failure (failureOf); the answer is decoded, and one that is not decode's is upstream.

attempt<A>(facility: string, f: (signal: AbortSignal) => PromiseLike<A>) => Effect.Effect<A, PortFailure>

A typed host Promise ABI call: fromPromise without a decode, since its type is the port's.

failuretypeof failureOf

A port's throw as its failure, for a caller with its own catch (a driver's SendRefused).

unavailable(facility: string, reason?: string) => Effect.Effect<never, Unavailable>

The failure of a port the host does not provide.

Source: packages/host-api/src/port.ts:46

errors

PortFailure type

type PortFailure = FacilityFailure | Unavailable;

What a port call fails with: the facility's own failure, or the host providing none.

Source: packages/host-api/src/errors.ts:37

integrations

Provider type

type Provider = ProviderChoice & {
    /** The driver's name: one of the release's kinds, or a driver a definition declares (`whatsapp`, `slack`, …). */
    driver: string;
    /** Required for a native boundary: validates and normalizes only this provider's declared fields. */
    validate_import_start?(values: Readonly<Record<string, string>>): Promise<Readonly<Record<string, string>>>;
    /** It imports a personal account (history and own sent messages) without sending. */
    personal?: boolean;
    /** It signs in with this vendor's OAuth client (`DriverOpen.oauth_client`); offered only where one is configured. */
    oauth?: OAuthVendor;
    /** The provider can send a test message once connected (`POST …/test`). */
    test?: TestSend;
    /**
     * `send` is idempotent by `message.id`: a repeat reaches the customer once, so a send that timed out is sent again.
     * Otherwise such a message stays `uncertain`, since the first send may have arrived.
     */
    idempotent_sends?: boolean;
    /** Provider-owned registration text for a personal or a workspace instance of `definition`; credentials and pairing keep the same runtime. */
    describe?(options: {
        readonly personal: boolean;
        readonly definition: IntegrationDefinition;
    }): Pick<ProviderChoice, 'label' | 'setup'>;
    open(ctx: DriverOpen): Promise<Link>;
};

A provider (@norbital-ai/providers, or a host's own), registered by the host for one driver by name. A release never names one. It runs in the host, outside the guest wall, with sealed credentials, raw network and direct emit, which is why a workspace cannot supply one. The contract stays Promise + AbortSignal + JSON; the engine adapts it once, aborting the signal on interruption and decoding every answer. A provider acknowledges an inbound delivery only after emit resolves, so a refused store is redelivered.

Members

NameTypeDescription
labelSchema.Union<readonly [Schema.String, Schema.Struct<{ readonly en: Schema.String; readonly zh: Schema.optionalKey<Schema.middlewareDecoding<Schema.String, never>>; }>]>
idSchema.String
setupSchema.Struct<{ readonly kind: Schema.Literals<readonly ["form", "qr", "code", "oauth", "none"]>; readonly steps: Schema.withDecodingDefaultKey<Schema.Codec<readonly { readonly text: string | { readonly en: string; readonly zh?: string; }; readonly href?: string; readonly copy?: "redirect_url" | "webhook_url"; }[], unknown, never, never>, never>; readonly fields: Schema.optionalKey<Schema.Codec<r…
description?Schema.optionalKey<Schema.middlewareDecoding<Schema.Union<readonly [Schema.String, Schema.Struct<{ readonly en: Schema.String; readonly zh: Schema.optionalKey<Schema.middlewareDecoding<Schema.String, never>>; }>]>, never>>

Concise catalogue description, localized by the authored surface.

icon?Schema.optionalKey<Schema.middlewareDecoding<Schema.String, never>>

Iconify provider mark, with a generic plug fallback when absent.

name?Schema.optionalKey<Schema.middlewareDecoding<Schema.Union<readonly [Schema.String, Schema.Struct<{ readonly en: Schema.String; readonly zh: Schema.optionalKey<Schema.middlewareDecoding<Schema.String, never>>; }>]>, never>>

Short catalogue name; the full registration label remains in label.

import_start?Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{ readonly kind: Schema.Literal<"timestamp">; readonly precision: Schema.optionalKey<Schema.Literal<"second">>; }>, Schema.Struct<{ readonly kind: Schema.Literal<"native">; readonly fields: Schema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly label: Schema.Union<readonly [Schema.String, Schema.Struct<{ readonly en: Schema.Str…
available?Schema.optionalKey<Schema.middlewareDecoding<Schema.Boolean, never>>

false: the host has no OAuth client for its sign-in (Provider.oauth), so it cannot connect here.

driverstring

The driver's name: one of the release's kinds, or a driver a definition declares (whatsapp, slack, …).

validate_import_start?((values: Readonly<Record<string, string>>) => Promise<Readonly<Record<string, string>>>) | undefined

Required for a native boundary: validates and normalizes only this provider's declared fields.

personal?boolean

It imports a personal account (history and own sent messages) without sending.

oauth?OAuthVendor

It signs in with this vendor's OAuth client (DriverOpen.oauth_client); offered only where one is configured.

test?TestSend

The provider can send a test message once connected (POST …/test).

idempotent_sends?boolean

send is idempotent by message.id: a repeat reaches the customer once, so a send that timed out is sent again. Otherwise such a message stays uncertain, since the first send may have arrived.

describe?((options: { readonly personal: boolean; readonly definition: IntegrationDefinition; }) => Pick<ProviderChoice, "label" | "setup">) | undefined

Provider-owned registration text for a personal or a workspace instance of definition; credentials and pairing keep the same runtime.

open(ctx: DriverOpen) => Promise<Link>

Source: packages/host-api/src/integrations.ts:578

engine

PushMessage type

type PushMessage = {
    readonly _tag: 'Push';
    /** The durable inbox notice identity, retained when an uncertain delivery is retried. */
    readonly id: string;
    readonly subscription: {
        readonly kind: 'web' | 'apns';
        readonly endpoint: string;
        readonly keys: Json;
    };
    readonly title: string;
    readonly body: string | null;
    readonly link: {
        readonly model: string;
        readonly id: string;
    } | null;
    readonly path: string;
};

One inbox notice to one device (bolt.push): the host routes it by subscription.kind (web push or APNs), signs it and sends { id, title, body, path }, path the workspace URL the notice opens.

Members

NameTypeDescription
_tag'Push'
idstring

The durable inbox notice identity, retained when an uncertain delivery is retried.

subscription{ readonly kind: 'web' | 'apns'; readonly endpoint: string; readonly keys: Json; }
titlestring
bodystring | null
link{ readonly model: string; readonly id: string; } | null
pathstring

Source: packages/bolt/src/engine/ports.ts:407

RUN_JS const

const RUN_JS: { readonly wallMs: 60000; readonly httpMs: 20000; readonly httpBytes: number; readonly answerBytes: number; readonly consoleChars: number; readonly outBytes: number; readonly inBytes: number; readonly bundleMs: 60000; readonly toolCalls: 200; }

The script's walls besides the host's CPU (what is left of the unit's 3 s) and its 256 MiB heap.

Members

NameTypeDescription
wallMs60000
httpMs20000
httpBytesnumber
answerBytesnumber
consoleCharsnumber

Console text kept (characters); past it lines are counted, not kept.

outBytesnumber

What a file run writes to /out, and the conversation files it is handed at /in.

inBytesnumber
bundleMs60000

A bundle, a cold bundler included.

toolCalls200

How many calls one run's tool(name, input) makes; which tools it reaches is each tool's ToolPolicy.scripts.

Source: packages/bolt/src/engine/agent/run-js.ts:31

Render class

class Render extends Render_base {
    static fromAbi(port: RenderPort | Off): Layer.Layer<Render>;
}

The host's browser printing a workspace page (RenderPort); a host that turns it off fails each call as unavailable.

Members

NameTypeDescription
pdf(page: { readonly path: string; readonly authorization: string; }) => Effect.Effect<Uint8Array, PortFailure>

Source: packages/bolt/src/engine/ports.ts:209

RowData type

type RowData = {
    readonly [field: string]: Json;
};

A row's stored values in wire form: a decimal as its exact text; dates and instants as ISO strings.

Source: packages/bolt/src/engine/contracts.ts:82

SeedPack type

type SeedPack = {
    readonly [model: string]: readonly RowData[];
};

Rows per model, as a seed pack's seed/<model>.json holds them.

Source: packages/bolt/src/engine/write/seed.ts:29

TenantDb class

class TenantDb extends TenantDb_base {
    /** An adapter's calls with the decoding reads over them. */
    static readonly typed: (adapter: RawDb) => TenantDbShape;
}

The activation's tenant database service; TenantDb.typed wraps a host adapter into its shape.

Members

NameTypeDescription
read(statements: readonly Sql[]) => Effect.Effect<readonly Rows[], DbError>

Read statements share one snapshot and answer in order; rows are relayed as JSON.

write(statement: Sql, lock?: Lock) => Effect.Effect<Rows, DbError>

An act's one write statement, with fixed deadlines and native locks before execution.

transaction(batch: DbBatch) => Effect.Effect<readonly Rows[], DbError>

Complete SQL statements atomically; answers are decoded only after commit or native dry-run rollback.

owe(work: Effect.Effect<void, DbError>) => void

Work this generation owes its database, run once just before its first statement. A cold start owes it rather than doing it, so a request or a cron slot that needs no data leaves a database billed by the second asleep.

readyEffect.Effect<void, DbError>

Settles what is owed, for work that must know its outcome before it composes a statement.

awakeEffect.Effect<boolean>

Whether this generation used the database so lately that it is still awake.

identityWrites() => number

How many statements on people or sessions have finished: what a memo of either keeps beside its answer, read before the read, so a write that lands at any point after makes the answer stale at once.

integrationWrites() => number

How many writing statements on sys_integration have finished, so resting syncs wake on connection changes.

teamWrites() => number

How many writing statements on sys_team have finished, so the team graph is read again.

writes() => number

How many writing statements have finished, as identityWrites counts them: read before a read, it tells whether anything this generation wrote could have changed what that read saw.

quietly<A, E, R>(work: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Work that only checks for work: unless it writes, it does not count as the database being in use.

rows<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<readonly A[], DbError | BoltError>

One read's rows, each decoded by schema.

one<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<Option.Option<A>, DbError | BoltError>

The row of a read that answers at most one.

value<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<A, DbError | BoltError>

The one column of the one row a read answers.

returning<A>(schema: Schema.Decoder<A>, statement: Sql, lock?: Lock) => Effect.Effect<readonly A[], DbError | BoltError>

A write's RETURNING rows, each decoded by schema.

Source: packages/bolt/src/engine/db/tenant-db.ts:96

TenantDbShape type

type TenantDbShape = RawDb & {
    /**
     * Work this generation owes its database, run once just before its first statement. A cold start owes it rather
     * than doing it, so a request or a cron slot that needs no data leaves a database billed by the second asleep.
     */
    readonly owe: (work: Effect.Effect<void, DbError>) => void;
    /** Settles what is owed, for work that must know its outcome before it composes a statement. */
    readonly ready: Effect.Effect<void, DbError>;
    /** Whether this generation used the database so lately that it is still awake. */
    readonly awake: Effect.Effect<boolean>;
    /**
     * How many statements on people or sessions have finished: what a memo of either keeps beside its answer, read
     * before the read, so a write that lands at any point after makes the answer stale at once.
     */
    readonly identityWrites: () => number;
    /** How many writing statements on `sys_integration` have finished, so resting syncs wake on connection changes. */
    readonly integrationWrites: () => number;
    /** How many writing statements on `sys_team` have finished, so the team graph is read again. */
    readonly teamWrites: () => number;
    /**
     * How many writing statements have finished, as `identityWrites` counts them: read before a read, it tells whether
     * anything this generation wrote could have changed what that read saw.
     */
    readonly writes: () => number;
    /** Work that only checks for work: unless …

One tenant database as the engine uses it: the adapter's raw calls plus deferred setup, wake tracking and decoding reads.

Members

NameTypeDescription
read(statements: readonly Sql[]) => Effect.Effect<readonly Rows[], DbError>

Read statements share one snapshot and answer in order; rows are relayed as JSON.

write(statement: Sql, lock?: Lock) => Effect.Effect<Rows, DbError>

An act's one write statement, with fixed deadlines and native locks before execution.

transaction(batch: DbBatch) => Effect.Effect<readonly Rows[], DbError>

Complete SQL statements atomically; answers are decoded only after commit or native dry-run rollback.

owe(work: Effect.Effect<void, DbError>) => void

Work this generation owes its database, run once just before its first statement. A cold start owes it rather than doing it, so a request or a cron slot that needs no data leaves a database billed by the second asleep.

readyEffect.Effect<void, DbError>

Settles what is owed, for work that must know its outcome before it composes a statement.

awakeEffect.Effect<boolean>

Whether this generation used the database so lately that it is still awake.

identityWrites() => number

How many statements on people or sessions have finished: what a memo of either keeps beside its answer, read before the read, so a write that lands at any point after makes the answer stale at once.

integrationWrites() => number

How many writing statements on sys_integration have finished, so resting syncs wake on connection changes.

teamWrites() => number

How many writing statements on sys_team have finished, so the team graph is read again.

writes() => number

How many writing statements have finished, as identityWrites counts them: read before a read, it tells whether anything this generation wrote could have changed what that read saw.

quietly<A, E, R>(work: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

Work that only checks for work: unless it writes, it does not count as the database being in use.

rows<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<readonly A[], DbError | BoltError>

One read's rows, each decoded by schema.

one<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<Option.Option<A>, DbError | BoltError>

The row of a read that answers at most one.

value<A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<A, DbError | BoltError>

The one column of the one row a read answers.

returning<A>(schema: Schema.Decoder<A>, statement: Sql, lock?: Lock) => Effect.Effect<readonly A[], DbError | BoltError>

A write's RETURNING rows, each decoded by schema.

Source: packages/bolt/src/engine/db/tenant-db.ts:31

Transport class

class Transport extends Transport_base {
    /** Mail is mandatory; SMS and push may be `off`. */
    static fromAbi(ports: {
        readonly Mail: TransportPort;
        readonly Sms: TransportPort | Off;
        readonly Push: TransportPort | Off;
    }): Layer.Layer<Transport>;
}

The host's own messaging: a send to an address.

Members

NameTypeDescription
send(message: TransportMessage) => Effect.Effect<{ readonly provider_id: string; }, PortFailure>

Source: packages/bolt/src/engine/ports.ts:431

WebRead class

class WebRead extends WebRead_base {
    static fromAbi(port: WebReadPort | Off): Layer.Layer<WebRead>;
}

Reads a public page; refuses private, loopback and link-local addresses. raw also answers the markup and its links.

Members

NameTypeDescription
read(url: string, options?: { readonly raw?: boolean; }) => Effect.Effect<WebPage, PortFailure>

Source: packages/bolt/src/engine/ports.ts:228

apply_migrations function

function apply_migrations(db: TenantDbShape, next: { readonly agent: { readonly skills: { readonly [x: string]: { readonly text: string; readonly digest: string; readonly files: readonly string[]; }; }; readonly internal?: string; readonly external?: string; }; readonly workspace: { readonly tz: string; readonly locale: string; readonly agent?: { readonly triage?: false; }; readonly apps?: readonly string[]; readonly currency?: string; readonly secrets?: { readonly [x: string]: { readonly label: string; readonly description?: string; }; }; readonly signup?: { readonly via: readonly ("email" | "phone")[]; readonly policies: readonly string[]; readonly party?: { readonly model: string; readonly match: { readonly email?: string; readonly phone?: string; }; }; readonly challenge?: true; }; readonly theme?: { readonly accent?: string; readonly radius?: "default" | "sharp" | "soft"; readonly palette?: "warm" | "neutral" | "crisp"; readonly light?: { readonly [x: string]: string; }; readonly dark?: { readonly [x: string]: string; }; }; readonly languages?: readonly string[]; readonly landing?: { readonly app: string; readonly single_app?: true; }; readonly navigation_visibility?: { readonly field: string; readonly model: string; readonly output: string; readonly apps?: { readonly [x: string]: readonly string[]; }; readonly pages?: { readonly [x: string]: readonly string[]; }; }; readonly ai?: { readonly embeddings?: readonly string[]; }; readonly convert?: { readonly to: readonly ("html" | "pdf" | "docx" | "pptx" | "odt" | "epub")[]; }; readonly csp?: { readonly connect?: readonly string[]; }; readonly memberships?: { readonly model: string; readonly bundles?: { readonly assignments: string; readonly levels: string; }; }; readonly limits?: { readonly [x: string]: { readonly [x: string]: string | { readonly rate: string; readonly per: "sender" | "actor" | "ip" | "subject"; } | readonly (string | { readonly rate: string; readonly per: "sender" | "actor" | "ip" | "subject"; })[]; }; }; }; readonly models: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly description: string; readonly check?: { readonly [x: string]: { readonly [x: string]: Schema.Json; }; }; readonly unique?: readonly { readonly fields: readonly string[]; readonly name?: string; readonly where?: { readonly [x: string]: Schema.Json; }; readonly import_key?: true; }[]; readonly key?: readonly string[]; readonly messages?: { readonly [x: string]: string; }; readonly icon?: string; readonly search?: { readonly text: readonly string[]; readonly indexes?: { readonly [x: string]: { readonly input: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly description: string; readonly dim: number; readonly metric: "l2" | "cosine" | "ip"; readonly field?: string; readonly candidates?: 7 | 1 | 2 | 4 | 3 | 5 | 6 | 8 | 9 | 12 | 10 | 11 | 13 | 14 | 15 | 16; readonly rerank?: true; }; }; readonly semantic?: { readonly fields: readonly string[]; readonly model: string; readonly dim: number; }; }; readonly was?: string; readonly indexes?: readonly { readonly on: readonly (string | { readonly lower: string; })[]; readonly unique?: true; readonly where?: { readonly [x: string]: Schema.Json; }; }[]; readonly locks?: { readonly [x: string]: { readonly where: { readonly [x: string]: Schema.Json; }; readonly except?: readonly string[]; }; }; readonly no_overlap?: readonly { readonly key: readonly string[]; readonly period: string; readonly name?: string; readonly where?: { readonly [x: string]: Schema.Json; }; }[]; readonly computed?: { readonly [x: string]: { readonly kind: "text" | "bool" | "int" | "decimal" | "money" | "date" | "instant"; readonly expr: import("@norbital-ai/store").Expr; readonly scale?: number; }; }; readonly table?: { readonly primary: "text" | "uuid" | "identity" | { readonly field: string; }; readonly identity?: string; }; readonly record_label?: string; }; }; readonly apps: { readonly [x: string]: { readonly title: string; readonly description: string; readonly icon: string; readonly pages: { readonly [x: string]: { readonly title: string; readonly icon?: string; readonly section?: string; readonly portal?: true; }; }; readonly policies?: never; readonly shell?: never; readonly audience?: "external" | "all" | "members" | { readonly public: readonly [string, ...string[]]; readonly challenge?: true; }; readonly banner?: string; readonly embed?: readonly `https://${string}`[]; readonly requires?: readonly ("location" | "location:background" | "notifications" | "camera")[]; } | { readonly title: string; readonly description: string; readonly icon: string; readonly policies: readonly [string, ...string[]]; readonly pages: { readonly [x: string]: { readonly title: string; readonly icon?: string; readonly section?: string; readonly portal?: true; }; }; readonly shell: "kiosk"; readonly audience?: "external" | "all" | "members"; readonly banner?: string; readonly embed?: readonly `https://${string}`[]; readonly requires?: readonly ("location" | "location:background" | "notifications" | "camera")[]; } | { readonly title: string; readonly description: string; readonly icon: string; readonly pages: { readonly [x: string]: { readonly title: string; readonly icon?: string; readonly section?: string; readonly portal?: true; }; }; readonly shell: "kiosk"; readonly audience: { readonly public: readonly [string, ...string[]]; readonly challenge?: true; }; readonly policies?: never; readonly banner?: string; readonly embed?: readonly `https://${string}`[]; readonly requires?: readonly ("location" | "location:background" | "notifications" | "camera")[]; }; }; readonly automations: { readonly [x: string]: { readonly description: string; readonly policies: readonly [string, ...string[]]; readonly agent?: "confirm" | "never"; readonly input?: { readonly [x: string]: import("@norbital-ai/ui").Kind | { readonly kind: "rows"; readonly of: string; readonly optional?: true; }; }; readonly output?: import("@norbital-ai/store/kind").OutputKind; readonly mode?: "job"; readonly on?: readonly ({ readonly cron: string; readonly tz?: string; readonly rest?: `${bigint}min` | `${bigint}s` | `${bigint}h` | `${bigint}d`; } | { readonly model: string; readonly verbs: readonly ["create" | "update" | "delete", ...("create" | "update" | "delete")[]]; })[]; readonly retry?: { readonly attempts: 7 | 2 | 4 | 3 | 5 | 6 | 8; readonly backoff?: `${bigint}min` | `${bigint}s` | `${bigint}h` | `${bigint}d`; }; readonly concurrency?: { readonly max: 7 | 1 | 2 | 4 | 3 | 5 | 26 | 6 | 8 | 9 | 12 | 10 | 11 | 13 | 14 | 15 | 16 | 21 | 22 | 17 | 18 | 19 | 20 | 35 | 25 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64; }; } | { readonly mode: "call"; readonly description: string; readonly policies: readonly [string, ...string[]]; readonly agent?: "confirm" | "never"; readonly input?: { readonly [x: string]: import("@norbital-ai/ui").Kind | { readonly kind: "rows"; readonly of: string; readonly optional?: true; }; }; readonly output?: import("@norbital-ai/store/kind").OutputKind; readonly on?: never; readonly retry?: never; readonly concurrency?: never; }; }; readonly policies: { readonly [x: string]: { readonly description: string; readonly grants: { readonly [x: string]: { readonly create?: { readonly verdict?: true; readonly columns?: { readonly [x: string]: readonly string[]; }; }; readonly update?: { readonly moves?: "all" | { readonly [x: string]: readonly string[]; }; readonly verdict?: true; readonly columns?: { readonly [x: string]: readonly string[]; }; }; readonly delete?: { readonly verdict?: true; }; readonly outputs?: { readonly [x: string]: { readonly history?: true; readonly scopes?: { readonly [x: string]: { readonly [x: string]: Schema.Json; }; }; }; }; }; }; readonly capabilities?: { readonly apps?: readonly string[]; readonly automations?: readonly string[]; readonly mcp?: readonly string[]; readonly syncs?: readonly string[]; readonly tools?: readonly string[]; }; }; }; readonly mcp: { readonly [x: string]: { readonly url: string; readonly description: string; readonly auth?: { readonly bearer: string; } | { readonly oauth: { readonly client_id: string; readonly scopes?: readonly string[]; readonly client_secret?: string; }; }; readonly tools?: readonly string[]; }; }; readonly exposures: { readonly [x: string]: { readonly outputs: { readonly [x: string]: { readonly [x: string]: { readonly fields: "all" | readonly string[]; }; }; readonly default: { readonly [x: string]: { readonly fields: "all" | readonly string[]; }; }; }; readonly create?: { readonly columns: { readonly [x: string]: readonly string[]; }; readonly effect?: true; readonly filled?: { readonly [x: string]: readonly string[]; }; readonly transform?: true; }; readonly update?: { readonly columns: { readonly [x: string]: readonly string[]; }; readonly effect?: true; readonly transform?: true; }; readonly delete?: { readonly effect?: true; readonly transform?: true; }; readonly syncs?: { readonly [x: string]: { readonly with: string; readonly schema?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly read?: true; readonly context?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly parser?: readonly (string | { readonly type: string; readonly extensions: readonly string[]; })[]; readonly every?: string; readonly partitions?: string; readonly policies?: readonly string[]; readonly write?: true; }; }; }; }; readonly custom_fields: { readonly [x: string]: { readonly description: string; readonly shape: import("@norbital-ai/ui").Kind; readonly check?: true; readonly label?: string; readonly search?: true; }; }; readonly integrations: { readonly [x: string]: { readonly description: string; readonly driver: "email" | "http" | "calendar" | "chat" | "sqlserver" | { readonly name: string; readonly read: "cursor" | "deliveries" | "items"; readonly conversation?: { readonly kind: "email" | "chat"; readonly handle: "email" | "phone" | "telegram" | "slack" | "discord" | null; readonly address?: string; }; readonly call?: "http"; readonly personal?: true; readonly oauth?: true; readonly items?: "calendar"; readonly request?: "http" | "database"; readonly credential?: true; }; readonly webhook?: { readonly verify: { readonly scheme: string; readonly secret: string; }; readonly policies?: readonly [string, ...string[]]; readonly handle?: true; }; readonly oauth?: { readonly secret: string; readonly client: string; readonly authorize?: string; readonly token?: string; readonly scopes?: readonly string[]; }; readonly http?: { readonly base_url: string; readonly auth?: { readonly bearer: string; } | { readonly header: { readonly name: string; readonly value: string; }; } | { readonly basic: { readonly user: string; readonly password: string; }; }; readonly allow?: { readonly methods: readonly ["GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE", ...("GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE")[]]; readonly paths: readonly [string, ...string[]]; }; readonly lend?: true; }; readonly credential?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly configuration?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly rate?: string; readonly test?: true; }; }; readonly needs: readonly ("phone" | "sms" | "challenge" | "embed" | "push" | "system1" | "system2" | "webhooks" | "outbound")[]; readonly relationships: { readonly [x: string]: { readonly to: string | readonly string[]; readonly optional?: true; readonly where?: { readonly [x: string]: Schema.Json; }; readonly default?: { readonly var: "actor.id" | "actor.party"; }; readonly inverse?: string; readonly on_delete?: "restrict" | "cascade" | "set_null"; readonly owned?: true; }; }; readonly messages?: { readonly [x: string]: string; }; readonly groups?: { readonly [x: string]: { readonly title: string; readonly icon: string; readonly default_child: string; readonly description?: string; }; }; } | { readonly tables: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly check?: { readonly [x: string]: object | { readonly where: object; readonly message: string; }; }; readonly unique?: readonly { readonly fields: readonly string[]; readonly name?: string; readonly where?: object; readonly import_key?: true; }[]; readonly key?: "text" | "uuid" | "identity" | readonly [string, ...string[]]; readonly index?: readonly (string | readonly string[])[]; readonly search?: { readonly text: readonly string[]; readonly indexes?: { readonly [x: string]: { readonly dim: number; readonly metric: "l2" | "cosine" | "ip"; readonly field?: string; readonly input?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly description?: string; readonly candidates?: number; readonly rerank?: true; }; }; readonly semantic?: { readonly fields: readonly string[]; readonly model: string; readonly dim: number; }; }; readonly was?: string; readonly indexes?: readonly { readonly on: readonly (string | { readonly lower: string; } | { readonly expr: import("@norbital-ai/store").Expr; })[]; readonly unique?: true; readonly where?: object; }[]; readonly locks?: { readonly [x: string]: { readonly where: object; readonly except?: readonly string[]; }; }; readonly no_overlap?: readonly { readonly key: readonly string[]; readonly period: string; readonly name?: string; readonly where?: object; }[]; readonly computed?: { readonly [x: string]: { readonly kind: "text" | "bool" | "int" | "decimal" | "money" | "date" | "instant"; readonly expr: import("@norbital-ai/store").Expr; readonly scale?: number; }; }; readonly identity?: string; readonly record_label?: string; readonly paths?: readonly ({ readonly field: string; readonly path: readonly string[]; } | { readonly field: string; readonly gin: true; })[]; readonly audit?: true; readonly natural?: readonly string[]; readonly through?: { readonly [x: string]: { readonly table: string; readonly from: string; readonly to: string; }; }; }; }; readonly tz: string; readonly currency: string | null; }, bundle: { readonly files: readonly { readonly name: string; readonly sql: string; }[]; readonly squashes: readonly { readonly name: string; readonly sql: string; }[]; readonly snapshotText: string; readonly snapshot: { readonly tables: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly check?: { readonly [x: string]: object | { readonly where: object; readonly message: string; }; }; readonly unique?: readonly { readonly fields: readonly string[]; readonly name?: string; readonly where?: object; readonly import_key?: true; }[]; readonly key?: "text" | "uuid" | "identity" | readonly [string, ...string[]]; readonly index?: readonly (string | readonly string[])[]; readonly search?: { readonly text: readonly string[]; readonly indexes?: { readonly [x: string]: { readonly dim: number; readonly metric: "l2" | "cosine" | "ip"; readonly field?: string; readonly input?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly description?: string; readonly candidates?: number; readonly rerank?: true; }; }; readonly semantic?: { readonly fields: readonly string[]; readonly model: string; readonly dim: number; }; }; readonly was?: string; readonly indexes?: readonly { readonly on: readonly (string | { readonly lower: string; } | { readonly expr: import("@norbital-ai/store").Expr; })[]; readonly unique?: true; readonly where?: object; }[]; readonly locks?: { readonly [x: string]: { readonly where: object; readonly except?: readonly string[]; }; }; readonly no_overlap?: readonly { readonly key: readonly string[]; readonly period: string; readonly name?: string; readonly where?: object; }[]; readonly computed?: { readonly [x: string]: { readonly kind: "text" | "bool" | "int" | "decimal" | "money" | "date" | "instant"; readonly expr: import("@norbital-ai/store").Expr; readonly scale?: number; }; }; readonly identity?: string; readonly record_label?: string; readonly paths?: readonly ({ readonly field: string; readonly path: readonly string[]; } | { readonly field: string; readonly gin: true; })[]; readonly audit?: true; readonly natural?: readonly string[]; readonly through?: { readonly [x: string]: { readonly table: string; readonly from: string; readonly to: string; }; }; }; }; readonly tz: string; readonly currency: string | null; }; readonly lock: { readonly files: { readonly [x: string]: string; }; readonly snapshot: string; readonly squashes?: readonly { readonly file: string; readonly checksum: string; readonly archive: string; readonly replaces: readonly { readonly name: string; readonly checksum: string; }[]; readonly proof: string; }[]; readonly physical?: { readonly [x: string]: string; }; }; readonly physical: { readonly [x: string]: readonly string[]; }; }): Effect.Effect<{ duration_ms: number; steps: { readonly id: string; readonly hazard: string; readonly rows: number; readonly summary: string; }[]; }, BoltError | DbError, never>

Each file and its receipt use one immutable SQL batch, guarded under the same advisory lock before and after DDL. Answers what it did: each step's rows (counted before the step, in the same transaction) and the whole duration.

Parameters

NameTypeDescription
dbTenantDbShape
  • read: (statements: readonly Sql[]) => Effect.Effect<readonly Rows[], DbError>

    Read statements share one snapshot and answer in order; rows are relayed as JSON.

  • write: (statement: Sql, lock?: Lock) => Effect.Effect<Rows, DbError>

    An act's one write statement, with fixed deadlines and native locks before execution.

  • transaction: (batch: DbBatch) => Effect.Effect<readonly Rows[], DbError>

    Complete SQL statements atomically; answers are decoded only after commit or native dry-run rollback.

  • owe: (work: Effect.Effect<void, DbError>) => void

    Work this generation owes its database, run once just before its first statement. A cold start owes it rather than doing it, so a request or a cron slot that needs no data leaves a database billed by the second asleep.

  • ready: Effect.Effect<void, DbError>

    Settles what is owed, for work that must know its outcome before it composes a statement.

  • awake: Effect.Effect<boolean>

    Whether this generation used the database so lately that it is still awake.

  • identityWrites: () => number

    How many statements on people or sessions have finished: what a memo of either keeps beside its answer, read before the read, so a write that lands at any point after makes the answer stale at once.

  • integrationWrites: () => number

    How many writing statements on sys_integration have finished, so resting syncs wake on connection changes.

  • teamWrites: () => number

    How many writing statements on sys_team have finished, so the team graph is read again.

  • writes: () => number

    How many writing statements have finished, as identityWrites counts them: read before a read, it tells whether anything this generation wrote could have changed what that read saw.

  • quietly: <A, E, R>(work: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

    Work that only checks for work: unless it writes, it does not count as the database being in use.

  • rows: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<readonly A[], DbError | BoltError>

    One read's rows, each decoded by schema.

  • one: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<Option.Option<A>, DbError | BoltError>

    The row of a read that answers at most one.

  • value: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<A, DbError | BoltError>

    The one column of the one row a read answers.

  • returning: <A>(schema: Schema.Decoder<A>, statement: Sql, lock?: Lock) => Effect.Effect<readonly A[], DbError | BoltError>

    A write's RETURNING rows, each decoded by schema.

next{ readonly agent: { readonly skills: { readonly [x: string]: { readonly text: string; readonly digest: string; readonly files: readonly string[]; }; }; readonly internal?: string; readonly external?: string; }; readonly workspace: { readonly tz: string; readonly locale: string; readonly agent?: { readonly triage?: false; }; readonly apps?: readonly string[]; readonly currency?: string; readonly s…
bundle{ readonly files: readonly { readonly name: string; readonly sql: string; }[]; readonly squashes: readonly { readonly name: string; readonly sql: string; }[]; readonly snapshotText: string; readonly snapshot: { readonly tables: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly check?: { readonly [x: string]: object | { readonly where: o…
  • files: readonly { readonly name: string; readonly sql: string; }[]
  • squashes: readonly { readonly name: string; readonly sql: string; }[]
  • snapshotText: string
  • snapshot: { readonly tables: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly check?: { readonly [x: string]: object | { readonly where: object; readonly message: string; }; }; readonly unique?: readonly { readonly fields: readonly string[]; readonly name?: string; readonly where?: object; readonly import_key?: true; }[]; readonly key?: "text" |…
  • lock: { readonly files: { readonly [x: string]: string; }; readonly snapshot: string; readonly squashes?: readonly { readonly file: string; readonly checksum: string; readonly archive: string; readonly replaces: readonly { readonly name: string; readonly checksum: string; }[]; readonly proof: string; }[]; readonly physical?: { readonly [x: string]: string; }; }
  • physical: { readonly [x: string]: readonly string[]; }

Source: packages/bolt/src/engine/schema/migrations.ts:301

decode_manifest function

function decode_manifest(u: unknown): Result.Result<EngineManifest, ManifestInvalid>

The one manifest decoder: every artifact read.

Parameters

NameTypeDescription
uunknown

Source: packages/bolt/src/engine/manifest.ts:253

decode_projected_manifest function

function decode_projected_manifest(u: unknown): Result.Result<EngineManifest, ManifestInvalid>

bolt check's evaluated manifest (project_manifest), decoded, with its needs recorded.

Parameters

NameTypeDescription
uunknown

Source: packages/bolt/src/engine/manifest.ts:256

decode_seed function

function decode_seed(m: EngineManifest, pack: SeedPack): void

Seed decode: throws seed_decode on the first bad row. bolt check runs it at build.

Parameters

NameTypeDescription
mEngineManifest
  • exposures: Schema.$Record<Schema.String, Schema.Struct<{ readonly outputs: Schema.StructWithRest<Schema.Struct<{ readonly default: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.Union<readonly [Schema.Literal<"all">, Schema.$Array<Schema.String>]>; }>>; }>, readonly [Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.Union<readonly [Sch…
  • policies: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly grants: Schema.$Record<Schema.String, Schema.Struct<{ readonly outputs: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly scopes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>; readonly history:…
  • agent: Schema.Struct<{ readonly internal: Schema.optionalKey<Schema.String>; readonly external: Schema.optionalKey<Schema.String>; readonly skills: Schema.$Record<Schema.String, Schema.Struct<{ readonly text: Schema.String; readonly digest: Schema.String; readonly files: Schema.$Array<Schema.String>; }>>; }>
  • integrations: Schema.$Record<Schema.String, Schema.Struct<{ readonly test: Schema.optionalKey<Schema.Literal<true>>; readonly description: Schema.String; readonly driver: Schema.Union<readonly [Schema.Literals<("email" | "http" | "calendar" | "chat" | "sqlserver")[]>, Schema.Struct<{ readonly read: Schema.Literals<readonly ["cursor", "deliveries", "items"]>; readonly request: Schema.optionalKey<Schema.Literals…
  • models: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.$Record<Schema.String, Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>>; readonly key: Schema.optionalKey<Schema.$Array<Schema.String>>; readonly unique: Schema.optionalKey<Schema.$Array<Schema.Struct<{ readonly fields: Schema.$Array<Schema.String>; readonly where: Schema.optionalKey<S…
  • relationships: Schema.$Record<Schema.String, Schema.Struct<{ readonly to: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>; readonly inverse: Schema.optionalKey<Schema.String>; readonly optional: Schema.optionalKey<Schema.Literal<true>>; readonly default: Schema.optionalKey<Schema.Struct<{ readonly var: Schema.Literals<readonly ["actor.id", "actor.party"]>; }>>; readonly on_delete: Schema.op…
  • automations: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly mode: Schema.optionalKey<Schema.Literal<"job">>; readonly on: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ readonly cron: Schema.String; readonly tz: Schema.optionalKey<Schema.String>; readonly rest: Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.BigInt, Schema.Literals<readonly ["…
  • needs: Schema.$Array<Schema.Literals<readonly ["sms", "phone", "push", "challenge", "system1", "system2", "embed", "webhooks", "outbound"]>>

    What the bundle needs from its host (Facilities, @norbital-ai/host-api), recorded at build.

  • workspace: Schema.Struct<{ readonly theme: Schema.optionalKey<Schema.Struct<{ readonly palette: Schema.optionalKey<Schema.Literals<readonly ["warm", "neutral", "crisp"]>>; readonly accent: Schema.optionalKey<Schema.String>; readonly radius: Schema.optionalKey<Schema.Literals<readonly ["sharp", "default", "soft"]>>; readonly light: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; readonly da…
  • mcp: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly url: Schema.String; readonly auth: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{ readonly bearer: Schema.String; }>, Schema.Struct<{ readonly oauth: Schema.Struct<{ readonly client_id: Schema.String; readonly client_secret: Schema.optionalKey<Schema.String>; readonly scopes: Schema.optionalKey<…
  • apps: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly shell: Schema.optionalKey<Schema.Never>; readonly policies: Schema.optionalKey<Schema.Never>; readonly audience: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["members", "external", "all"]>, Schema.Struct<{ readonly public: Schema.NonEmptyArray<Schema.String>; readonly challenge: Schema.optionalKey…
  • custom_fields: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly shape: Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>; readonly label: Schema.optionalKey<Schema.String>; readonly search: Schema.optionalKey<Schema.Literal<true>>; readonly check: Schema.optionalKey<Schema.Literal<true>>; }>>
  • groups?: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly title: Schema.String; readonly description: Schema.optionalKey<Schema.String>; readonly icon: Schema.String; readonly default_child: Schema.String; }>>>
  • messages?: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>
packSeedPack

Source: packages/bolt/src/engine/write/seed.ts:33

migration_objects function

function migration_objects(schema: SchemaSpec): Effect.Effect<readonly SchemaObject[], BoltError>

What a generated migration keeps beside a schema's tables: these exact native triggers are source definitions.

Parameters

NameTypeDescription
schemaSchemaSpec
  • tables: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.$Record<Schema.String, Schema.Codec<Kind, Kind, never, never>>; /** Pure CEL over this row or one to-one layer; own-field labels are materialized, relation labels resolve while reading. */ readonly record_label: Schema.optionalKey<Schema.String>; /** * The primary key: these fields (composite or natural), or an `id` column of t…
  • tz: Schema.String

    The zone { today } defaults and date buckets read; UTC when unset.

  • currency: Schema.NullOr<Schema.String>

    The currency a money field without its own is checked against.

Source: packages/bolt/src/engine/schema/migrations.ts:80

migration_schema function

function migration_schema(next: EngineManifest | SchemaSlice): SchemaSpec

The migratable schema of a manifest or schema slice: its tables, time zone and currency.

Parameters

NameTypeDescription
nextEngineManifest | SchemaSlice

Source: packages/bolt/src/engine/schema/migrations.ts:74

output_type function

function output_type(bytes: Uint8Array, name: string): { mime: string; } | { refused: string; }

What a returned file is, by its bytes (the name only tells office documents and text kinds apart): media, an office document or a PDF, an archive, or UTF-8 text. An executable or any other binary is refused.

Parameters

NameTypeDescription
bytesUint8Array
namestring

Source: packages/bolt/src/engine/agent/run-js.ts:337

plan function

function plan(applied: AppliedSchemaSlice | null, next: EngineManifest | SchemaSlice): Effect.Effect<Plan & { readonly slice: SchemaSlice; }, BoltError>

The store's plan from applied to the manifest's (or a given) slice, the engine's objects beside both.

Parameters

NameTypeDescription
appliedAppliedSchemaSlice | null
nextEngineManifest | SchemaSlice

Source: packages/bolt/src/engine/schema/plan-full.ts:15

project_manifest function

function project_manifest(m: LoadedManifest): unknown

The loaded manifest as the engine's, before decode_manifest: +secrets.ts joins the workspace as secrets.

Parameters

NameTypeDescription
mLoadedManifest

Source: packages/bolt/src/engine/manifest.ts:410

read_applied function

function read_applied(db: TenantDbShape): Effect.Effect<{ fingerprint: string; original: { readonly [x: string]: Schema.Json; }; schema: import("@norbital-ai/store").SchemaSpec; } | null, BoltError | import("@norbital-ai/host-api").DbError, never>

Current applied schema, with its original verified identity; a slice the snapshot schema refuses fails to decode.

Parameters

NameTypeDescription
dbTenantDbShape
  • read: (statements: readonly Sql[]) => Effect.Effect<readonly Rows[], DbError>

    Read statements share one snapshot and answer in order; rows are relayed as JSON.

  • write: (statement: Sql, lock?: Lock) => Effect.Effect<Rows, DbError>

    An act's one write statement, with fixed deadlines and native locks before execution.

  • transaction: (batch: DbBatch) => Effect.Effect<readonly Rows[], DbError>

    Complete SQL statements atomically; answers are decoded only after commit or native dry-run rollback.

  • owe: (work: Effect.Effect<void, DbError>) => void

    Work this generation owes its database, run once just before its first statement. A cold start owes it rather than doing it, so a request or a cron slot that needs no data leaves a database billed by the second asleep.

  • ready: Effect.Effect<void, DbError>

    Settles what is owed, for work that must know its outcome before it composes a statement.

  • awake: Effect.Effect<boolean>

    Whether this generation used the database so lately that it is still awake.

  • identityWrites: () => number

    How many statements on people or sessions have finished: what a memo of either keeps beside its answer, read before the read, so a write that lands at any point after makes the answer stale at once.

  • integrationWrites: () => number

    How many writing statements on sys_integration have finished, so resting syncs wake on connection changes.

  • teamWrites: () => number

    How many writing statements on sys_team have finished, so the team graph is read again.

  • writes: () => number

    How many writing statements have finished, as identityWrites counts them: read before a read, it tells whether anything this generation wrote could have changed what that read saw.

  • quietly: <A, E, R>(work: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>

    Work that only checks for work: unless it writes, it does not count as the database being in use.

  • rows: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<readonly A[], DbError | BoltError>

    One read's rows, each decoded by schema.

  • one: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<Option.Option<A>, DbError | BoltError>

    The row of a read that answers at most one.

  • value: <A>(schema: Schema.Decoder<A>, statement: Sql) => Effect.Effect<A, DbError | BoltError>

    The one column of the one row a read answers.

  • returning: <A>(schema: Schema.Decoder<A>, statement: Sql, lock?: Lock) => Effect.Effect<readonly A[], DbError | BoltError>

    A write's RETURNING rows, each decoded by schema.

Source: packages/bolt/src/engine/schema/plan.ts:86

read_migrations function

function read_migrations(directory: string): Effect.Effect<{ files: MigrationFile[]; squashes: MigrationFile[]; snapshotText: string; snapshot: { readonly tables: { readonly [x: string]: { readonly fields: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly check?: { readonly [x: string]: object | { readonly where: object; readonly message: string; }; }; readonly unique?: readonly { readonly fields: readonly string[]; readonly name?: string; readonly where?: object; readonly import_key?: true; }[]; readonly key?: "text" | "uuid" | "identity" | readonly [string, ...string[]]; readonly index?: readonly (string | readonly string[])[]; readonly search?: { readonly text: readonly string[]; readonly indexes?: { readonly [x: string]: { readonly dim: number; readonly metric: "l2" | "cosine" | "ip"; readonly field?: string; readonly input?: { readonly [x: string]: import("@norbital-ai/ui").Kind; }; readonly description?: string; readonly candidates?: number; readonly rerank?: true; }; }; readonly semantic?: { readonly fields: readonly string[]; readonly model: string; readonly dim: number; }; }; readonly was?: string; readonly indexes?: readonly { readonly on: readonly (string | { readonly lower: string; } | { readonly expr: import("@norbital-ai/store").Expr; })[]; readonly unique?: true; readonly where?: object; }[]; readonly locks?: { readonly [x: string]: { readonly where: object; readonly except?: readonly string[]; }; }; readonly no_overlap?: readonly { readonly key: readonly string[]; readonly period: string; readonly name?: string; readonly where?: object; }[]; readonly computed?: { readonly [x: string]: { readonly kind: "text" | "bool" | "int" | "decimal" | "money" | "date" | "instant"; readonly expr: import("@norbital-ai/store").Expr; readonly scale?: number; }; }; readonly identity?: string; readonly record_label?: string; readonly paths?: readonly ({ readonly field: string; readonly path: readonly string[]; } | { readonly field: string; readonly gin: true; })[]; readonly audit?: true; readonly natural?: readonly string[]; readonly through?: { readonly [x: string]: { readonly table: string; readonly from: string; readonly to: string; }; }; }; }; readonly tz: string; readonly currency: string | null; }; lock: { readonly files: { readonly [x: string]: string; }; readonly snapshot: string; readonly squashes?: readonly { readonly file: string; readonly checksum: string; readonly archive: string; readonly replaces: readonly { readonly name: string; readonly checksum: string; }[]; readonly proof: string; }[]; readonly physical?: { readonly [x: string]: string; }; }; physical: Readonly<Record<string, readonly string[]>>; }, BoltError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>

Reads and verifies a migrations/ folder against its lock: SQL history, archived squashes, snapshot digest and physical definitions. Any missing or changed file fails migration_invalid or migration_changed.

Parameters

NameTypeDescription
directorystring

Source: packages/bolt/src/engine/schema/migrations.ts:167

read_pack function

function read_pack(dir: string): Effect.Effect<{ dir: string; meta: { readonly format: 1; readonly name: string; readonly hash: string; readonly start: readonly string[]; readonly rows: { readonly [x: string]: number; }; readonly assets: readonly { readonly path: string; readonly sha256: string; readonly bytes: number; readonly content_type: string; }[]; }; rows: { [k: string]: { readonly [x: string]: Schema.Json; }[]; }; }, BoltError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem>

Every model's rows in memory, for in-process hosts and test kits.

Parameters

NameTypeDescription
dirstring

Source: packages/bolt/src/engine/write/pack.ts:215

read_pack_source function

function read_pack_source(dir: string): Effect.Effect<{ meta: { readonly format: 1; readonly name: string; readonly hash: string; readonly start: readonly string[]; readonly rows: { readonly [x: string]: number; }; readonly assets: readonly { readonly path: string; readonly sha256: string; readonly bytes: number; readonly content_type: string; }[]; }; asset: (path: string) => Effect.Effect<Uint8Array<ArrayBufferLike>, BoltError, FileSystem.FileSystem>; rows: (model: string, from: number) => Stream.Stream<{ readonly [x: string]: Schema.Json; }, BoltError, never>; }, BoltError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem>

A pack whose rows stay on disk until each model is restored, a line at a time (a cell holds 128 MiB).

Parameters

NameTypeDescription
dirstring

Source: packages/bolt/src/engine/write/pack.ts:180

size_bytes function

function size_bytes(s: string): number

'5MiB' or '5MB' → bytes.

Parameters

NameTypeDescription
sstring

Source: packages/bolt/src/engine/callables/upload.ts:55

stateField function

function stateField(m: EngineManifest, model: string): { readonly name: string; readonly spec: StateKind; } | undefined

model's state field (bolt check admits at most one): its name and its states.

Parameters

NameTypeDescription
mEngineManifest
  • exposures: Schema.$Record<Schema.String, Schema.Struct<{ readonly outputs: Schema.StructWithRest<Schema.Struct<{ readonly default: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.Union<readonly [Schema.Literal<"all">, Schema.$Array<Schema.String>]>; }>>; }>, readonly [Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.Union<readonly [Sch…
  • policies: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly grants: Schema.$Record<Schema.String, Schema.Struct<{ readonly outputs: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly scopes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>; readonly history:…
  • agent: Schema.Struct<{ readonly internal: Schema.optionalKey<Schema.String>; readonly external: Schema.optionalKey<Schema.String>; readonly skills: Schema.$Record<Schema.String, Schema.Struct<{ readonly text: Schema.String; readonly digest: Schema.String; readonly files: Schema.$Array<Schema.String>; }>>; }>
  • integrations: Schema.$Record<Schema.String, Schema.Struct<{ readonly test: Schema.optionalKey<Schema.Literal<true>>; readonly description: Schema.String; readonly driver: Schema.Union<readonly [Schema.Literals<("email" | "http" | "calendar" | "chat" | "sqlserver")[]>, Schema.Struct<{ readonly read: Schema.Literals<readonly ["cursor", "deliveries", "items"]>; readonly request: Schema.optionalKey<Schema.Literals…
  • models: Schema.$Record<Schema.String, Schema.Struct<{ readonly fields: Schema.$Record<Schema.String, Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>>; readonly key: Schema.optionalKey<Schema.$Array<Schema.String>>; readonly unique: Schema.optionalKey<Schema.$Array<Schema.Struct<{ readonly fields: Schema.$Array<Schema.String>; readonly where: Schema.optionalKey<S…
  • relationships: Schema.$Record<Schema.String, Schema.Struct<{ readonly to: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>; readonly inverse: Schema.optionalKey<Schema.String>; readonly optional: Schema.optionalKey<Schema.Literal<true>>; readonly default: Schema.optionalKey<Schema.Struct<{ readonly var: Schema.Literals<readonly ["actor.id", "actor.party"]>; }>>; readonly on_delete: Schema.op…
  • automations: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly mode: Schema.optionalKey<Schema.Literal<"job">>; readonly on: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{ readonly cron: Schema.String; readonly tz: Schema.optionalKey<Schema.String>; readonly rest: Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.BigInt, Schema.Literals<readonly ["…
  • needs: Schema.$Array<Schema.Literals<readonly ["sms", "phone", "push", "challenge", "system1", "system2", "embed", "webhooks", "outbound"]>>

    What the bundle needs from its host (Facilities, @norbital-ai/host-api), recorded at build.

  • workspace: Schema.Struct<{ readonly theme: Schema.optionalKey<Schema.Struct<{ readonly palette: Schema.optionalKey<Schema.Literals<readonly ["warm", "neutral", "crisp"]>>; readonly accent: Schema.optionalKey<Schema.String>; readonly radius: Schema.optionalKey<Schema.Literals<readonly ["sharp", "default", "soft"]>>; readonly light: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>; readonly da…
  • mcp: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly url: Schema.String; readonly auth: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{ readonly bearer: Schema.String; }>, Schema.Struct<{ readonly oauth: Schema.Struct<{ readonly client_id: Schema.String; readonly client_secret: Schema.optionalKey<Schema.String>; readonly scopes: Schema.optionalKey<…
  • apps: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly shell: Schema.optionalKey<Schema.Never>; readonly policies: Schema.optionalKey<Schema.Never>; readonly audience: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["members", "external", "all"]>, Schema.Struct<{ readonly public: Schema.NonEmptyArray<Schema.String>; readonly challenge: Schema.optionalKey…
  • custom_fields: Schema.$Record<Schema.String, Schema.Struct<{ readonly description: Schema.String; readonly shape: Schema.Codec<import("@norbital-ai/ui").Kind, import("@norbital-ai/ui").Kind, never, never>; readonly label: Schema.optionalKey<Schema.String>; readonly search: Schema.optionalKey<Schema.Literal<true>>; readonly check: Schema.optionalKey<Schema.Literal<true>>; }>>
  • groups?: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly title: Schema.String; readonly description: Schema.optionalKey<Schema.String>; readonly icon: Schema.String; readonly default_child: Schema.String; }>>>
  • messages?: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>
modelstring

Source: packages/bolt/src/engine/manifest.ts:491

validate_database_request function

function validate_database_request(value: unknown): Effect.Effect<DatabaseRequest, BoltError>

Decodes a guest's database request, refusing unknown keys or one over the argument byte limit as invalid_input.

Parameters

NameTypeDescription
valueunknown

Source: packages/bolt/src/engine/integrations/database.ts:17

protocol

wire_error function

function wire_error(e: unknown): { status: number; body: WireError; }

A transport failure as it is answered: a BoltError by its code at CODE's status, anything else a 500 that names nothing.

Parameters

NameTypeDescription
eunknown

Source: packages/bolt/src/protocol/wire.ts:141