droboticflow/src/types.ts
d-robotics 63512da71f
Some checks failed
web-ci / checks (push) Waiting to run
web-ci / checks (pull_request) Has been cancelled
🐛 Preserve confirmed annotation frames and enforce v4 time evidence
2026-10-22 12:54:08 +08:00

2350 lines
56 KiB
TypeScript

import type { ReviewProblem } from "./services/api/review-draft";
import type { Edge, Node } from "reactflow";
export type UserRole = "admin" | "supplier_manager" | "annotator" | "quality_reviewer" | "acceptance_reviewer";
export interface User {
deletedAt?: string;
deletedBy?: string;
defaultProjectRoles?: ProjectMemberRole[];
id: string;
organizationId?: string;
name: string;
/** China mainland mobile number (^1[3-9]\d{9}$); the account's login and
* account-management identifier. */
phone: string;
role: UserRole;
supplierId?: string;
isSuperAdmin?: boolean;
status?: "active" | "disabled";
createdAt?: string;
updatedAt?: string;
}
export interface Organization {
id: string;
name: string;
slug: string;
status: "active" | "disabled";
createdAt?: string;
updatedAt?: string;
}
export interface StoragePathFavorite {
scopeKey: string;
bucket: string;
prefix?: string;
label?: string;
}
export interface DatabaseCollectionSummary {
name: string;
documentCount: number;
sampleFields?: string[];
}
export interface DatabaseIndexSummary {
name: string;
keys: Record<string, any>;
unique?: boolean;
}
export interface DatabaseOverview {
connectionId?: string;
connectionName?: string;
target?: "platform" | "business";
provider: string;
database: string;
readOnly: boolean;
configured?: boolean;
collections: DatabaseCollectionSummary[];
}
export interface DatabaseQueryResult {
connectionId?: string;
connectionName?: string;
target?: "platform" | "business";
provider: string;
database: string;
collection: string;
configured?: boolean;
filter?: Record<string, any>;
limit: number;
skip: number;
total: number;
sampleFields?: string[];
documents: Record<string, any>[];
}
export interface DatabaseCollectionMutationResult {
collection: string;
summary: DatabaseCollectionSummary;
}
export interface DatabaseCollectionDeleteResult {
collection: string;
deleted: boolean;
}
export interface DatabaseIndexesResult {
collection: string;
indexes: DatabaseIndexSummary[];
}
export interface DatabaseIndexMutationResult {
collection: string;
index: DatabaseIndexSummary;
}
export interface DatabaseIndexDeleteResult {
collection: string;
indexName: string;
deleted: boolean;
}
export interface DatabaseDocumentMutationResult {
collection: string;
document: Record<string, any>;
}
export interface DatabaseDocumentDeleteResult {
collection: string;
documentId: string;
deleted: boolean;
}
export interface ExternalBusinessWriteScope {
connectionId: string;
collections: string[];
}
export interface ExternalBusinessWriteToken {
id: string;
name: string;
description?: string;
enabled: boolean;
tokenPreview?: string;
scopes: ExternalBusinessWriteScope[];
lastUsedAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface ExternalBusinessWriteTokensResult {
items: ExternalBusinessWriteToken[];
}
export interface ExternalBusinessWriteTokenMutationResult {
token: ExternalBusinessWriteToken;
apiKey?: string;
}
export interface ObjectStorageBucketSummary {
name: string;
objectCount?: number;
totalBytes?: number;
createdAt?: string;
lastModified?: string;
}
export interface ObjectStorageObjectSummary {
bucket: string;
key: string;
name: string;
kind: "directory" | "file" | "json" | "image" | "video" | "audio";
sizeBytes?: number;
contentType?: string;
etag?: string;
lastModified?: string;
storageClass?: string;
metadata?: Record<string, any>;
}
export interface ObjectStorageOverview {
connectionId?: string;
connectionName?: string;
provider: string;
endpoint?: string;
bucket?: string;
configured: boolean;
buckets: ObjectStorageBucketSummary[];
}
export interface ObjectStorageBrowseResult {
connectionId?: string;
connectionName?: string;
provider: string;
endpoint?: string;
configured: boolean;
bucket: string;
prefix?: string;
items: ObjectStorageObjectSummary[];
nextMarker?: string;
hasMore?: boolean;
limit?: number;
}
export interface ObjectStorageBucketMutationResult {
bucket: ObjectStorageBucketSummary;
}
export interface ObjectStorageBucketDeleteResult {
bucket: string;
deleted: boolean;
}
export interface ObjectStorageObjectMutationResult {
object: ObjectStorageObjectSummary;
objects?: ObjectStorageObjectSummary[];
}
export interface ObjectStorageObjectDeleteResult {
bucket: string;
key: string;
deleted: boolean;
originalKey?: string;
trashKey?: string;
}
export interface Project {
deletionTaskId?: string;
id: string;
name: string;
description: string;
scene?: string;
ownerUserId?: string;
customer?: string;
dataBatch?: string;
storageConnectionId?: string;
storageBucket?: string;
storagePrefix?: string;
workflowInstanceId?: string;
annotationStandard?: string;
qualityPolicy?: Record<string, unknown>;
deliveryConfig?: Record<string, unknown>;
progressStatus?: string;
qualityStatus?: string;
deliveryStatus?: string;
status?: "active" | "archived";
workflowCount?: number;
workflowStatusCounts?: {
listening?: number;
draft?: number;
running?: number;
failed?: number;
cancelled?: number;
completed?: number;
};
createdAt: string;
updatedAt?: string;
}
export type PortType = "json" | "image" | "video" | "tensor" | "file";
export type PortTransmission = "bus" | "oss" | "shm" | "stream";
export type PortContainer = "single" | "collection" | "directory" | "dataset";
export interface PortDefinition {
id: string;
name: string;
type: PortType;
container?: PortContainer;
payloadMode?: ArtifactTransferMode;
role?: string;
required?: boolean;
description?: string;
transmission?: PortTransmission; // Data transfer strategy
}
export type WorkflowDefinitionState = "draft" | "released";
export type ArtifactTransferMode = "inline" | "ref";
export interface ArtifactReference {
provider: "BOS";
connectionId: string;
bucket: string;
key?: string;
prefix?: string;
manifestKey?: string;
versionId?: string;
etag?: string;
sizeBytes?: number;
sha256?: string;
mimeType?: string;
kind: "object" | "directory";
}
export interface ArtifactPayload {
mode: ArtifactTransferMode;
type: PortType;
inline?: unknown;
ref?: ArtifactReference;
}
export interface WorkflowInputTarget {
nodeId: string;
targetPortId: string;
}
export interface WorkflowInputDefinition {
id: string;
name: string;
description?: string;
type: PortType;
container?: PortContainer;
payloadMode?: ArtifactTransferMode;
role?: string;
required: boolean;
defaultPayload?: ArtifactPayload;
bindings: WorkflowInputTarget[];
}
export interface ArtifactStoragePolicy {
connectionId: string;
bucket: string;
prefixTemplate?: string;
}
export interface ResolvedInputBinding {
workflowInputId: string;
nodeId: string;
targetPortId: string;
payload: ArtifactPayload;
}
export interface NodeInputBinding {
targetPortId: string;
workflowInputId?: string;
sourceNodeId?: string;
sourcePortId?: string;
payload?: ArtifactPayload;
artifacts?: ExecutionData[];
}
export interface Operator {
id: string;
name: string;
type: "builtin" | "custom" | "lightweight";
category: string;
description: string;
inputs: PortDefinition[];
outputs: PortDefinition[];
configSchema?: Record<string, unknown>;
version?: string; // Operator business/runtime version
image?: string; // Docker image for custom operators
imageId?: string; // Digest-pinned image reference when available
containerCommand?: string[]; // Optional Kubernetes container command override
containerArgs?: string[]; // Optional Kubernetes container args override
runtimeContract?: Record<string, unknown>; // Runtime artifact, parameter, and acceptance contract
skillDefinition?: string; // AI-readable description for workflow generation
publicationStatus?: OperatorPublicationStatus;
generationSource?: OperatorGenerationSource;
publicationEvidence?: OperatorPublicationEvidence;
hyperparams?: HyperParam[]; // K8s Job environment variables
resources?: {
cpuRequest?: string;
cpuLimit?: string;
memoryRequest?: string;
memoryLimit?: string;
gpuType?: string;
gpuLimit?: string;
sharedMemorySize?: string;
};
businessStage?: DataMetricStage;
}
export interface HyperParam {
key: string;
value: string;
description?: string;
type?: "string" | "number" | "boolean";
}
export type RunMode = "production" | "debug";
export interface NodeOverride {
hyperparams?: HyperParam[];
image?: string;
containerCommand?: string[];
containerArgs?: string[];
inputs?: Record<string, ArtifactPayload>;
}
export interface DebugExecutionTarget {
targetNodeId?: string;
singleNode?: boolean;
}
export type DebugTarget = DebugExecutionTarget;
export interface WorkflowReleaseRunRequest {
trigger?: "manual" | "scheduled" | "retry";
inputs?: Record<string, ArtifactPayload>;
}
export interface WorkflowDebugRunRequest {
trigger?: "manual" | "scheduled" | "retry";
mode?: "debug";
environment?: "dev" | "poc";
inputs?: Record<string, ArtifactPayload>;
nodeOverrides?: Record<string, NodeOverride>;
debugTarget?: DebugExecutionTarget;
}
export type WorkflowStatus = "draft" | "ready" | "running" | "completed" | "failed" | "cancelled";
export type WorkflowType = "batch" | "streaming";
export type WorkflowKind = "standard" | "scan";
export type WorkflowExecutionScope = "production" | "sandbox";
export type OperatorPublicationStatus = "draft" | "built" | "verified" | "published";
export type OperatorGenerationSource = "manual" | "ai";
export interface OperatorPublicationEvidence {
repositoryUrl?: string;
repositoryCommit?: string;
image?: string;
imageId?: string;
fixtureChecksum?: string;
testCommand?: string;
acceptanceProjectId?: string;
acceptanceWorkflowId?: string;
acceptanceRunId?: string;
verifiedAt?: string;
verifiedBy?: string;
}
export interface WorkflowSchedule {
interval: number; // in seconds
mode?: "interval_seconds" | "every_hours" | "every_days_at_time";
intervalHours?: number;
dayInterval?: number;
timeOfDay?: string;
anchorAt?: string;
timezone?: string;
cron?: string;
sourcePath?: string; // OSS path to watch
}
export interface Workflow {
id: string;
projectId: string;
name: string;
description: string;
type: WorkflowType;
kind?: WorkflowKind;
hidden?: boolean;
executionScope?: WorkflowExecutionScope;
scanConfig?: ScanConfig;
captureAutomation?: CaptureAutomationConfig;
hyperparams?: HyperParam[];
maxConcurrentRuns?: number;
nodeTimeoutSeconds?: number;
runTimeoutSeconds?: number;
maxRetryAttempts?: number;
retryBackoffSeconds?: number;
schedule?: WorkflowSchedule;
definitionState?: WorkflowDefinitionState;
definitionVersion?: number;
definitionFamilyId?: string;
supersedesWorkflowId?: string;
workflowInputs?: WorkflowInputDefinition[];
artifactStorage?: ArtifactStoragePolicy;
nodes: Node[];
edges: Edge[];
status: WorkflowStatus;
lastRun?: string;
lastRunId?: string;
lastRunAt?: string;
archivedAt?: string;
archivedByUserId?: string;
archiveReason?: string;
createdAt?: string;
updatedAt?: string;
capabilities?: WorkflowCapability[];
humanWorkSummary?: HumanWorkSummary;
}
export interface WorkflowDeletionPreview {
workflowId: string;
workflowName: string;
runCount: number;
blockingRunCount: number;
waitingHumanRunCount: number;
humanTaskCount: number;
pendingAnnotationCount: number;
pendingQualityCount: number;
pendingAcceptanceCount: number;
claimedHumanTaskCount: number;
legacyAnnotationTaskCount: number;
deliveryPackageCount: number;
captureRecordCount: number;
generatedArtifactCount: number;
generatedArtifactBytes: number;
projectMembershipCount: number;
rawCapturesRetained: boolean;
projectMembersRetained: boolean;
generatedStorageCleanup: boolean;
}
export interface WorkflowDeletionReceipt {
deleted: boolean;
workflowId: string;
workflowName: string;
reason: string;
deletedAt: string;
preview: WorkflowDeletionPreview;
}
export interface WorkflowCapability {
id: "human_annotation" | "human_quality_review" | "human_acceptance" | string;
pluginId: string;
label: string;
path: string;
pendingCount?: number;
}
export interface HumanWorkSummary {
pendingAnnotation: number;
pendingQuality: number;
pendingAcceptance: number;
rework: number;
escalated: number;
}
export interface PluginManifest {
id: string;
name: string;
version: string;
requiredCoreVersion: string;
system?: boolean;
routes?: Array<{ id: string; path: string; label: string; requiredRoles?: string[] }>;
navigation?: Array<{
id: string;
path: string;
label: string;
icon?: string;
order?: number;
groupId?: string;
groupLabel?: string;
groupIcon?: string;
requiredRoles?: string[];
}>;
workflowCapabilities?: string[];
operatorIds?: string[];
permissions?: string[];
configSchema?: Record<string, any>;
viewers?: Array<{ id: string; previewKinds: string[]; optional: boolean }>;
}
export interface PluginStatus {
manifest: PluginManifest;
enabled: boolean;
config?: Record<string, any>;
}
export interface SourceStateRecord {
id: string;
workflowId: string;
nodeId: string;
sourceFingerprint: string;
dataSource?: string;
sourcePath?: string;
bucket?: string;
prefix?: string;
pattern?: string;
scanMode?: string;
incrementalUnit?: string;
directoryDepth?: number;
seenFingerprints?: string[];
lastRunId?: string;
lastListedCount?: number;
lastNewCount?: number;
lastScanStartedAt?: string;
lastScanCompletedAt?: string;
updatedAt: string;
}
export interface WorkflowNodeSourceState {
nodeId: string;
supported: boolean;
stateful: boolean;
reason?: string;
scanMode?: string;
dataSource?: string;
sourcePath?: string;
bucket?: string;
prefix?: string;
pattern?: string;
incrementalUnit?: string;
directoryDepth?: number;
currentFingerprint?: string;
current?: SourceStateRecord | null;
versions?: SourceStateRecord[];
}
export interface WorkflowTemplate {
id: string;
name: string;
description: string;
type: WorkflowType;
kind?: WorkflowKind;
executionScope?: WorkflowExecutionScope;
scanConfig?: ScanConfig;
hyperparams?: HyperParam[];
maxConcurrentRuns?: number;
nodeTimeoutSeconds?: number;
runTimeoutSeconds?: number;
maxRetryAttempts?: number;
retryBackoffSeconds?: number;
schedule?: WorkflowSchedule;
workflowInputs?: WorkflowInputDefinition[];
artifactStorage?: ArtifactStoragePolicy;
definitionState?: WorkflowDefinitionState;
definitionVersion?: number;
definitionFamilyId?: string;
supersedesTemplateId?: string;
nodes: Node[];
edges: Edge[];
createdAt: string;
updatedAt?: string;
}
export interface WorkflowRelease extends Omit<WorkflowTemplate, "id" | "createdAt" | "updatedAt"> {
id: string;
organizationId: string;
templateId: string;
version: number;
capabilities?: string[];
requiredPluginIds?: string[];
usesPublicSupplierPool?: boolean;
contentDigest: string;
releaseNotes?: string;
publishedByUserId: string;
publishedAt: string;
createdAt: string;
}
export interface ProjectWorkflowInstance {
id: string;
organizationId: string;
projectId: string;
releaseId: string;
releaseVersion: number;
sourceTemplateId: string;
workflowId: string;
supplierId?: string;
status: "active" | "superseded";
supersedesInstanceId?: string;
createdByUserId: string;
createdAt: string;
updatedAt: string;
}
export interface SystemConfig {
id?: string;
k8s: {
endpoint?: string;
namespace: string;
workspacePVCName?: string;
workspaceMountPath?: string;
kubeconfig?: string;
kubeconfigPreview?: string;
hasKubeconfig?: boolean;
};
worker: {
pollIntervalMs: number;
maxConcurrentRuns: number;
};
artifactStorage?: {
connectionId?: string;
bucket?: string;
prefixTemplate?: string;
};
ai: {
provider: string;
baseURL: string;
model: string;
apiKey?: string;
apiKeyPreview?: string;
hasAPIKey?: boolean;
};
operatorGeneration: {
enabled: boolean;
giteaBaseURL?: string;
giteaOrganization?: string;
giteaToken?: string;
giteaTokenPreview?: string;
hasGiteaToken?: boolean;
repositoryMode: "per_operator_repo" | "monorepo";
repositoryPrefix?: string;
monorepoName?: string;
defaultBranch?: string;
imageRegistry?: string;
buildStrategy: "kaniko";
kanikoNamespace?: string;
kanikoServiceAccount?: string;
registrySecretName?: string;
requireHumanApproval: boolean;
};
businessMongo?: {
uri?: string;
database?: string;
uriPreview?: string;
hasUri?: boolean;
};
defaults: {
cpuRequest: string;
cpuLimit: string;
memoryRequest: string;
memoryLimit: string;
gpuLimit?: string;
};
timezone: string;
updatedAt?: string;
}
export interface GPUCapacityNode {
name: string;
allocatable: number;
selectorMatched: boolean;
unschedulable: boolean;
}
export interface GPUCapacity {
resourceName: string;
nodeSelector?: Record<string, string>;
selectorSummary: string;
nodes: GPUCapacityNode[];
totalAllocatable: number;
schedulableAllocatable: number;
maxAllocatable: number;
schedulableNodeCount: number;
available: boolean;
checkedAt: string;
}
export interface WorkerCapacity {
gpu: GPUCapacity;
}
export interface DashboardGate {
status: "passed" | "blocked" | "unknown" | string;
label: string;
message: string;
evidence?: Record<string, any>;
}
export interface DashboardPOCReadiness {
status: "passed" | "blocked" | "unknown" | string;
label: string;
message: string;
latestAcceptanceRunId?: string;
latestAcceptanceUpdatedAt?: string;
latestAcceptanceStatus?: string;
sourceCommit?: string;
catalogHash?: string;
catalogCount?: number;
completedAt?: string;
freshness?: "fresh" | "stale" | "unknown" | string;
staleReason?: string;
currentSourceCommit?: string;
currentCatalogHash?: string;
currentCatalogCount?: number;
acceptanceScope?: string;
fullExternalAcceptance: boolean;
preflightFailure: boolean;
preflightStages: string[];
requiredExternals: string[];
externalVerificationPassed: string[];
externalVerificationMissing: string[];
missingCoverage: string[];
blockingMissingCoverage: string[];
operatorRepositoryCount: number;
operatorRepositoryRequiredCount: number;
operatorRepositoryCoverageComplete: boolean;
operatorRepositoryPolicyClean: boolean;
realFixtureCount: number;
generatedFixtureCount: number;
allFixturesReal: boolean;
gpu: DashboardGate;
gpuWorkflowPreflight: DashboardGate;
dcloud: DashboardGate;
strictAcceptance: DashboardGate;
serviceAvailability?: DashboardGate;
gpuCapacity?: DashboardGate;
businessAcceptance?: DashboardGate;
operatorCoverage?: DashboardGate;
nextActions: string[];
}
export interface DashboardSummary {
audienceScope: "platform" | "vendor" | "self";
workforce?: {
from?: string;
to?: string;
totals: DashboardWorkforceMetric;
items: DashboardWorkforceMetric[];
};
projects: {
active: number;
archived: number;
};
operators: {
total: number;
builtin: number;
custom: number;
historical: number;
};
jobs: {
today: number;
successRate: number;
running: number;
failed: number;
averageDurationMs: number;
};
audits: {
pending: number;
};
data: { captureDurationSeconds: number; videoCount: number; packageCount: number };
tasks: {
running: number;
succeeded: number;
failed: number;
waiting: number;
pendingAnnotation: number;
inAnnotation: number;
pendingQuality: number;
pendingAcceptance: number;
rejected: number;
escalated: number;
qualityPassRate: number;
};
trends: Array<{ date: string; runCount: number; succeeded: number; failed: number; newData: number }>;
poc: DashboardPOCReadiness;
}
export interface WorkforceReturnMetrics {
decisionCount: number;
taskCount: number;
problemCount: number;
sliceCount: number;
videoSeconds: number;
unlocatedCount: number;
unknownDetailCount: number;
}
export interface WorkforceStatistics {
firstSubmittedTasks?: number;
submissionCount?: number;
reworkSubmissionCount?: number;
unknownSubmissionCount?: number;
firstVideoSeconds?: number;
reworkVideoSeconds?: number;
unknownVideoCount?: number;
qualityReturns?: WorkforceReturnMetrics;
acceptanceReturns?: WorkforceReturnMetrics;
}
export interface WorkforceReturnDetail {
id: string;
userId: string;
supplierId: string;
taskId: string;
taskIds: string[];
stage: "quality" | "acceptance";
round: number;
createdAt: string;
metrics: WorkforceReturnMetrics;
problems: ReviewProblem[];
comment?: string;
attributionUnknown?: boolean;
}
export interface DashboardWorkforceMetric extends WorkforceStatistics {
supplierName?: string;
role?: string;
date?: string;
templateVersion?: number;
userId?: string;
userName?: string;
supplierId?: string;
outputCount: number;
submittedCount: number;
reworkCount: number;
durationSeconds: number;
qualityApproved: number;
qualityRejected: number;
acceptanceApproved: number;
acceptanceRejected: number;
qualityPassRate: number | null;
acceptancePassRate: number | null;
reworkRate: number | null;
}
export interface LogEntry {
timestamp: string;
level: "INFO" | "WARN" | "ERROR" | "DEBUG";
message: string;
operator?: string;
}
export interface ResourceUsage {
timestamp: string;
cpu: number;
memory: number;
gpu?: number;
gpuMemoryUsedMiB?: number;
gpuMemoryTotalMiB?: number;
gpuName?: string;
gpuCount?: number;
}
export interface ExecutionData {
id: string;
runId: string;
nodeId: string;
portId?: string;
portName?: string;
name: string;
type: PortType;
size: string;
sizeBytes?: number;
path: string;
metadata?: {
duration?: string;
resolution?: string;
codec?: string;
thumbnail?: string;
mimeType?: string;
sha256?: string;
};
data?: Record<string, any> & {
reportSummary?: ArtifactReportSummary;
};
payload?: ArtifactPayload;
transferMode?: "inline" | "ref";
presentation?: "value" | "collection" | "reference" | string;
}
// A manifest member is a read-only projection of a manifest artifact. It is
// deliberately not an ExecutionData record: members do not become top-level
// lineage artifacts and their source paths/connection credentials stay server-side.
export interface RunArtifactManifestMember {
id: string;
name: string;
kind: "video" | "image" | "audio" | "text" | "file" | string;
group?: string;
mimeType?: string;
sizeBytes?: number;
contentAvailable: boolean;
details?: Record<string, string | number | boolean | string[]>;
}
export interface RunArtifactManifestMembersResponse {
runId: string;
artifactId: string;
schemaVersion?: string;
recognized: boolean;
message?: string;
summary: {
manifestName?: string;
contentCount?: number;
contentAvailableCount?: number;
memberLimitReached?: boolean;
groups?: Array<{ name: string; count: number }>;
transferMode?: "inline" | "ref";
presentation?: "value" | "collection" | "reference" | string;
schemaHash?: string;
versionId?: string;
};
items: RunArtifactManifestMember[];
total: number;
limit: number;
offset: number;
truncated: boolean;
}
export interface ArtifactReportIssueHit {
code: string;
label?: string;
count: number;
}
export interface ArtifactReportSummary {
schemaVersion: number;
kind: "quality";
title?: string;
unit?: "trajectory" | "episode" | "file" | "item" | string;
totalCount: number;
successCount: number;
failureCount: number;
runtimeErrorCount?: number;
successRate?: number;
issueHits?: ArtifactReportIssueHit[];
}
export interface LightweightOperatorCodeFileManifest {
path: string;
sizeBytes: number;
mode: string;
modTime: string;
sha256: string;
}
export interface LightweightOperatorCodeManifest {
nodeId: string;
nodeLabel?: string;
codeSubPath: string;
mountPath: string;
workspacePath: string;
readOnly: boolean;
fileCount: number;
totalBytes: number;
sha256: string;
generatedAt: string;
files: LightweightOperatorCodeFileManifest[];
}
export interface ExecutionRunMetadata {
lightweightOperatorCodeManifests?: Record<string, LightweightOperatorCodeManifest>;
trainingInputs?: TrainingInput[];
annotationTaskIdsByNode?: Record<string, string[]>;
}
export interface ScanConfig {
dataSource?: string;
sourcePath?: string;
connectionId?: string;
bucket?: string;
prefix?: string;
endpoint?: string;
accessKeyId?: string;
secretAccessKey?: string;
accessKeyPreview?: string;
secretAccessKeyPreview?: string;
hasAccessKeyId?: boolean;
hasSecretAccessKey?: boolean;
scanMode?: string;
incrementalUnit?: string;
directoryDepth?: number;
pattern?: string;
enabled: boolean;
notifications?: {
onSuccess: boolean;
onFailure: boolean;
channel?: string;
target?: string;
};
}
export interface CaptureAutomationConfig {
deliveryPrefix?: string;
deliveryProjectDirectory?: string;
enabled: boolean;
hasStarted?: boolean;
connectionId: string;
bucket: string;
prefix: string;
schema?: string;
completionMode?: "manifest_and_files" | "required_files";
manifestName?: string;
workflowInputId?: string;
pollIntervalSeconds?: number;
stabilityWindowSeconds?: number;
requiredPatterns?: string[];
maxRetryAttempts?: number;
retryBackoffSeconds?: number;
}
export interface WorkflowRuntimePolicyRevision {
previousAcceptanceSampleProbability?: number;
updatedByUserName?: string;
revision: number;
maxConcurrentCaptureRuns: number;
acceptanceSampleProbability: number;
updatedByUserId: string;
updatedAt: string;
}
export interface WorkflowRuntimePolicy extends WorkflowRuntimePolicyRevision {
id: string;
organizationId: string;
projectId: string;
workflowId: string;
}
export type CaptureBusinessStage =
| "incomplete"
| "stabilizing"
| "ready"
| "queued"
| "automatic_processing"
| "waiting_annotation"
| "waiting_quality"
| "sampling"
| "waiting_acceptance"
| "packaging"
| "delivered"
| "no_deliverables"
| "failed"
| "cancelled"
| "discarded";
export interface CaptureSamplingDecision {
decision: "selected" | "not_selected";
probability: number;
policyRevision: number;
randomValue: number;
decidedAt: string;
decidedByUserId: string;
sourceHumanBatchId: string;
}
export type CaptureRecordStatus =
| "incomplete"
| "stabilizing"
| "ready"
| "launching"
| "requeueing"
| "queued"
| "running"
| "waiting_for_human"
| "completed"
| "failed"
| "cancelled"
| "discarded";
export type CaptureActionType =
| "reprocess_requested"
| "reprocess_queued"
| "reprocess_failed"
| "cancelled"
| "discarded"
| "restored";
export interface CaptureActionRecord {
id: string;
action: CaptureActionType;
fromStatus: CaptureRecordStatus;
toStatus: CaptureRecordStatus;
actorUserId: string;
reason: string;
runId?: string;
attempt?: number;
maxAttempts?: number;
nextRetryAt?: string;
parentRunId?: string;
createdAt: string;
}
export interface CaptureRecord {
delivery?: { connectionId: string; bucket: string; prefix: string };
id: string;
projectId: string;
workflowId: string;
connectionId: string;
bucket: string;
prefix: string;
captureId: string;
manifestKey?: string;
fingerprint?: string;
status: CaptureRecordStatus;
missingTypes?: string[];
stabilityChecks?: number;
stabilityObservedAt?: string;
fileCount: number;
totalBytes: number;
runId?: string;
attempt?: number;
maxAttempts?: number;
nextRetryAt?: string;
parentRunId?: string;
failedNodeId?: string;
businessStage?: CaptureBusinessStage;
contractRevision?: string;
runtimePolicyRevision?: number;
samplingDecision?: CaptureSamplingDecision;
error?: string;
statusBeforeDiscard?: CaptureRecordStatus;
actions?: CaptureActionRecord[];
discoveredAt: string;
readyAt?: string;
startedAt?: string;
completedAt?: string;
updatedAt: string;
}
export interface CaptureRecordCounts {
total: number;
incomplete: number;
ready: number;
queued: number;
running: number;
waitingForHuman: number;
completed: number;
failed: number;
cancelled: number;
discarded: number;
waitingAnnotation: number;
waitingQuality: number;
sampling: number;
waitingAcceptance: number;
packaging: number;
delivered: number;
noDeliverables?: number;
}
export interface CaptureAutomationResponse {
config?: CaptureAutomationConfig;
counts: CaptureRecordCounts;
records: CaptureRecord[];
}
export interface StorageConnection {
id: string;
name: string;
description?: string;
provider: "BOS" | "OSS";
endpoint?: string;
bucket?: string;
accessKeyId?: string;
secretAccessKey?: string;
accessKeyPreview?: string;
secretAccessKeyPreview?: string;
hasAccessKeyId?: boolean;
hasSecretAccessKey?: boolean;
createdAt?: string;
updatedAt?: string;
}
export interface MongoConnection {
id: string;
name: string;
description?: string;
uri?: string;
database?: string;
uriPreview?: string;
hasUri?: boolean;
createdAt?: string;
updatedAt?: string;
}
export interface MongoConnectionTestResult extends DatabaseOverview {}
export interface SourceCollection {
runId: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
collectionId: string;
collectionName?: string;
path: string;
relativePath: string;
meta: Record<string, any>;
hasIntrinsics: boolean;
hasVideoMeta: boolean;
requiredFiles: string[];
missingRequiredFiles: string[];
videoCount: number;
fileCount: number;
totalBytes: number;
valid: boolean;
createdAt: string;
storage: AssetStorageLocation;
}
export interface AssetStorageLocation {
provider?: string;
endpoint?: string;
bucket?: string;
prefix?: string;
path?: string;
}
export interface SourceCollectionEntry {
path: string;
name: string;
kind: "directory" | "video" | "json" | "file";
collectionName?: string;
sizeBytes?: number;
codec?: string;
resolution?: string;
frameRate?: number;
duration?: number;
metadata?: Record<string, any>;
artifact?: ExecutionData;
derivedFromIndex?: boolean;
}
export interface SourceCollectionDetail {
collection: SourceCollection;
prefix?: string;
entries: SourceCollectionEntry[];
}
export interface PackageRecord {
runId: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
packageName: string;
clipId: string;
sourceVideo: string;
clipDuration: number;
fileCount: number;
pipelineTags: string[];
storagePath: string;
quality?: Record<string, any>;
annotation?: Record<string, any>;
createdAt: string;
previewArtifact?: ExecutionData;
storage: AssetStorageLocation;
}
export interface PackageDetail {
package: PackageRecord;
files: ExecutionData[];
}
export type SamplingTaskStatus = "pending" | "completed";
export type SamplingItemStatus = "pending" | "completed";
export interface SamplingRuleSummary {
id: string;
field: string;
operator: string;
value?: any;
samplePercent: number;
matchedCount: number;
sampledCount: number;
}
export interface SamplingReview {
videoQuality: string;
annotationAccuracy: string;
annotationCompleteness: string;
overallGrade: string;
notes?: string;
reviewedAt: string;
}
export interface SamplingItem {
id: string;
taskId: string;
packageName: string;
clipId: string;
sourceVideo: string;
sampleRuleId: string;
storagePath?: string;
quality?: Record<string, any>;
annotation?: Record<string, any>;
previewArtifact?: ExecutionData;
status: SamplingItemStatus;
review?: SamplingReview;
}
export interface SamplingTask {
id: string;
runId: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
name: string;
description: string;
status: SamplingTaskStatus;
rules: SamplingRuleSummary[];
items: SamplingItem[];
createdAt: string;
updatedAt: string;
}
export type NodeExecutionStatus =
| "queued"
| "running"
| "cancelled"
| "waiting_for_audit"
| "waiting_for_human"
| "completed"
| "failed";
export interface NodeExecution {
nodeId: string;
nodeLabel: string;
operatorId?: string;
operatorVersion?: string;
operatorImage?: string;
operatorImageId?: string;
attempt?: number;
status: NodeExecutionStatus;
startedAt?: string;
endedAt?: string;
stageManifestPath?: string;
inputArtifacts?: ExecutionData[];
inputLineage?: InputLineage[];
inputBindings?: NodeInputBinding[];
logs: LogEntry[];
artifacts: ExecutionData[];
dataRefs?: DataRef[];
dataMetrics?: DataMetrics;
metricsMaterializedAt?: string;
resourceSeries: ResourceUsage[];
error?: string;
}
export interface K8sRef {
nodeId: string;
attempt?: number;
jobName: string;
namespace: string;
}
export interface DataRef {
artifactId?: string;
artifactName?: string;
portId?: string;
kind?: string;
datasetType?: string;
manifestPath?: string;
payloadPath?: string;
partitionDir?: string;
partitionCount?: number;
itemCount?: number;
datasetId?: string;
datasetVersionId?: string;
split?: string;
fingerprint?: string;
}
export type DataMetricStage = "collect" | "process" | "clean" | "validate" | "annotate" | "audit" | "train";
export type DataMetricQuality = "exact" | "derived" | "estimated";
export type CollectionTaskStatus = "draft" | "active" | "paused" | "completed" | "cancelled";
export type CollectionTaskMode = "collection_only" | "full_training";
export interface DataVolume {
trajectoryCount?: number;
durationSeconds?: number;
bytes?: number;
fileCount?: number;
}
export interface DatasetMetricRef {
datasetId?: string;
datasetVersionId?: string;
name?: string;
split?: string;
fingerprint?: string;
kind?: string;
datasetType?: string;
manifestPath?: string;
payloadPath?: string;
partitionDir?: string;
partitionCount?: number;
itemCount?: number;
}
export interface TrainingInput {
datasetId?: string;
datasetVersionId?: string;
name?: string;
split?: string;
volume?: DataVolume;
manifestPath?: string;
partitionDir?: string;
external?: boolean;
quality?: DataMetricQuality;
}
export interface DataMetrics {
schemaVersion: number;
stage: DataMetricStage;
input?: DataVolume;
output?: DataVolume;
rejected?: DataVolume;
technicalValid?: DataVolume;
trainReady?: DataVolume;
datasetRefs?: DatasetMetricRef[];
trainingInputs?: TrainingInput[];
rejectionReasons?: Record<string, number>;
quality?: DataMetricQuality;
occurredAt?: string;
}
export interface CollectionTaskRequirements {
requireTechnicalValidation: boolean;
requireQuality: boolean;
requireAnnotation: boolean;
requireAudit: boolean;
}
export interface CollectionTask {
id: string;
organizationId?: string;
projectId: string;
projectName?: string;
name: string;
description?: string;
robotModel: string;
robotVersion?: string;
scene: string;
modalities: string[];
format?: string;
mode: CollectionTaskMode;
status: CollectionTaskStatus;
workflowId?: string;
workflowName?: string;
stageBindings?: Partial<Record<DataMetricStage, string>>;
targets: DataVolume;
requirements: CollectionTaskRequirements;
splitRules?: Partial<Record<"train" | "val" | "test", number>>;
lastRunId?: string;
createdAt?: string;
updatedAt?: string;
}
export type CollectionTaskInput = Omit<
CollectionTask,
"id" | "organizationId" | "projectName" | "workflowName" | "lastRunId" | "createdAt" | "updatedAt"
>;
export interface DatasetVersion {
id: string;
datasetId: string;
taskId?: string;
projectId?: string;
name: string;
split?: string;
fingerprint: string;
volume?: DataVolume;
storage?: AssetStorageLocation;
manifestPath?: string;
partitionDir?: string;
producerRunId?: string;
producerNodeId?: string;
artifactId?: string;
quality: DataMetricQuality;
createdAt: string;
updatedAt?: string;
}
export interface DataMetricFact {
id: string;
sourceKey: string;
projectId?: string;
projectName?: string;
taskId?: string;
taskName?: string;
robotModel?: string;
scene?: string;
workflowId?: string;
workflowName?: string;
runId: string;
nodeId: string;
nodeLabel?: string;
attempt: number;
stage: DataMetricStage;
input?: DataVolume;
output?: DataVolume;
rejected?: DataVolume;
technicalValid?: DataVolume;
trainReady?: DataVolume;
datasetRefs?: DatasetMetricRef[];
trainingInputs?: TrainingInput[];
rejectionReasons?: Record<string, number>;
quality: DataMetricQuality;
occurredAt: string;
recordedAt: string;
}
export interface DataStageSummary {
stage: DataMetricStage;
input?: DataVolume;
output?: DataVolume;
rejected?: DataVolume;
technicalValid?: DataVolume;
trainReady?: DataVolume;
runCount: number;
}
export interface DataOperationsSummary {
from: string;
to: string;
timezone: string;
updatedAt: string;
freshness: string;
stages: DataStageSummary[];
training: {
consumed: DataVolume;
unique: DataVolume;
runCount: number;
};
hourly: Array<{ hour: string; stages: Partial<Record<DataMetricStage, DataVolume>> }>;
rejectionReasons: Record<string, number>;
tasks: Array<{
taskId: string;
taskName: string;
status: CollectionTaskStatus;
targets: DataVolume;
collected: DataVolume;
percent: number;
}>;
factCount: number;
exactCount: number;
derivedCount: number;
estimatedCount: number;
unknownCount: number;
}
export interface TrainingUsage {
id: string;
taskId?: string;
taskName?: string;
projectId?: string;
projectName?: string;
workflowId?: string;
workflowName?: string;
runId: string;
nodeId: string;
nodeLabel?: string;
model?: string;
inputs: TrainingInput[];
consumed: DataVolume;
quality: DataMetricQuality;
occurredAt: string;
}
export interface InputLineage {
workflowEdgeId?: string;
sourceNodeId?: string;
sourceHandle?: string;
targetNodeId: string;
targetHandle?: string;
artifact: ExecutionData;
}
export interface ExecutionLineageNode {
nodeId: string;
nodeLabel: string;
operatorId?: string;
operatorVersion?: string;
operatorImage?: string;
operatorImageId?: string;
status: NodeExecutionStatus;
startedAt?: string;
endedAt?: string;
stageManifestPath?: string;
inputArtifacts: ExecutionData[];
outputArtifacts: ExecutionData[];
dataRefs?: DataRef[];
}
export interface ExecutionLineageEdge {
id: string;
workflowEdgeId?: string;
sourceNodeId?: string;
sourceNodeLabel?: string;
sourceHandle?: string;
sourceArtifactId?: string;
sourceArtifactName?: string;
sourcePortId?: string;
sourcePortName?: string;
targetNodeId: string;
targetNodeLabel?: string;
targetHandle?: string;
relation: string;
}
export interface ExecutionLineage {
runId: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
nodes: ExecutionLineageNode[];
edges: ExecutionLineageEdge[];
}
export interface ArtifactLineage {
runId: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
artifactId: string;
artifactName?: string;
artifact: ExecutionData;
producer?: ExecutionLineageNode;
consumers: ExecutionLineageNode[];
upstreamEdges: ExecutionLineageEdge[];
downstreamEdges: ExecutionLineageEdge[];
nodes: ExecutionLineageNode[];
edges: ExecutionLineageEdge[];
}
export interface ExecutionRun {
id: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
captureDirectories?: string[];
taskId?: string;
trigger: "manual" | "scheduled" | "retry" | "rerun_subtree" | "human_release";
attempt?: number;
mode?: RunMode;
releaseId?: string;
workflowVersion?: number;
gitCommitSha?: string;
imageDigest?: string;
nodeOverrides?: Record<string, NodeOverride>;
debugTarget?: DebugExecutionTarget;
definitionVersion?: number;
inputs?: Record<string, ArtifactPayload>;
resolvedInputBindings?: ResolvedInputBinding[];
parentRunId?: string;
restartFromNodeId?: string;
availableAt?: string;
status:
| "queued"
| "running"
| "stopping"
| "waiting_for_audit"
| "waiting_for_human"
| "completed"
| "failed"
| "cancelled";
stopMode?: "graceful" | "force";
stopRequestedAt?: string;
previousRunAt?: string;
currentRunAt?: string;
startedAt?: string;
endedAt?: string;
durationMs?: number;
currentNodeId?: string;
nodeExecutions: NodeExecution[];
logs: LogEntry[];
resourceSeries: ResourceUsage[];
artifacts: ExecutionData[];
k8sRefs: K8sRef[];
metadata?: ExecutionRunMetadata;
createdAt: string;
updatedAt: string;
error?: string;
failure?: ExecutionFailure;
progress?: ExecutionProgress;
}
export interface ExecutionFailure {
code?: string;
stage?: string;
nodeId?: string;
message: string;
retryable?: boolean;
suggestion?: string;
}
export interface ExecutionProgress {
nodeId?: string;
currentCaptureDirectories?: string[];
currentFile?: string;
stage?: string;
epoch?: number;
step?: number;
maxStep?: number;
samplesPerSecond?: number;
estimatedRemainingSeconds?: number;
checkpoint?: string;
updatedAt?: string;
}
export interface ExecutionRunSummary {
id: string;
workflowId: string;
workflowName: string;
projectId: string;
projectName: string;
captureDirectories?: string[];
taskId?: string;
trigger: "manual" | "scheduled" | "retry" | "rerun_subtree" | "human_release";
attempt?: number;
mode?: RunMode;
releaseId?: string;
workflowVersion?: number;
parentRunId?: string;
restartFromNodeId?: string;
availableAt?: string;
status:
| "queued"
| "running"
| "stopping"
| "waiting_for_audit"
| "waiting_for_human"
| "completed"
| "failed"
| "cancelled";
stopMode?: "graceful" | "force";
stopRequestedAt?: string;
startedAt?: string;
endedAt?: string;
durationMs?: number;
currentNodeId?: string;
createdAt: string;
updatedAt: string;
error?: string;
failure?: ExecutionFailure;
progress?: ExecutionProgress;
}
export interface AuditTask {
id: string;
runId: string;
workflowId: string;
projectId: string;
nodeId: string;
workflowName: string;
projectName: string;
operatorName: string;
createdAt: string;
updatedAt: string;
status: "pending" | "approved" | "rejected";
data: {
image: string;
confidence: number;
detectedObjects: string[];
reason: string;
};
}
export type AnnotationAssignmentRole = "annotator" | "quality_reviewer" | "acceptance_reviewer" | "vendor_manager";
export type AnnotationTaskStatus =
| "pending_annotation"
| "pending_quality"
| "pending_acceptance"
| "rework"
| "accepted"
| "rejected";
export type ProjectMemberRole = "annotator" | "quality_reviewer" | "acceptance_reviewer";
export interface Supplier {
deletionTaskId?: string;
isDefault?: boolean;
id: string;
organizationId: string;
name: string;
status: string;
createdAt: string;
updatedAt: string;
}
export interface ProjectMember {
userName?: string;
userPhone?: string;
userStatus?: "active" | "disabled" | "missing";
id: string;
organizationId: string;
projectId: string;
userId: string;
supplierId?: string;
roles: ProjectMemberRole[];
legacySnapshot?: Record<string, string>;
createdAt: string;
updatedAt: string;
}
export type ObjectStorageUploadSessionStatus = "prepared" | "running" | "paused" | "completed" | "failed" | "cancelled";
export type ObjectStorageUploadItemStatus = "pending" | "uploading" | "success" | "skipped" | "failed" | "cancelled";
export interface ObjectStorageUploadSessionItem {
id: string;
relativePath: string;
key: string;
kind: "file" | "directory";
contentType?: string;
sizeBytes: number;
lastModified?: number;
action: "upload" | "create_placeholder" | "skip" | "conflict";
status: ObjectStorageUploadItemStatus;
mode?: "direct" | "multipart";
uploadId?: string;
uploadedParts?: Array<{ partNumber: number; eTag: string }>;
uploadedBytes?: number;
eTag?: string;
error?: string;
updatedAt: string;
}
export interface ObjectStorageUploadSession {
id: string;
organizationId: string;
userId: string;
connectionId: string;
bucket: string;
prefix?: string;
conflictPolicy: "overwrite" | "skip" | "error";
status: ObjectStorageUploadSessionStatus;
items: ObjectStorageUploadSessionItem[];
version: number;
expiresAt: string;
completedAt?: string;
cancelledAt?: string;
createdAt: string;
updatedAt: string;
}
export interface ObjectStorageUploadSessionSummary {
session: ObjectStorageUploadSession;
totalBytes: number;
processedBytes: number;
uploadedBytes: number;
successCount: number;
skippedCount: number;
failedCount: number;
cancelledCount: number;
pendingCount: number;
}
export interface DictionarySelection {
id: string;
kind: "action" | "slice" | "discard_reason";
version: number;
code: string;
name: string;
tags: string[];
}
export interface SemanticLabelDefinition {
dictionary?: DictionarySelection;
id: string;
name: string;
description?: string;
aliases?: string[];
color?: string;
}
export interface AnnotationLabelRecord {
tags?: string[];
kind?: "action" | "slice" | "discard_reason";
requiresNote?: boolean;
id: string;
organizationId: string;
code: string;
name: string;
category?: string;
description?: string;
example?: string;
color?: string;
aliases?: string[];
status: "active" | "inactive";
version: number;
updatedAt: string;
history?: Array<{
tags?: string[];
version: number;
code: string;
name: string;
category?: string;
description?: string;
example?: string;
color?: string;
aliases?: string[];
status: "active" | "inactive";
updatedByUserId: string;
updatedAt: string;
}>;
}
export interface ProjectAnnotationLabelsRecord {
sliceLabelIds?: string[];
discardReasonLabelIds?: string[];
items?: AnnotationLabelRecord[];
id: string;
organizationId: string;
projectId: string;
labelIds: string[];
updatedAt?: string;
}
export interface AnnotationTemplate {
id: string;
organizationId?: string;
projectId: string;
name: string;
version: number;
status: "draft" | "published" | "retired";
labels: SemanticLabelDefinition[];
phrases?: string[];
prelabel: {
enabled: boolean;
minimumConfidence?: number;
enableWilor?: boolean;
enableHead?: boolean;
};
humanStages?: Array<{
id: string;
label: string;
kind: "annotation" | "review" | "acceptance";
requiredRole: string;
editorSchema?: string;
rejectTargets?: string[];
confirmOnly?: boolean;
}>;
createdByUserId: string;
publishedByUserId?: string;
publishedAt?: string;
createdAt: string;
updatedAt: string;
}
export interface AnnotationSegment {
clearDictionary?: boolean;
dictionary?: DictionarySelection;
status?: "pending" | "described" | "invalid";
id: string;
labelId: string;
label: string;
description?: string;
handedness?: string;
start: number;
end: number;
confidence?: number;
phrases?: string[];
source?: string;
isInvalid?: boolean;
}
export interface SliceSegment {
dictionary?: DictionarySelection;
discardReasonDictionary?: DictionarySelection;
deliveryDisposition?: "keep" | "discard";
discardReason?: string;
discardReasonLabelId?: string;
discardReasonVersion?: number;
discardReasonName?: string;
discardReasonNote?: string;
discardedByUserId?: string;
discardedAt?: string;
discardedAnnotations?: AnnotationSegment[];
id: string;
name?: string;
start: number;
end: number;
sourceIds?: string[];
taskLabelId?: string;
taskLabel?: string;
annotationStatus?: "pending" | "labeled" | "empty_confirmed";
}
export interface AnnotationFrameTimeline {
camera: "left" | "right";
frameCount: number;
originTimestampUs: number;
coverageEndTimestampUs: number;
boundariesSeconds: number[];
boundaryTimestampUs?: number[];
rightBoundariesSeconds?: number[];
rangeStartSecond?: number;
rangeEndSecond?: number;
boundaryContract?: string;
}
export interface SliceOperation {
type: "adjust" | "split" | "merge" | "delete" | "restore";
segmentIds?: string[];
at?: number;
before?: SliceSegment[];
after?: SliceSegment[];
}
export interface SliceRevision {
id: string;
organizationId?: string;
taskId: string;
revision: number;
segments: SliceSegment[];
operations?: SliceOperation[];
authorUserId: string;
changeReason?: string;
durationSeconds?: number;
createdAt: string;
/**
* 送检结构变更摘要(票 07 产、票 08 消费):服务端从"退回基线 vs 提交工作区"
* 的切片结构 diff 计算的净计数。仅返工送检附带;首标送检无退回基线时不存在。
*/
structureChangeSummary?: {
merged: number;
split: number;
discarded: number;
boundaryMoves: number;
};
}
export interface AnnotationTaskRecord {
continuousActions?: boolean;
processingProfile?: string;
id: string;
organizationId?: string;
projectId: string;
dataTaskId?: string;
workflowId?: string;
runId?: string;
nodeId?: string;
artifactId?: string;
sourceVideo: string;
rightArtifactId?: string;
rightSourceVideo?: string;
clipStart: number;
clipEnd: number;
sourceIsFullVideo?: boolean;
sourceDurationSeconds?: number;
coverageStartSecond?: number;
coverageEndSecond?: number;
coverageMode?: string;
templateId: string;
templateVersion: number;
labelSnapshot?: SemanticLabelDefinition[];
supplierId?: string;
legacyAssignment?: Record<string, string>;
assignedUserId?: string;
status: AnnotationTaskStatus;
currentRevision: number;
/** Current task-pool stage, supplied by the task-list API for queue routing. */
humanStageId?: string;
sliceCount?: number;
completedSliceCount?: number;
pendingSliceCount?: number;
annotationEventCount?: number;
poseSummary?: Record<string, any>;
createdAt: string;
updatedAt: string;
}
export interface AnnotationRevision {
id: string;
organizationId?: string;
taskId: string;
revision: number;
templateVersion: number;
segments: AnnotationSegment[];
authorUserId: string;
changeReason?: string;
isRework: boolean;
countsAsOutput: boolean;
durationSeconds?: number;
createdAt: string;
}
export interface AnnotationReview {
id: string;
taskId: string;
revision: number;
stage: "split_quality" | "quality" | "acceptance";
decision: "approved" | "rejected";
reviewerUserId: string;
comment?: string;
videoQuality?: string;
annotationAccuracy?: number;
annotationCompleteness?: number;
overallGrade?: string;
reasonCodes?: string[];
problemSliceIds?: string[];
rejectTargets?: string[];
nextRevision?: number;
createdAt: string;
}
export interface AnnotationTaskDetail {
task: AnnotationTaskRecord;
editorState?: {
phase: "slice" | "materializing" | "annotate";
canConfirmDescriptions: boolean;
canRecoverGeneration?: boolean;
canReconfirmSavedGeneration?: boolean;
};
sliceRevisions: SliceRevision[];
revisions: AnnotationRevision[];
reviews: AnnotationReview[];
humanItem?: HumanItem;
}
export interface AnnotationWorkloadAggregate extends WorkforceStatistics {
supplierName?: string;
role?: string;
userName?: string;
userId: string;
supplierId: string;
templateVersion: number;
assignedCount: number;
submittedCount: number;
qualityApproved: number;
qualityRejected: number;
acceptanceApproved: number;
acceptanceRejected: number;
reworkCount: number;
outputCount: number;
durationSeconds: number;
}
export interface AnnotationWorkloadSummary {
from?: string;
to?: string;
totals?: DashboardWorkforceMetric;
items: AnnotationWorkloadAggregate[];
eventCount: number;
}
export type HumanItemStatus =
| "ready"
| "claimed"
| "in_progress"
| "submitted"
| "rework"
| "escalated"
| "accepted"
| "rejected"
| "cancelled";
export interface HumanTaskDisplayContext {
projectName?: string;
workflowName?: string;
captureDirectories?: string[];
}
export interface HumanItem {
/** Server-computed acceptance claim capability; never used as a write credential. */
canClaim?: boolean;
reviewHistoryStatus?: "pending_acceptance" | "accepted";
/** Requesting user's last formal review; independent of current workflow. */
reviewHistory?: {
decision: "approved" | "rejected";
stageId?: string;
revision?: number;
round?: number;
reviewedAt?: string;
};
claimedAt?: string;
processingScope?: "public" | "internal" | "supplier";
processingProfile?: string;
id: string;
organizationId: string;
pluginId: string;
batchId: string;
projectId: string;
supplierId?: string;
workflowId: string;
runId: string;
gateNodeId: string;
legacyTaskId?: string;
legacyAuditTaskId?: string;
subject: { artifactId?: string; itemKey: string; mediaType?: string; payload?: Record<string, any> };
currentStageId: string;
status: HumanItemStatus;
assignedUserId?: string;
legacyAssignment?: Record<string, string>;
currentRevision: number;
reviewRound: number;
maxReworkRounds: number;
version: number;
latestAuthorUserId?: string;
pendingCombinedSubmissionId?: string;
pendingCombinedPayloadSha?: string;
releasePartitionId?: string;
acceptedAt?: string;
acceptedByUserId?: string;
cancelledAt?: string;
cancelledByUserId?: string;
cancellationReason?: string;
createdAt: string;
updatedAt: string;
display?: HumanTaskDisplayContext;
}
export interface HumanReject {
id: string;
organizationId: string;
batchId: string;
itemId: string;
projectId: string;
workflowId: string;
runId: string;
stageId: string;
attemptRound: number;
reviewedRevision?: number;
rejectedByUserId: string;
reasonCodes: string[];
problemSliceIds?: string[];
comment: string;
allowedReopenStages: string[];
status: "open" | "reopened" | "resolved" | "escalated";
version: number;
reopenCount: number;
reopenedByUserId?: string;
reopenTargetStageId?: string;
reopenComment?: string;
reopenedAt?: string;
createdAt: string;
updatedAt: string;
display?: HumanTaskDisplayContext;
}
export interface DeliveryPackage {
id: string;
organizationId: string;
projectId: string;
workflowId: string;
supplierId?: string;
legacyAssignment?: Record<string, string>;
parentRunId: string;
childRunId: string;
releasePartitionId: string;
manifestDigest: string;
itemIds: string[];
artifactIds?: string[];
headposeArtifactIds?: string[];
handposeArtifactIds?: string[];
qualitySummary?: Record<string, unknown>;
status: "building" | "pending_acceptance" | "accepted" | "rejected" | "failed" | "no_deliverables";
acceptanceHumanItemId?: string;
acceptanceHumanItemVersion?: number;
assignedUserId?: string;
claimedAt?: string;
finalExportArtifactIds?: string[];
finalExportedAt?: string;
version: number;
acceptanceReviews?: Array<{
id: string;
decision: "approved" | "rejected";
reviewerUserId: string;
comment?: string;
videoQuality?: string;
annotationAccuracy?: number;
annotationCompleteness?: number;
overallGrade?: string;
reasonCodes?: string[];
createdAt: string;
}>;
createdAt: string;
updatedAt: string;
}
export interface DeliveryPackageManifestItem {
packageName: string;
clipId: string;
clipName: string;
startSecond: number;
endSecond: number;
duration: number;
annotation?: Record<string, any>;
segmentManifest?: Record<string, any>;
}
export interface DeliveryPackageContents {
deliveryPackage: DeliveryPackage;
artifacts: ExecutionData[];
manifest?: {
packageCount?: number;
trainingEnabled?: boolean;
items?: DeliveryPackageManifestItem[];
};
}