forked from longtao.wu/droboticflow
1093 lines
58 KiB
Go
1093 lines
58 KiB
Go
package domain
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
type UserRole string
|
|
|
|
const (
|
|
UserRoleAdmin UserRole = "admin"
|
|
UserRolePipelineEngineer UserRole = "pipeline_engineer"
|
|
UserRoleDataOperator UserRole = "data_operator"
|
|
UserRoleQAReviewer UserRole = "qa_reviewer"
|
|
UserRoleComplianceAuditor UserRole = "compliance_auditor"
|
|
UserRoleAuditor UserRole = "auditor"
|
|
UserRoleOperator UserRole = "operator"
|
|
)
|
|
|
|
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"
|
|
)
|
|
|
|
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"
|
|
)
|
|
|
|
type RunTrigger string
|
|
|
|
const (
|
|
RunTriggerManual RunTrigger = "manual"
|
|
RunTriggerScheduled RunTrigger = "scheduled"
|
|
RunTriggerRetry RunTrigger = "retry"
|
|
RunTriggerRerunSubtree RunTrigger = "rerun_subtree"
|
|
)
|
|
|
|
type RunStatus string
|
|
|
|
const (
|
|
RunStatusQueued RunStatus = "queued"
|
|
RunStatusRunning RunStatus = "running"
|
|
RunStatusStopping RunStatus = "stopping"
|
|
RunStatusWaitingForAudit RunStatus = "waiting_for_audit"
|
|
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"
|
|
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"`
|
|
Description string `json:"description,omitempty" bson:"description,omitempty"`
|
|
Transmission string `json:"transmission,omitempty" bson:"transmission,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 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"`
|
|
}
|
|
|
|
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 {
|
|
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"`
|
|
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 {
|
|
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"`
|
|
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"`
|
|
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"`
|
|
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"`
|
|
CreatedAt string `json:"createdAt" bson:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt" bson:"updatedAt"`
|
|
}
|
|
|
|
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"`
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
// 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"`
|
|
}
|
|
|
|
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"`
|
|
Logs []LogEntryRecord `json:"logs" bson:"logs"`
|
|
Artifacts []ExecutionArtifact `json:"artifacts" bson:"artifacts"`
|
|
DataRefs []DataRefRecord `json:"dataRefs,omitempty" bson:"dataRefs,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"`
|
|
}
|
|
|
|
type RunMetadata struct {
|
|
LightweightOperatorCodeManifests map[string]LightweightOperatorCodeManifest `json:"lightweightOperatorCodeManifests,omitempty" bson:"lightweightOperatorCodeManifests,omitempty"`
|
|
}
|
|
|
|
// 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 {
|
|
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"`
|
|
}
|
|
|
|
type RunRecord 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"`
|
|
Trigger RunTrigger `json:"trigger" bson:"trigger"`
|
|
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"`
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
Trigger RunTrigger `json:"trigger" bson:"trigger"`
|
|
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
|
|
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 {
|
|
ID string `json:"id" bson:"id"`
|
|
OrganizationID string `json:"organizationId,omitempty" bson:"organizationId,omitempty"`
|
|
Name string `json:"name" bson:"name"`
|
|
Email string `json:"email" bson:"email"`
|
|
Role UserRole `json:"role" bson:"role"`
|
|
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 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"`
|
|
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"`
|
|
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 {
|
|
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"`
|
|
POC DashboardPOCReadiness `json:"poc"`
|
|
}
|
|
|
|
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"`
|
|
}
|
|
|
|
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"`
|
|
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"`
|
|
Nodes []WorkflowNode `json:"nodes"`
|
|
Edges []WorkflowEdge `json:"edges"`
|
|
Schedule *WorkflowSchedule `json:"schedule,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"`
|
|
}
|
|
|
|
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"`
|
|
PublicationStatus OperatorPublicationStatus `json:"publicationStatus,omitempty"`
|
|
GenerationSource OperatorGenerationSource `json:"generationSource,omitempty"`
|
|
PublicationEvidence *OperatorPublicationEvidence `json:"publicationEvidence,omitempty"`
|
|
}
|
|
|
|
type CreateUserInput struct {
|
|
OrganizationID string `json:"organizationId,omitempty"`
|
|
Name string `json:"name"`
|
|
Email string `json:"email"`
|
|
Role UserRole `json:"role"`
|
|
Password string `json:"password,omitempty"`
|
|
PasswordHash string `json:"passwordHash,omitempty"`
|
|
IsSuperAdmin bool `json:"isSuperAdmin,omitempty"`
|
|
Status UserStatus `json:"status,omitempty"`
|
|
}
|