// This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { baseUrl: 'https://api.eigenpal.com' | (string & {}); }; export type UpdateAutomationRequest = { /** * Move a YAML workflow into this workflow folder. `null` files it at the tenant root. Ignored for the folder lookup when `folderPath` is also sent, but a string value is still validated before the path is applied. */ folderId?: string | null; /** * Slash-separated workflow folder path. Missing folders are created. Empty or `/` means root. When both fields are sent, `folderPath` wins after `folderId` validation. */ folderPath?: string; }; export type AutomationDatasetImportMultipartRequest = { /** * Dataset ZIP file */ file: Blob | File; /** * `append` adds examples without deleting existing rows. `replace` deletes the current dataset before importing. */ mode?: 'append' | 'replace'; }; /** * Replacement evaluator configuration. */ export type EvaluatorConfigUpdate = { /** * Complete evaluator YAML to validate and store. */ yaml: string; }; /** * Fields used to create or update a dataset example. */ export type DatasetExampleMutation = { /** * Example name. Required on create; omitted or null uses a generated name where supported. */ name?: string | null; /** * Input arguments for the example. */ input?: { [key: string]: unknown; } | null; /** * Expected JSON output. Null clears the expected output. */ expected?: unknown | null; /** * Caller-managed metadata. */ metadata?: { [key: string]: unknown; } | null; /** * Human note about the example. Null clears the annotation. */ annotation?: string | null; /** * Optional display order. Null clears the order. */ rowOrder?: number | null; /** * Step output overrides used during example runs. */ overrides?: { [key: string]: unknown; } | null; }; /** * Partial update for a dataset example. Omitted fields are preserved. */ export type DatasetExampleUpdate = { /** * Example name. Required on create; omitted or null uses a generated name where supported. */ name?: string | null; /** * Input arguments for the example. */ input?: { [key: string]: unknown; } | null; /** * Expected JSON output. Null clears the expected output. */ expected?: unknown | null; /** * Caller-managed metadata. */ metadata?: { [key: string]: unknown; } | null; /** * Human note about the example. Null clears the annotation. */ annotation?: string | null; /** * Optional display order. Null clears the order. */ rowOrder?: number | null; /** * Step output overrides used during example runs. */ overrides?: { [key: string]: unknown; } | null; }; export type DatasetExampleExpectedFileUploadRequest = { /** * One or more expected files to upload. */ file: Array; }; export type DatasetExampleExpectedFileRenameRequest = { /** * New basename for the file. The parent folder is preserved. */ newFilename: string; }; export type DatasetExampleInputFileUploadRequest = { /** * One or more input files to upload. */ file: Array; }; export type DatasetExampleInputFileRenameRequest = { /** * New basename for the file. The parent folder is preserved. */ newFilename: string; }; /** * Request body for starting an experiment batch. */ export type ExperimentCreate = { /** * Optional dataset example ids to run. Omit to run the full dataset. */ examples?: Array; /** * Maximum concurrent example runs for this experiment. */ batchConcurrency?: number | null; /** * Optional source version/ref to use for experiment runs. */ sourceRef?: string; }; /** * Exactly one of `yaml` or `historyId`, plus a bare semver `version`. YAML is capped at 1 MiB. `historyId` copies the selected snapshot into a new tagged row and does not retag the source. Set `activate: false` to create a detached candidate that does not move live HEAD; that path requires an existing current version. */ export type CreateAutomationVersionRequest = { /** * Validated workflow YAML to publish as a new tagged version. Mutually exclusive with `historyId`. At most 1 MiB. */ yaml: string; /** * Bare semver tag such as 1.2.0. Do not include a leading v. */ version: string; /** * Whether to make the new version current immediately. Defaults to true. Set false to keep a tagged candidate off live traffic until promote. `activate: false` requires an existing current workflow version and returns 400 if HEAD is empty. */ activate?: boolean; } | { /** * Existing version id from GET /automations/{id}/versions. Creates a new tagged snapshot copied from that version; the source tag is left unchanged. Mutually exclusive with `yaml`. */ historyId: string; /** * Bare semver tag such as 1.2.0. Do not include a leading v. */ version: string; /** * Whether to make the new version current immediately. Defaults to true. Set false to keep a tagged candidate off live traffic until promote. `activate: false` requires an existing current workflow version and returns 400 if HEAD is empty. */ activate?: boolean; }; /** * Optional JSON body. Send `{}` when no message is needed. Restore always creates a new untagged current snapshot; it does not retag the source version. */ export type RestoreAutomationVersionRequest = { /** * Optional restore commit message. Defaults to a timestamped restore note. */ message?: string; }; export type CreateEmailServerRequest = { name: string; enabled?: boolean; transport: 'resend'; apiKey: string; fromEmail: string; fromName: string; } | { name: string; enabled?: boolean; transport: 'smtp'; host: string; port?: number; security?: 'starttls' | 'tls' | 'none'; username?: string; password?: string; caPem?: string; fromEmail: string; fromName: string; }; export type UpdateEmailServerRequest = { name?: string; enabled?: boolean; transport: 'resend'; apiKey?: string; fromEmail: string; fromName: string; } | { name?: string; enabled?: boolean; transport: 'smtp'; host: string; port: number; security: 'starttls' | 'tls' | 'none'; username?: string | null; password?: string; caPem?: string | null; fromEmail: string; fromName: string; } | { name?: string; enabled?: boolean; }; export type TestEmailServerRequest = { to: string; }; export type CreateFileMultipartRequest = { /** * Binary file field */ file: Blob | File; /** * Optional lifecycle marker. `run-input` marks a retry-safe temporary run pre-upload reaped after 24 hours. `builder-attachment` marks a Studio builder intermediary (any MIME) with the same TTL. */ purpose?: 'run-input' | 'builder-attachment'; }; export type CreateFileUploadSessionRequest = { filename: string; contentType: string; size: number; purpose?: 'run-input' | 'builder-attachment'; idempotencyKey?: string; }; export type PresignFileUploadPartRequest = { partNumber: number; }; export type FolderType = 'workflow' | 'template'; export type CreateFolderRequest = { /** * Folder name. Cannot contain `/`. */ name: string; /** * Which folder tree to create in. Required; there is no default. */ type: FolderType; /** * Parent folder id. Omit or `null` to create at the tree root. */ parentId?: string | null; }; export type UpdateFolderRequest = { /** * New folder name. Cannot contain `/`. */ name?: string; /** * New parent folder id. `null` moves the folder to the tree root. */ parentId?: string | null; }; /** * Run envelope. Declare provenance with the `X-Eigenpal-Trigger` header (`api` or `cli`). Legacy 0.5.12 body shapes remain accepted. */ export type RunStartBody = { /** * Automation target without a version suffix, e.g. workflows.invoice or agents.support. */ target: string; /** * Scalar and structured automation arguments. */ input?: { [key: string]: unknown; }; /** * File inputs as ingress references (`{ "$fileId": "file_..." }` or `{ "$inline": { filename, mimeType, base64 } }`). Upload bytes via multipart `files.` parts instead. */ files?: { [key: string]: { /** * Reusable file-pool id to materialize */ $fileId: string; } | { $inline: { /** * Original filename for the materialized artifact */ filename: string; /** * MIME type for the materialized artifact */ mimeType: string; /** * Base64-encoded file bytes */ base64: string; }; } | Array<{ /** * Reusable file-pool id to materialize */ $fileId: string; } | { $inline: { /** * Original filename for the materialized artifact */ filename: string; /** * MIME type for the materialized artifact */ mimeType: string; /** * Base64-encoded file bytes */ base64: string; }; }>; }; /** * Per-step output overrides. Workflow runs only. */ overrides?: { steps?: { [key: string]: { [key: string]: unknown; }; }; }; /** * Caller-supplied run metadata. */ metadata?: { [key: string]: unknown; }; }; export type RunStartMultipartRequest = { /** * Automation target, e.g. `workflows.invoice`. */ target: string; /** * JSON-encoded scalar input object. */ input?: string; /** * JSON-encoded step overrides. */ overrides?: string; /** * JSON-encoded run metadata. */ metadata?: string; [key: string]: unknown; }; /** * Create or update a dataset example from the run input, actual output, and review corrections. */ export type PromoteRunRequest = { /** * Dataset example name to create or update. Defaults to a generated name when omitted. */ name?: string; }; /** * Create or replace review metadata for a run. Attribution fields (`reviewedBy`, `closedBy`, and their emails) are read-only and populated from the authenticated user or API key creator. */ export type RunReviewRequest = { /** * Reviewer verdict. Omit or send null for feedback without a ranking (nit). Defaults are applied client-side only; any verdict/status combination is accepted. */ verdict?: 'correct' | 'incorrect' | null; /** * Review lifecycle. Defaults from verdict (`correct` → `closed`, otherwise `open`). Use `closed` or `wont_fix` to close an open review. */ status?: 'open' | 'closed' | 'wont_fix'; /** * Reviewer note. */ note?: string | null; /** * Corrected JSON output for this run. Send `null` to clear a previously stored correction. */ correctedOutput?: unknown | null; /** * Field and file corrections. When present, replaces the entire correction set for this review. Omit to leave existing corrections unchanged. */ corrections?: Array<{ id?: string; kind: 'field' | 'file'; path: string; label?: string | null; originalValue?: unknown; correctedValue?: unknown; note?: string | null; correctedArtifactPath?: string | null; }>; }; /** * JSON request body for copying one run output file into the corrected artifact set. */ export type RunReviewExpectedFileCopyRequest = { /** * Name of an existing run output file to copy into corrected artifacts. */ outputFileName: string; /** * Optional name for the copied corrected file. Defaults to the original output file name. */ expectedName?: string; }; export type RunReviewExpectedFileUploadRequest = { /** * Corrected artifact file to upload. */ file: Blob | File; /** * Optional stored corrected file name. Defaults to the uploaded filename. */ name?: string; }; /** * Rename one corrected file. */ export type RunReviewExpectedFileUpdateRequest = { /** * New corrected file name. */ name: string; }; export type TemplateFileReferenceRequest = { /** * Reusable file id produced by the direct file upload flow. It is consumed as upload transport, not exposed as template identity. */ fileId: string; name?: string; description?: string; /** * When true, the create response includes a one-time cleanupProof for unpublished CLI staging. Normal uploads omit this. */ staged?: boolean; }; export type TemplateReplaceRequest = { /** * Reusable file id produced by the direct file upload flow. It is consumed as upload transport, not exposed as template identity. */ fileId: string; }; export type TemplateStagingRequest = { proof: string; action: 'cleanup' | 'finalize'; }; export type AuthCheckResponse = { ok: true; tenantId: string; tenantSlug: string; tenantName: string | null; userId: string | null; keyId: string; email: string | null; name: string | null; scope: Array; wildcardGranted: boolean; }; export type ApiErrorEnvelope = { issues: Array; /** * Request id echoed via the x-request-id header */ requestId: string; /** * Suggested fix for known error patterns */ hint?: string; /** * Link to relevant docs */ docsUrl?: string; /** * Present on 409 workflow_name_conflict responses. Id of the workflow that already owns the requested name. */ conflictingWorkflowId?: string; }; export type ApiErrorIssue = { /** * JSON path of the offending field, or "" */ field: string; /** * Human-readable error message */ message: string; /** * Machine-readable error code (e.g. invalid_value, not_found, api_trigger_disabled, manual_trigger_disabled) */ code: string; /** * Issue severity */ severity: 'error' | 'warning'; }; export type ListAutomationsResponse = { data: Array; total: number; limit: number; offset: number; }; export type AutomationSummary = { /** * Implementation id for the automation. Workflow automations use workflow ids; agent automations use agent workflow ids. */ id: string; type: AutomationType; slug: string; name: string | null; description?: string | null; status?: string; version?: string | null; triggers?: AutomationTriggerState; /** * False when the automations registry row exists but the workflow/agent implementation row is missing. */ implementationAvailable?: boolean; /** * Workflow folder id. Null for unfiled workflows, agent automations, and orphan registry rows. */ folderId: string | null; /** * Slash-separated workflow folder path from the tenant root, such as `billing/invoices`. Null at root and for agent automations. */ folderPath: string | null; createdAt: string; updatedAt?: string; }; export type AutomationType = 'workflow' | 'agent'; export type AutomationTriggerState = { api: boolean; email: boolean; manual: boolean; cron: boolean; }; export type AutomationDetail = { /** * Implementation id for the automation. Workflow automations use workflow ids; agent automations use agent workflow ids. */ id: string; type: AutomationType; slug: string; name: string | null; description?: string | null; status?: string; version?: string | null; triggers?: AutomationTriggerState; /** * False when the automations registry row exists but the workflow/agent implementation row is missing. */ implementationAvailable?: boolean; /** * Workflow folder id. Null for unfiled workflows, agent automations, and orphan registry rows. */ folderId: string | null; /** * Slash-separated workflow folder path from the tenant root, such as `billing/invoices`. Null at root and for agent automations. */ folderPath: string | null; createdAt: string; updatedAt?: string; inputSchema?: { [key: string]: unknown; } | null; outputSchema?: { [key: string]: unknown; } | null; }; export type DeleteAutomationResponse = { deleted: true; id: string; }; export type DatasetImportResponse = { mode: 'append'; created: number; expectedSet: number; skipped: number; issues: Array; } | { mode: 'replace'; created: number; expectedSet: number; deleted: number; filesDeleted: number; }; /** * Evaluator YAML and parsed evaluator configuration for an automation. */ export type EvaluatorConfigResponse = { /** * Automation that owns this evaluator config. */ automationId: string; automationType: AutomationType; /** * Evaluator configuration YAML. */ yaml: string; config: { /** * Parsed evaluator definitions from the YAML. */ evaluators: Array; /** * Overall score threshold required for the experiment to pass. */ passThreshold: number; }; }; export type DatasetExampleList = { data: Array; total: number; limit: number; offset: number; }; /** * One input/expected-output row in an automation dataset. */ export type DatasetExample = { /** * Stable public example id. Workflow examples use DB ids; agent examples use deterministic name-derived ids. */ id: string; /** * Human-readable dataset example name. */ name: string; /** * Automation that owns this example. */ automationId: string; automationType: AutomationType; /** * Input arguments used when this example is run. Null when listing with `include=metadata`. */ input: { [key: string]: unknown; } | null; /** * Expected JSON output for evaluator comparisons. Null when listing with `include=metadata`. */ expected: unknown | null; /** * Expected files attached to this example. */ expectedFiles: Array<{ /** * Expected file name. */ name: string; /** * Download URL for the expected file. */ url?: string; }>; /** * Caller-managed metadata for sorting or filtering examples. */ metadata: { [key: string]: unknown; } | null; /** * Human note about the example. */ annotation: string | null; /** * Optional display order within the dataset. */ rowOrder: number | null; /** * Step output overrides used when running this example. */ overrides: { [key: string]: unknown; } | null; /** * Most recent run id created from this example. */ latestRunId: string | null; createdAt?: string; updatedAt?: string | null; }; export type DatasetExampleExpectedFileList = { /** * Paths under the example expected folder. */ files: Array; }; export type DatasetExampleExpectedFileUploadResponse = { /** * Stored expected file paths. */ uploaded: Array; }; export type DatasetExampleExpectedFileRenameResponse = { ok: true; filename: string; /** * Updated expected file path. */ path: string; }; export type DatasetExampleInputFileList = { /** * Paths under the example input folder. */ files: Array; }; export type DatasetExampleInputFileUploadResponse = { /** * Stored input file paths. */ uploaded: Array; }; export type DatasetExampleInputFileRenameResponse = { ok: true; filename: string; /** * Updated input file path. */ path: string; }; export type ExampleRunResponse = { /** * Run id created for this example. */ id: string; /** * Implementation type behind the automation. */ type: 'workflow' | 'agent'; /** * Experiment batch id when the run is associated with a batch. The API also calls this an experiment id in experiment routes. */ batchId: string | null; /** * Example runs are accepted asynchronously. */ finished: false; }; /** * Experiment batch summary for an automation dataset run. */ export type Experiment = { /** * Experiment batch id. Some CLI commands historically call this a batch id. */ id: string; /** * Automation this experiment belongs to. */ automationId: string; automationType: AutomationType; /** * Experiment batch status. */ status: 'queued' | 'running' | 'completed'; /** * Total runs in the experiment. */ runCount: number; /** * Runs that have completed. */ completedCount: number; /** * Runs whose evaluator scores passed. */ passedCount: number; /** * Runs whose evaluator scores failed. */ failedCount: number; /** * Average automated evaluator score. */ avgScore: number | null; createdAt: string; completedAt: string | null; version: string | null; }; /** * Accepted experiment batch and the runs it enqueued. */ export type ExperimentCreateResponse = { /** * Experiment batch id. */ id: string; /** * Runs enqueued for this experiment. */ runs: Array<{ /** * Run id. */ id: string; /** * Dataset example id. */ exampleId: string | null; }>; /** * Number of runs enqueued. */ total: number; }; /** * Experiment batch detail. */ export type ExperimentDetail = { /** * Experiment batch id. Some CLI commands historically call this a batch id. */ id: string; /** * Automation this experiment belongs to. */ automationId: string; automationType: AutomationType; /** * Experiment batch status. */ status: 'queued' | 'running' | 'completed'; /** * Total runs in the experiment. */ runCount: number; /** * Runs that have completed. */ completedCount: number; /** * Runs whose evaluator scores passed. */ passedCount: number; /** * Runs whose evaluator scores failed. */ failedCount: number; /** * Average automated evaluator score. */ avgScore: number | null; createdAt: string; completedAt: string | null; version: string | null; /** * Runs created for dataset examples in this experiment. */ runs: Array<{ /** * Run id created for the experiment. */ id: string; /** * Current run status. */ status: string; /** * Dataset example id for the run. */ exampleId: string | null; /** * Dataset example name for the run. */ exampleName: string | null; /** * Persisted weighted evaluator score. */ evalScore: number | null; /** * Persisted aggregate evaluator verdict. */ evalPassed: boolean | null; createdAt: string; completedAt: string | null; }>; /** * Evaluator results keyed by run id. */ resultsByRun: { [key: string]: Array; }; }; /** * Automated evaluator result for one run. */ export type EvalResult = { /** * Evaluator result id. */ id: string; /** * Run this score belongs to. */ runId: string; /** * Automation this score belongs to. */ automationId: string | null; /** * Evaluator name from configuration. */ evaluatorName: string; /** * Evaluator implementation type. */ evaluatorType: string; /** * Automated evaluator score. Do not confuse this with a human review verdict. */ score: number | null; /** * Whether this evaluator passed. */ passed: boolean | null; /** * Optional evaluator label. */ label: string | null; /** * Weight used in aggregate scoring. */ weight: number | null; /** * Score threshold required for this evaluator to pass. */ passThreshold: number | null; /** * Evaluator description. */ description: string | null; /** * Evaluator-specific details. */ details: unknown | null; /** * Evaluator error, when scoring failed. */ error: string | null; createdAt: string; }; export type RunReviewHealthResponse = { timeRange: { from: string; to: string; }; granularity: { bucket: 'day' | 'week' | 'month'; rollingWindow: number; minRollingReviews: number; }; summary: RunReviewHealthSummary; buckets: Array; rolling: Array; }; export type RunReviewHealthSummary = { totalRuns: number; /** * Runs with a ranked verdict (`correct` or `incorrect`). Null verdict (nit) is excluded. */ reviewedRuns: number; reviewCoverage: number | null; correctReviews: number; incorrectReviews: number; /** * Runs with a review row and null verdict (nit). Excluded from review coverage and accuracy. */ nitReviews: number; reviewedCorrectness: number | null; confidence: RunReviewHealthConfidence; }; /** * Wilson score confidence interval for reviewed correctness. Null bounds mean there are no reviewed runs in the sample. */ export type RunReviewHealthConfidence = { lower: number | null; upper: number | null; method: 'wilson'; }; export type RunReviewHealthBucket = { start: string; end: string; totalRuns: number; /** * Runs with a ranked verdict (`correct` or `incorrect`). Null verdict (nit) is excluded. */ reviewedRuns: number; reviewCoverage: number | null; correctReviews: number; incorrectReviews: number; /** * Runs with a review row and null verdict (nit). Excluded from review coverage and accuracy. */ nitReviews: number; reviewedCorrectness: number | null; }; export type RunReviewHealthRollingPoint = { at: string; /** * Runs with a ranked verdict (`correct` or `incorrect`). Null verdict (nit) is excluded. */ reviewedRuns: number; correctReviews: number; reviewedCorrectness: number; confidenceLower: number; confidenceUpper: number; /** * Total production runs in the rolling window ending at this point. */ totalRunsInWindow: number; /** * Share of runs in the rolling window that were reviewed (0-1). Uses the same window size as rolling accuracy, applied to all runs. */ reviewCoverage: number; }; export type AutomationTriggersResponse = { automationId: string; type: AutomationType; triggers: AutomationTriggerState; }; export type ListAutomationVersionsResponse = { data: Array; total: number; limit: number; offset: number; }; export type AutomationVersion = { id: string; automationId: string; version: string | null; sourceRef?: string | null; isCurrent?: boolean; createdAt?: string; }; export type ListEmailServersResponse = { data: Array; total: number; limit: number; offset: number; }; export type EmailServer = ({ transport: 'resend'; } & PublicResendEmailServer) | ({ transport: 'smtp'; } & PublicSmtpEmailServer); export type PublicResendEmailServer = { id: string; name: string; enabled: boolean; createdAt: string; updatedAt: string; transport: 'resend'; fromEmail: string; fromName: string; apiKeyConfigured: true; }; export type PublicSmtpEmailServer = { id: string; name: string; enabled: boolean; createdAt: string; updatedAt: string; transport: 'smtp'; fromEmail: string; fromName: string; host: string; port: number; security: 'starttls' | 'tls' | 'none'; username: string | null; passwordConfigured: boolean; caPemConfigured: boolean; }; export type DeleteEmailServerResponse = { deleted: true; id: string; }; export type TestEmailServerResponse = { ok: true; transport: 'resend' | 'smtp'; messageId: string; } | { ok: false; error: string; }; export type ExperimentRef = { id: string; automationId: string; }; export type File = { id: string; filename: string; contentType: string | null; size: number | null; /** * Optional lifecycle marker. `run-input` marks a retry-safe temporary run pre-upload reaped after 24 hours. `builder-attachment` marks a Studio builder intermediary (any MIME) with the same TTL. Omitted/null means a durable reusable file. */ purpose?: string | null; createdAt: string; }; export type DeleteFileResponse = { deleted: boolean; }; export type PresignedFileUploadSession = { transport: 'presigned-put'; uploadId: string; fileId: string; url: string; headers: { [key: string]: string; }; expiresAt: string; maxFileSizeBytes: number; }; export type PresignedMultipartFileUploadSession = { transport: 'presigned-multipart'; uploadId: string; fileId: string; partSizeBytes: number; partCount: number; partsUrl: string; completeUrl: string; expiresAt: string; maxFileSizeBytes: number; }; export type MultipartFileUploadFallback = { transport: 'multipart'; url: string; maxFileSizeBytes: number; }; export type FileUploadSession = { uploadId: string; fileId: string; transport: 'presigned-put' | 'presigned-multipart'; status: string; expiresAt: string; partSizeBytes?: number | null; partCount?: number | null; parts?: Array<{ partNumber: number; size?: number; etag: string; }>; }; export type AbortFileUploadResponse = { aborted: true; }; export type ListFileUploadPartsResponse = { transport: 'presigned-multipart'; uploadId: string; fileId: string; partSizeBytes: number; partCount: number; expiresAt: string; parts: Array<{ partNumber: number; size?: number; etag: string; }>; }; export type PresignFileUploadPartResponse = { transport: 'presigned-multipart'; partNumber: number; url: string; headers: { [key: string]: string; }; expiresAt: string; partSizeBytes: number; }; export type ListFoldersResponse = Array; export type Folder = { id: string; parentId: string | null; type: FolderType; name: string; createdAt: string; /** * Direct subfolder count. Present on tree listings. */ childCount?: number; /** * Workflows filed directly in this folder. Present on workflow-tree listings. */ workflowCount?: number; /** * Up to a handful of item names — subfolders first, then workflows — for a peek at folder contents. Present on workflow-tree listings. */ previewItems?: Array<{ name: string; kind: 'folder' | 'workflow'; }>; }; export type DeleteFolderResponse = { deleted: true; id: string; }; export type HumanReviewListResponse = { tasks: Array<{ id: string; executionId: string; automationId: string; automationName: string; sourceKind: 'workflow_step' | 'agent_tool'; sourceLabel: string; status: 'pending' | 'approved' | 'rejected' | 'cancelled'; requiredCount: number; confirmedCount: number; version: number; createdAt: string; updatedAt: string; }>; nextCursor: string | null; }; export type HumanReviewTaskResponse = { task: HumanReviewTaskDetail; }; export type HumanReviewTaskDetail = { id: string; executionId: string; automationId: string; automationName: string; sourceKind: 'workflow_step' | 'agent_tool'; sourceLabel: string; status: 'pending' | 'approved' | 'rejected' | 'cancelled'; requiredCount: number; confirmedCount: number; version: number; createdAt: string; updatedAt: string; files: Array<{ fileId: string; filename: string; mimeType?: string; size?: number; fieldName?: string; artifactPath: string; /** * run_input for authorized run input files; attachment for extra current-run files. Omitted on historical tasks and inferred at read time. */ role?: 'run_input' | 'attachment'; }>; /** * Non-file trigger input derived at read time. Null when every field is a file or external source id. omitted_too_large when the projection exceeds the review data byte limit. */ input: { status: 'available'; data: { [key: string]: unknown; } | Array; } | { status: 'omitted_too_large'; } | null; machineData: { [key: string]: unknown; } | Array; draftData: { [key: string]: unknown; } | Array; schema: { [key: string]: unknown; } | null; fieldMetadata: { [key: string]: { /** * Producer-supplied confidence: 0–1 numeric (legacy) or categorical low|medium|high from ai.extract grounding. Not calibrated by Eigenpal. */ confidence?: number | 'low' | 'medium' | 'high' | string; /** * Short label shown in the review UI */ label?: string; /** * Longer reviewer guidance for this field */ description?: string; /** * Legacy per-field override kept for existing tasks. Prefer selection.fields.review. */ review?: 'auto' | 'always' | 'never'; /** * Opaque display metadata preserved for the review UI */ display?: { [key: string]: unknown; }; }; }; requiredPaths: Array; selectionReasons: { [key: string]: 'always' | 'explicit' | 'low_confidence' | 'missing_confidence' | 'all' | 'reviewer_edit' | 'threshold_met' | 'never' | 'excluded' | 'unmatched' | 'missing_confidence_skip'; }; decisions: Array<{ id: string; path: string; originalValue: string | number | boolean | null; currentValue: string | number | boolean | null; required: boolean; reason: 'always' | 'explicit' | 'low_confidence' | 'missing_confidence' | 'all' | 'reviewer_edit' | 'threshold_met' | 'never' | 'excluded' | 'unmatched' | 'missing_confidence_skip'; confirmedBy: string | null; confirmedAt: string | null; version: number; }>; instructions: string | null; completedBy: string | null; completedAt: string | null; outcomeReason: string | null; /** * Optional lineage@1 document resolved from the extract sidecar. Omitted when missing or unreadable. Validate with @openparser/lineage. */ lineage?: { [key: string]: unknown; }; /** * Optional ParsedDocument resolved from the extract sidecar. Omitted when missing or unreadable. Validate with @openparser/schema. */ parsedDocument?: { [key: string]: unknown; }; }; export type HumanReviewApproveResponse = { task: HumanReviewTaskDetail; }; export type HumanReviewFieldResponse = { task: HumanReviewTaskDetail; }; export type HumanReviewRejectResponse = { task: HumanReviewTaskDetail; }; export type ListModelsResponse = { data: Array; total: number; }; export type PublicModel = { id: string; kind: 'llm' | 'ocr'; provider: string; label: string; capabilities: Array<'text' | 'vision' | 'ocr'>; configured: boolean; available: boolean; /** * Configuration state only: `configured` means credentials are present in this environment; `unconfigured` means the catalog entry exists but credentials are missing. This list does not probe live providers, so it never reports healthy/degraded/outage. `unknown` is reserved and is not emitted by this endpoint. */ health: 'configured' | 'unconfigured' | 'unknown'; defaultFor: Array<'text' | 'vision' | 'ocr'>; /** * `local` means on-prem / no cloud provider egress (`local: true` or tesseract). `hosted` means the provider is a cloud API. Endpoints are never returned. */ location: 'local' | 'hosted'; limits?: PublicModelLimits; /** * Static Eigenpal credit rates when known without a live vendor catalog. Omitted for OpenParser OCR and for LLMs (token prices are not part of this catalog). */ cost?: PublicModelCost; aliases: Array; tags: Array; /** * Optional picker rank. Higher is more capable. Omitted on catalog rows that do not set it. Does not change role defaults. */ capabilityRank?: number; }; export type PublicModelLimits = { requestTimeoutSeconds?: number; maxConcurrentRequests?: number; }; export type PublicModelCost = { creditsPerPage?: number; unit: 'credits'; }; export type RunsListResponse = { runs: Array; nextCursor: string | null; }; export type RunListItem = { id: string; type: 'workflow' | 'agent'; /** * True when the run has reached a terminal status. */ finished: boolean; /** * Deterministic pseudo-random rank in [0, 1) for this run within the tenant. Use with a sample rate threshold to review a stable subset. */ sampleRank: number; /** * Parent run id when this run was started by an invoke-workflow step. Omitted for top-level runs. */ parentExecutionId?: string; timing: RunTiming; source: RunSource; trigger: RunTrigger; /** * Present only on eval-scoped runs. Omitted otherwise. */ eval?: RunEval; /** * Terminal failure message. Present on terminal runs; null when the run succeeded. Absent while the run is still in flight. */ error?: RunError; execution: RunExecutionMeta; }; export type RunTiming = { createdAt: string; startedAt: string | null; completedAt: string | null; durationMs: number | null; /** * When the user requested cancel; status may still be `running` until the worker stops. */ cancelRequestedAt: string | null; }; export type RunSource = { /** * Owning workflow id or agent id. */ id: string; name: string | null; /** * Workflow version label (workflow runs only). */ version: string | null; /** * Captured workflow version id (workflow runs only). */ versionId?: string | null; /** * Agent slug (agent runs only). */ slug?: string | null; /** * LLM model used (agent runs only). */ model?: string | null; /** * Git provenance (agent runs only). */ git?: RunSourceGit | null; /** * Whether the live workflow/agent implementation still exists (`GET /api/v1/runs/:id` detail only). */ implementationAvailable?: boolean; /** * Whether the owning automation registry row still exists (`GET /api/v1/runs/:id` detail only). */ automationFound?: boolean; /** * Current released workflow version label when the source is live (`GET /api/v1/runs/:id` detail only). */ currentVersion?: string | null; }; export type RunSourceGit = { requestedRef: string | null; resolvedRef: string | null; resolvedTag: string | null; commitSha: string | null; }; export type RunTrigger = { type: string | null; by: { id: string; name: string | null; email: string; } | null; /** * Inbound email trigger details (agent runs, `expand=input` not required). */ email?: unknown; }; export type RunEval = { /** * Eval example label (agent example name or workflow example id). */ example: string | null; /** * Workflow eval example folder id (workflow runs only). */ exampleId?: string | null; score: number | null; passed: boolean | null; }; export type RunError = string | null; export type RunExecutionMeta = { /** * Status of this run. `retry.nextRun.status` is a later retry, not this run. */ status: ExecutionStatus; /** * Whether the completed output matched the workflow or agent output schema. */ schemaValid: boolean | null; /** * Experiment batch id when the run is part of a batch. */ batchId: string | null; retry: RunExecutionRetry; /** * Lightweight review state for run list rows. */ review?: RunReviewSummary | null; /** * Pending in-flight human review when the run is waiting on a reviewer. */ humanReview?: RunHumanReviewSummary | null; }; export type ExecutionStatus = 'created' | 'pending' | 'running' | 'waiting' | 'finalizing' | 'completed' | 'failed' | 'cancelled' | 'rejected'; export type RunExecutionRetry = { /** * Retry attempt index (0 = original run). */ number: number; /** * Run id of the prior attempt in the retry chain. */ previousRunId: string | null; /** * Retry run spawned from this run, if any. Present on list and detail without `expand`. `status` here is the later retry, not this run. */ nextRun: { id: string; status: string; } | null; }; export type RunReviewSummary = { verdict: 'correct' | 'incorrect' | null; status: 'open' | 'closed' | 'wont_fix'; /** * True when review notes were left. */ hasNote: boolean; /** * Number of field/file corrections. */ correctionCount: number; }; export type RunHumanReviewSummary = { taskId: string; sourceKind: 'workflow_step' | 'agent_tool'; sourceLabel: string; status: 'pending'; requiredCount: number; confirmedCount: number; version: number; }; export type Run = { id: string; type: 'workflow' | 'agent'; /** * True when the run has reached a terminal status. */ finished: boolean; /** * Deterministic pseudo-random rank in [0, 1) for this run within the tenant. Use with a sample rate threshold to review a stable subset. */ sampleRank: number; /** * Parent run id when this run was started by an invoke-workflow step. Omitted for top-level runs. */ parentExecutionId?: string; timing: RunTiming; source: RunSource; trigger: RunTrigger; /** * Present only on eval-scoped runs. Omitted otherwise. */ eval?: RunEval; /** * Completed runs only. Per-automation business result — not a generic schema. Absent until the run completes. */ output?: { [key: string]: unknown; } | null; /** * Completed runs only. Download with GET /api/v1/runs/:id/artifacts/:path. Absent until the run completes. */ files?: Array; /** * Terminal failure message. Present on terminal runs; null when the run succeeded. Absent while the run is still in flight. */ error?: RunError; /** * Present only with `expand=input`. */ input?: RunInput; /** * Present only with `expand=usage`. Null for old runs without telemetry. */ usage?: RunUsage | null; /** * Slim execution metadata always present (`status`, `schemaValid`, `batchId`, `retry`). Pass `expand=execution` to replace with full RunExecution (WorkflowRunExecution or AgentRunExecution depending on run type). */ execution: RunExecutionMeta | RunExecution; /** * Present only with `expand=debug`. */ debug?: RunDebug; }; export type RunArtifact = { name: string; /** * `input`, `output`, `debug`, `report`, or another stable artifact role. */ role: string; /** * Canonical artifact path for GET /api/v1/runs/:id/artifacts/:path. */ path: string; /** * Workflow step that produced the file, when known. */ stepName?: string; contentType?: string | null; size?: number | null; }; export type RunInput = { /** * Input arguments the run was started with. */ args: unknown; /** * Uploaded input files (agent runs only). */ files?: Array; /** * Caller-supplied run metadata, if any. */ metadata?: unknown; }; export type RunFile = { name: string; }; export type RunUsage = { tokens: { input: number | null; output: number | null; cacheRead: number | null; cacheWrite: number | null; }; creditsCharged: number | null; durationMs: number | null; /** * LLM call count (workflow runs only). */ llmCallCount?: number; /** * OCR pages processed (workflow runs only). */ ocrPagesProcessed?: number; /** * Agent conversation turns (agent runs only). */ agentTurns?: number | null; }; export type RunExecution = WorkflowRunExecution | AgentRunExecution; export type WorkflowRunExecution = { /** * Status of this run. `retry.nextRun.status` is a later retry, not this run. */ status: ExecutionStatus; /** * Whether the completed output matched the workflow or agent output schema. */ schemaValid: boolean | null; /** * Experiment batch id when the run is part of a batch. */ batchId: string | null; retry: RunExecutionRetry; review?: RunReview | null; /** * Pending in-flight human review when the run is waiting on a reviewer. */ humanReview?: RunHumanReviewSummary | null; /** * Slim per-step rows (`id`, name, type, status, timing, order, capped error excerpt). Full `input`/`output` live on `GET /api/v1/runs/{id}/steps/{stepExecutionId}`. */ steps: Array; /** * Child invoke-workflow runs and their steps (`expand=execution`, workflow runs only). Omitted when there are no children. */ childExecutions?: Array; /** * Workflow definition snapshot captured when the run was created (`expand=execution`). */ definitionSnapshot?: unknown | null; /** * Ground-truth expected output and files. */ expected?: { output?: unknown; files?: Array; }; }; export type RunReview = { id: string; verdict: 'correct' | 'incorrect' | null; status: 'open' | 'closed' | 'wont_fix'; note: string; correctedOutput?: unknown | null; /** * User id of the last reviewer. Read-only; set from the authenticated user or API key creator. */ reviewedBy: string | null; /** * Email of the last reviewer. Read-only; set from the authenticated user or API key creator. */ reviewedByEmail: string | null; reviewedAt: string; /** * User id recorded when the review was closed. Read-only; set when status becomes closed or wont_fix. */ closedBy: string | null; /** * Email recorded when the review was closed. Read-only; set when status becomes closed or wont_fix. */ closedByEmail: string | null; closedAt: string | null; closedNote: string | null; createdAt: string; updatedAt: string; corrections: Array; }; export type RunReviewCorrection = { id: string; kind: 'field' | 'file'; /** * JSON Pointer for field corrections, or canonical artifact path for file reviews. */ path: string; label: string | null; originalValue?: unknown | null; correctedValue?: unknown | null; note: string; correctedArtifactPath?: string | null; createdAt: string; updatedAt: string; }; export type AgentRunExecution = { /** * Status of this run. `retry.nextRun.status` is a later retry, not this run. */ status: ExecutionStatus; /** * Whether the completed output matched the workflow or agent output schema. */ schemaValid: boolean | null; /** * Experiment batch id when the run is part of a batch. */ batchId: string | null; retry: RunExecutionRetry; review?: RunReview | null; /** * Pending in-flight human review when the run is waiting on a reviewer. */ humanReview?: RunHumanReviewSummary | null; files: { /** * Output artifacts the agent produced. */ output: Array; }; /** * Ground-truth expected output and files. */ expected?: { output?: unknown; files?: Array; }; /** * Expected-vs-actual comparison for eval runs (terminal runs only). */ comparison?: unknown; }; export type RunDebug = { /** * Execution phase timeline and structured failure. */ observability: unknown; /** * Workflow trace id for span lookup (workflow runs only). */ traceId?: string | null; }; export type RunAccepted = { id: string; type: 'workflow' | 'agent'; finished: false; source?: RunSource; }; export type RunArtifactsResponse = { artifacts: Array; }; export type RunCancelResponse = { id: string; type: 'workflow' | 'agent'; /** * True when the run has reached a terminal status. */ finished: boolean; execution: { status: ExecutionStatus; }; cancellation: { /** * `cancelled` — the run was terminated immediately (it had not started). `requested` — the run is in-flight; cancellation was requested and the status will become `cancelled` shortly. `already_terminal` — the run had already finished; nothing changed. */ state: 'cancelled' | 'requested' | 'already_terminal'; /** * Run status at the time the cancel request was received. */ wasStatus: ExecutionStatus; }; }; export type RunEventsResponse = { events: Array; }; export type RunEvent = { type: string; timestamp: string; status?: string | null; message?: string | null; metadata?: { [key: string]: unknown; }; }; export type PromoteRunResponse = { /** * Automation that owns the promoted example. */ automationId: string; /** * Implementation type behind the automation. */ automationType: 'workflow' | 'agent'; /** * Dataset example identifier returned for follow-up API calls. */ exampleId: string; /** * Dataset example name. */ name: string | null; }; export type RunReviewDetail = { /** * Review metadata and corrections. Corrected files are listed separately at GET /runs/{id}/reviews/expected. */ review: RunReview | null; }; export type RunReviewExpectedArtifacts = { /** * Corrected artifact files attached to the run review. Corrected JSON output lives on the review object at GET /runs/{id}/reviews. */ files: Array; }; /** * Corrected file created or renamed by the request. */ export type RunReviewExpectedFileMutationResponse = RunFile; /** * Corrected file after the rename. */ export type RunReviewExpectedFileUpdateResponse = RunFile; /** * Automated evaluator results attached to a run. */ export type RunScoresResponse = { /** * Automated evaluator scores for the run. These are separate from human review verdicts. */ scores: Array; }; export type RunStepsResponse = { steps: Array; total: number; }; export type RunStepDetailResponse = unknown; export type RunTraceResponse = { /** * Chronological trace events. Workflow runs return observability phases or step executions; agent runs return parsed trace.jsonl events. */ events: Array; }; /** * Trace event emitted by a workflow or agent run. Extra fields depend on the run type and event source. */ export type RunTraceEvent = { /** * Event type when present. Agent traces mirror trace.jsonl events; workflow traces use execution phase or step records. */ type?: string; /** * Workflow execution phase, when present. */ phase?: string; /** * Workflow step name, when present. */ stepName?: string; /** * Event or execution status, when present. */ status?: string; /** * Event start timestamp. */ startedAt?: string | null; /** * Event completion timestamp. */ completedAt?: string | null; /** * Human-readable event message. */ message?: string | null; [key: string]: unknown; }; export type RunUsageResponse = { usage: RunUsage | null; }; export type ListTemplatesResponse = { items: Array