# Build private JavaScript/TypeScript components

Users and authorized external agents can build Display, Run and records-only Store source without administrator review or a per-package cloud deployment. **Every new component is private by default**, including builds submitted through the legacy `flip_plugin_publish` tool. Building, testing, making something reusable and installing it are never permission to share publicly.

## Read the live contract

Sync and read this guide, then call `flip_plugin_authoring_info` under `flip:plugins:read`. Use its assigned namespace, complete editable example, APIs and limits. A package contains a manifest draft, text files, artifact entrypoints, license, deterministic test cases and original idempotency key. Omit artifact digests; Flip stamps actual compiled identities. Do not invent a service URL, install arbitrary dependencies or include lifecycle scripts.

Current limits: 240 KiB complete package, 128 KiB combined source, 32 files, eight artifacts and 32 tests; each source-file content string is at most65,536 characters. All limits apply together. Each Run/Store extension requires a meaningful deterministic fixture. Fixture `storeResult` values grant no real storage access. Each author's account allows at most five pending jobs and 100 unarchived ordinary build jobs across its components and apps. Successful, failed and cancelled ordinary jobs occupy a build slot until archived.

Reviewed Flip Official App source families are exempt from the 100-job history cap, including new private/queued versions before a public template exists. The server requires both the exact trusted publisher hash and complete component ID from its operator-owned family registry; an app name, source field, similar ID, ordinary custom component or another author cannot claim the exemption. All jobs still count toward the five-pending limit and retain every source-size, compiler, authorization, immutable-version and sharing check. No build is archived or removed automatically. Build-history `quota.used` and `remaining` describe ordinary slots; the additive `quota.exempt` counts unarchived Official builds, while `pending` includes both. Older responses can omit `exempt` (treat it as zero); older Core versions can still report all jobs against their legacy 100-slot cap until upgraded. History remains paginated independently of quota.

New supporting builds include `performance` in the original publication receipt,
with version `flip.source-performance/1.0`. Read the original job through
`flip_plugin_publication_get`; its result contains
`publication.publication.performance`. Each fixture identifies its one-based
number, extension, kind, optional action and Store capability-call count.
Qualified warnings flag multiple Store calls and a Run fixture that used no
Store calls or events. These are deterministic fixture observations, not live
request counts, latency or proof that arbitrary source is pure. Keep meaningful
populated/paginated fixtures and inspect the actual code before changing a
complete aggregate. A zero-call fixture can take another branch for real input.
The current `storeResult` supplies the same fake response for every Store call;
it does not simulate different cursor pages. Use separate local model tests for
multi-page behavior rather than claiming one compiler fixture covers that case.
Reports exclude fixture inputs, expected/result bodies and timing. Existing
compiled artifacts, manifests and pins are unchanged; older receipts without
this field remain original and are never rebuilt to produce it.

An optional native mobile sibling has a separate 128 KiB aggregate JSON-source budget, with a 384 KiB complete package ceiling only when the manifest explicitly references that supported sibling. The original executable-source budget stays 128 KiB. Only `.json` source entry paths selected by `Display.mobile` may exceed the ordinary 65,536-character string limit, and those entries must satisfy the native document's independent 128 KiB UTF-8/depth32/value-string16KiB limits. Ordinary files and all other request/value limits remain unchanged. Read `flip_plugin_authoring_info.nativeMobile` and the [native mobile contract](../contracts/mobile-display-v1.md); do not put executable source in the native JSON slot.

The opt-in native `list` control requires iPhone0.4.0(16) and the compatible compiler. Current authoring discovery publishes its minimum build, styles, viewport placement and stable-key rules under `nativeMobile.controlRequirements.list`. A list publishes as ordinary inert companion JSON; it adds no permission or automatic fetch/write. Existing installed apps and earlier immutable source versions are preserved until an owner deliberately adopts a new version.

## Build privately and inspect the original receipt

Use `flip_plugin_build` under existing `flip:plugins:publish`. The complete package has no public-sharing switch. The compatibility `flip_plugin_publish` also builds privately; its legacy `sharingAccepted` field does not share source. Never put personal data, credentials or signed URLs in a package.

Inspect `flip_plugin_publication_get` or `flip_plugin_publications`. The list accepts optional `includeArchived:true` and an opaque `cursor`; follow its `nextCursor` to read later pages and inspect `quota` for current build capacity. Queued, building/testing, ready or failed describe automatic checks. The historical wire status `published` means immutable admission, not public visibility: inspect `visibility` separately. A ready private version is available to its owner through the owner catalog and My plugins; other users and anonymous source/bundle requests cannot access it.

Preserve the exact source, original key and original job after interruption. Repeat that request to recover it; do not create a new version/key merely to retry uncertainty. Correct terminal failed source under a new version. Build-lease recovery does not replay record writes or actions.

## Clean up completed builds

When the user requests build cleanup, inspect the exact owned jobs and call `flip_plugin_publication_archive` under existing `flip:plugins:publish` with `publicationId`, its current `sourceHash` and a stable `idempotencyKey`. Only terminal `published`, `failed` or `cancelled` jobs can be archived. Queued, building and testing jobs must finish first. The receipt is `{publicationId,sourceHash,archived:true,archivedAt}`; retain the original key and inspect the exact job after an interrupted response.

Archiving an ordinary build frees one build slot and removes the job from the default `flip_plugin_publications` list. Official builds already use no history slot. My plugins retains the version with its archive marker, and `flip_plugin_publication_get` and original build-key recovery retain the exact receipt. Installed apps, source, compiled artifacts, public visibility and runtime/provider pins remain available under their existing access rules. The immutable package version stays reserved. Archiving is permanent build-history cleanup; it grants no permission to update an app, withdraw a package or delete records/files.

## Share only when explicitly requested

Only an explicit user request to share the exact component/version publicly authorizes `flip_plugin_share`. Read its current owned receipt and call `flip_plugin_source_get` with the exact `pluginId` and `pluginVersion` to inspect private source under `flip:plugins:read`, then supply `publicationId`, `expectedRevision`, `sourceHash` and `sharingAccepted:true`. This separate tool is sufficient; an additional browser confirmation is not required. An OAuth scope permits the tool but does not substitute for the user's instruction.

Public sharing is **permanent and one way**. The exact licensed source and compiled assets become public and reusable. There is no unpublish operation. Every transitive dependency must already be public and enabled. Never share dependencies automatically to make another share succeed; obtain explicit user instructions for each. Existing downloaded code cannot be recalled. The web interface offers the same deliberate Share publicly action in My plugins.

Community discovery lists the latest public package version; exact details retain older versions, aggregate app usage and an inert code viewer. New versions never silently upgrade existing pins. Reuse shares definitions, not another user's records, files, configuration or grants.

## App packages

A complete app package bundles exact Display, Run and Store dependencies and a reusable app definition. `flip_app_template_draft` sanitizes an owned app revision, omitting personal configuration, records, file references, connection details and consent. Review its defaults/warnings and manifest before `flip_app_template_create`, which always saves privately. `flip_app_template_install` creates a fresh private app and empty collections with fresh IDs and bindings; it never copies another user's data or credentials.

`flip_app_template_share` is a separate permanent public action bound to the current manifest digest and revision, allowed only after an explicit sharing request and after every required component is already public. App-package creation never shares components. Creating a new app needs an all-current-and-future-tools grant; source authoring does not. Existing grants acquire no new scopes implicitly.

All reviewed OCI/static receipts and exact runtime/provider pins remain preserved. Classic web Display source uses an opaque browser frame; Run/Store use fresh bounded guest invocations and currently mapped capabilities. Source authoring grants no SQL, infrastructure, direct device or automation authority. Only exact declared trusted Display host controls can request barcode scanning or nutrition references in an owned Use view; they do not grant guest media/network access or Run effects. Nutrition uses a `nutrition` value slot and `service:nutrition`/`nutrition.lookup` permission; inspect the Display guide, cache saved foods first and retain attribution. Sensitive direct Run writes and event automation retain their separate owner browser review. Calendar authorization uses an explicit user request and a separate calendar capability; building source never grants it.

Related: [Display](flip://docs/display), [Run](flip://docs/run), [Store](flip://docs/store). Human guide: [Build and share](https://buildyourflip.com/docs#publish).

## App Store showcases

A public component is not itself a public saved app. Bundle exact components into a private app package, and share exact releases only after an explicit user request. The public App Store exposes only public/enabled package closures. Owners add real PNG screenshots and schema-valid fictional demo records through My app packages → App Store showcase, save/preview privately, and separately acknowledge public-content publication. Never infer permission to publish screenshots or records from a build/install request. Supported source Run/Store can execute unchanged inside disposable browser QuickJS VMs using the memory Store; production credentials, files, integrations and automation are unavailable. Native OCI Run actions are unavailable. Native Store-backed collections use the explicit memory adapter without contacting or executing their provider. Existing MCP scopes/tools are unchanged; showcase editing is currently a web control.

Web Display authoring defaults to JavaScript/TypeScript and `export default mount(root, flip)`; omit the optional `renderer` field. Published portable JSON versions retain their exact history and explicit renderer. Discovery prefers a family’s classic web release when available; neither building nor that preference updates installed pins or changes mobile compatibility.
