Skip to content
API reference

build

Import
import * as api from "@fungi.computer/oyster/build";
Kind Export Description
class AppPublisherError Closed failure boundary for the four private composition stages.
class WorkspaceBuildError A nested package must own its build graph, never inherit its host’s.
type alias ImmutableArtifactObjects Write-once object storage for one artifact root.
type alias StagedArtifactObject One object ready to store under its reference.
type alias StagedBuildOutput A build’s output manifest and each distinct object it names.
type alias WorkspaceBuildStep One captured dependency build step.
type alias AppBackendOutput The checked Worker output of one App backend build.
type alias DefinitionEmission One App backend build and the declaration derived from it.
type alias AppPublisherCoreConfigInput App identity and caller-selected recipe inputs before normalization.
type alias PinnedRecipe Fully resolved recipe with its pinned toolchain.
type alias CapturedSource A source tree captured into a scoped local snapshot directory.
type alias RawBuildOutput Compiler bytes or a bounded collection of emitted UI assets.
type alias UiBuildOutput A complete HTML document or an asset collection.
type alias BuildExecutorOutput Raw executor result before the recipe owner assigns App surface meaning.
type alias PreparedUiOutput UI output paired with its immutable artifact media type.
type alias BuildOutput Complete, non-empty App content accepted by immutable artifact writers.
type alias StoredArtifact Reference and digest of the persisted App build root.
type alias PreparedCandidate A locally captured and built candidate awaiting native artifact/catalog custody.
type alias SourceCapture Four structural roles used by the private composition.
type alias BuildExecutor Compiles captured source and reads its matching declaration.
type alias ArtifactWriter Persists one complete App build as immutable artifacts.
type alias ReleaseCreator Release catalog role needed to record a built candidate.
type alias AppPublisherOptions Captured build inputs and the resource owners used to publish a candidate.
type alias AppPublisher Builds and records immutable App Release candidates.
type alias AppCandidatePreparer Builds a candidate before artifact storage and catalog publication.
type alias AppPublisherStage The bounded stages reported by AppPublisherError.
type alias CapturedConfig App identity and normalized recipe with its digest.
type alias FirstPartyAppSourceDistribution A first-party editable source tree ready to seed into an Artifacts template.
type alias LocalBuildExecutorOptions How one build executor is composed; never part of a recipe or request.
type alias LocalAppPublisherOptions Local Git, recipe and artifact directory configuration with a Release catalog.
type alias WorkspaceBuildPolicy The build policy one manifest declares.
type alias BuildManifest Manifest metadata with the App-owned build policy decoded.
type alias WorkspaceBuild One App page build derived from its manifests and package graph.
constant dependencyBuildProgram Captured-dependency build program with guarded filesystem access.
constant workspaceBuildStepSchema One captured dependency build step. Paths are relative to the captured snapshot root. A TypeScript step compiles one config; a Tailwind step compiles one stylesheet input into its output (the same path for an App’s own stylesheet, which compiles in place). A script step runs the one package.json script a workspace dependency names as its build (fungi.build.script), with pnpm, in that package’s directory; only an admitted Computer build executes it.
constant pinnedRecipeSchema Canonical recipe policy shared by core and the local adapter.
constant AppPublisherCoreConfigSchema Core configuration contains only immutable App identity and recipe policy.
constant appBackendExportConditions Package-export conditions used by the pinned Workers builder.
constant capturedPinnedRecipeSchema Persisted, fully resolved recipe including its code-owned toolchain.
constant bundledHtmlRecipe Engine/toolchain-independent input: an already bundled, captured directory. The producer owns compilation; Publisher never discovers its build scripts. These ceilings cannot be raised by a publication request.
constant workspaceBuildPolicySchema package.json#fungi.build. An App manifest (the manifest nearest the entry) declares its recipe beside the page policy: react, shellEntry, the workspace packages whose declared stylesheets compile first (packageStylesheets) and its own stylesheets, compiled in place, in order. A workspace package declares its build products: extra TypeScript configs compiled after its tsconfig.build.json, and its stylesheet input and output; or, instead of TypeScript configs, the one package.json script that builds it (script), which only an admitted Computer build runs. Every path is relative to the manifest that declares it. Dependency-only metadata needs no App recipe; App callers require one through appBuildRecipe. Unknown fields are refused, so a builder never silently ignores a policy it does not know.
constant workspaceProjectsArguments The pnpm arguments that list a source tree’s workspace projects.
function stageBuildOutput() Stage a build’s bytes: the output manifest that names each object by its digest and size, and each distinct object once.
function writeArtifactRoot() Write the asset manifest and App root an output manifest names. The objects it names are already stored, and checked, by the caller.
function readBundledHtml() Read only regular files under the captured entry’s directory. No scripts, dependency hydration, URL rewriting, or access to the producer’s live build.
function createDefinitionEmission() Build one App backend and derive its declaration from that same build.
function pinsCurrentToolchain() Whether a pinned recipe pins this Publisher’s current toolchain (its build policy included). An executor refuses any other: a recipe pinned under another policy describes a build this code does not perform.
function digestPinnedRecipe() Hash every captured build and output-policy input in the Publisher recipe.
function normalizeAppPublisherRecipe() Decode and normalize Publisher-owned recipe policy for durable seed proof.
function pinnedRecipeObjectBound() The largest single object a build under this recipe may upload: no larger than the largest output bound the recipe could assign it under.
function fitsPinnedRecipe() Whether output built elsewhere (a Computer’s candidate manifest) is one this recipe could assign: the same surfaces and maxOutputBytes bound the preparer applies here. Asset sizes stay the artifact writer’s policy.
function createAppCandidatePreparer() Construct one private App Publisher with copied core configuration and roles.
function createCapturedCandidatePreparer() Prepare a candidate from a previously captured recipe.
function commitPreparedCandidate() Persist a prepared build through the native artifact and App Release owners.
function createAppPublisher() Compose capture, compilation, immutable writing and Release recording.
function repositoryEnvironment() Run a nested repository without inheriting the caller’s Git checkout.
function artifactsGitEnvironment() Git environment for one authenticated Artifacts fetch; caller validates token.
function hostedArtifactsGitRemote() Credential-free private route used by the hosted Publisher Git client.
function boundedBundlePolicy() Requests may tighten the catalog bounds, never raise them.
function createLocalSourceCapture() Local proving adapter; accepted source policy is intentionally fixed to main.
function createLocalDirectorySourceCapture() Capture saved App files for local authoring without modifying the customer’s repository. Provenance names the exact temporary Git snapshot, not an existing customer commit. Dependencies and local credentials are not source inputs.
function createArtifactsSourceCapture() Capture an exact Artifacts commit through a trusted host’s credential-free Git URL.
function createLocalCommitSourceCapture() Capture one explicit committed revision without manufacturing a branch.
function createFirstPartyAppSourceDistribution() Project one pinned first-party App and its pnpm workspace dependency graph without changing upstream files or manufacturing Git history. The caller records the returned provenance on the Artifacts template seed commit.
function localSnapshotBuildOptions() Exact pinned esbuild options shared by local builds and artifact-budget proofs.
function createLocalBuildExecutor() Local proving adapter; it builds only the captured extracted snapshot.
function createLocalArtifactWriter() Local proving adapter; the configured root is private and write-once.
function createLocalAppPublisher() Construct the complete local proving adapter around the provider-neutral core.
function frozenSnapshotInstallArguments() Frozen hydration policy. Cached bytes are verified and copied into each snapshot.
function readBuildManifest() Read package metadata once; only fungi.build rejects unknown fields.
function appBuildRecipe() Select an App recipe and root its paths in the captured source tree.
function resolveWorkspaceBuild() Derive one App’s page build from the captured source alone: the manifest nearest entry must be the owning pnpm workspace (or standalone repository root). It declares the App policy, its runtime imports select its compile roots; their workspace: dependencies give the compile order, and each dependency’s manifest declares its own extra build products.

Closed failure boundary for the four private composition stages.

  • Error
Signature
new AppPublisherError(stage, options?): AppPublisherError;
Parameter Type
stage AppPublisherStage
options? ErrorOptions

AppPublisherError

Signature
Error.constructor;
Signature
readonly _tag: "AppPublisherError";
Signature
readonly stage: AppPublisherStage;

A nested package must own its build graph, never inherit its host’s.

  • Error
Signature
new WorkspaceBuildError(directory, ownerDirectory): WorkspaceBuildError;
Parameter Type Description
directory string The nearer package, relative to the captured source root.
ownerDirectory string The workspace whose dependencies would otherwise be inherited.

WorkspaceBuildError

Signature
Error.constructor;
Signature
readonly code: "non_workspace_package" = "non_workspace_package";

The nearest package is absent from pnpm’s workspace inventory.

Signature
readonly directory: string;

The nearer package, relative to the captured source root.

Signature
readonly ownerDirectory: string;

The workspace whose dependencies would otherwise be inherited.

ImmutableArtifactObjectstype alias

Section titled “ImmutableArtifactObjects”
Signature
type ImmutableArtifactObjects = Readonly<{
create: Promise<"created" | "exists">;
read: Promise<Uint8Array<ArrayBufferLike> | null>;
}>;

Write-once object storage for one artifact root.


StagedArtifactObjecttype alias

Section titled “StagedArtifactObject”
Signature
type StagedArtifactObject = Readonly<{
artifactRef: ArtifactRef;
bytes: Uint8Array;
digest: Sha256Digest;
}>;

One object ready to store under its reference.


StagedBuildOutputtype alias

Section titled “StagedBuildOutput”
Signature
type StagedBuildOutput = Readonly<{
manifest: CandidateOutputManifest;
objects: readonly StagedArtifactObject[];
}>;

A build’s output manifest and each distinct object it names.


WorkspaceBuildSteptype alias

Section titled “WorkspaceBuildStep”
Signature
type WorkspaceBuildStep = Schema.Schema.Type<typeof workspaceBuildStepSchema>;

One captured dependency build step.


AppBackendOutputtype alias

Section titled “AppBackendOutput”
Signature
type AppBackendOutput = Readonly<{
file: esbuild.OutputFile;
inputs: readonly string[];
}>;

The checked Worker output of one App backend build.


DefinitionEmissiontype alias

Section titled “DefinitionEmission”
Signature
type DefinitionEmission = Awaited<ReturnType<typeof createDefinitionEmission>>;

One App backend build and the declaration derived from it.


AppPublisherCoreConfigInputtype alias

Section titled “AppPublisherCoreConfigInput”
Signature
type AppPublisherCoreConfigInput = Schema.Codec.Encoded<
typeof AppPublisherCoreConfigSchema
>;

App identity and caller-selected recipe inputs before normalization.


PinnedRecipetype alias

Section titled “PinnedRecipe”
Signature
type PinnedRecipe = Schema.Schema.Type<typeof capturedPinnedRecipeSchema>;

Fully resolved recipe with its pinned toolchain.


CapturedSourcetype alias

Section titled “CapturedSource”
Signature
type CapturedSource = Readonly<{
sourceRevision: SourceRevision;
sourceTreeDigest: Sha256Digest;
snapshotPath: string;
}>;

A source tree captured into a scoped local snapshot directory.


RawBuildOutputtype alias

Section titled “RawBuildOutput”
Signature
type RawBuildOutput =
| Readonly<{
kind: "bytes";
bytes: Uint8Array;
}>
| Readonly<{
kind: "assets";
base: string;
assets: readonly object[];
}>;

Compiler bytes or a bounded collection of emitted UI assets.


UiBuildOutputtype alias

Section titled “UiBuildOutput”
Signature
type UiBuildOutput =
| Readonly<{
kind: "html";
bytes: Uint8Array;
}>
| Extract<
RawBuildOutput,
{
kind: "assets";
}
>;

A complete HTML document or an asset collection.


BuildExecutorOutputtype alias

Section titled “BuildExecutorOutput”
Signature
type BuildExecutorOutput =
| RawBuildOutput
| Readonly<{
kind: "app";
ui: PreparedUiOutput | null;
backend: Uint8Array | null;
}>;

Raw executor result before the recipe owner assigns App surface meaning.


PreparedUiOutputtype alias

Section titled “PreparedUiOutput”
Signature
type PreparedUiOutput =
| Readonly<{
content: Extract<
UiBuildOutput,
{
kind: "html";
}
>;
mediaType: "text/html; charset=utf-8";
}>
| Readonly<{
content: Extract<
UiBuildOutput,
{
kind: "assets";
}
>;
mediaType: "application/vnd.fungi.app-assets+json";
}>;

UI output paired with its immutable artifact media type.


BuildOutputtype alias

Section titled “BuildOutput”
Signature
type BuildOutput =
| Readonly<{
kind: "ui";
ui: PreparedUiOutput;
}>
| Readonly<{
kind: "backend";
backend: Uint8Array;
}>
| (Readonly<{
kind: "app";
ui: PreparedUiOutput;
backend: Uint8Array;
}> &
Readonly<{
declaration?: AppDeclaration;
}>);

Complete, non-empty App content accepted by immutable artifact writers.


StoredArtifacttype alias

Section titled “StoredArtifact”
Signature
type StoredArtifact = Readonly<{
artifactRef: ArtifactRef;
artifactDigest: Sha256Digest;
}>;

Reference and digest of the persisted App build root.


PreparedCandidatetype alias

Section titled “PreparedCandidate”
Signature
type PreparedCandidate = Readonly<{
appId: AppId;
releaseId: ReleaseId;
output: BuildOutput;
provenance: Readonly<{
sourceRevision: SourceRevision;
sourceTreeDigest: Sha256Digest;
buildRecipeDigest: Sha256Digest;
}>;
}>;

A locally captured and built candidate awaiting native artifact/catalog custody.


SourceCapturetype alias

Section titled “SourceCapture”
Signature
type SourceCapture = object;

Four structural roles used by the private composition.

Signature
readonly capture: () => Effect.Effect<CapturedSource, unknown, Scope.Scope>;

Acquire a snapshot whose cleanup follows the Effect scope.

Effect.Effect<CapturedSource, unknown, Scope.Scope>


BuildExecutortype alias

Section titled “BuildExecutor”
Signature
type BuildExecutor = object;

Compiles captured source and reads its matching declaration.

Signature
readonly build: (source, recipe) => Effect.Effect<BuildExecutorOutput, unknown, Scope.Scope>;

Compile only the captured source under its pinned recipe.

Parameter Type
source CapturedSource
recipe PinnedRecipe

Effect.Effect<BuildExecutorOutput, unknown, Scope.Scope>

Signature
readonly optional declaration?: (source, recipe) => Effect.Effect<AppDeclaration, unknown>;

Read the App’s declaration from the same captured tree. Every App, a fork included, declares through its own source; there is no other source.

Parameter Type
source CapturedSource
recipe PinnedRecipe

Effect.Effect<AppDeclaration, unknown>


ArtifactWritertype alias

Section titled “ArtifactWriter”
Signature
type ArtifactWriter = object;

Persists one complete App build as immutable artifacts.

Signature
readonly write: (output) => Effect.Effect<StoredArtifact, unknown>;

Persist the App root and return its reference and digest.

Parameter Type
output BuildOutput

Effect.Effect<StoredArtifact, unknown>


ReleaseCreatortype alias

Section titled “ReleaseCreator”
Signature
type ReleaseCreator = Pick<AppReleaseCatalog, "createRelease">;

Release catalog role needed to record a built candidate.


AppPublisherOptionstype alias

Section titled “AppPublisherOptions”
Signature
type AppPublisherOptions = Readonly<{
config: AppPublisherCoreConfigInput;
releaseCatalog: ReleaseCreator;
sourceCapture: SourceCapture;
buildExecutor: BuildExecutor;
artifactWriter: ArtifactWriter;
}>;

Captured build inputs and the resource owners used to publish a candidate.


AppPublishertype alias

Section titled “AppPublisher”
Signature
type AppPublisher = Readonly<{
createCandidate: (releaseId) => Effect.Effect<Release, AppPublisherError>;
}>;

Builds and records immutable App Release candidates.


AppCandidatePreparertype alias

Section titled “AppCandidatePreparer”
Signature
type AppCandidatePreparer = Readonly<{
prepareCandidate: (
releaseId,
) => Effect.Effect<PreparedCandidate, AppPublisherError>;
}>;

Builds a candidate before artifact storage and catalog publication.


AppPublisherStagetype alias

Section titled “AppPublisherStage”
Signature
type AppPublisherStage =
"configuration" | "source" | "build" | "artifact" | "release";

The bounded stages reported by AppPublisherError.


CapturedConfigtype alias

Section titled “CapturedConfig”
Signature
type CapturedConfig = Readonly<{
appId: AppId;
recipe: PinnedRecipe;
buildRecipeDigest: Sha256Digest;
}>;

App identity and normalized recipe with its digest.


FirstPartyAppSourceDistributiontype alias

Section titled “FirstPartyAppSourceDistribution”
Signature
type FirstPartyAppSourceDistribution = Readonly<{
appId: AppId;
sourceRevision: SourceRevision;
sourceTreeDigest: ReturnType<typeof parseSha256Digest>;
appDirectory: string;
files: readonly Readonly<{
path: string;
contents: Uint8Array;
}>[];
}>;

A first-party editable source tree ready to seed into an Artifacts template.


LocalBuildExecutorOptionstype alias

Section titled “LocalBuildExecutorOptions”
Signature
type LocalBuildExecutorOptions = Readonly<{
packageStoreDirectory?: string;
packageCacheDirectory?: string;
packageScripts?: "run";
onPhase?: (phase, milliseconds) => void;
}>;

How one build executor is composed; never part of a recipe or request.


LocalAppPublisherOptionstype alias

Section titled “LocalAppPublisherOptions”
Signature
type LocalAppPublisherOptions = Readonly<{
config: unknown;
releaseCatalog: ReleaseCreator;
}>;

Local Git, recipe and artifact directory configuration with a Release catalog.


WorkspaceBuildPolicytype alias

Section titled “WorkspaceBuildPolicy”
Signature
type WorkspaceBuildPolicy = Schema.Schema.Type<
typeof workspaceBuildPolicySchema
>;

The build policy one manifest declares.


BuildManifesttype alias

Section titled “BuildManifest”
Signature
type BuildManifest = ReturnType<typeof readBuildManifest>;

Manifest metadata with the App-owned build policy decoded.


WorkspaceBuildtype alias

Section titled “WorkspaceBuild”
Signature
type WorkspaceBuild = Readonly<{
directory: string;
packageName: string;
react: boolean;
shellEntry?: string;
dependencies: readonly string[];
steps: readonly WorkspaceBuildStep[];
}>;

One App page build derived from its manifests and package graph.

dependencyBuildProgramconstant

Section titled “dependencyBuildProgram”
Signature
const dependencyBuildProgram: string = bundledDependencyBuildProgram;

Captured-dependency build program with guarded filesystem access.


workspaceBuildStepSchemaconstant

Section titled “workspaceBuildStepSchema”
Signature
const workspaceBuildStepSchema: Union<
readonly [
Struct<{
kind: Literal<"typescript">;
config: String;
}>,
Struct<{
kind: Literal<"tailwind">;
input: String;
output: String;
}>,
Struct<{
kind: Literal<"script">;
directory: String;
script: String;
}>,
]
>;

One captured dependency build step. Paths are relative to the captured snapshot root. A TypeScript step compiles one config; a Tailwind step compiles one stylesheet input into its output (the same path for an App’s own stylesheet, which compiles in place). A script step runs the one package.json script a workspace dependency names as its build (fungi.build.script), with pnpm, in that package’s directory; only an admitted Computer build executes it.


pinnedRecipeSchemaconstant

Section titled “pinnedRecipeSchema”
Signature
const pinnedRecipeSchema: Struct<{
kind: optional<Literals<readonly ["bundled-html", "source-html"]>>;
entry: String;
assets: optional<
Struct<{
maxManifestBytes: Number;
maxObjects: Number;
maxObjectBytes: Number;
maxTotalBytes: Number;
}>
>;
assetBase: optionalKey<String>;
backend: Union<
readonly [
Null,
Struct<{
entry: optional<String>;
runtime: Struct<{
kind: Literal<"durable-facet">;
stateSchema: Number;
}>;
compatibilityDate: String;
exportName: String;
}>,
]
>;
maxOutputBytes: Number;
}>;

Canonical recipe policy shared by core and the local adapter.


AppPublisherCoreConfigSchemaconstant

Section titled “AppPublisherCoreConfigSchema”
Signature
const AppPublisherCoreConfigSchema: Struct<{
appId: refine<AppId, String>;
recipe: Struct<{
kind: optional<Literals<readonly ["bundled-html", "source-html"]>>;
entry: String;
assets: optional<Struct<{
maxManifestBytes: Number;
maxObjects: Number;
maxObjectBytes: Number;
maxTotalBytes: Number;
}>>;
assetBase: optionalKey<String>;
backend: Union<readonly [Null, Struct<{
entry: optional<String>;
runtime: Struct<{
kind: Literal<...>;
stateSchema: Number;
}>;
compatibilityDate: String;
exportName: String;
}>]>;
maxOutputBytes: Number;
}>;
}>;

Core configuration contains only immutable App identity and recipe policy.


appBackendExportConditionsconstant

Section titled “appBackendExportConditions”
Signature
const appBackendExportConditions: readonly string[];

Package-export conditions used by the pinned Workers builder.


capturedPinnedRecipeSchemaconstant

Section titled “capturedPinnedRecipeSchema”
Signature
const capturedPinnedRecipeSchema: Struct<{
kind: optional<Literals<readonly ["bundled-html", "source-html"]>>;
bundle: Literal<true>;
entry: String;
format: Literals<readonly ["html", "esm", "assets"]>;
assets: optional<
Struct<{
maxManifestBytes: Number;
maxObjects: Number;
maxObjectBytes: Number;
maxTotalBytes: Number;
}>
>;
assetBase: optionalKey<String>;
toolchain: $Record<String, String>;
maxOutputBytes: Number;
platform: Literals<readonly ["browser", "neutral"]>;
backend: Union<
readonly [
Null,
Struct<{
entry: optional<String>;
runtime: Struct<{
kind: Literal<"durable-facet">;
stateSchema: Number;
}>;
compatibilityDate: String;
exportName: String;
}>,
]
>;
target: Tuple<readonly [Literal<"es2022">]>;
}>;

Persisted, fully resolved recipe including its code-owned toolchain.


bundledHtmlRecipeconstant

Section titled “bundledHtmlRecipe”
Signature
const bundledHtmlRecipe: Readonly<{
kind: "bundled-html";
toolchain: Readonly<{
recipe: "captured-bundled-html-v1";
}>;
limits: Readonly<{
maxManifestBytes: 1048576;
maxObjects: 1024;
maxObjectBytes: 16777216;
maxTotalBytes: 67108864;
}>;
extensions: readonly string[];
}>;

Engine/toolchain-independent input: an already bundled, captured directory. The producer owns compilation; Publisher never discovers its build scripts. These ceilings cannot be raised by a publication request.


workspaceBuildPolicySchemaconstant

Section titled “workspaceBuildPolicySchema”
Signature
const workspaceBuildPolicySchema: Struct<{
kind: optional<Literals<readonly ["bundled-html", "source-html"]>>;
assets: optional<
Struct<{
maxManifestBytes: Number;
maxObjects: Number;
maxObjectBytes: Number;
maxTotalBytes: Number;
}>
>;
assetBase: optionalKey<String>;
entry: optional<String>;
backend: optional<
Union<
readonly [
Null,
Struct<{
entry: optional<String>;
runtime: Struct<{
kind: Literal<"durable-facet">;
stateSchema: Number;
}>;
compatibilityDate: String;
exportName: String;
}>,
]
>
>;
maxOutputBytes: optional<Number>;
react: optional<Boolean>;
shellEntry: optional<String>;
packageStylesheets: optional<$Array<String>>;
stylesheets: optional<$Array<String>>;
typescript: optional<$Array<String>>;
script: optional<NonEmptyString>;
stylesheet: optional<
Struct<{
input: String;
output: String;
}>
>;
}>;

package.json#fungi.build. An App manifest (the manifest nearest the entry) declares its recipe beside the page policy: react, shellEntry, the workspace packages whose declared stylesheets compile first (packageStylesheets) and its own stylesheets, compiled in place, in order. A workspace package declares its build products: extra TypeScript configs compiled after its tsconfig.build.json, and its stylesheet input and output; or, instead of TypeScript configs, the one package.json script that builds it (script), which only an admitted Computer build runs. Every path is relative to the manifest that declares it. Dependency-only metadata needs no App recipe; App callers require one through appBuildRecipe. Unknown fields are refused, so a builder never silently ignores a policy it does not know.


workspaceProjectsArgumentsconstant

Section titled “workspaceProjectsArguments”
Signature
const workspaceProjectsArguments: readonly string[];

The pnpm arguments that list a source tree’s workspace projects.

stageBuildOutput()function

Section titled “stageBuildOutput()”
Signature
function stageBuildOutput(output): StagedBuildOutput;

Stage a build’s bytes: the output manifest that names each object by its digest and size, and each distinct object once.

Parameter Type
output BuildOutput

StagedBuildOutput


writeArtifactRoot()function

Section titled “writeArtifactRoot()”
Signature
function writeArtifactRoot(
manifest,
objects,
options,
): Promise<
Readonly<{
artifactRef: ArtifactRef;
artifactDigest: Sha256Digest;
}>
>;

Write the asset manifest and App root an output manifest names. The objects it names are already stored, and checked, by the caller.

Parameter Type
manifest | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "ui"; ui: | { mediaType: "text/html; charset=utf-8"; content: { digest: Sha256Digest; byteLength: number; kind: "html"; }; } | { mediaType: "application/vnd.fungi.app-assets+json"; content: { kind: "assets"; base: string; assets: readonly object[]; }; }; } | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "backend"; backend: { digest: Sha256Digest; byteLength: number; }; } | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "app"; ui: | { mediaType: "text/html; charset=utf-8"; content: { digest: Sha256Digest; byteLength: number; kind: "html"; }; } | { mediaType: "application/vnd.fungi.app-assets+json"; content: { kind: "assets"; base: string; assets: readonly object[]; }; }; backend: { digest: Sha256Digest; byteLength: number; }; }
objects ImmutableArtifactObjects
options Readonly<{ rootArtifactRef: ArtifactRef; assetPolicy: AssetBuildPolicy | undefined; }>

Promise<Readonly<{ artifactRef: ArtifactRef; artifactDigest: Sha256Digest; }>>


readBundledHtml()function

Section titled “readBundledHtml()”
Signature
function readBundledHtml(
snapshot,
recipe,
): Promise<
Readonly<{
kind: "assets";
base: string;
assets: readonly object[];
}>
>;

Read only regular files under the captured entry’s directory. No scripts, dependency hydration, URL rewriting, or access to the producer’s live build.

Parameter Type
snapshot string
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

Promise<Readonly<{ kind: "assets"; base: string; assets: readonly object[]; }>>


createDefinitionEmission()function

Section titled “createDefinitionEmission()”
Signature
function createDefinitionEmission(source, recipe): Promise<{
entryPoints: (entry) => Record<string, string>;
outdir: string;
plugins: Plugin[];
worker: AppBackendOutput;
declare: Promise<Readonly<{
api?: Readonly<{
methods: Readonly<Record<string, Readonly<...>>>;
toolFamily?: Readonly<{
name: ...;
list: ...;
call: ...;
}>;
events?: Readonly<Record<..., ...>>;
}>;
displayName?: string;
capabilities: readonly (
| "computer.list"
| "computer.readFile"
| "computer.writeFile"
| "computer.execute"
| "approvals"
| "agent.list"
| "agent.manage"
| "agent.rename"
| "agent.avatar"
| "agent.toolPolicy"
| "agent.read"
| "agent.send"
| "llm.generation"
| "media.generation"
| "games:servers"
| "git.repository"
| "apps.open"
| "apps.call"
| "app.storage"
| "app.events.emit"
| "team.workbenchHost"
| "marketplace.browse"
| "marketplace.purchase"
| "workflow.run"
| "workflow.publish"
| "workflow.arm"
| "world"
| "channels.read"
| "channels.personal.manage")[];
calls?: readonly Readonly<{
appId: string;
methods: readonly string[];
}>[];
guidance?: string;
handlers: readonly "file.open"[];
receives?: readonly "git.push"[];
icon?: string;
roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[];
storage?: readonly Readonly<{
key: string;
scopes: readonly (... | ...)[];
maxBytes: number;
}>[];
commands?: readonly Readonly<{
id: string;
title: string;
category: string;
description?: string;
sigil?: string;
projections?: Readonly<...>;
}>[];
gills?: readonly Readonly<{
id: string;
source: string;
title: string;
params?: readonly ...[];
watch?: AppGillWatch;
desktop?: Readonly<...>;
}>[];
backend?: Readonly<{
bindings: readonly Readonly<{
name: ...;
operations: ...;
}>[];
sync?: Readonly<{
method: ...;
}>;
}>;
}>>;
}>;

Build one App backend and derive its declaration from that same build.

A declared fungi.backendDefinition adds a second, build-only entry that derives the declaration with buildAppDeclaration(appBackend, fungi.app). esbuild loads every path and resolves every import once per build, so the Worker serves exactly the definition bytes and module resolution the declaration describes. The Worker output is then checked to include that definition and no build-only declaration code, and the declaration output to import nothing at runtime.

Parameter Type
source CapturedSource
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

Promise<{ entryPoints: (entry) => Record<string, string>; outdir: string; plugins: Plugin[]; worker: AppBackendOutput; declare: Promise<Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>>; }>


pinsCurrentToolchain()function

Section titled “pinsCurrentToolchain()”
Signature
function pinsCurrentToolchain(recipe): boolean;

Whether a pinned recipe pins this Publisher’s current toolchain (its build policy included). An executor refuses any other: a recipe pinned under another policy describes a build this code does not perform.

Parameter Type
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

boolean


digestPinnedRecipe()function

Section titled “digestPinnedRecipe()”
Signature
function digestPinnedRecipe(recipe): Sha256Digest;

Hash every captured build and output-policy input in the Publisher recipe.

Parameter Type
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

Sha256Digest


normalizeAppPublisherRecipe()function

Section titled “normalizeAppPublisherRecipe()”
Signature
function normalizeAppPublisherRecipe(input): Readonly<{
recipe: PinnedRecipe;
buildRecipeDigest: Sha256Digest;
}>;

Decode and normalize Publisher-owned recipe policy for durable seed proof.

Parameter Type
input { appId: string; recipe: { kind?: "bundled-html" | "source-html"; entry: string; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes: number; }; }
input.appId string
input.recipe { kind?: "bundled-html" | "source-html"; entry: string; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes: number; }
input.recipe.kind? "bundled-html" | "source-html"
input.recipe.entry string
input.recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
input.recipe.assets.maxManifestBytes number
input.recipe.assets.maxObjects number
input.recipe.assets.maxObjectBytes number
input.recipe.assets.maxTotalBytes number
input.recipe.assetBase? string
input.recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
input.recipe.maxOutputBytes number

Readonly<{ recipe: PinnedRecipe; buildRecipeDigest: Sha256Digest; }>


pinnedRecipeObjectBound()function

Section titled “pinnedRecipeObjectBound()”
Signature
function pinnedRecipeObjectBound(recipe): number;

The largest single object a build under this recipe may upload: no larger than the largest output bound the recipe could assign it under.

Parameter Type
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

number


fitsPinnedRecipe()function

Section titled “fitsPinnedRecipe()”
Signature
function fitsPinnedRecipe(output, recipe): boolean;

Whether output built elsewhere (a Computer’s candidate manifest) is one this recipe could assign: the same surfaces and maxOutputBytes bound the preparer applies here. Asset sizes stay the artifact writer’s policy.

Parameter Type
output | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "ui"; ui: | { mediaType: "text/html; charset=utf-8"; content: { digest: Sha256Digest; byteLength: number; kind: "html"; }; } | { mediaType: "application/vnd.fungi.app-assets+json"; content: { kind: "assets"; base: string; assets: readonly object[]; }; }; } | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "backend"; backend: { digest: Sha256Digest; byteLength: number; }; } | { declaration?: Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<…>>>; toolFamily?: Readonly<{ name: …; list: …; call: …; }>; events?: Readonly<Record<…, …>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly (… | …)[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<…>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly …[]; watch?: AppGillWatch; desktop?: Readonly<…>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: …; operations: …; }>[]; sync?: Readonly<{ method: …; }>; }>; }>; kind: "app"; ui: | { mediaType: "text/html; charset=utf-8"; content: { digest: Sha256Digest; byteLength: number; kind: "html"; }; } | { mediaType: "application/vnd.fungi.app-assets+json"; content: { kind: "assets"; base: string; assets: readonly object[]; }; }; backend: { digest: Sha256Digest; byteLength: number; }; }
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; }
recipe.kind? "bundled-html" | "source-html"
recipe.bundle true
recipe.entry string
recipe.format "html" | "assets" | "esm"
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
recipe.assets.maxManifestBytes number
recipe.assets.maxObjects number
recipe.assets.maxObjectBytes number
recipe.assets.maxTotalBytes number
recipe.assetBase? string
recipe.toolchain { [key: string]: string; }
recipe.maxOutputBytes number
recipe.platform "browser" | "neutral"
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null
recipe.target readonly ["es2022"]

boolean


createAppCandidatePreparer()function

Section titled “createAppCandidatePreparer()”
Signature
function createAppCandidatePreparer(options): AppCandidatePreparer;

Construct one private App Publisher with copied core configuration and roles.

Parameter Type
options Pick<AppPublisherOptions, "config" | "sourceCapture" | "buildExecutor">

AppCandidatePreparer


createCapturedCandidatePreparer()function

Section titled “createCapturedCandidatePreparer()”
Signature
function createCapturedCandidatePreparer(config, options): AppCandidatePreparer;

Prepare a candidate from a previously captured recipe.

Parameter Type
config CapturedConfig
options Pick<AppPublisherOptions, "sourceCapture" | "buildExecutor">

AppCandidatePreparer


commitPreparedCandidate()function

Section titled “commitPreparedCandidate()”
Signature
function commitPreparedCandidate(
prepared,
options,
): Effect<Release, AppPublisherError>;

Persist a prepared build through the native artifact and App Release owners.

Parameter Type
prepared PreparedCandidate
options Pick<AppPublisherOptions, "artifactWriter" | "releaseCatalog">

Effect<Release, AppPublisherError>


createAppPublisher()function

Section titled “createAppPublisher()”
Signature
function createAppPublisher(options): AppPublisher;

Compose capture, compilation, immutable writing and Release recording.

Parameter Type
options AppPublisherOptions

AppPublisher


repositoryEnvironment()function

Section titled “repositoryEnvironment()”
Signature
function repositoryEnvironment(): ProcessEnv;

Run a nested repository without inheriting the caller’s Git checkout.

ProcessEnv


artifactsGitEnvironment()function

Section titled “artifactsGitEnvironment()”
Signature
function artifactsGitEnvironment(token): ProcessEnv;

Git environment for one authenticated Artifacts fetch; caller validates token.

Parameter Type
token string

ProcessEnv


hostedArtifactsGitRemote()function

Section titled “hostedArtifactsGitRemote()”
Signature
function hostedArtifactsGitRemote(endpoint, repository): string;

Credential-free private route used by the hosted Publisher Git client.

Parameter Type
endpoint string
repository string

string


boundedBundlePolicy()function

Section titled “boundedBundlePolicy()”
Signature
function boundedBundlePolicy(policy, maxOutputBytes): boolean;

Requests may tighten the catalog bounds, never raise them.

Parameter Type
policy { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
policy.maxManifestBytes number
policy.maxObjects number
policy.maxObjectBytes number
policy.maxTotalBytes number
maxOutputBytes number

boolean


createLocalSourceCapture()function

Section titled “createLocalSourceCapture()”
Signature
function createLocalSourceCapture(repositoryPath): SourceCapture;

Local proving adapter; accepted source policy is intentionally fixed to main.

Parameter Type
repositoryPath string

SourceCapture


createLocalDirectorySourceCapture()function

Section titled “createLocalDirectorySourceCapture()”
Signature
function createLocalDirectorySourceCapture(directory): SourceCapture;

Capture saved App files for local authoring without modifying the customer’s repository. Provenance names the exact temporary Git snapshot, not an existing customer commit. Dependencies and local credentials are not source inputs.

Parameter Type
directory string

SourceCapture


createArtifactsSourceCapture()function

Section titled “createArtifactsSourceCapture()”
Signature
function createArtifactsSourceCapture(options): SourceCapture;

Capture an exact Artifacts commit through a trusted host’s credential-free Git URL.

Parameter Type
options { remote: string; token: string; sourceRevision: SourceRevision; }
options.remote string
options.token string
options.sourceRevision SourceRevision

SourceCapture


createLocalCommitSourceCapture()function

Section titled “createLocalCommitSourceCapture()”
Signature
function createLocalCommitSourceCapture(
repositoryPath,
sourceRevision,
): SourceCapture;

Capture one explicit committed revision without manufacturing a branch.

Parameter Type
repositoryPath string
sourceRevision SourceRevision

SourceCapture


createFirstPartyAppSourceDistribution()function

Section titled “createFirstPartyAppSourceDistribution()”
Signature
function createFirstPartyAppSourceDistribution(options): Effect<
Readonly<{
appId: AppId;
sourceRevision: SourceRevision;
sourceTreeDigest: Sha256Digest;
appDirectory: string;
files: readonly Readonly<{
path: string;
contents: Uint8Array;
}>[];
}>,
unknown
>;

Project one pinned first-party App and its pnpm workspace dependency graph without changing upstream files or manufacturing Git history. The caller records the returned provenance on the Artifacts template seed commit.

Parameter Type
options { appId: string; source: CapturedSource; entry: string; }
options.appId string
options.source CapturedSource
options.entry string

Effect<Readonly<{ appId: AppId; sourceRevision: SourceRevision; sourceTreeDigest: Sha256Digest; appDirectory: string; files: readonly Readonly<{ path: string; contents: Uint8Array; }>[]; }>, unknown>


localSnapshotBuildOptions()function

Section titled “localSnapshotBuildOptions()”
Signature
function localSnapshotBuildOptions(source, recipe, emission): BuildOptions;

Exact pinned esbuild options shared by local builds and artifact-budget proofs.

Parameter Type Description
source CapturedSource -
recipe { kind?: "bundled-html" | "source-html"; bundle: true; entry: string; format: "html" | "assets" | "esm"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; toolchain: { [key: string]: string; }; maxOutputBytes: number; platform: "browser" | "neutral"; backend: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; target: readonly ["es2022"]; } -
recipe.kind? "bundled-html" | "source-html" -
recipe.bundle true -
recipe.entry string -
recipe.format "html" | "assets" | "esm" -
recipe.assets? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; } -
recipe.assets.maxManifestBytes number -
recipe.assets.maxObjects number -
recipe.assets.maxObjectBytes number -
recipe.assets.maxTotalBytes number -
recipe.assetBase? string -
recipe.toolchain { [key: string]: string; } -
recipe.maxOutputBytes number -
recipe.platform "browser" | "neutral" -
recipe.backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null -
recipe.target readonly ["es2022"] -
emission { entryPoints: (entry) => Record<string, string>; outdir: string; plugins: Plugin[]; worker: AppBackendOutput; declare: Promise<Readonly<{ api?: Readonly<{ methods: Readonly<Record<string, Readonly<{ description: …; input: …; output: …; effect: …; requires: …; pending?: …; hidden?: …; anonymous?: …; present?: …; }>>>; toolFamily?: Readonly<{ name: string; list: string; call: string; }>; events?: Readonly<Record<string, Readonly<…>>>; }>; displayName?: string; capabilities: readonly ( | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[]; calls?: readonly Readonly<{ appId: string; methods: readonly string[]; }>[]; guidance?: string; handlers: readonly "file.open"[]; receives?: readonly "git.push"[]; icon?: string; roles: readonly ("files" | "dashboard" | "inbox" | "media" | "sessions" | "terminal")[]; storage?: readonly Readonly<{ key: string; scopes: readonly ("member" | "team")[]; maxBytes: number; }>[]; commands?: readonly Readonly<{ id: string; title: string; category: string; description?: string; sigil?: string; projections?: Readonly<{ bindings?: …; agent?: …; help?: …; menu?: …; palette?: …; slash?: …; }>; }>[]; gills?: readonly Readonly<{ id: string; source: string; title: string; params?: readonly Readonly<…>[]; watch?: AppGillWatch; desktop?: Readonly<{ sizes: …; }>; }>[]; backend?: Readonly<{ bindings: readonly Readonly<{ name: … | … | … | … | … | … | … | … | … | …; operations: readonly …[]; }>[]; sync?: Readonly<{ method: string; }>; }>; }>>; } -
emission.entryPoints (entry) => Record<string, string> Entries for the one backend build: the Worker and, if defined, its declaration.
emission.outdir string -
emission.plugins Plugin[] -
emission.worker -
emission.declare -

BuildOptions


createLocalBuildExecutor()function

Section titled “createLocalBuildExecutor()”
Signature
function createLocalBuildExecutor(options?): BuildExecutor;

Local proving adapter; it builds only the captured extracted snapshot.

Parameter Type
options LocalBuildExecutorOptions

BuildExecutor


createLocalArtifactWriter()function

Section titled “createLocalArtifactWriter()”
Signature
function createLocalArtifactWriter(artifactRoot, assetPolicy?): ArtifactWriter;

Local proving adapter; the configured root is private and write-once.

Parameter Type
artifactRoot string
assetPolicy? { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }
assetPolicy.maxManifestBytes? number
assetPolicy.maxObjects? number
assetPolicy.maxObjectBytes? number
assetPolicy.maxTotalBytes? number

ArtifactWriter


createLocalAppPublisher()function

Section titled “createLocalAppPublisher()”
Signature
function createLocalAppPublisher(options): AppPublisher;

Construct the complete local proving adapter around the provider-neutral core.

Parameter Type
options LocalAppPublisherOptions

AppPublisher


frozenSnapshotInstallArguments()function

Section titled “frozenSnapshotInstallArguments()”
Signature
function frozenSnapshotInstallArguments(
packageStoreDirectory?,
packageCacheDirectory?,
): string[];

Frozen hydration policy. Cached bytes are verified and copied into each snapshot.

Parameter Type
packageStoreDirectory? string
packageCacheDirectory? string

string[]


readBuildManifest()function

Section titled “readBuildManifest()”
Signature
function readBuildManifest(packageJson): object;

Read package metadata once; only fungi.build rejects unknown fields.

Parameter Type
packageJson string

object

Name Type
name? string
dependencies? object
scripts? object
fungi object
fungi.appId? AppId
fungi.build | { kind?: "bundled-html" | "source-html"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; entry?: string; backend?: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes?: number; react?: boolean; shellEntry?: string; packageStylesheets?: readonly string[]; stylesheets?: readonly string[]; typescript?: readonly string[]; script?: string; stylesheet?: { input: string; output: string; }; } | undefined

appBuildRecipe()function

Section titled “appBuildRecipe()”
Signature
function appBuildRecipe(manifest, directory): object;

Select an App recipe and root its paths in the captured source tree.

Parameter Type
manifest { name?: string; dependencies?: { [key: string]: string; }; scripts?: { [key: string]: string; }; fungi: { appId?: AppId; build: | { kind?: "bundled-html" | "source-html"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; entry?: string; backend?: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes?: number; react?: boolean; shellEntry?: string; packageStylesheets?: readonly string[]; stylesheets?: readonly string[]; typescript?: readonly string[]; script?: string; stylesheet?: { input: string; output: string; }; } | undefined; }; }
manifest.name? string
manifest.dependencies? { [key: string]: string; }
manifest.scripts? { [key: string]: string; }
manifest.fungi { appId?: AppId; build: | { kind?: "bundled-html" | "source-html"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; entry?: string; backend?: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes?: number; react?: boolean; shellEntry?: string; packageStylesheets?: readonly string[]; stylesheets?: readonly string[]; typescript?: readonly string[]; script?: string; stylesheet?: { input: string; output: string; }; } | undefined; }
manifest.fungi.appId? AppId
manifest.fungi.build | { kind?: "bundled-html" | "source-html"; assets?: { maxManifestBytes: number; maxObjects: number; maxObjectBytes: number; maxTotalBytes: number; }; assetBase?: string; entry?: string; backend?: | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null; maxOutputBytes?: number; react?: boolean; shellEntry?: string; packageStylesheets?: readonly string[]; stylesheets?: readonly string[]; typescript?: readonly string[]; script?: string; stylesheet?: { input: string; output: string; }; } | undefined
directory string

object

Name Type Default value
kind? "bundled-html" | "source-html" -
entry string relativeEntrySchema
assets? object -
assets.maxManifestBytes number -
assets.maxObjects number -
assets.maxObjectBytes number -
assets.maxTotalBytes number -
assetBase? string -
backend | { entry?: string; runtime: { kind: "durable-facet"; stateSchema: number; }; compatibilityDate: string; exportName: string; } | null -
maxOutputBytes number -

resolveWorkspaceBuild()function

Section titled “resolveWorkspaceBuild()”
Signature
function resolveWorkspaceBuild(options): Promise<
Readonly<{
directory: string;
packageName: string;
react: boolean;
shellEntry?: string;
dependencies: readonly string[];
steps: readonly (
| {
kind: "typescript";
config: string;
}
| {
kind: "tailwind";
input: string;
output: string;
}
| {
kind: "script";
directory: string;
script: string;
}
)[];
}>
>;

Derive one App’s page build from the captured source alone: the manifest nearest entry must be the owning pnpm workspace (or standalone repository root). It declares the App policy, its runtime imports select its compile roots; their workspace: dependencies give the compile order, and each dependency’s manifest declares its own extra build products.

Parameter Type Description
options { root: string; entry: string; backendEntry?: string | null; projects: string; } -
options.root string -
options.entry string -
options.backendEntry? string | null The selected recipe’s backend, if it differs from the manifest recipe.
options.projects string pnpm ls -r --depth -1 --json output for the same source tree.

Promise<Readonly<{ directory: string; packageName: string; react: boolean; shellEntry?: string; dependencies: readonly string[]; steps: readonly ( | { kind: "typescript"; config: string; } | { kind: "tailwind"; input: string; output: string; } | { kind: "script"; directory: string; script: string; })[]; }>>