# Configure Run actions

A Run component supplies declared actions with typed inputs/outputs, effect classifications, required permissions, deadlines and durable execution receipts. Configuring an action does not invoke it; ordering cards in Run Studio does not create execution edges.

## Inspect, configure and invoke

Read the exact library component and saved owned tool before changing an action. Match the current input/configuration schemas and declared permission mappings. Validate and save the complete definition; preserve other components and records.

A declared read action may be invoked with `flip_action_invoke_read` under `flip:run:read`. It still needs the current owned tool, saved binding, revision and original key. Inspect its execution receipt and wait for a recorded result. A read action can create Activity history while leaving application records unchanged.

Direct write or external Run invocations require a separate exact-input owner browser review. `flip_action_request_approval` requests that review but executes nothing and cannot approve itself. A changed layout/input, expired review or withdrawn grant requires current authorization. Saved automation needs independent authorization and remains separate from layout versions and MCP connection status. Calendar schedules may be authorized through an explicit tool after the user grants the separate calendar capability; event rules retain owner browser review.

Cancellation requests do not undo completed effects. If an execution's outcome is unknown, inspect Activity and current data using the original request/key; do not create a new device command merely because a response was lost.

`flip_executions_list` returns a bounded page of Activity summaries without output or progress bodies. Pass an optional `limit` from 1 to 50 (default 25). If `nextCursor` is non-null, pass it as `cursor` with the same `appId` to read the next page. Use `flip_execution_get` with the original `executionId` to read the full result. Summaries may contain fewer rows than requested to respect the metadata byte limit; `nextCursor`, rather than row count, determines whether more history exists. Reading a page or result never invokes an action.

## Calendar and cron automation

Use a scheduled source with an IANA time zone to run an existing read/write action daily, weekly, monthly or on a five-field cron expression. `flip_automation_schedule_preview` is read-only; create/update saves disabled rules. Only when the user explicitly requests enabling that exact schedule, use `flip_automation_authorize` with `consent:true`, its current app/rule revisions and one original key under the separate `flip:automations:authorize` permission. Existing clients must approve that capability once through OAuth; there is no extra per-schedule browser confirmation. Native Use authorization and the legacy browser flow remain available. Read [Automations](flip://docs/automations) for first-of-month setup, next runs, missed times and delivery recovery.

## Author JavaScript/TypeScript source

Use `flip_plugin_authoring_info` for the full source package and exact current contracts. A source Run artifact is `javascript-module`; its runtime is `javascript-sandbox/json-v1`. Export a default handler:

```ts
export default async function ({actionId, input, config, packageConfig, mode}, flip) {
  if (actionId !== "page" || !input || !Number.isInteger(input.limit) ||
      input.limit < 1 || input.limit > 50) throw Error("Choose a bounded page");
  const page = await flip.store({
    operation: "records.query",
    payload: {collectionId: "entries", limit: input.limit}
  });
  return {output: page, events: []};
}
```

The manifest must declare that action, its actual schemas and effect, the scoped `entries` read permission, and a meaningful deterministic fixture. This example demonstrates Run's scoped Store interface; a Display that only needs this page should query its Store binding directly. This is source structure, not a complete publish request. Returned events must match declared event IDs/schemas and include stable event keys. They cannot authorize an automation by themselves.

Choose Run for work that needs current scoped server data or a supported server calculation. Use Display local expressions or ordinary web code for simple arithmetic, formatting and proposal transforms on already supplied data. Every Run adds admission, authority, transport and sandbox work, even when its handler has no Store calls. A pure preparation Run is appropriate only when the available local contract cannot express the required operation. Do not put executable code in native JSON to avoid a Run.

Keep requested views bounded: apply declared indexed filters and cursor pagination before loading rows. Do not reread complete histories for every filter change, next-page tap or polling tick. If a calculation truly requires every page, retain and expose completeness; never shorten a scan by silently treating partial rows as a whole total. Test with multiple deterministic pages and count the Store calls, rather than accepting an empty first-page fixture as performance evidence. Source guests have fresh heaps, so an in-memory variable does not cache records between invocations. Update confirmed results locally and refresh only the affected scope; preserve current authorization and revision checks.

`flip.store({operation,payload,idempotencyKey})` reaches only current mapped Host capabilities. Read and Preview actions cannot mutate, even if source asks for a write. No direct Node, filesystem, network, SQL or cloud credential API is available. Source actions are read/write only with at most a ten-second deadline; arbitrary external effects and OCI deployment are outside this source profile.

For record calls, `payload.collectionId` is this component's **manifest declaration key**, such as `entries`, matching `resource: "collection:entries"`. The exact action must require that permission. Its saved `permissionBindings` map the permission to an owned collection UUID; Core resolves the provider alias. The owned UUID and a different app alias do not replace the declared key in guest source. Native/MCP record APIs use the owned UUID instead.

```ts
const result = await flip.store({
  operation: "records.query",
  payload: {collectionId: "entries", limit: 10}
});
const count = result.records.length;
```

The awaited result is the Store **payload**, not the full response envelope; use `result.records`, not `result.payload.records`. User fields live in `record.data`. This snippet assumes the declared permission and current compatible mapping; read `flip_plugin_authoring_info.runtime.runStore` for the full examples. Writes require a write action in Use, original operation keys and current revisions.

Source versions retain exact interpreter image/revision pins. A runtime correction applies to newly built versions: build privately under a new package version, explicitly adopt it in the saved Run while preserving collection/provider bindings, and request fresh owner consent for changed schedules. Never silently retarget an old version, migrate records, share publicly or replay uncertain writes.

Each invocation gets a fresh guest heap. Limits include two seconds CPU, ten seconds total wall time, 32 MiB guest memory, 512 KiB stack, 128 KiB JSON input/output and 32 capability calls. Two children run at once; up to eight wait in FIFO order. Waiting consumes the original deadline and renews no authority. Overflow is rejected, and queued cancellation/expiry executes no capability.

Existing reviewed OCI workers retain their language-neutral wire contract and exact deployments. Python authoring template support remains planned; source publication accepts JavaScript/TypeScript, not arbitrary Python/Node packages or containers.

Related: [Plugin model](flip://docs/plugin-model), [Store](flip://docs/store), [Source publishing](flip://docs/source-publishing). Human guide: [Run](https://buildyourflip.com/docs#plugin-model/run).
