跳到主要内容

bolt-cli/test

bolt-cli/test

此内容目前仅提供英文版。

导入自 @norbital-ai/bolt-cli/test

Public test edge: one scoped workspace layer and Effect-native callers.

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.

成员

名称类型说明
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>

源码: 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.

成员

名称类型说明
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.

源码: 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.

成员

名称类型说明
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>

源码: packages/host-api/src/ai.ts:55

test

Caller type

type Caller = Effect.Success<ReturnType<Kit['as']>>;

Reads, writes, approval decisions, uploads and automation starts through the real host routes under one authority, with native decoded values and typed failures. query takes a typed read request; wire_query is Bolt's own host-conformance hook over ad hoc manifests, not for workspace tests.

成员

名称类型说明
authorityAuthority
queryKitQuery
wire_query(request: object) => Effect.Effect<{ readonly [x: string]: { readonly key?: { readonly [x: string]: Schema.Json; }; readonly max?: { readonly [x: string]: Schema.Json; }; readonly min?: { readonly [x: string]: Schema.Json; }; readonly sum?: { readonly [x: string]: Json; }; readonly count?: number; readonly avg?: { readonly [x: string]: Json; }; } | { readonly rows: readonly { readonly key?: { rea…

Bolt's own host-conformance suites only, over ad hoc manifests no generated names describe: a read request as the wire carries it, decoded by the host's one decoder. @norbital-ai/bolt-cli's kit leaves it out.

history<C extends string>(model: Is<C, ReadableName>, id: NoInfer<Id<C>>, options?: HistoryOptions<C>) => Effect.Effect<readonly { readonly revision: number; readonly at: string; readonly actor: { readonly kind: string; readonly id: string; } | null; readonly cause: "cascade" | "direct" | "derived" | "seed" | "erased"; readonly changed: { readonly [x: number]: unknown; readonly [x: string]: unknown; }; …

A record's revisions as the page's bolt.history reads them, oldest first; at starts from an instant, a revision or just before an approval request. A record as of a revision: take its at, then read the root with as_of.

actKitAct
run<const A extends string, O>(automation: string extends A ? string : Is<A, AutomationName>, input: NoInfer<string extends A ? Json : StartInput<A>>, output: Schema.Decoder<O>, options?: NoInfer<AutomationSpecOf<A> extends { mode: "call"; } ? never : { id?: string; }>) => Effect.Effect<O, ActFailure | Schema.SchemaError>

Decodes the native job receipt or call output with the supplied result schema.

sync_control<const M extends string, const S extends string>(model: Is<M, ModelName>, sync: Is<S, FileSyncName<M> | ReadSyncName<M>>, input: NoInfer<SyncControlInput<M, S>>, options?: { id?: string; }) => Effect.Effect<{ readonly records: readonly { readonly model: string; readonly id: string; readonly revision: number; }[]; readonly kind: "pending_approval"; readonly request_id: string; } | { readonly kind:…

Native manual sync control through its real host route.

upload(field: `${string}.${string}`, file: { name: string; mime: string; bytes: Uint8Array; id?: string; }) => Effect.Effect<Committed<FileRef> | PendingApproval, ActFailure>
approvals{ decide(request_id: string, input: { decision: 'approve' | 'reject' | 'request_changes' | 'withdraw'; reason?: string; }): Effect.Effect<void, ActFailure>; }

bolt.approvals.decide: approve, reject or request changes on a request this caller may decide now (a reason for the last two), or withdraw their own.

源码: packages/bolt-cli/src/test/effect.ts:49

CassetteOptions type

type CassetteOptions = NonNullable<NonNullable<EngineOptions<never>['fakes']>['ai']>;

AI playback configuration: response cassettes and an optional System 1 responder.

成员

名称类型说明
cassetteCassette
sys_1?Ai['Service']['ask']

源码: packages/bolt-cli/src/test/effect.ts:62

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.

成员

名称类型说明
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>

源码: 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.

示例

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

源码: 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.

成员

名称类型说明
rowsSchema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>

源码: 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.

成员

名称类型说明
messagestring
sqlstateSchema.String
outcome_unknown?Schema.optionalKey<Schema.Literal<true>>
constraint?Schema.optional<Schema.String>
column?Schema.optional<Schema.String>

源码: 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.

源码: packages/host-api/src/ai.ts:162

engine

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).

成员

名称类型说明
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.

源码: packages/bolt/src/engine/ports.ts:116

test

JobResult const

const JobResult: Schema.Union<readonly [Schema.Struct<{ readonly kind: Schema.Literal<"pending_approval">; readonly request_id: Schema.String; readonly records: Schema.$Array<Schema.Struct<{ readonly model: Schema.String; readonly id: Schema.String; readonly revision: Schema.Number; }>>; }>, Schema.Struct<{ readonly output: Schema.Struct<{ readonly id: Schema.String; readonly automation: Schema.String; }>; readonly kind: Schema.Literal<"committed">; readonly records: Schema.$Array<Schema.Struct<{ readonly model: Schema.String; readonly id: Schema.String; readonly revision: Schema.Number; }>>; readonly unchang…

A queued automation's actual native receipt, suitable as a run result decoder.

源码: packages/bolt-cli/src/test/effect.ts:100

Kit interface

interface Kit extends EngineKit {}

A scoped workspace's test controls: create callers, inspect native rows and port observations, advance its clock, run due work, and exercise real HTTP and integration entry points.

成员

名称类型说明
manifestEngineManifest
releasestring

The verified artifact hash, or the explicit in-memory test release.

dbTenantDbShape
stored_queryKitQuery

A write callback's native stored reader (ctx.query), unscoped, in this workspace.

body_acts(who: Holder | Authority) => Effect.Effect<KitAct, BoltError>

An automation's native batch writer, under this caller's authority.

fakesFakes
syncs{ read(name: string, options?: { readonly instance?: string; readonly partition?: string; }): Effect.Effect<{ readonly pages: number; }, EngineError | KitInvalid>; deliver(): Effect.Effect<{ readonly delivered: number; }, EngineError | KitInvalid>; write(name: string, rows: readonly Json[], options?: { readonly instance?: string; }): Effect.Effect<void, ActFailure | EngineError | KitInvalid>; tes…

The workspace's real sync engine: read runs a remote sync's read, deliver drains committed writes, write commits one page of rows as read answers them ($id, $version, $deleted and fields) exactly as a read run commits a page, without the read body (instance defaults to the sync's one instance; a refused page fails with the act's failure), and test runs an instance's integration test body.

integrations{ pair(instance: string, input: Json): Effect.Effect<void, EngineError | PortFailure | SendRefused>; may(who: Holder | Authority, instance: string): Effect.Effect<boolean | null, EngineError | PortFailure | SendRefused>; }

The host's integration links over providers: pair pairs an instance as the settings page does (its provider writes the credential and status), may answers whether who may manage it (null: no such instance).

count{ readonly reads: number; readonly writes: number; reset(): void; }
clock{ now(): string; set(instant: string): void; advance(value: string): void; }
adminHolder
member(policies: readonly string[], over?: Partial<Extract<EngineActor, { kind: "member"; }>>) => Holder & { readonly id: string; }
as(who: Holder | Authority) => Effect.Effect<Caller, BoltError>
visitor(app: string, options?: { readonly ip?: string; }) => Effect.Effect<Caller, BoltError>
sign_in(address: string) => Effect.Effect<Authority, KitFailure>

A sign-in by address, as a host's: an invited (or signing-up) newcomer joins, writing sys_user and waking its listeners.

run_due() => Effect.Effect<{ readonly failed: readonly { readonly id: string; readonly automation: string; readonly error: string | null; }[]; }, EngineError>

Fires crons due at the clock and drains every run due at it, chained runs included; dies if work stays due. Answers the runs that failed in this call, each with its own error.

crash(runId: string) => Effect.Effect<void, KitFailure>

The host dies as runId ends, before its end is recorded: nothing more reaches the database, no retry runs, and the run stays running for its lease to reclaim (run_due past the lease) to rerun from the start. Every other run in flight in that wake dies with it and waits for its lease the same way. Fails when runId is not claimed in this wake: a run queued behind a running one (a crashed one included) waits for that one's lease before it can be crashed.

settled() => Effect.Effect<void>

Waits for background work to go quiet. It runs nothing queued: run_due runs model effects and started automations.

receive(instance: string, messages: Json | readonly Json[], options?: { readonly history?: true; readonly bins?: readonly Uint8Array[]; }) => Effect.Effect<void, EngineError | KitInvalid>

Inbound conversation messages through the instance's link; a message the engine cannot decode fails the call.

event(instance: string, event: Exclude<DriverEvent, { kind: "messages" | "invalidate"; }>) => Effect.Effect<void, EngineError>

Any other event a driver hands the engine: a delivery report, a cleared chat, presence, an outbound reference.

handle(request: Request, options?: { readonly address?: string; }) => Effect.Effect<Response>

Real native HTTP routes, including isolated public SSR when acquired from an artifact.

session(id: string) => Effect.Effect<string, KitFailure>

源码: packages/bolt-cli/src/test/effect.ts:42

tooling

KitInvalid class

class KitInvalid extends KitInvalid_base {
}

Invalid test configuration, fixture input or compiler setup; these failures cannot be mistaken for a business refusal.

成员

名称类型说明
messagestring

源码: packages/bolt/src/tooling/test-engine.ts:250

test

NativeActAnswer type

type NativeActAnswer = Effect.Success<ReturnType<Caller['act']>>;

A native map-write outcome, with each import result decoded using its actual model.

源码: packages/bolt-cli/src/test/effect.ts:53

NativeReadAnswer type

type NativeReadAnswer = Effect.Success<ReturnType<Caller['query']>>;

A manifest-dependent query's decoded pages or aggregates; dynamic field values retain their native values.

源码: packages/bolt-cli/src/test/effect.ts:51

NativeReadRow const

const NativeReadRow: Schema.StructWithRest<Schema.Struct<{ readonly $sync: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{ readonly status: Schema.Literals<readonly ["pending", "ok", "failed"]>; readonly message: Schema.optionalKey<Schema.String>; }>>>; readonly $approval: Schema.optionalKey<Schema.Struct<{ readonly request_id: Schema.String; readonly state: Schema.Literals<readonly ["Pending", "ChangesRequested"]>; readonly step: Schema.Int; readonly steps: Schema.$Array<Schema.Struct<{ readonly name: Schema.String; readonly teams: Schema.$Array<Schema.String>; readonly users: Schema.$Array<Sche…

A native query row's fixed metadata; its manifest-dependent fields retain their decoded values.

源码: packages/bolt-cli/src/test/effect.ts:103

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.

成员

名称类型说明
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.

源码: 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.

源码: packages/host-api/src/errors.ts:37

engine

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.

成员

名称类型说明
pdf(page: { readonly path: string; readonly authorization: string; }) => Effect.Effect<Uint8Array, PortFailure>

源码: packages/bolt/src/engine/ports.ts:209

test

TestOptions type

type TestOptions<P extends TestPorts = never> = Pick<
	EngineOptions<P>,
	'seed' | 'now' | 'secrets_key' | 'ports' | 'fakes' | 'links' | 'providers' | 'host'
> & {
	pack?: Pack;
	/** The workspace guest CPU budget; the kit default is the host's 3000 ms. */
	guest_cpu_ms?: number;
	/** Optional meter for each guest run's CPU, for profiling a workspace. */
	guest_meter?: (session: string, nanos: bigint) => void;
	/** Optional meter for each round trip a guest run makes to the host: how many `ctx` calls cross together. */
	guest_crossed?: (session: string, calls: number) => void;
	db?: Layer.Layer<TenantDb, KitFailure>;
} & (
		| {
				/** A release verified by read_artifact; public HTTP requests execute its isolated server programs. */
				artifact: Artifact;
				root?: never;
				manifest?: never;
				guest?: never;
				transforms?: never;
		  }
		| {
				artifact?: never;
				root?: string;
				manifest?: EngineManifest;
				guest?: GuestProgram;
				transforms?: Iterable<string>;
		  }
	);

Workspace fixture and host configuration: use a verified release, check authored source, or supply a manifest/guest (with transforms, the write callbacks it carries per verb: '<model>.create', '<model>.update', '<model>.delete'); choose seed data, control time, and native ports. seed defaults to the template's test pack when root has seed/test/, else none; rows here (or 'none') replace it. The public base pack and bank rows never load in a test.

源码: packages/bolt-cli/src/test/effect.ts:70

TestPorts type

type TestPorts = Layer.Success<NonNullable<Parameters<typeof test_engine>[0]['ports']>>;

Host port service keys a test may replace with native Layers, including file storage, conversion, web, geography, transport, AI, outbound HTTP, images and MCP.

源码: packages/bolt-cli/src/test/effect.ts:56

TestWorkspace class

class TestWorkspace extends Context.Service<TestWorkspace, Kit>()(
	'@norbital-ai/bolt-cli/test/TestWorkspace'
) {
	static readonly layer = <P extends TestPorts>(
		options: TestOptions<P>
	): Layer.Layer<TestWorkspace | WorkspaceServices, KitFailure> =>
		Layer.effectContext(
			Effect.gen(function* () {
				const {
					root,
					db: injected,
					pack,
					guest_cpu_ms,
					guest_meter,
					guest_crossed,
					...engine
				} = options;
				let { manifest, guest, transforms } = options;
				const artifact = options.artifact;
				let migrations = artifact?.migrations;
				if (artifact !== undefined) ({ manifest, guest } = artifact);
				// a template's tests seed from its own `test` pack (`seed/test/`) unless they pass rows or 'none'; the public
				// `base` and the bank's `sample` are product seeds, never test fixtures
				const testRoot =
					options.seed === undefined &&
					root !== undefined &&
					(yield* FileSystem.FileSystem.pipe(
						Effect.flatMap((fs) => fs.exists(join(root, 'seed', 'test'))),
						Effect.provide(node),
						Effect.mapError(invalid)
					))
						? root
						: undefined;
				if (root !== undefined) {
					const built = yield* checked(root);
					if (built.errors.length > 0 || built.manifest === undefined)
						return yield* Effect.fail(
							new KitInvalid({
								message: `bolt check failed:\n${built.errors.map((d) => `  ${d.code} ${d.message}`).join('\n')}`
							})
						);
					({ manifest, guest, transforms } = built);
					const fs = yield* FileSystem.FileSystem.pipe(Effect.provide(node));
					const directory = join(root, 'migrations');
					if (yield* fs.exists(join(directory, 'snapshot.json')).pipe(Effect.mapError(invalid)))
						migrations = yield* read_migrations(directory).pipe(
							Effect.provide(node),
							Effect.mapError(invalid)
						);
				}
				if (manifest === undefined)
					return yield* Effect.fail(
						new KitInvalid({ message: 'TestWorkspace takes a root or a manifest' })
					);
				const context = yield* Layer.build(
					test_engine({
						...engine,
						manifest,
						guest,
						transforms,
						artifact,
						db: (m) =>
							injected === undefined
								? TestDb.layer(m, migrations)
								: Layer.effect(
										TenantDb,
										Effect.gen(function* () {
											const db = yield* TenantDb;
											yield* migrated(db, m, migrations);
											return db;
										})
									).pipe(Layer.provide(injected)),
						// the kit's own runner: guest code runs in this process's `node:vm` contexts
						guests: node_guests({
							...(guest_cpu_ms == null ? {} : { cpu_ms: guest_cpu_ms }),
							...(guest_meter == null ? {} : { meter: guest_meter }),
							...(guest_crossed == null ? {} : { crossed: guest_crossed })
						}),
						audit: memory_audit(),
						pack:
							pack !== undefined
								? () => Effect.succeed(pack)
								: testRoot === undefined
									? undefined
									: (m) => testPack(testRoot, m)
					})
				);
				return Context.add(context, TestWorkspace, Context.get(context, TestEngine));
			})
		);
}

A native test workspace service; its layer owns database and engine resources in scope and exposes the same host routes used by deployed workspaces.

成员

名称类型说明
manifestEngineManifest
releasestring

The verified artifact hash, or the explicit in-memory test release.

dbTenantDbShape
stored_queryKitQuery

A write callback's native stored reader (ctx.query), unscoped, in this workspace.

body_acts(who: Holder | Authority) => Effect.Effect<KitAct, BoltError>

An automation's native batch writer, under this caller's authority.

fakesFakes
syncs{ read(name: string, options?: { readonly instance?: string; readonly partition?: string; }): Effect.Effect<{ readonly pages: number; }, EngineError | KitInvalid>; deliver(): Effect.Effect<{ readonly delivered: number; }, EngineError | KitInvalid>; write(name: string, rows: readonly Json[], options?: { readonly instance?: string; }): Effect.Effect<void, ActFailure | EngineError | KitInvalid>; tes…

The workspace's real sync engine: read runs a remote sync's read, deliver drains committed writes, write commits one page of rows as read answers them ($id, $version, $deleted and fields) exactly as a read run commits a page, without the read body (instance defaults to the sync's one instance; a refused page fails with the act's failure), and test runs an instance's integration test body.

integrations{ pair(instance: string, input: Json): Effect.Effect<void, EngineError | PortFailure | SendRefused>; may(who: Holder | Authority, instance: string): Effect.Effect<boolean | null, EngineError | PortFailure | SendRefused>; }

The host's integration links over providers: pair pairs an instance as the settings page does (its provider writes the credential and status), may answers whether who may manage it (null: no such instance).

count{ readonly reads: number; readonly writes: number; reset(): void; }
clock{ now(): string; set(instant: string): void; advance(value: string): void; }
adminHolder
member(policies: readonly string[], over?: Partial<Extract<EngineActor, { kind: "member"; }>>) => Holder & { readonly id: string; }
as(who: Holder | Authority) => Effect.Effect<Caller, BoltError>
visitor(app: string, options?: { readonly ip?: string; }) => Effect.Effect<Caller, BoltError>
sign_in(address: string) => Effect.Effect<Authority, KitFailure>

A sign-in by address, as a host's: an invited (or signing-up) newcomer joins, writing sys_user and waking its listeners.

run_due() => Effect.Effect<{ readonly failed: readonly { readonly id: string; readonly automation: string; readonly error: string | null; }[]; }, EngineError>

Fires crons due at the clock and drains every run due at it, chained runs included; dies if work stays due. Answers the runs that failed in this call, each with its own error.

crash(runId: string) => Effect.Effect<void, KitFailure>

The host dies as runId ends, before its end is recorded: nothing more reaches the database, no retry runs, and the run stays running for its lease to reclaim (run_due past the lease) to rerun from the start. Every other run in flight in that wake dies with it and waits for its lease the same way. Fails when runId is not claimed in this wake: a run queued behind a running one (a crashed one included) waits for that one's lease before it can be crashed.

settled() => Effect.Effect<void>

Waits for background work to go quiet. It runs nothing queued: run_due runs model effects and started automations.

receive(instance: string, messages: Json | readonly Json[], options?: { readonly history?: true; readonly bins?: readonly Uint8Array[]; }) => Effect.Effect<void, EngineError | KitInvalid>

Inbound conversation messages through the instance's link; a message the engine cannot decode fails the call.

event(instance: string, event: Exclude<DriverEvent, { kind: "messages" | "invalidate"; }>) => Effect.Effect<void, EngineError>

Any other event a driver hands the engine: a delivery report, a cleared chat, presence, an outbound reference.

handle(request: Request, options?: { readonly address?: string; }) => Effect.Effect<Response>

Real native HTTP routes, including isolated public SSR when acquired from an artifact.

session(id: string) => Effect.Effect<string, KitFailure>

源码: packages/bolt-cli/src/test/effect.ts:292

engine

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.

成员

名称类型说明
read(url: string, options?: { readonly raw?: boolean; }) => Effect.Effect<WebPage, PortFailure>

源码: packages/bolt/src/engine/ports.ts:228

test

WorkspaceServices type

type WorkspaceServices = Exclude<Layer.Success<ReturnType<typeof test_engine>>, TestEngine>;

The engine, database, host, shell and port services made available alongside TestWorkspace by its layer.

源码: packages/bolt-cli/src/test/effect.ts:60

expect function

function expect<T>(actual: T, message?: string): EffectVitest.Assertion<void, T>
function expect(val: any, message?: string): Chai.Assertion

Assert workspace values and typed operation outcomes with Vitest's matchers.

参数

名称类型说明
actualT
message?string

源码: packages/bolt-cli/src/test/effect.ts:39

it function

function it<ExtraContext extends {}>(name: string | Function, fn?: EffectVitest.TestFunction<ExtraContext> | undefined, options?: number): void
function it<ExtraContext extends {}>(name: string | Function, options?: TestCollectorOptions, fn?: EffectVitest.TestFunction<ExtraContext> | undefined): void

Effect-aware Vitest helpers: it.effect scopes each test, layer shares a scoped service layer across a suite, describe groups scenarios, and expect asserts their values and outcomes.

参数

名称类型说明
namestring | Function
fn?TestFunction<ExtraContext>
options?number

源码: packages/bolt-cli/src/test/effect.ts:33

memory_audit function

function memory_audit(): { port: AuditPort; records: Map<string, { readonly id: string; readonly operation_id: string; readonly at: string; readonly category: "write" | "integration" | "approval" | "identity" | "automation"; readonly action: string; readonly status: "failed" | "pending_approval" | "committed" | "prepared" | "refused" | "conflict" | "unknown"; readonly actor: { readonly kind: "system" | "member" | "envoy" | "visitor" | "api_key"; readonly id: string | null; readonly label: string | null; }; readonly subject: { readonly model: string; readonly id: string; readonly revision: number | null; } | null; readonly invocation: string | null; readonly transaction: string | null; readonly run: string | null; readonly approval: string | null; readonly recorded_at: string; readonly payload_bytes: number; readonly payload: Schema.Json; }>; }

A complete process-local audit facility for tests; production hosts must supply a durable separate store.

源码: packages/bolt-cli/src/test/audit.ts:13

compiler

prepare_migrations function

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

Generation writes its SQL, snapshot, proof and lock together, only once the whole history is proved and accepted.

参数

名称类型说明
argsArgs

源码: packages/bolt-cli/src/compiler/migrations.ts:165

test

prune function

function prune(dir: string, count: number): Effect.Effect<void, PlatformError>

Keeps a checkpoint directory's newest count entries (an entry, its companions and its in-flight writes share the name before the first dot); once per directory and process, after its first write. Another process may prune the same directory: an entry gone meanwhile is skipped.

参数

名称类型说明
dirstring
countnumber

源码: packages/bolt-cli/src/test/checkpoint.ts:94

release function

function release(root: string): Effect.Effect<string, KitInvalid, never>

root's release as bolt build lays it out (bundle/, source/, seed/<pack>/, release.json): answers its directory. Built in a private copy resolving the workspace's own packages, then renamed into place whole.

参数

名称类型说明
rootstring

源码: packages/bolt-cli/src/test/release.ts:28

respond_system_1 function

function respond_system_1(request: import("@norbital-ai/host-api").DecisionRequest, model?: string): Effect.Effect<import("@norbital-ai/host-api").DecisionResult, PortFailure>

A deterministic, zero-cost System 1 responder for tests: prefer the respond choice, otherwise the first choice, and return zero scores.

参数

名称类型说明
requestimport("@norbital-ai/host-api").DecisionRequest
  • state: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>
  • questions: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{ readonly type: Schema.Literal<"noul">; readonly instructions: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null, Schema.$Array<Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>; readonly criteria: Schema.optionalKey<Sch…
model?string

源码: packages/bolt-cli/src/test/effect.ts:106

runAutomation function

function runAutomation<E, R>(t: Kit, start: Effect.Effect<{ readonly kind: "pending_approval"; readonly request_id: string; readonly records: readonly { readonly model: string; readonly id: string; readonly revision: number; }[]; } | { readonly kind: "committed"; readonly output: { readonly id: string; readonly automation: string; }; readonly records: readonly { readonly model: string; readonly id: string; readonly revision: number; }[]; readonly unchanged?: readonly { readonly model: string; readonly id: string; }[] | undefined; }, E, R>): Effect.Effect<{ readonly state: string; readonly output: Schema.Json; readonly error: { readonly code: string; readonly message: string; } | null; }, E | RunFailure, R>

Start through the native route, execute the queue, and inspect the actual run's settlement.

参数

名称类型说明
argsArgs

源码: packages/bolt-cli/src/test/runs.ts:38

settledRun function

function settledRun(t: Kit, id: string): Effect.Effect<{ readonly state: string; readonly output: Schema.Json; readonly error: { readonly code: string; readonly message: string; } | null; }, RunFailure, never>

The actual native run ledger, without treating queue admission as business completion.

参数

名称类型说明
argsArgs

源码: packages/bolt-cli/src/test/runs.ts:16