Codegen

Generate typed accessors for your Lunnoa Automate deployment.

Entity types, workflow inputs, and agents are defined per deployment, so the generic SDK types them loosely. Generate typed accessors against your deployment first, then commit the output with your app.

Run codegen

codegen.sh
npx @lunnoa/client codegen \  --url https://lunnoa.your-company.example \  --api-key lna_... \  --out ./src/lunnoa

This writes lunnoa.generated.ts with createDeploymentClient. Entity attributes, workflow inputs, and agents become compile-time checked:

lunnoa.generated.usage.ts
import { LunnoaClient } from '@lunnoa/client';import { createDeploymentClient } from './lunnoa/lunnoa.generated';const lunnoa = createDeploymentClient(  new LunnoaClient({ baseUrl, apiKey }),);// Entity attributes and states are compile-time checkedconst open = await lunnoa.entities.invoice.list({ state: 'pending' });await lunnoa.entities.invoice.create({  name: 'INV-1',  attributes: { amount: 99.5, status: 'pending' },});// Workflow inputs typed from the manual trigger schemaawait lunnoa.workflows.processInvoice.executeAndWait({ invoiceId: 'abc' });// Agents by nameconst stream = await lunnoa.agents.supportAgent.streamMessage(taskId, 'Hi');

Re-run codegen whenever entity types, workflows, or agents change on the deployment.

The generated file also exports:

  • DEPLOYMENT_SCHEMA_FINGERPRINT: stable string of entity-type slug, schemaRevision, and allowUnknownAttributes
  • ENTITY_TYPE_SCHEMA_REVISIONS: map of slug → revision at codegen time

Compare those against a live entityTypes.list() when you need to detect stale generated types after a schema deploy.

If you cannot run codegen yet, fall back to the generic namespaces and discover schemas at runtime.

Next

  • Discovery: inspect schemas without generated types
  • Entities: query and create records
  • CLI: discover the catalogue, then deploy defineEntityType before regenerating
  • TypeScript client SDK: overview and auth patterns