Skip to main content
Live mode lets you test your integration against real vendor APIs while keeping Ekanos mocked. In a single-integration project the toolbar’s Data dropdown switches between Fixtures and Live API; in a repo each integration chooses for itself (see Live or fixtures per integration). In live mode, the harness stops seeding your data keys, your widgets’ own query functions run, and their requests reach your actual API under your declared egress.

Setup

Declare a live block on your integration entry:
Now the toolbar’s Data dropdown’s Live API option is enabled for this integration.

Egress validation

The harness enforces your definition’s egress allowlist in live mode. A browser request to an undeclared origin throws EgressDeniedError (from @ekanos/sdk/context, code: 'EGRESS_DENIED'):
Allowed requests are sent with redirect: 'error', so a redirect to another origin fails rather than being followed. This is a harness convenience, not a preview of production enforcement: production runs no egress check on the client path today. Flipping to live mode is still a real test of the declaration under review, not of a second list kept beside it.
Do NOT set live.egress if definition is set. Supplying both is a hard error naming your slug. The harness reads the allowlist from your definition, so there is only one list and it is the one a reviewer reads. live.egress exists only for an entry with no definition.

Local packages register under a namespace, like the host does

The host registers a partner package under a token, <namespace>__<slug> (for example acme__news), while your code keeps sending its bare SLUG (news). The harness now does the same, so a bug that only shows up in that gap shows up locally first.
  • The namespace is the namespace in your repo’s root ekanos.json, else local. A package that sets availability.mode: "global" stays under its bare slug, as on the host.
  • Your code does not change. A bare slug sent to /api/integrations/<slug>/… is resolved to the token with the same function the host runs. A token from another namespace reaches nothing and answers unknown_integration.
  • Keys use the token. .ekanos/local-secrets.json holds one block per token (local__news), and the live context and stored OAuth tokens are keyed by it too. A file written before this, with blocks under the bare slug (news) or the display name an experience used (acme/news), is read merged and moved under the token the next time the harness writes it; the fixtures pin and Connect-as switches in .ekanos/local-state.json move the same way. There is nothing to do by hand. Saving local-secrets.json mid sign-in no longer drops the sign-in.
  • The redirect URI names no integration, as the host’s does: http://localhost:<port>/api/integrations/oauth/callback. The integration’s token travels in the OAuth state. Register the one the Local OAuth panel shows; if you registered a per-integration URL for your local app, add this one beside it.
  • The console names a package acme/news, never the token. The token appears only in URLs and keys.
  • ctx.integration.slug is the token too, in every context the harness builds (actions, webhooks, schedules, onActivate and tools, in fixtures and live mode). The host’s buildIntegrationContext is handed the token, so code that builds a URL or a key from ctx.integration.slug (acme__news) behaves the same locally as in production; a global package sees its bare slug. The slug in your definition stays bare. Fixtures files need no change, since nothing in them names the slug. In fixtures mode the Triggers and Activation pages ask the harness server for the token before they build their context, and a failed lookup shows as a failed run, never as the bare slug.

Credential storage

Live mode reads credentials (the OAuth client id and secret, signed webhooks’ secrets, API keys, and the fields of an activation form) from .ekanos/local-secrets.json in your project root. In a repo, each integration package has its own. The file is gitignored, never packed by ekanos publish, written with mode 0600, and read on every request. The harness generates it on first use. OAuth tokens are stored in the same file once a Connect completes, and replayed through your onTokens handler when the harness starts, so a restart does not ask you to authorize again. They are not replayed if the OAuth app’s client id changed. On the integration’s Connect tab, or on the Preview tab’s Activation or Triggers section:
  1. Find the Local OAuth panel (shown for integrations that declare oauth, in either mode)
  2. Follow the checklist to create a developer app at your vendor’s console
  3. Paste the client id, secret, and any webhook signing secrets into the form (one field per secret name your definition declares)
  4. Click Save credentials
The shell writes them to .ekanos/local-secrets.json and never echoes values back. A saved key shows as filled beside an empty field; a blank field keeps what is saved. Saving, or editing a value in the file, rebuilds the live context and forgets any current connection.
Credentials last until you Disconnect. They survive a harness restart, a browser reload and the regeneration of .ekanos/harness. An integration whose credentials are the fields of its activation form stores its string fields from the Connect tab, and saving again replaces them. Activation data you submit through the plain activation form on the Preview tab is a different thing: it is held in memory only, never written to localStorage, a fixture or the registry, and is cleared on reload and on Disconnect.

Live or fixtures per integration

In repo mode the global Data selector is gone. Each integration answers from Live or Fixtures on its own terms: Pin to fixtures (the button on an integration’s chip, and Unpin to undo it) keeps an integration on fixtures even when it is connected. The pin is saved in the integration package’s .ekanos/local-state.json as { "pinnedFixtures": { "<slug>": true } }. The file is gitignored, separate from credentials, and survives a restart and the regeneration of .ekanos/harness. Disconnect does not clear a pin. An integration with No connection needed (its contract’s auth is none and it declares no keys) reads that everywhere in the harness, starts on Live, and has nothing to connect. If it has settings, its Connect tab says “Settings below are optional.” Live reads of a connected integration run with its stored credentials; a widget or page write runs on your click, and a workflow write waits for your approval first. See Repo mode for the whole picture.

Opting in

An integration with no live block is fixtures-only; the toolbar control is disabled for it and says why. The harness also forces fixtures mode while a live.egress is wider than the definition’s egress. One WITH a live block opens in fixtures mode by default. To use live mode:
  1. Select Live API in the toolbar’s Data dropdown (single-integration project), or
  2. Declare live: { default: 'live' } — for integrations whose widgets never call the vendor from the browser (every vendor call is server-side behind ctx.fetch)
A choice made in the toolbar wins over live.default and is saved in localStorage, so it survives reloads.

Keys that stay mocked (seeds)

live.seeds lists the react-query keys that stay mocked in live mode — Ekanos-side state your widgets read before they can call anything (a saved setting, an account preference). Everything not listed runs its real query function:
This is the boundary the design draws:
  • Mocked: Ekanos-side state
  • Live: your vendor
A query key with a seed never fetches, so an HTTP fixture behind it is unreachable. Use one or the other.

OAuth loop on localhost

For an integration with oauth declared:
1
Switch to Live API (the entry needs a live block).
2
On the integration’s Connect tab (or the Preview tab’s Activation or Triggers section), find the Local OAuth panel.
3
Follow the checklist to set up a developer app at your vendor’s console. It is derived from your declaration: the redirect URI http://localhost:<port>/api/integrations/oauth/callback (<port> is 3100 unless you passed --port; Copy button), the declared scopes, and the code grant (with PKCE when declared). Add oauth.setup to the entry for the console link and key names it cannot know.
4
Paste the client id, secret, and any webhook signing secrets into the form and click Save credentials.
5
Click Connect (on the Connect tab or in the activation dialog). The shell’s oauth/connect route builds the authorize URL (PKCE when declared) and sends the browser to your vendor.
6
Your vendor redirects back to oauth/callback, which verifies the single-use state, exchanges the code through ctx.fetch (an undeclared token-endpoint origin fails with EgressDeniedError), and awaits your onTokens handler on the live context.
7
oauth/status then answers connected, the SDK’s OAuthActivationForm auto-activates, and onActivate runs on the same context.
8
Your widgets read what the handlers wrote through fetchIntegrationStorage(), unchanged. An empty read runs your declared schedules once first, as the host does.
The tokens are stored in .ekanos/local-secrets.json and replayed on the next start, so the connection lasts until you Disconnect. Changing the OAuth app’s client id discards them. The API routes refuse any request whose Host is not loopback unless EKANOS_HARNESS_EXPOSED=1; ekanos dev --host sets that after printing a warning.

API routes available

The shell’s API route (createHarnessApiHandlers from @ekanos/harness/api) serves these under /api/integrations/<slug>/: In live mode the browser passes the active integration’s requests to these routes. local-setup and actions/<actionName> are reached in both modes. The routes run against one server-held context per integration, whose ctx.fetch reaches your vendor under the declared egress.

Widget data fetching

Use useIntegrationFetch() from @ekanos/sdk/hooks. The harness mounts IntegrationFetchProvider and IntegrationActivationDataProvider unconditionally, so the hook returns a fetch already gated for whichever mode the toolbar is in, and useActivationData() returns what was last submitted to the activation form (null before any submission or after Disconnect):
In fixtures mode, fetch is answered from your fixtures. In live mode, it reaches your real API.
Taking an IntegrationFetch as an argument lets the same query function serve ctx.fetch on the server and this hook’s fetch on the client. In the harness the client fetch is gated by the harness’s own check; in production today it is a plain, unmediated browser fetch.
The live.FetchProvider field is deprecated. It still works and receives fetch, mode, and activationData as props; use it only to compose an authenticated fetch once at a single seam.

Knowing which mode is active

Call useHarnessDataMode() from @ekanos/harness/hooks. It has no SDK equivalent, so call it only from code that runs nowhere but the harness:
It returns the EFFECTIVE mode—accounting for an integration with no live block or a live.egress/definition mismatch (both force fixtures regardless of the toolbar).

Troubleshooting

EgressDeniedError in live mode

The origin is not in your definition’s egress. Add it or fix a typo in your URL.

NoRecordedResponseError in live mode

The request was a same-origin /api/… request outside the active integration’s own /api/integrations/<slug>/… routes. Those are answered from fixtures in both modes; record a fixture for it, or call your vendor with an absolute URL.

Can’t find where credentials were saved

Check .ekanos/local-secrets.json in your project root (in a repo, in the integration package’s own folder). The file is gitignored and never committed.

Changing credentials

To change credentials, save new values in the Local OAuth panel or the Connect tab, or edit .ekanos/local-secrets.json; either rebuilds the live context and forgets the current connection. Disconnect on the Connect tab removes the integration’s stored fields and keys and keeps the OAuth app’s own keys.