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.

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

Next