# KIE Nodes

This package is runtime code for KIE nodes. Node definitions are generated from
KIE docs through `packages/kie-codegen`.

## Generated Files

- `src/kie-manifest.json` is generated by `npm run generate:kie`.
- `npm run generate:kie` also regenerates
  `packages/kie-codegen/src/configs/*.ts` from `https://docs.kie.ai/llms.txt`
  and linked OpenAPI markdown pages.
- Do not edit `src/kie-manifest.json` directly. Changes will be overwritten.
- Persistent node definition fixes belong in KIE codegen parser/fetcher/writer
  source, then configs and manifest must be regenerated.

## Runtime Flow

1. `src/index.ts` loads `src/kie-manifest.json`.
2. `src/kie-factory.ts` creates runtime node classes from manifest entries.
3. `src/kie-base.ts` handles KIE API submission, polling, uploads, and result
   conversion.

## Media Input Rules

KIE APIs often document upload fields as `*_url` or `*_urls`, but NodeTool nodes
must expose media handles, not raw URL strings.

- single image URL fields use `image`
- single video URL fields use `video`
- single audio URL fields use `audio`
- multiple media URL fields use `list[image]`, `list[video]`, or `list[audio]`

The factory uploads AssetRefs with `uploadImageInput`, `uploadVideoInput`, or
`uploadAudioInput` before sending URL strings to KIE.
