1450 lines
81 KiB
Go

package domain
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
type UserRole string
const (
UserRoleAdmin UserRole = "admin"
UserRoleSupplierManager UserRole = "supplier_manager"
UserRoleAnnotator UserRole = "annotator"
UserRoleQualityReviewer UserRole = "quality_reviewer"
UserRoleAcceptanceReviewer UserRole = "acceptance_reviewer"
)
type UserStatus string
const (
UserStatusActive UserStatus = "active"
UserStatusDisabled UserStatus = "disabled"
)
type OrganizationStatus string
const (
DefaultOrganizationID = "org_default"
OrganizationStatusActive = "active"
OrganizationStatusDisabled = "disabled"
)
type ProjectStatus string
const (
ProjectStatusActive ProjectStatus = "active"
ProjectStatusArchived ProjectStatus = "archived"
)
type PortType string
const (
PortTypeJSON PortType = "json"
PortTypeImage PortType = "image"
PortTypeVideo PortType = "video"
PortTypeTensor PortType = "tensor"
PortTypeFile PortType = "file"
)
// PortContainer describes the shape of the value at a port. It is
// deliberately independent from PortType: a video collection is still made
// of video values, while a directory/dataset is a file reference with a
// different cardinality and materialisation contract.
type PortContainer string
const (
PortContainerSingle PortContainer = "single"
PortContainerCollection PortContainer = "collection"
PortContainerDirectory PortContainer = "directory"
PortContainerDataset PortContainer = "dataset"
)
type WorkflowStatus string
const (
WorkflowStatusDraft WorkflowStatus = "draft"
WorkflowStatusReady WorkflowStatus = "ready"
WorkflowStatusRunning WorkflowStatus = "running"
WorkflowStatusCompleted WorkflowStatus = "completed"
WorkflowStatusFailed WorkflowStatus = "failed"
WorkflowStatusCancelled WorkflowStatus = "cancelled"
)
type WorkflowExecutionScope string
const (
WorkflowExecutionScopeProduction WorkflowExecutionScope = "production"
WorkflowExecutionScopeSandbox WorkflowExecutionScope = "sandbox"
)
type WorkflowType string
const (
WorkflowTypeBatch WorkflowType = "batch"
WorkflowTypeStreaming WorkflowType = "streaming"
)
type WorkflowKind string
const (
WorkflowKindStandard WorkflowKind = "standard"
WorkflowKindScan WorkflowKind = "scan"
)
type StorageProvider string
const (
StorageProviderBOS StorageProvider = "BOS"
StorageProviderOSS StorageProvider = "OSS"
)
type RunTrigger string
const (
RunTriggerManual RunTrigger = "manual"
RunTriggerScheduled RunTrigger = "scheduled"
RunTriggerRetry RunTrigger = "retry"
RunTriggerRerunSubtree RunTrigger = "rerun_subtree"
RunTriggerHumanRelease RunTrigger = "human_release"
)
type RunMode string
const (
RunModeProduction RunMode = "production"
RunModeDebug RunMode = "debug"
RunModeAll RunMode = "all"
)
func (m RunMode) Normalized() RunMode {
if m == RunModeDebug {
return RunModeDebug
}
return RunModeProduction
}
type RunStatus string
const (
RunStatusQueued RunStatus = "queued"
RunStatusRunning RunStatus = "running"
RunStatusStopping RunStatus = "stopping"
RunStatusWaitingForAudit RunStatus = "waiting_for_audit"
RunStatusWaitingForHuman RunStatus = "waiting_for_human"
RunStatusCompleted RunStatus = "completed"
RunStatusFailed RunStatus = "failed"
RunStatusCancelled RunStatus = "cancelled"
)
type RunStopMode string
const (
RunStopModeGraceful RunStopMode = "graceful"
RunStopModeForce RunStopMode = "force"
)
type AuditStatus string
const (
AuditStatusPending AuditStatus = "pending"
AuditStatusApproved AuditStatus = "approved"
AuditStatusRejected AuditStatus = "rejected"
)
type NodeExecutionStatus string
const (
NodeExecutionStatusQueued NodeExecutionStatus = "queued"
NodeExecutionStatusRunning NodeExecutionStatus = "running"
NodeExecutionStatusWaitingForAudit NodeExecutionStatus = "waiting_for_audit"
NodeExecutionStatusWaitingForHuman NodeExecutionStatus = "waiting_for_human"
NodeExecutionStatusCompleted NodeExecutionStatus = "completed"
NodeExecutionStatusFailed NodeExecutionStatus = "failed"
NodeExecutionStatusCancelled NodeExecutionStatus = "cancelled"
)
type Position struct {
X float64 `json:"x" bson:"x"`
Y float64 `json:"y" bson:"y"`
}
type PortDefinition struct {
ID string `json:"id" bson:"id"`
Name string `json:"name" bson:"name"`
Type PortType `json:"type" bson:"type"`
Container PortContainer `json:"container,omitempty" bson:"container,omitempty"`
PayloadMode ArtifactTransferMode `json:"payloadMode,omitempty" bson:"payloadMode,omitempty"`
Role string `json:"role,omitempty" bson:"role,omitempty"`
Required bool `json:"required" bson:"required"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
// Transmission is a legacy runtime-routing hint (bus/oss/shm/stream). New
// UI and operator contracts use PayloadMode; keep it for persisted graph
// compatibility and worker adapters.
Transmission string `json:"transmission,omitempty" bson:"transmission,omitempty"`
}
type WorkflowDefinitionState string
const (
WorkflowDefinitionStateDraft WorkflowDefinitionState = "draft"
WorkflowDefinitionStateReleased WorkflowDefinitionState = "released"
)
type ArtifactTransferMode string
const (
ArtifactTransferModeInline ArtifactTransferMode = "inline"
ArtifactTransferModeRef ArtifactTransferMode = "ref"
)
type ArtifactRefKind string
const (
ArtifactRefKindObject ArtifactRefKind = "object"
ArtifactRefKindDirectory ArtifactRefKind = "directory"
)
// ArtifactReference is a credential-free pointer to durable object storage.
type ArtifactReference struct {
ObjectKeys []string `json:"objectKeys,omitempty" bson:"objectKeys,omitempty"`
CaptureUnit string `json:"captureUnit,omitempty" bson:"captureUnit,omitempty"`
Provider StorageProvider `json:"provider" bson:"provider"`
ConnectionID string `json:"connectionId" bson:"connectionId"`
Bucket string `json:"bucket" bson:"bucket"`
Key string `json:"key,omitempty" bson:"key,omitempty"`
Prefix string `json:"prefix,omitempty" bson:"prefix,omitempty"`
ManifestKey string `json:"manifestKey,omitempty" bson:"manifestKey,omitempty"`
VersionID string `json:"versionId,omitempty" bson:"versionId,omitempty"`
ETag string `json:"etag,omitempty" bson:"etag,omitempty"`
SizeBytes int64 `json:"sizeBytes,omitempty" bson:"sizeBytes,omitempty"`
SHA256 string `json:"sha256,omitempty" bson:"sha256,omitempty"`
MimeType string `json:"mimeType,omitempty" bson:"mimeType,omitempty"`
Kind ArtifactRefKind `json:"kind" bson:"kind"`
}
// ArtifactPayload is the common value/reference carrier used by workflow
// inputs and execution artifacts. Mode selects exactly one of Inline and Ref.
type ArtifactPayload struct {
Mode ArtifactTransferMode `json:"mode" bson:"mode"`
Type PortType `json:"type" bson:"type"`
Inline any `json:"inline,omitempty" bson:"inlineValue,omitempty"`
Ref *ArtifactReference `json:"ref,omitempty" bson:"ref,omitempty"`
}
type WorkflowInputTarget struct {
NodeID string `json:"nodeId" bson:"nodeId"`
TargetPortID string `json:"targetPortId" bson:"targetPortId"`
}
type WorkflowInputDefinition struct {
ID string `json:"id" bson:"id"`
Name string `json:"name" bson:"name"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Type PortType `json:"type" bson:"type"`
Container PortContainer `json:"container,omitempty" bson:"container,omitempty"`
PayloadMode ArtifactTransferMode `json:"payloadMode,omitempty" bson:"payloadMode,omitempty"`
Role string `json:"role,omitempty" bson:"role,omitempty"`
Required bool `json:"required" bson:"required"`
DefaultPayload *ArtifactPayload `json:"defaultPayload,omitempty" bson:"defaultPayload,omitempty"`
Bindings []WorkflowInputTarget `json:"bindings" bson:"bindings"`
}
type ArtifactStoragePolicy struct {
ConnectionID string `json:"connectionId" bson:"connectionId"`
Bucket string `json:"bucket" bson:"bucket"`
PrefixTemplate string `json:"prefixTemplate,omitempty" bson:"prefixTemplate,omitempty"`
}
type ResolvedInputBinding struct {
WorkflowInputID string `json:"workflowInputId" bson:"workflowInputId"`
NodeID string `json:"nodeId" bson:"nodeId"`
TargetPortID string `json:"targetPortId" bson:"targetPortId"`
Payload ArtifactPayload `json:"payload" bson:"payload"`
}
type NodeInputBinding struct {
TargetPortID string `json:"targetPortId" bson:"targetPortId"`
WorkflowInputID string `json:"workflowInputId,omitempty" bson:"workflowInputId,omitempty"`
SourceNodeID string `json:"sourceNodeId,omitempty" bson:"sourceNodeId,omitempty"`
SourcePortID string `json:"sourcePortId,omitempty" bson:"sourcePortId,omitempty"`
Payload *ArtifactPayload `json:"payload,omitempty" bson:"payload,omitempty"`
Artifacts []ExecutionArtifact `json:"artifacts,omitempty" bson:"artifacts,omitempty"`
}
type HyperParam struct {
Key string `json:"key" bson:"key"`
Value string `json:"value" bson:"value"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Type string `json:"type,omitempty" bson:"type,omitempty"`
}
type NodeOverride struct {
Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"`
Image string `json:"image,omitempty" bson:"image,omitempty"`
ContainerCommand []string `json:"containerCommand,omitempty" bson:"containerCommand,omitempty"`
ContainerArgs []string `json:"containerArgs,omitempty" bson:"containerArgs,omitempty"`
Inputs map[string]ArtifactPayload `json:"inputs,omitempty" bson:"inputs,omitempty"`
}
type DebugExecutionTarget struct {
TargetNodeID string `json:"targetNodeId,omitempty" bson:"targetNodeId,omitempty"`
SingleNode bool `json:"singleNode,omitempty" bson:"singleNode,omitempty"`
}
type DebugTarget = DebugExecutionTarget
type WorkflowNodeData struct {
Label string `json:"label" bson:"label"`
Category string `json:"category" bson:"category"`
Description string `json:"description" bson:"description"`
Inputs []PortDefinition `json:"inputs" bson:"inputs"`
Outputs []PortDefinition `json:"outputs" bson:"outputs"`
OperatorID string `json:"operatorId,omitempty" bson:"operatorId,omitempty"`
OperatorVersion string `json:"operatorVersion,omitempty" bson:"operatorVersion,omitempty"`
OperatorImageID string `json:"operatorImageId,omitempty" bson:"operatorImageId,omitempty"`
Image string `json:"image,omitempty" bson:"image,omitempty"`
ContainerCommand []string `json:"containerCommand,omitempty" bson:"containerCommand,omitempty"`
ContainerArgs []string `json:"containerArgs,omitempty" bson:"containerArgs,omitempty"`
RuntimeContract map[string]any `json:"runtimeContract,omitempty" bson:"runtimeContract,omitempty"`
SkillDefinition string `json:"skillDefinition,omitempty" bson:"skillDefinition,omitempty"`
PublicationStatus OperatorPublicationStatus `json:"publicationStatus,omitempty" bson:"publicationStatus,omitempty"`
GenerationSource OperatorGenerationSource `json:"generationSource,omitempty" bson:"generationSource,omitempty"`
PublicationEvidence *OperatorPublicationEvidence `json:"publicationEvidence,omitempty" bson:"publicationEvidence,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"`
ConnectionID string `json:"connectionId,omitempty" bson:"connectionId,omitempty"`
Bucket string `json:"bucket,omitempty" bson:"bucket,omitempty"`
Prefix string `json:"prefix,omitempty" bson:"prefix,omitempty"`
Pattern string `json:"pattern,omitempty" bson:"pattern,omitempty"`
CPU string `json:"cpu,omitempty" bson:"cpu,omitempty"`
Memory string `json:"memory,omitempty" bson:"memory,omitempty"`
GPU string `json:"gpu,omitempty" bson:"gpu,omitempty"`
SharedMemorySize string `json:"sharedMemorySize,omitempty" bson:"sharedMemorySize,omitempty"`
BusinessStage DataMetricStage `json:"businessStage,omitempty" bson:"businessStage,omitempty"`
MetricBoundary bool `json:"metricBoundary,omitempty" bson:"metricBoundary,omitempty"`
}
type WorkflowNode struct {
ID string `json:"id" bson:"id"`
Type string `json:"type" bson:"type"`
Data WorkflowNodeData `json:"data" bson:"data"`
Position Position `json:"position" bson:"position"`
}
type WorkflowEdge struct {
ID string `json:"id" bson:"id"`
Source string `json:"source" bson:"source"`
SourceHandle string `json:"sourceHandle,omitempty" bson:"sourceHandle,omitempty"`
Target string `json:"target" bson:"target"`
TargetHandle string `json:"targetHandle,omitempty" bson:"targetHandle,omitempty"`
Animated bool `json:"animated,omitempty" bson:"animated,omitempty"`
}
type ProjectRecord struct {
DeletionTaskID string `json:"deletionTaskId,omitempty" bson:"deletionTaskId,omitempty"`
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
Scene string `json:"scene,omitempty" bson:"scene,omitempty"`
OwnerUserID string `json:"ownerUserId,omitempty" bson:"ownerUserId,omitempty"`
Customer string `json:"customer,omitempty" bson:"customer,omitempty"`
DataBatch string `json:"dataBatch,omitempty" bson:"dataBatch,omitempty"`
StorageConnectionID string `json:"storageConnectionId,omitempty" bson:"storageConnectionId,omitempty"`
StorageBucket string `json:"storageBucket,omitempty" bson:"storageBucket,omitempty"`
StoragePrefix string `json:"storagePrefix,omitempty" bson:"storagePrefix,omitempty"`
WorkflowInstanceID string `json:"workflowInstanceId,omitempty" bson:"workflowInstanceId,omitempty"`
AnnotationStandard string `json:"annotationStandard,omitempty" bson:"annotationStandard,omitempty"`
QualityPolicy map[string]any `json:"qualityPolicy,omitempty" bson:"qualityPolicy,omitempty"`
DeliveryConfig map[string]any `json:"deliveryConfig,omitempty" bson:"deliveryConfig,omitempty"`
ProgressStatus string `json:"progressStatus,omitempty" bson:"progressStatus,omitempty"`
QualityStatus string `json:"qualityStatus,omitempty" bson:"qualityStatus,omitempty"`
DeliveryStatus string `json:"deliveryStatus,omitempty" bson:"deliveryStatus,omitempty"`
Status ProjectStatus `json:"status" bson:"status"`
StoragePathFavorites []StoragePathFavoriteRecord `json:"storagePathFavorites,omitempty" bson:"storagePathFavorites,omitempty"`
WorkflowCount int `json:"workflowCount" bson:"-"`
WorkflowStatusCounts WorkflowStatusCounts `json:"workflowStatusCounts" bson:"-"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type WorkflowStatusCounts struct {
Listening int `json:"listening"`
Draft int `json:"draft"`
Running int `json:"running"`
Failed int `json:"failed"`
Cancelled int `json:"cancelled"`
Completed int `json:"completed"`
}
type OperatorResources struct {
CPURequest string `json:"cpuRequest,omitempty" bson:"cpuRequest,omitempty"`
CPULimit string `json:"cpuLimit,omitempty" bson:"cpuLimit,omitempty"`
MemoryRequest string `json:"memoryRequest,omitempty" bson:"memoryRequest,omitempty"`
MemoryLimit string `json:"memoryLimit,omitempty" bson:"memoryLimit,omitempty"`
GPUType string `json:"gpuType,omitempty" bson:"gpuType,omitempty"`
GPULimit string `json:"gpuLimit,omitempty" bson:"gpuLimit,omitempty"`
SharedMemorySize string `json:"sharedMemorySize,omitempty" bson:"sharedMemorySize,omitempty"`
}
type OperatorPublicationStatus string
const (
OperatorPublicationStatusDraft OperatorPublicationStatus = "draft"
OperatorPublicationStatusBuilt OperatorPublicationStatus = "built"
OperatorPublicationStatusVerified OperatorPublicationStatus = "verified"
OperatorPublicationStatusPublished OperatorPublicationStatus = "published"
)
type OperatorGenerationSource string
const (
OperatorGenerationSourceManual OperatorGenerationSource = "manual"
OperatorGenerationSourceAI OperatorGenerationSource = "ai"
)
type OperatorPublicationEvidence struct {
RepositoryURL string `json:"repositoryUrl,omitempty" bson:"repositoryUrl,omitempty"`
RepositoryCommit string `json:"repositoryCommit,omitempty" bson:"repositoryCommit,omitempty"`
Image string `json:"image,omitempty" bson:"image,omitempty"`
ImageID string `json:"imageId,omitempty" bson:"imageId,omitempty"`
FixtureChecksum string `json:"fixtureChecksum,omitempty" bson:"fixtureChecksum,omitempty"`
TestCommand string `json:"testCommand,omitempty" bson:"testCommand,omitempty"`
AcceptanceProjectID string `json:"acceptanceProjectId,omitempty" bson:"acceptanceProjectId,omitempty"`
AcceptanceWorkflowID string `json:"acceptanceWorkflowId,omitempty" bson:"acceptanceWorkflowId,omitempty"`
AcceptanceRunID string `json:"acceptanceRunId,omitempty" bson:"acceptanceRunId,omitempty"`
VerifiedAt string `json:"verifiedAt,omitempty" bson:"verifiedAt,omitempty"`
VerifiedBy string `json:"verifiedBy,omitempty" bson:"verifiedBy,omitempty"`
}
type OperatorRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Type string `json:"type" bson:"type"`
Category string `json:"category" bson:"category"`
Description string `json:"description" bson:"description"`
Inputs []PortDefinition `json:"inputs" bson:"inputs"`
Outputs []PortDefinition `json:"outputs" bson:"outputs"`
ConfigSchema map[string]any `json:"configSchema,omitempty" bson:"configSchema,omitempty"`
Version string `json:"version,omitempty" bson:"version,omitempty"`
Image string `json:"image,omitempty" bson:"image,omitempty"`
ImageID string `json:"imageId,omitempty" bson:"imageId,omitempty"`
ContainerCommand []string `json:"containerCommand,omitempty" bson:"containerCommand,omitempty"`
ContainerArgs []string `json:"containerArgs,omitempty" bson:"containerArgs,omitempty"`
RuntimeContract map[string]any `json:"runtimeContract,omitempty" bson:"runtimeContract,omitempty"`
SkillDefinition string `json:"skillDefinition,omitempty" bson:"skillDefinition,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"`
Resources *OperatorResources `json:"resources,omitempty" bson:"resources,omitempty"`
BusinessStage DataMetricStage `json:"businessStage,omitempty" bson:"businessStage,omitempty"`
PublicationStatus OperatorPublicationStatus `json:"publicationStatus,omitempty" bson:"publicationStatus,omitempty"`
GenerationSource OperatorGenerationSource `json:"generationSource,omitempty" bson:"generationSource,omitempty"`
PublicationEvidence *OperatorPublicationEvidence `json:"publicationEvidence,omitempty" bson:"publicationEvidence,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type BuiltinOperatorDeletionRecord struct {
Key string `json:"key" bson:"key"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
OperatorID string `json:"operatorId,omitempty" bson:"operatorId,omitempty"`
OperatorName string `json:"operatorName,omitempty" bson:"operatorName,omitempty"`
DeletedAt string `json:"deletedAt" bson:"deletedAt"`
}
type WorkflowSchedule struct {
Mode WorkflowScheduleMode `json:"mode,omitempty" bson:"mode,omitempty"`
Interval int `json:"interval" bson:"interval"`
IntervalHours int `json:"intervalHours,omitempty" bson:"intervalHours,omitempty"`
DayInterval int `json:"dayInterval,omitempty" bson:"dayInterval,omitempty"`
TimeOfDay string `json:"timeOfDay,omitempty" bson:"timeOfDay,omitempty"`
AnchorAt string `json:"anchorAt,omitempty" bson:"anchorAt,omitempty"`
Timezone string `json:"timezone,omitempty" bson:"timezone,omitempty"`
Cron string `json:"cron,omitempty" bson:"cron,omitempty"`
SourcePath string `json:"sourcePath,omitempty" bson:"sourcePath,omitempty"`
}
type WorkflowRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
ProjectID string `json:"projectId" bson:"projectId"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
Type WorkflowType `json:"type" bson:"type"`
Kind WorkflowKind `json:"kind,omitempty" bson:"kind,omitempty"`
Hidden bool `json:"hidden,omitempty" bson:"hidden"`
ExecutionScope WorkflowExecutionScope `json:"executionScope,omitempty" bson:"executionScope,omitempty"`
ScanConfig *ScanConfig `json:"scanConfig,omitempty" bson:"scanConfig,omitempty"`
CaptureAutomation *CaptureAutomationConfig `json:"captureAutomation,omitempty" bson:"captureAutomation,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"`
MaxConcurrentRuns int `json:"maxConcurrentRuns,omitempty" bson:"maxConcurrentRuns,omitempty"`
NodeTimeoutSeconds int `json:"nodeTimeoutSeconds,omitempty" bson:"nodeTimeoutSeconds,omitempty"`
RunTimeoutSeconds int `json:"runTimeoutSeconds,omitempty" bson:"runTimeoutSeconds,omitempty"`
MaxRetryAttempts int `json:"maxRetryAttempts,omitempty" bson:"maxRetryAttempts,omitempty"`
RetryBackoffSeconds int `json:"retryBackoffSeconds,omitempty" bson:"retryBackoffSeconds,omitempty"`
Schedule *WorkflowSchedule `json:"schedule,omitempty" bson:"schedule,omitempty"`
DefinitionState WorkflowDefinitionState `json:"definitionState" bson:"definitionState"`
DefinitionVersion int `json:"definitionVersion" bson:"definitionVersion"`
DefinitionFamilyID string `json:"definitionFamilyId" bson:"definitionFamilyId"`
SupersedesWorkflowID string `json:"supersedesWorkflowId,omitempty" bson:"supersedesWorkflowId,omitempty"`
WorkflowInputs []WorkflowInputDefinition `json:"workflowInputs,omitempty" bson:"workflowInputs,omitempty"`
ArtifactStorage *ArtifactStoragePolicy `json:"artifactStorage,omitempty" bson:"artifactStorage,omitempty"`
Nodes []WorkflowNode `json:"nodes" bson:"nodes"`
Edges []WorkflowEdge `json:"edges" bson:"edges"`
Status WorkflowStatus `json:"status" bson:"status"`
LastRunID string `json:"lastRunId,omitempty" bson:"lastRunId,omitempty"`
LastRunAt string `json:"lastRunAt,omitempty" bson:"lastRunAt,omitempty"`
ArchivedAt string `json:"archivedAt,omitempty" bson:"archivedAt,omitempty"`
ArchivedByUserID string `json:"archivedByUserId,omitempty" bson:"archivedByUserId,omitempty"`
ArchiveReason string `json:"archiveReason,omitempty" bson:"archiveReason,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
Capabilities []WorkflowCapability `json:"capabilities,omitempty" bson:"-"`
HumanWorkSummary *HumanWorkSummary `json:"humanWorkSummary,omitempty" bson:"-"`
}
type TemplateRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
Type WorkflowType `json:"type" bson:"type"`
Kind WorkflowKind `json:"kind,omitempty" bson:"kind,omitempty"`
ExecutionScope WorkflowExecutionScope `json:"executionScope,omitempty" bson:"executionScope,omitempty"`
ScanConfig *ScanConfig `json:"scanConfig,omitempty" bson:"scanConfig,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"`
MaxConcurrentRuns int `json:"maxConcurrentRuns,omitempty" bson:"maxConcurrentRuns,omitempty"`
NodeTimeoutSeconds int `json:"nodeTimeoutSeconds,omitempty" bson:"nodeTimeoutSeconds,omitempty"`
RunTimeoutSeconds int `json:"runTimeoutSeconds,omitempty" bson:"runTimeoutSeconds,omitempty"`
MaxRetryAttempts int `json:"maxRetryAttempts,omitempty" bson:"maxRetryAttempts,omitempty"`
RetryBackoffSeconds int `json:"retryBackoffSeconds,omitempty" bson:"retryBackoffSeconds,omitempty"`
Schedule *WorkflowSchedule `json:"schedule,omitempty" bson:"schedule,omitempty"`
DefinitionState WorkflowDefinitionState `json:"definitionState" bson:"definitionState"`
DefinitionVersion int `json:"definitionVersion" bson:"definitionVersion"`
DefinitionFamilyID string `json:"definitionFamilyId" bson:"definitionFamilyId"`
SupersedesTemplateID string `json:"supersedesTemplateId,omitempty" bson:"supersedesTemplateId,omitempty"`
WorkflowInputs []WorkflowInputDefinition `json:"workflowInputs,omitempty" bson:"workflowInputs,omitempty"`
ArtifactStorage *ArtifactStoragePolicy `json:"artifactStorage,omitempty" bson:"artifactStorage,omitempty"`
Nodes []WorkflowNode `json:"nodes" bson:"nodes"`
Edges []WorkflowEdge `json:"edges" bson:"edges"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type LogEntryRecord struct {
Timestamp string `json:"timestamp" bson:"timestamp"`
Level string `json:"level" bson:"level"`
Message string `json:"message" bson:"message"`
Operator string `json:"operator,omitempty" bson:"operator,omitempty"`
}
type ResourceSample struct {
Timestamp string `json:"timestamp" bson:"timestamp"`
CPU int `json:"cpu" bson:"cpu"`
Memory int `json:"memory" bson:"memory"`
GPU int `json:"gpu,omitempty" bson:"gpu,omitempty"`
GPUMemoryUsedMiB int `json:"gpuMemoryUsedMiB" bson:"gpuMemoryUsedMiB,omitempty"`
GPUMemoryTotalMiB int `json:"gpuMemoryTotalMiB,omitempty" bson:"gpuMemoryTotalMiB,omitempty"`
GPUName string `json:"gpuName,omitempty" bson:"gpuName,omitempty"`
GPUCount int `json:"gpuCount,omitempty" bson:"gpuCount,omitempty"`
}
type ArtifactMetadata struct {
Duration string `json:"duration,omitempty" bson:"duration,omitempty"`
Resolution string `json:"resolution,omitempty" bson:"resolution,omitempty"`
Codec string `json:"codec,omitempty" bson:"codec,omitempty"`
Thumbnail string `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`
SHA256 string `json:"sha256,omitempty" bson:"sha256,omitempty"`
MimeType string `json:"mimeType,omitempty" bson:"mimeType,omitempty"`
Temporary bool `json:"temporary,omitempty" bson:"temporary,omitempty"`
}
type ExecutionArtifact struct {
ID string `json:"id" bson:"id"`
RunID string `json:"runId" bson:"runId"`
NodeID string `json:"nodeId" bson:"nodeId"`
PortID string `json:"portId,omitempty" bson:"portId,omitempty"`
PortName string `json:"portName,omitempty" bson:"portName,omitempty"`
Name string `json:"name" bson:"name"`
Type PortType `json:"type" bson:"type"`
Size string `json:"size" bson:"size"`
SizeBytes int64 `json:"sizeBytes,omitempty" bson:"sizeBytes,omitempty"`
Path string `json:"path" bson:"path"`
Metadata *ArtifactMetadata `json:"metadata,omitempty" bson:"metadata,omitempty"`
Data map[string]any `json:"data,omitempty" bson:"data,omitempty"`
Payload *ArtifactPayload `json:"payload,omitempty" bson:"payload,omitempty"`
// TransferMode and Presentation are response-only projections. They keep the
// public UI contract free of storage locators while preserving the persisted
// payload for worker replay and authorized content delivery.
TransferMode ArtifactTransferMode `json:"transferMode,omitempty" bson:"-"`
Presentation string `json:"presentation,omitempty" bson:"-"`
Mode RunMode `json:"mode,omitempty" bson:"mode,omitempty"`
Temporary bool `json:"temporary,omitempty" bson:"temporary,omitempty"`
}
// UnmarshalJSON keeps the public artifact contract compatible with older
// runners that emitted size as a string while accepting newer runners that
// emit the exact byte count as a JSON number.
func (artifact *ExecutionArtifact) UnmarshalJSON(data []byte) error {
type plain ExecutionArtifact
var fields map[string]json.RawMessage
if err := json.Unmarshal(data, &fields); err != nil {
return err
}
sizeRaw := fields["size"]
delete(fields, "size")
withoutSize, err := json.Marshal(fields)
if err != nil {
return err
}
var parsed plain
if err := json.Unmarshal(withoutSize, &parsed); err != nil {
return err
}
*artifact = ExecutionArtifact(parsed)
if len(sizeRaw) == 0 || strings.TrimSpace(string(sizeRaw)) == "null" {
return nil
}
var sizeText string
if sizeRaw[0] == '"' {
if err := json.Unmarshal(sizeRaw, &sizeText); err != nil {
return fmt.Errorf("decode artifact size: %w", err)
}
artifact.Size = sizeText
if bytes, err := strconv.ParseInt(strings.TrimSpace(sizeText), 10, 64); err == nil && bytes >= 0 {
artifact.SizeBytes = bytes
}
return nil
}
var number json.Number
decoder := json.NewDecoder(strings.NewReader(string(sizeRaw)))
decoder.UseNumber()
if err := decoder.Decode(&number); err != nil {
return fmt.Errorf("decode artifact size: %w", err)
}
bytes, err := strconv.ParseInt(number.String(), 10, 64)
if err != nil || bytes < 0 {
return fmt.Errorf("artifact size must be a non-negative integer or string")
}
artifact.SizeBytes = bytes
artifact.Size = formatArtifactSize(bytes)
return nil
}
func formatArtifactSize(bytes int64) string {
if bytes < 1024 {
return strconv.FormatInt(bytes, 10) + " B"
}
value := float64(bytes)
units := []string{"KB", "MB", "GB", "TB"}
for _, unit := range units {
value /= 1024
if value < 1024 {
return strconv.FormatFloat(value, 'f', 1, 64) + " " + unit
}
}
return strconv.FormatFloat(value, 'f', 1, 64) + " PB"
}
type DataRefRecord struct {
ArtifactID string `json:"artifactId,omitempty" bson:"artifactId,omitempty"`
ArtifactName string `json:"artifactName,omitempty" bson:"artifactName,omitempty"`
PortID string `json:"portId,omitempty" bson:"portId,omitempty"`
Kind string `json:"kind,omitempty" bson:"kind,omitempty"`
DatasetType string `json:"datasetType,omitempty" bson:"datasetType,omitempty"`
ManifestPath string `json:"manifestPath,omitempty" bson:"manifestPath,omitempty"`
PayloadPath string `json:"payloadPath,omitempty" bson:"payloadPath,omitempty"`
PartitionDir string `json:"partitionDir,omitempty" bson:"partitionDir,omitempty"`
PartitionCount int `json:"partitionCount,omitempty" bson:"partitionCount,omitempty"`
ItemCount int `json:"itemCount,omitempty" bson:"itemCount,omitempty"`
DatasetID string `json:"datasetId,omitempty" bson:"datasetId,omitempty"`
DatasetVersionID string `json:"datasetVersionId,omitempty" bson:"datasetVersionId,omitempty"`
Split string `json:"split,omitempty" bson:"split,omitempty"`
Fingerprint string `json:"fingerprint,omitempty" bson:"fingerprint,omitempty"`
}
type NodeExecutionRecord struct {
NodeID string `json:"nodeId" bson:"nodeId"`
NodeLabel string `json:"nodeLabel" bson:"nodeLabel"`
OperatorID string `json:"operatorId,omitempty" bson:"operatorId,omitempty"`
OperatorVersion string `json:"operatorVersion,omitempty" bson:"operatorVersion,omitempty"`
OperatorImage string `json:"operatorImage,omitempty" bson:"operatorImage,omitempty"`
OperatorImageID string `json:"operatorImageId,omitempty" bson:"operatorImageId,omitempty"`
Attempt int `json:"attempt,omitempty" bson:"attempt,omitempty"`
Status NodeExecutionStatus `json:"status" bson:"status"`
StartedAt string `json:"startedAt,omitempty" bson:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty" bson:"endedAt,omitempty"`
StageManifestPath string `json:"stageManifestPath,omitempty" bson:"stageManifestPath,omitempty"`
InputArtifacts []ExecutionArtifact `json:"inputArtifacts,omitempty" bson:"inputArtifacts,omitempty"`
InputLineage []InputLineageRecord `json:"inputLineage,omitempty" bson:"inputLineage,omitempty"`
InputBindings []NodeInputBinding `json:"inputBindings,omitempty" bson:"inputBindings,omitempty"`
Logs []LogEntryRecord `json:"logs" bson:"logs"`
Artifacts []ExecutionArtifact `json:"artifacts" bson:"artifacts"`
DataRefs []DataRefRecord `json:"dataRefs,omitempty" bson:"dataRefs,omitempty"`
DataMetrics *DataMetricsRecord `json:"dataMetrics,omitempty" bson:"dataMetrics,omitempty"`
MetricsMaterializedAt string `json:"metricsMaterializedAt,omitempty" bson:"metricsMaterializedAt,omitempty"`
ResourceSeries []ResourceSample `json:"resourceSeries" bson:"resourceSeries"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
}
type InputLineageRecord struct {
WorkflowEdgeID string `json:"workflowEdgeId,omitempty" bson:"workflowEdgeId,omitempty"`
SourceNodeID string `json:"sourceNodeId,omitempty" bson:"sourceNodeId,omitempty"`
SourceHandle string `json:"sourceHandle,omitempty" bson:"sourceHandle,omitempty"`
TargetNodeID string `json:"targetNodeId" bson:"targetNodeId"`
TargetHandle string `json:"targetHandle,omitempty" bson:"targetHandle,omitempty"`
Artifact ExecutionArtifact `json:"artifact" bson:"artifact"`
}
type LineageNodeRecord struct {
NodeID string `json:"nodeId"`
NodeLabel string `json:"nodeLabel"`
OperatorID string `json:"operatorId,omitempty"`
OperatorVersion string `json:"operatorVersion,omitempty"`
OperatorImage string `json:"operatorImage,omitempty"`
OperatorImageID string `json:"operatorImageId,omitempty"`
Status NodeExecutionStatus `json:"status"`
StartedAt string `json:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty"`
StageManifestPath string `json:"stageManifestPath,omitempty"`
InputArtifacts []ExecutionArtifact `json:"inputArtifacts"`
OutputArtifacts []ExecutionArtifact `json:"outputArtifacts"`
DataRefs []DataRefRecord `json:"dataRefs,omitempty"`
}
type LineageEdgeRecord struct {
ID string `json:"id"`
WorkflowEdgeID string `json:"workflowEdgeId,omitempty"`
SourceNodeID string `json:"sourceNodeId,omitempty"`
SourceNodeLabel string `json:"sourceNodeLabel,omitempty"`
SourceHandle string `json:"sourceHandle,omitempty"`
SourceArtifactID string `json:"sourceArtifactId,omitempty"`
SourceArtifactName string `json:"sourceArtifactName,omitempty"`
SourcePortID string `json:"sourcePortId,omitempty"`
SourcePortName string `json:"sourcePortName,omitempty"`
TargetNodeID string `json:"targetNodeId"`
TargetNodeLabel string `json:"targetNodeLabel,omitempty"`
TargetHandle string `json:"targetHandle,omitempty"`
Relation string `json:"relation"`
}
type RunLineageRecord struct {
RunID string `json:"runId"`
WorkflowID string `json:"workflowId"`
WorkflowName string `json:"workflowName"`
ProjectID string `json:"projectId"`
ProjectName string `json:"projectName"`
Artifacts []ExecutionArtifact `json:"artifacts"`
Nodes []LineageNodeRecord `json:"nodes"`
Edges []LineageEdgeRecord `json:"edges"`
}
type ArtifactLineageRecord struct {
RunID string `json:"runId"`
WorkflowID string `json:"workflowId"`
WorkflowName string `json:"workflowName"`
ProjectID string `json:"projectId"`
ProjectName string `json:"projectName"`
ArtifactID string `json:"artifactId"`
ArtifactName string `json:"artifactName,omitempty"`
Artifact ExecutionArtifact `json:"artifact"`
Producer *LineageNodeRecord `json:"producer,omitempty"`
Consumers []LineageNodeRecord `json:"consumers"`
UpstreamEdges []LineageEdgeRecord `json:"upstreamEdges"`
DownstreamEdges []LineageEdgeRecord `json:"downstreamEdges"`
Nodes []LineageNodeRecord `json:"nodes"`
Edges []LineageEdgeRecord `json:"edges"`
}
type K8sRef struct {
NodeID string `json:"nodeId" bson:"nodeId"`
Attempt int `json:"attempt,omitempty" bson:"attempt,omitempty"`
JobName string `json:"jobName" bson:"jobName"`
Namespace string `json:"namespace" bson:"namespace"`
}
type LightweightOperatorCodeFileManifest struct {
Path string `json:"path" bson:"path"`
SizeBytes int64 `json:"sizeBytes" bson:"sizeBytes"`
Mode string `json:"mode" bson:"mode"`
ModTime string `json:"modTime" bson:"modTime"`
SHA256 string `json:"sha256" bson:"sha256"`
}
type LightweightOperatorCodeManifest struct {
NodeID string `json:"nodeId" bson:"nodeId"`
NodeLabel string `json:"nodeLabel,omitempty" bson:"nodeLabel,omitempty"`
CodeSubPath string `json:"codeSubPath" bson:"codeSubPath"`
MountPath string `json:"mountPath" bson:"mountPath"`
WorkspacePath string `json:"workspacePath" bson:"workspacePath"`
ReadOnly bool `json:"readOnly" bson:"readOnly"`
FileCount int `json:"fileCount" bson:"fileCount"`
TotalBytes int64 `json:"totalBytes" bson:"totalBytes"`
SHA256 string `json:"sha256" bson:"sha256"`
GeneratedAt string `json:"generatedAt" bson:"generatedAt"`
Files []LightweightOperatorCodeFileManifest `json:"files" bson:"files"`
ExcludedPaths []string `json:"excludedPaths,omitempty" bson:"excludedPaths,omitempty"`
}
type RunMetadata struct {
CaptureDeliveryPackage *CaptureDeliveryPackageRuntime `json:"captureDeliveryPackage,omitempty" bson:"captureDeliveryPackage,omitempty"`
LightweightOperatorCodeManifests map[string]LightweightOperatorCodeManifest `json:"lightweightOperatorCodeManifests,omitempty" bson:"lightweightOperatorCodeManifests,omitempty"`
TrainingInputs []TrainingInputRecord `json:"trainingInputs,omitempty" bson:"trainingInputs,omitempty"`
AnnotationTaskIDsByNode map[string][]string `json:"annotationTaskIdsByNode,omitempty" bson:"annotationTaskIdsByNode,omitempty"`
HumanReleasePartitionID string `json:"humanReleasePartitionId,omitempty" bson:"humanReleasePartitionId,omitempty"`
HumanReleaseUniqueKey string `json:"humanReleaseUniqueKey,omitempty" bson:"humanReleaseUniqueKey,omitempty"`
}
// A release child keeps its source workflow identity while freezing the newer
// package runtime. It never changes the source task or the stored workflow.
type CaptureDeliveryPackageRuntime struct {
SourceRunID string `json:"sourceRunId" bson:"sourceRunId"`
SourceWorkflowID string `json:"sourceWorkflowId" bson:"sourceWorkflowId"`
PolicyWorkflowID string `json:"policyWorkflowId" bson:"policyWorkflowId"`
PolicyVersion int `json:"policyVersion" bson:"policyVersion"`
Node WorkflowNode `json:"node" bson:"node"`
}
// RunFailure is the machine-readable counterpart to RunRecord.Error. Error is
// intentionally retained for backwards compatibility and human-readable logs.
type RunFailure struct {
Code string `json:"code" bson:"code"`
Stage string `json:"stage,omitempty" bson:"stage,omitempty"`
NodeID string `json:"nodeId,omitempty" bson:"nodeId,omitempty"`
Message string `json:"message" bson:"message"`
Retryable bool `json:"retryable" bson:"retryable"`
Suggestion string `json:"suggestion,omitempty" bson:"suggestion,omitempty"`
}
// RunProgress carries structured progress for long-running operators. It is
// optional so existing runners and persisted Run documents remain compatible.
type RunProgress struct {
NodeID string `json:"nodeId,omitempty" bson:"nodeId,omitempty"`
CurrentCaptureDirectories []string `json:"currentCaptureDirectories,omitempty" bson:"currentCaptureDirectories,omitempty"`
CurrentFile string `json:"currentFile,omitempty" bson:"currentFile,omitempty"`
Stage string `json:"stage,omitempty" bson:"stage,omitempty"`
Epoch int `json:"epoch,omitempty" bson:"epoch,omitempty"`
Step int `json:"step,omitempty" bson:"step,omitempty"`
MaxStep int `json:"maxStep,omitempty" bson:"maxStep,omitempty"`
SamplesPerSecond float64 `json:"samplesPerSecond,omitempty" bson:"samplesPerSecond,omitempty"`
EstimatedRemainingSeconds int64 `json:"estimatedRemainingSeconds,omitempty" bson:"estimatedRemainingSeconds,omitempty"`
Checkpoint string `json:"checkpoint,omitempty" bson:"checkpoint,omitempty"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
// RunRetryAttempt preserves the failed execution evidence before an explicit retry.
type RunRetryAttempt struct {
Attempt int `json:"attempt" bson:"attempt"`
RetriedAt string `json:"retriedAt" bson:"retriedAt"`
Status RunStatus `json:"status" bson:"status"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
NodeExecutions []NodeExecutionRecord `json:"nodeExecutions" bson:"nodeExecutions"`
K8sRefs []K8sRef `json:"k8sRefs" bson:"k8sRefs"`
}
type RunRecord struct {
// QueryExceptionCategory is a private read-replica fact, never client input/output.
QueryExceptionCategory string `json:"-" bson:"queryExceptionCategory,omitempty"`
RetryHistory []RunRetryAttempt `json:"-" bson:"retryHistory,omitempty"`
DeliveryOutcome string `json:"deliveryOutcome,omitempty" bson:"deliveryOutcome,omitempty"`
ProcessingProfile string `json:"processingProfile,omitempty" bson:"processingProfile,omitempty"`
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
WorkflowID string `json:"workflowId" bson:"workflowId"`
WorkflowName string `json:"workflowName" bson:"workflowName"`
ProjectID string `json:"projectId" bson:"projectId"`
ProjectName string `json:"projectName" bson:"projectName"`
CaptureDirectories []string `json:"captureDirectories,omitempty" bson:"captureDirectories,omitempty"`
TaskID string `json:"taskId,omitempty" bson:"taskId,omitempty"`
Trigger RunTrigger `json:"trigger" bson:"trigger"`
Attempt int `json:"attempt,omitempty" bson:"attempt,omitempty"`
DefinitionVersion int `json:"definitionVersion,omitempty" bson:"definitionVersion,omitempty"`
Mode RunMode `json:"mode,omitempty" bson:"mode,omitempty"`
ReleaseID string `json:"releaseId,omitempty" bson:"releaseId,omitempty"`
WorkflowVersion int `json:"workflowVersion,omitempty" bson:"workflowVersion,omitempty"`
GitCommitSha string `json:"gitCommitSha,omitempty" bson:"gitCommitSha,omitempty"`
ImageDigest string `json:"imageDigest,omitempty" bson:"imageDigest,omitempty"`
NodeOverrides map[string]NodeOverride `json:"nodeOverrides,omitempty" bson:"nodeOverrides,omitempty"`
DebugTarget *DebugExecutionTarget `json:"debugTarget,omitempty" bson:"debugTarget,omitempty"`
Inputs map[string]ArtifactPayload `json:"inputs,omitempty" bson:"inputs,omitempty"`
ResolvedInputBindings []ResolvedInputBinding `json:"resolvedInputBindings,omitempty" bson:"resolvedInputBindings,omitempty"`
ParentRunID string `json:"parentRunId,omitempty" bson:"parentRunId,omitempty"`
RestartFromNodeID string `json:"restartFromNodeId,omitempty" bson:"restartFromNodeId,omitempty"`
AvailableAt string `json:"availableAt,omitempty" bson:"availableAt,omitempty"`
ExecutionLeaseOwner string `json:"executionLeaseOwner,omitempty" bson:"executionLeaseOwner,omitempty"`
ExecutionLeaseExpiresAt string `json:"executionLeaseExpiresAt,omitempty" bson:"executionLeaseExpiresAt,omitempty"`
Status RunStatus `json:"status" bson:"status"`
StopMode RunStopMode `json:"stopMode,omitempty" bson:"stopMode,omitempty"`
StopRequestedAt string `json:"stopRequestedAt,omitempty" bson:"stopRequestedAt,omitempty"`
PreviousRunAt string `json:"previousRunAt,omitempty" bson:"previousRunAt,omitempty"`
CurrentRunAt string `json:"currentRunAt,omitempty" bson:"currentRunAt,omitempty"`
StartedAt string `json:"startedAt,omitempty" bson:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty" bson:"endedAt,omitempty"`
DurationMS int64 `json:"durationMs,omitempty" bson:"durationMs,omitempty"`
CurrentNodeID string `json:"currentNodeId,omitempty" bson:"currentNodeId,omitempty"`
NodeExecutions []NodeExecutionRecord `json:"nodeExecutions" bson:"nodeExecutions"`
Logs []LogEntryRecord `json:"logs" bson:"logs"`
ResourceSeries []ResourceSample `json:"resourceSeries" bson:"resourceSeries"`
Artifacts []ExecutionArtifact `json:"artifacts" bson:"artifacts"`
K8sRefs []K8sRef `json:"k8sRefs" bson:"k8sRefs"`
Metadata *RunMetadata `json:"metadata,omitempty" bson:"metadata,omitempty"`
Failure *RunFailure `json:"failure,omitempty" bson:"failure,omitempty"`
Progress *RunProgress `json:"progress,omitempty" bson:"progress,omitempty"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
// ArchivedAt marks a terminal run excluded from org-wide scans (e.g. the
// deletion-safety reference check) once it's old enough that its data no
// longer needs to participate in day-to-day queries. The record itself is
// untouched — archiving never deletes it; only deleting the run's own
// project does that.
ArchivedAt string `json:"archivedAt,omitempty" bson:"archivedAt,omitempty"`
}
type RunSummary struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
WorkflowID string `json:"workflowId" bson:"workflowId"`
WorkflowName string `json:"workflowName" bson:"workflowName"`
ProjectID string `json:"projectId" bson:"projectId"`
ProjectName string `json:"projectName" bson:"projectName"`
CaptureDirectories []string `json:"captureDirectories,omitempty" bson:"captureDirectories,omitempty"`
TaskID string `json:"taskId,omitempty" bson:"taskId,omitempty"`
Trigger RunTrigger `json:"trigger" bson:"trigger"`
Mode RunMode `json:"mode,omitempty" bson:"mode,omitempty"`
ReleaseID string `json:"releaseId,omitempty" bson:"releaseId,omitempty"`
WorkflowVersion int `json:"workflowVersion,omitempty" bson:"workflowVersion,omitempty"`
GitCommitSha string `json:"gitCommitSha,omitempty" bson:"gitCommitSha,omitempty"`
ImageDigest string `json:"imageDigest,omitempty" bson:"imageDigest,omitempty"`
Attempt int `json:"attempt,omitempty" bson:"attempt,omitempty"`
ParentRunID string `json:"parentRunId,omitempty" bson:"parentRunId,omitempty"`
RestartFromNodeID string `json:"restartFromNodeId,omitempty" bson:"restartFromNodeId,omitempty"`
AvailableAt string `json:"availableAt,omitempty" bson:"availableAt,omitempty"`
ExecutionLeaseOwner string `json:"executionLeaseOwner,omitempty" bson:"executionLeaseOwner,omitempty"`
ExecutionLeaseExpiresAt string `json:"executionLeaseExpiresAt,omitempty" bson:"executionLeaseExpiresAt,omitempty"`
Status RunStatus `json:"status" bson:"status"`
StopMode RunStopMode `json:"stopMode,omitempty" bson:"stopMode,omitempty"`
StopRequestedAt string `json:"stopRequestedAt,omitempty" bson:"stopRequestedAt,omitempty"`
StartedAt string `json:"startedAt,omitempty" bson:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty" bson:"endedAt,omitempty"`
DurationMS int64 `json:"durationMs,omitempty" bson:"durationMs,omitempty"`
CurrentNodeID string `json:"currentNodeId,omitempty" bson:"currentNodeId,omitempty"`
Failure *RunFailure `json:"failure,omitempty" bson:"failure,omitempty"`
Progress *RunProgress `json:"progress,omitempty" bson:"progress,omitempty"`
Error string `json:"error,omitempty" bson:"error,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type RunSummaryCursor struct {
CreatedAt string `json:"createdAt"`
ID string `json:"id"`
}
type RunSummaryQuery struct {
Limit int
Cursor *RunSummaryCursor
IncludeAggregates bool
AggregatesExplicit bool
Status RunStatus
Mode RunMode
Search string
ProjectID string
WorkflowID string
}
type RunSummaryPage struct {
Items []RunSummary
Total int64
StatusCounts map[RunStatus]int64
NextCursor *RunSummaryCursor
HasMore bool
}
type AuditTaskPayload struct {
Image string `json:"image" bson:"image"`
Confidence float64 `json:"confidence" bson:"confidence"`
DetectedObjects []string `json:"detectedObjects" bson:"detectedObjects"`
Reason string `json:"reason" bson:"reason"`
}
type AuditTaskRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
RunID string `json:"runId" bson:"runId"`
WorkflowID string `json:"workflowId" bson:"workflowId"`
ProjectID string `json:"projectId" bson:"projectId"`
NodeID string `json:"nodeId" bson:"nodeId"`
WorkflowName string `json:"workflowName" bson:"workflowName"`
ProjectName string `json:"projectName" bson:"projectName"`
OperatorName string `json:"operatorName" bson:"operatorName"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
Status AuditStatus `json:"status" bson:"status"`
Data AuditTaskPayload `json:"data" bson:"data"`
}
type UserRecord struct {
DeletionRequestedAt string `json:"-" bson:"deletionRequestedAt,omitempty"`
DeletionActorID string `json:"-" bson:"deletionActorId,omitempty"`
// Empty/legacy is grandfathered; every new account and role change is managed.
AcceptanceAccessMode string `json:"acceptanceAccessMode,omitempty" bson:"acceptanceAccessMode,omitempty"`
DeletedAt string `json:"deletedAt,omitempty" bson:"deletedAt,omitempty"`
DeletedBy string `json:"deletedBy,omitempty" bson:"deletedBy,omitempty"`
// Deprecated: retained for historical audit only; permissions use Role.
DefaultProjectRoles []AnnotationAssignmentRole `json:"defaultProjectRoles,omitempty" bson:"defaultProjectRoles"`
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
// LegacyEmail is read-only compatibility data for accounts created before
// the phone-only identity migration. It is never returned to clients or
// used for account management; it only keeps old accounts login-capable
// until their phone field is migrated.
LegacyEmail string `json:"-" bson:"email,omitempty"`
// Phone is the China mainland mobile number identifier used for login
// and account management. It is required for every account.
Phone string `json:"phone" bson:"phone"`
Role UserRole `json:"role" bson:"role"`
SupplierID string `json:"supplierId,omitempty" bson:"supplierId"`
IsSuperAdmin bool `json:"isSuperAdmin,omitempty" bson:"isSuperAdmin,omitempty"`
PasswordHash string `json:"passwordHash,omitempty" bson:"passwordHash,omitempty"`
Status UserStatus `json:"status,omitempty" bson:"status,omitempty"`
StoragePathFavorites []StoragePathFavoriteRecord `json:"storagePathFavorites,omitempty" bson:"storagePathFavorites,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type OrganizationRecord struct {
ID string `json:"id" bson:"id"`
Name string `json:"name" bson:"name"`
Slug string `json:"slug" bson:"slug"`
Status OrganizationStatus `json:"status" bson:"status"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type SessionRecord struct {
ID string `json:"id" bson:"id"`
UserID string `json:"userId" bson:"userId"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
TokenHash string `json:"tokenHash,omitempty" bson:"tokenHash"`
ExpiresAt string `json:"expiresAt" bson:"expiresAt"`
ExpiresAtTime time.Time `json:"-" bson:"expiresAtTime,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
LastSeenAt string `json:"lastSeenAt" bson:"lastSeenAt"`
}
type StoragePathFavoriteRecord struct {
ScopeKey string `json:"scopeKey" bson:"scopeKey"`
Bucket string `json:"bucket" bson:"bucket"`
Prefix string `json:"prefix,omitempty" bson:"prefix,omitempty"`
Label string `json:"label,omitempty" bson:"label,omitempty"`
}
type K8sSettings struct {
Endpoint string `json:"endpoint,omitempty" bson:"endpoint,omitempty"`
Namespace string `json:"namespace" bson:"namespace"`
WorkspacePVCName string `json:"workspacePVCName,omitempty" bson:"workspacePVCName,omitempty"`
WorkspaceMountPath string `json:"workspaceMountPath,omitempty" bson:"workspaceMountPath,omitempty"`
Kubeconfig string `json:"kubeconfig,omitempty" bson:"kubeconfig,omitempty"`
KubeconfigPreview string `json:"kubeconfigPreview,omitempty" bson:"-"`
HasKubeconfig bool `json:"hasKubeconfig,omitempty" bson:"-"`
}
type WorkerSettings struct {
PollIntervalMS int `json:"pollIntervalMs" bson:"pollIntervalMs"`
MaxConcurrentRuns int `json:"maxConcurrentRuns" bson:"maxConcurrentRuns"`
}
type StorageSettings struct {
Endpoint string `json:"endpoint" bson:"endpoint"`
Buckets []string `json:"buckets" bson:"buckets"`
}
type ArtifactStorageSettings struct {
ConnectionID string `json:"connectionId,omitempty" bson:"connectionId,omitempty"`
Bucket string `json:"bucket,omitempty" bson:"bucket,omitempty"`
PrefixTemplate string `json:"prefixTemplate,omitempty" bson:"prefixTemplate,omitempty"`
}
type AISettings struct {
Provider string `json:"provider" bson:"provider"`
BaseURL string `json:"baseURL" bson:"baseURL"`
Model string `json:"model" bson:"model"`
APIKey string `json:"apiKey,omitempty" bson:"apiKey,omitempty"`
APIKeyPreview string `json:"apiKeyPreview,omitempty" bson:"-"`
HasAPIKey bool `json:"hasAPIKey,omitempty" bson:"-"`
}
type OperatorGenerationSettings struct {
Enabled bool `json:"enabled" bson:"enabled"`
GiteaBaseURL string `json:"giteaBaseURL,omitempty" bson:"giteaBaseURL,omitempty"`
GiteaOrganization string `json:"giteaOrganization,omitempty" bson:"giteaOrganization,omitempty"`
GiteaToken string `json:"giteaToken,omitempty" bson:"giteaToken,omitempty"`
GiteaTokenPreview string `json:"giteaTokenPreview,omitempty" bson:"-"`
HasGiteaToken bool `json:"hasGiteaToken,omitempty" bson:"-"`
RepositoryMode string `json:"repositoryMode" bson:"repositoryMode"`
RepositoryPrefix string `json:"repositoryPrefix,omitempty" bson:"repositoryPrefix,omitempty"`
MonorepoName string `json:"monorepoName,omitempty" bson:"monorepoName,omitempty"`
DefaultBranch string `json:"defaultBranch,omitempty" bson:"defaultBranch,omitempty"`
ImageRegistry string `json:"imageRegistry,omitempty" bson:"imageRegistry,omitempty"`
BuildStrategy string `json:"buildStrategy" bson:"buildStrategy"`
KanikoNamespace string `json:"kanikoNamespace,omitempty" bson:"kanikoNamespace,omitempty"`
KanikoServiceAccount string `json:"kanikoServiceAccount,omitempty" bson:"kanikoServiceAccount,omitempty"`
RegistrySecretName string `json:"registrySecretName,omitempty" bson:"registrySecretName,omitempty"`
RequireHumanApproval bool `json:"requireHumanApproval" bson:"requireHumanApproval"`
}
type BusinessMongoSettings struct {
URI string `json:"uri,omitempty" bson:"uri,omitempty"`
Database string `json:"database,omitempty" bson:"database,omitempty"`
URIPreview string `json:"uriPreview,omitempty" bson:"-"`
HasURI bool `json:"hasUri,omitempty" bson:"-"`
}
type DefaultResources struct {
CPURequest string `json:"cpuRequest" bson:"cpuRequest"`
CPULimit string `json:"cpuLimit" bson:"cpuLimit"`
MemoryRequest string `json:"memoryRequest" bson:"memoryRequest"`
MemoryLimit string `json:"memoryLimit" bson:"memoryLimit"`
GPULimit string `json:"gpuLimit,omitempty" bson:"gpuLimit,omitempty"`
}
type ExternalBusinessWriteScope struct {
ConnectionID string `json:"connectionId" bson:"connectionId"`
Collections []string `json:"collections" bson:"collections"`
}
type ExternalBusinessWriteTokenRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Enabled bool `json:"enabled" bson:"enabled"`
TokenValue string `json:"tokenValue,omitempty" bson:"tokenValue,omitempty"`
TokenHash string `json:"tokenHash,omitempty" bson:"tokenHash,omitempty"`
TokenPreview string `json:"tokenPreview,omitempty" bson:"tokenPreview,omitempty"`
Scopes []ExternalBusinessWriteScope `json:"scopes,omitempty" bson:"scopes,omitempty"`
LastUsedAt string `json:"lastUsedAt,omitempty" bson:"lastUsedAt,omitempty"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type ExternalBusinessWriteSettings struct {
Tokens []ExternalBusinessWriteTokenRecord `json:"tokens,omitempty" bson:"tokens,omitempty"`
}
type SettingsRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
K8s K8sSettings `json:"k8s" bson:"k8s"`
Worker WorkerSettings `json:"worker" bson:"worker"`
Storage StorageSettings `json:"storage" bson:"storage"`
ArtifactStorage ArtifactStorageSettings `json:"artifactStorage,omitempty" bson:"artifactStorage,omitempty"`
AI AISettings `json:"ai" bson:"ai"`
OperatorGeneration OperatorGenerationSettings `json:"operatorGeneration" bson:"operatorGeneration"`
BusinessMongo BusinessMongoSettings `json:"businessMongo" bson:"businessMongo"`
ExternalBusinessWrite ExternalBusinessWriteSettings `json:"externalBusinessWrite,omitempty" bson:"externalBusinessWrite,omitempty"`
Defaults DefaultResources `json:"defaults" bson:"defaults"`
Timezone string `json:"timezone" bson:"timezone"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type SettingsView struct {
ID string `json:"id"`
K8s K8sSettings `json:"k8s"`
Worker WorkerSettings `json:"worker"`
ArtifactStorage ArtifactStorageSettings `json:"artifactStorage,omitempty"`
AI AISettings `json:"ai"`
OperatorGeneration OperatorGenerationSettings `json:"operatorGeneration"`
BusinessMongo BusinessMongoSettings `json:"businessMongo"`
Defaults DefaultResources `json:"defaults"`
Timezone string `json:"timezone"`
UpdatedAt string `json:"updatedAt"`
}
type DashboardSummary struct {
AudienceScope string `json:"audienceScope"`
Workforce DashboardWorkforceSummary `json:"workforce"`
Projects struct {
Active int `json:"active"`
Archived int `json:"archived"`
} `json:"projects"`
Operators struct {
Total int `json:"total"`
Builtin int `json:"builtin"`
Custom int `json:"custom"`
Historical int `json:"historical"`
} `json:"operators"`
Jobs struct {
Today int `json:"today"`
SuccessRate float64 `json:"successRate"`
Running int `json:"running"`
Failed int `json:"failed"`
AverageDurationMS int64 `json:"averageDurationMs"`
} `json:"jobs"`
Audits struct {
Pending int `json:"pending"`
} `json:"audits"`
Data struct {
CaptureDurationSeconds int64 `json:"captureDurationSeconds"`
VideoCount int `json:"videoCount"`
PackageCount int `json:"packageCount"`
} `json:"data"`
Tasks struct {
Running int `json:"running"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Waiting int `json:"waiting"`
PendingAnnotation int `json:"pendingAnnotation"`
InAnnotation int `json:"inAnnotation"`
PendingQuality int `json:"pendingQuality"`
PendingAcceptance int `json:"pendingAcceptance"`
Rejected int `json:"rejected"`
Escalated int `json:"escalated"`
QualityPassRate float64 `json:"qualityPassRate"`
} `json:"tasks"`
Trends []DashboardTrendPoint `json:"trends"`
POC DashboardPOCReadiness `json:"poc"`
}
type DashboardWorkforceMetric struct {
WorkforceStatistics
SupplierName string `json:"supplierName,omitempty"`
Role string `json:"role,omitempty"`
Date string `json:"date,omitempty"`
TemplateVersion int `json:"templateVersion,omitempty"`
AssignedCount int64 `json:"assignedCount"`
UserID string `json:"userId,omitempty"`
UserName string `json:"userName,omitempty"`
SupplierID string `json:"supplierId,omitempty"`
OutputCount int64 `json:"outputCount"`
SubmittedCount int64 `json:"submittedCount"`
ReworkCount int64 `json:"reworkCount"`
DurationSeconds int64 `json:"durationSeconds"`
QualityApproved int64 `json:"qualityApproved"`
QualityRejected int64 `json:"qualityRejected"`
AcceptanceApproved int64 `json:"acceptanceApproved"`
AcceptanceRejected int64 `json:"acceptanceRejected"`
QualityPassRate *float64 `json:"qualityPassRate"`
AcceptancePassRate *float64 `json:"acceptancePassRate"`
ReworkRate *float64 `json:"reworkRate"`
}
type DashboardWorkforceSummary struct {
AsOf string `json:"asOf,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Totals DashboardWorkforceMetric `json:"totals"`
Items []DashboardWorkforceMetric `json:"items"`
}
type DashboardTrendPoint struct {
Date string `json:"date"`
RunCount int `json:"runCount"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
NewData int `json:"newData"`
}
type DashboardGate struct {
Status string `json:"status"`
Label string `json:"label"`
Message string `json:"message"`
Evidence map[string]any `json:"evidence,omitempty"`
}
type DashboardPOCReadiness struct {
Status string `json:"status"`
Label string `json:"label"`
Message string `json:"message"`
LatestAcceptanceRunID string `json:"latestAcceptanceRunId,omitempty"`
LatestAcceptanceUpdatedAt string `json:"latestAcceptanceUpdatedAt,omitempty"`
LatestAcceptanceStatus string `json:"latestAcceptanceStatus,omitempty"`
AcceptanceScope string `json:"acceptanceScope,omitempty"`
FullExternalAcceptance bool `json:"fullExternalAcceptance"`
PreflightFailure bool `json:"preflightFailure"`
PreflightStages []string `json:"preflightStages"`
RequiredExternals []string `json:"requiredExternals"`
ExternalVerificationPassed []string `json:"externalVerificationPassed"`
ExternalVerificationMissing []string `json:"externalVerificationMissing"`
MissingCoverage []string `json:"missingCoverage"`
BlockingMissingCoverage []string `json:"blockingMissingCoverage"`
OperatorRepositoryCount int `json:"operatorRepositoryCount"`
OperatorRepositoryRequiredCount int `json:"operatorRepositoryRequiredCount"`
OperatorRepositoryCoverageComplete bool `json:"operatorRepositoryCoverageComplete"`
OperatorRepositoryPolicyClean bool `json:"operatorRepositoryPolicyClean"`
RealFixtureCount int `json:"realFixtureCount"`
GeneratedFixtureCount int `json:"generatedFixtureCount"`
AllFixturesReal bool `json:"allFixturesReal"`
SourceCommit string `json:"sourceCommit,omitempty"`
CatalogHash string `json:"catalogHash,omitempty"`
CatalogCount int `json:"catalogCount,omitempty"`
CompletedAt string `json:"completedAt,omitempty"`
Freshness string `json:"freshness"`
StaleReason string `json:"staleReason,omitempty"`
CurrentSourceCommit string `json:"currentSourceCommit,omitempty"`
CurrentCatalogHash string `json:"currentCatalogHash,omitempty"`
CurrentCatalogCount int `json:"currentCatalogCount,omitempty"`
ServiceAvailability DashboardGate `json:"serviceAvailability"`
GPUCapacity DashboardGate `json:"gpuCapacity"`
BusinessAcceptance DashboardGate `json:"businessAcceptance"`
OperatorCoverage DashboardGate `json:"operatorCoverage"`
GPU DashboardGate `json:"gpu"`
GPUWorkflowPreflight DashboardGate `json:"gpuWorkflowPreflight"`
DCloud DashboardGate `json:"dcloud"`
StrictAcceptance DashboardGate `json:"strictAcceptance"`
NextActions []string `json:"nextActions"`
}
type StorageConnectionRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
Provider StorageProvider `json:"provider" bson:"provider"`
Endpoint string `json:"endpoint,omitempty" bson:"endpoint,omitempty"`
Bucket string `json:"bucket,omitempty" bson:"bucket,omitempty"`
AccessKeyID string `json:"accessKeyId,omitempty" bson:"accessKeyId,omitempty"`
SecretAccessKey string `json:"secretAccessKey,omitempty" bson:"secretAccessKey,omitempty"`
AccessKeyPreview string `json:"accessKeyPreview,omitempty" bson:"-"`
SecretAccessKeyPreview string `json:"secretAccessKeyPreview,omitempty" bson:"-"`
HasAccessKeyID bool `json:"hasAccessKeyId,omitempty" bson:"-"`
HasSecretAccessKey bool `json:"hasSecretAccessKey,omitempty" bson:"-"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type MongoConnectionRecord struct {
ID string `json:"id" bson:"id"`
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
Name string `json:"name" bson:"name"`
Description string `json:"description,omitempty" bson:"description,omitempty"`
URI string `json:"uri,omitempty" bson:"uri,omitempty"`
Database string `json:"database,omitempty" bson:"database,omitempty"`
URIPreview string `json:"uriPreview,omitempty" bson:"-"`
HasURI bool `json:"hasUri,omitempty" bson:"-"`
CreatedAt string `json:"createdAt" bson:"createdAt"`
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
}
type CreateProjectInput struct {
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Scene string `json:"scene,omitempty"`
OwnerUserID string `json:"ownerUserId,omitempty"`
Customer string `json:"customer,omitempty"`
DataBatch string `json:"dataBatch,omitempty"`
StorageConnectionID string `json:"storageConnectionId,omitempty"`
StorageBucket string `json:"storageBucket,omitempty"`
StoragePrefix string `json:"storagePrefix,omitempty"`
AnnotationStandard string `json:"annotationStandard,omitempty"`
QualityPolicy map[string]any `json:"qualityPolicy,omitempty"`
DeliveryConfig map[string]any `json:"deliveryConfig,omitempty"`
}
type CreateStorageConnectionInput struct {
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Provider StorageProvider `json:"provider"`
Endpoint string `json:"endpoint,omitempty"`
Bucket string `json:"bucket,omitempty"`
AccessKeyID string `json:"accessKeyId,omitempty"`
SecretAccessKey string `json:"secretAccessKey,omitempty"`
}
type CreateMongoConnectionInput struct {
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
URI string `json:"uri,omitempty"`
Database string `json:"database,omitempty"`
}
type CreateWorkflowInput struct {
OrganizationID string `json:"organizationId,omitempty"`
ProjectID string `json:"projectId"`
Name string `json:"name"`
Description string `json:"description"`
Type WorkflowType `json:"type"`
Kind WorkflowKind `json:"kind,omitempty"`
Hidden bool `json:"hidden,omitempty"`
ExecutionScope WorkflowExecutionScope `json:"executionScope,omitempty"`
ScanConfig *ScanConfig `json:"scanConfig,omitempty"`
CaptureAutomation *CaptureAutomationConfig `json:"captureAutomation,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty"`
MaxConcurrentRuns int `json:"maxConcurrentRuns,omitempty"`
NodeTimeoutSeconds int `json:"nodeTimeoutSeconds,omitempty"`
RunTimeoutSeconds int `json:"runTimeoutSeconds,omitempty"`
MaxRetryAttempts int `json:"maxRetryAttempts,omitempty"`
RetryBackoffSeconds int `json:"retryBackoffSeconds,omitempty"`
Nodes []WorkflowNode `json:"nodes"`
Edges []WorkflowEdge `json:"edges"`
Schedule *WorkflowSchedule `json:"schedule,omitempty"`
WorkflowInputs []WorkflowInputDefinition `json:"workflowInputs,omitempty"`
ArtifactStorage *ArtifactStoragePolicy `json:"artifactStorage,omitempty"`
}
type CreateTemplateInput struct {
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Type WorkflowType `json:"type"`
Kind WorkflowKind `json:"kind,omitempty"`
ExecutionScope WorkflowExecutionScope `json:"executionScope,omitempty"`
ScanConfig *ScanConfig `json:"scanConfig,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty"`
MaxConcurrentRuns int `json:"maxConcurrentRuns,omitempty"`
NodeTimeoutSeconds int `json:"nodeTimeoutSeconds,omitempty"`
RunTimeoutSeconds int `json:"runTimeoutSeconds,omitempty"`
MaxRetryAttempts int `json:"maxRetryAttempts,omitempty"`
RetryBackoffSeconds int `json:"retryBackoffSeconds,omitempty"`
Schedule *WorkflowSchedule `json:"schedule,omitempty"`
Nodes []WorkflowNode `json:"nodes"`
Edges []WorkflowEdge `json:"edges"`
WorkflowInputs []WorkflowInputDefinition `json:"workflowInputs,omitempty"`
ArtifactStorage *ArtifactStoragePolicy `json:"artifactStorage,omitempty"`
}
type CreateOperatorInput struct {
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Category string `json:"category"`
Description string `json:"description"`
Inputs []PortDefinition `json:"inputs"`
Outputs []PortDefinition `json:"outputs"`
ConfigSchema map[string]any `json:"configSchema,omitempty"`
Version string `json:"version,omitempty"`
Image string `json:"image,omitempty"`
ImageID string `json:"imageId,omitempty"`
ContainerCommand []string `json:"containerCommand,omitempty"`
ContainerArgs []string `json:"containerArgs,omitempty"`
RuntimeContract map[string]any `json:"runtimeContract,omitempty"`
SkillDefinition string `json:"skillDefinition,omitempty"`
Hyperparams []HyperParam `json:"hyperparams,omitempty"`
Resources *OperatorResources `json:"resources,omitempty"`
BusinessStage DataMetricStage `json:"businessStage,omitempty"`
PublicationStatus OperatorPublicationStatus `json:"publicationStatus,omitempty"`
GenerationSource OperatorGenerationSource `json:"generationSource,omitempty"`
PublicationEvidence *OperatorPublicationEvidence `json:"publicationEvidence,omitempty"`
}
type CreateUserInput struct {
DefaultProjectRoles []AnnotationAssignmentRole `json:"defaultProjectRoles,omitempty"`
OrganizationID string `json:"organizationId,omitempty"`
Name string `json:"name"`
Phone string `json:"phone"`
Role UserRole `json:"role"`
SupplierID string `json:"supplierId,omitempty"`
Password string `json:"password,omitempty"`
PasswordHash string `json:"passwordHash,omitempty"`
IsSuperAdmin bool `json:"isSuperAdmin,omitempty"`
Status UserStatus `json:"status,omitempty"`
}