Skip to content

Type Alias: DraftFunctionResponse

@kortexya/reasoninglayer


@kortexya/reasoninglayer / Functions / DraftFunctionResponse

Type Alias: DraftFunctionResponse

DraftFunctionResponse = { questions: AuthoringClarificationQuestionDto[]; sessionId: string; status: "needs_clarification"; understood: object; } | { draft: FunctionDraftDto; explanation?: string | null; generationTimeMs: number; status: "complete"; warnings: string[]; }

Defined in: src/types/functions.ts:280

Response for an AI function draft.

Type Declaration

{ questions: AuthoringClarificationQuestionDto[]; sessionId: string; status: "needs_clarification"; understood: object; }

questions

questions: AuthoringClarificationQuestionDto[]

Clarification questions the user must answer.

sessionId

sessionId: string

Session ID to echo back in the follow-up request.

status

status: "needs_clarification"

Discriminator: clarification is needed.

understood

understood: object

What the model already understood from the description.

{ draft: FunctionDraftDto; explanation?: string | null; generationTimeMs: number; status: "complete"; warnings: string[]; }

draft

draft: FunctionDraftDto

The draft, in the exact shape registerFunction accepts (add tenantId client-side).

explanation?

optional explanation: string | null

Plain-language summary of what the drafted function does.

generationTimeMs

generationTimeMs: number

Wall-clock generation time in milliseconds.

status

status: "complete"

Discriminator: the draft is ready.

warnings

warnings: string[]

Non-fatal issues the user should see (e.g., unknown function references).

Remarks

Discriminated union by status:

  • "needs_clarification" — the model needs more information; answer questions and call again with sessionId.
  • "complete"draft holds a validated FunctionDraftDto in the exact shape RegisterFunctionRequest accepts (add tenantId client-side).