Skip to main content

Code Blocks

Code blocks run typed TypeScript for logic that is awkward or unavailable in HAL itself. Herd deploys the code, extracts its input and output schemas, and creates a synchronized adapter for use in actions.

Available tools

Code must use @herd-labs/code-blocks-framework and export the framework server’s fetch handler. The declared input and output schemas become the adapter’s HAL types.

Lifecycle

  1. Create the code block with its name, TypeScript source, and optional intent.
  2. Execute the test deployment with representative inputs.
  3. Review logs when debugging, then disable log collection for faster calls.
  4. Publish the version before importing its adapter into an action.
When you update published code, Herd creates a new draft. When the latest version is already a draft, Herd updates that draft in place.
Do not edit or delete the generated adapter directly. Change the owning code block so the adapter and schemas stay synchronized.