package protocol import "time" const ( RunCapabilityProcessInstall = "process.install" RunCapabilityProcessStart = "process.start" RunCapabilityProcessStop = "process.stop" RunCapabilityProcessStatus = "process.status" RunCapabilityLogsRead = "logs.read" RunCapabilityConfigWrite = "config.write" RunCapabilityFilesList = "files.list" RunCapabilityFilesRead = "files.read" RunCapabilityFilesWrite = "files.write" RunCapabilityRemoteFTPRead = "remote.ftp.read" RunCapabilityRemoteFTPWrite = "remote.ftp.write" RunCapabilityRemoteRsyncRead = "remote.rsync.read" RunCapabilityRemoteRsyncWrite = "remote.rsync.write" RunCapabilityRemoteRunFilesRead = "remote.run.files.read" RunCapabilityRemoteRunFilesWrite = "remote.run.files.write" RunCapabilityRemoteRunProcessStart = "remote.run.process.start" RunCapabilityRemoteRunProcessStop = "remote.run.process.stop" RunCapabilityRemoteRunDBMySQLQuery = "remote.run.db.mysql.query" RunCapabilityRemoteRunDBSQLiteProbe = "remote.run.db.sqlite.probe" RunCapabilityRemoteRunDBSQLiteQuery = "remote.run.db.sqlite.query" RunCapabilityRemoteRunLogsTransfer = "remote.run.logs.transfer" RunCapabilityRemoteRunRCONCommand = "remote.run.rcon.command" RunCapabilityRemoteRunProtectedSQL = "remote.run.protected.sql" RunCapabilityRemoteRunProtectedRCON = "remote.run.protected.rcon" RunCapabilityRemoteRunProgram = "remote.run.program.command" RunCapabilityRunSelfUpdate = "run.self-update" RunCapabilityDistributionBuild = "distribution.build" RunCapabilityDependenciesCheck = "dependencies.check" RunCapabilityDependenciesInstall = "dependencies.install" RunCapabilityLogsBackfill = "logs.backfill" RunCapabilityDeploymentPlan = "deployment.plan.v1" ) type RunJobProgressReport struct { Percent int `json:"percent"` Message string `json:"message,omitempty"` } type RunJobExecutionInput struct { WorkspaceScope string `json:"workspaceScope,omitempty"` Content string `json:"content,omitempty"` ExpectedVersion int `json:"expectedVersion,omitempty"` ExpectedChecksum string `json:"expectedChecksum,omitempty"` MaxReadBytes int `json:"maxReadBytes,omitempty"` RemoteAdapterKey string `json:"remoteAdapterKey,omitempty"` RemoteAdapterKind string `json:"remoteAdapterKind,omitempty"` TimeoutSeconds int `json:"timeoutSeconds,omitempty"` PluginID string `json:"pluginId,omitempty"` LifecycleOperation string `json:"lifecycleOperation,omitempty"` TargetVersion string `json:"targetVersion,omitempty"` Inputs map[string]string `json:"inputs,omitempty"` LogSource *RuntimeLogSourcePlan `json:"logSource,omitempty"` LogSources []RuntimeLogSourcePlan `json:"logSources,omitempty"` DLLExtensions []RuntimeDLLExtensionPlan `json:"dllExtensions,omitempty"` SourceRCON *RuntimeSourceRCONPlan `json:"sourceRcon,omitempty"` SQLiteSchemaProbe *SQLiteSchemaProbeRequest `json:"sqliteSchemaProbe,omitempty"` Deployment *ServerDeploymentExecution `json:"deployment,omitempty"` ServerDeploymentPlan *ServerDeploymentPlan `json:"serverDeploymentPlan,omitempty"` } // SQLiteSchemaProbeBinding identifies the package and current database binding // that authorized a probe. It contains only logical identities, never a path, // DSN, socket, or credential. type SQLiteSchemaProbeBinding struct { ServerInstanceID string `json:"serverInstanceId"` RunBindingID string `json:"runBindingId"` RunEndpointID string `json:"runEndpointId"` PluginID string `json:"pluginId"` PluginVersion string `json:"pluginVersion"` AdapterVersion string `json:"adapterVersion"` GameVersion string `json:"gameVersion,omitempty"` DatabaseIdentity string `json:"databaseIdentity"` } // SQLiteSchemaProbeLimits cap every independent part of diagnostic output. // They are applied by Run even when the caller asks for larger values. type SQLiteSchemaProbeLimits struct { MaxObjects int `json:"maxObjects"` MaxColumnsPerObject int `json:"maxColumnsPerObject"` MaxIndexesPerObject int `json:"maxIndexesPerObject"` MaxForeignKeys int `json:"maxForeignKeys"` MaxCardinalityReads int `json:"maxCardinalityReads"` MaxSampleRows int `json:"maxSampleRows"` TimeoutMS int `json:"timeoutMs"` MaxResultBytes int `json:"maxResultBytes"` } // SQLiteSchemaProbeRequest requests generic, query-only SQLite metadata for // assignment.TargetKey. TargetKey is always resolved inside the scoped package // workspace; this request intentionally has no path or SQL field. type SQLiteSchemaProbeRequest struct { RequestID string `json:"requestId"` Binding SQLiteSchemaProbeBinding `json:"binding"` Limits SQLiteSchemaProbeLimits `json:"limits"` } type SQLiteSchemaProbeColumn struct { NameFingerprint string `json:"nameFingerprint"` DeclaredType string `json:"declaredType"` Nullable *bool `json:"nullable,omitempty"` PrimaryKey bool `json:"primaryKey"` Ordinal int `json:"ordinal"` } type SQLiteSchemaProbeIndex struct { NameFingerprint string `json:"nameFingerprint"` Unique bool `json:"unique"` ColumnHashes []string `json:"columnHashes"` } type SQLiteSchemaProbeForeignKey struct { FromColumnHash string `json:"fromColumnHash"` ToObjectHash string `json:"toObjectHash"` ToColumnHash string `json:"toColumnHash"` } type SQLiteSchemaProbeObject struct { ObjectHash string `json:"objectHash"` Kind string `json:"kind"` NameFingerprint string `json:"nameFingerprint"` DeclaredColumns []SQLiteSchemaProbeColumn `json:"declaredColumns"` Indexes []SQLiteSchemaProbeIndex `json:"indexes"` ForeignKeys []SQLiteSchemaProbeForeignKey `json:"foreignKeys"` ApproximateRows *int64 `json:"approximateRows,omitempty"` SampleFingerprints []string `json:"sampleFingerprints,omitempty"` } type SQLiteSchemaProbeSafeError struct { Code string `json:"code"` Retryable bool `json:"retryable"` } // SQLiteSchemaProbeResult is a terminal, redacted envelope. Names and sample // values are represented only by salted-looking SHA-256 fingerprints. type SQLiteSchemaProbeResult struct { RequestID string `json:"requestId"` JobID string `json:"jobId"` Binding SQLiteSchemaProbeBinding `json:"binding"` Status string `json:"status"` ObservedAt time.Time `json:"observedAt"` SourceFingerprint string `json:"sourceFingerprint,omitempty"` SchemaFingerprint string `json:"schemaFingerprint,omitempty"` ResultDigest string `json:"resultDigest,omitempty"` Objects []SQLiteSchemaProbeObject `json:"objects,omitempty"` SafeError SQLiteSchemaProbeSafeError `json:"safeError,omitempty"` Limits SQLiteSchemaProbeLimits `json:"limits"` } type ServerDeploymentExecution struct { SchemaVersion string `json:"schemaVersion"` Mode string `json:"mode"` ProfileKey string `json:"profileKey,omitempty"` CreateInputs map[string]string `json:"createInputs,omitempty"` ServerRoot string `json:"serverRoot,omitempty"` WorkingDirectory string `json:"workingDirectory,omitempty"` StartCommand string `json:"startCommand,omitempty"` StopCommand string `json:"stopCommand,omitempty"` StatusCommand string `json:"statusCommand,omitempty"` Shell string `json:"shell,omitempty"` Revision int `json:"revision"` } // ServerDeploymentPlan is kept only for backward-compatible decoding of // legacy assignments. Game-specific deployment plans are no longer executed by // Run; plugins own game lifecycle policy through action assets. type ServerDeploymentPlan struct { SchemaVersion string `json:"schemaVersion"` Operation string `json:"operation"` PluginID string `json:"pluginId"` TemplateKey string `json:"templateKey"` TemplateVersion string `json:"templateVersion"` SteamAppID string `json:"steamAppId"` ExecutableKey string `json:"executableKey"` InstallRootKey string `json:"installRootKey"` ConfigKey string `json:"configKey"` ConfigFormat string `json:"configFormat"` Prerequisites []RuntimeServerPrerequisite `json:"prerequisites,omitempty"` ConfigMappings []RuntimeServerConfigMapping `json:"configMappings"` DiscoveryMarkers []RuntimeServerDiscoveryMarker `json:"discoveryMarkers"` VerificationChecks []RuntimeServerVerificationCheck `json:"verificationChecks"` } type RuntimeServerPrerequisite struct { Key string `json:"key"` Kind string `json:"kind"` } type RuntimeServerConfigMapping struct { FieldKey string `json:"fieldKey"` ConfigKey string `json:"configKey"` ValueType string `json:"valueType"` Required bool `json:"required"` } type RuntimeServerDiscoveryMarker struct { Key string `json:"key"` Kind string `json:"kind"` TargetKey string `json:"targetKey"` Expected string `json:"expected,omitempty"` Required bool `json:"required"` } type RuntimeServerVerificationCheck struct { Key string `json:"key"` Kind string `json:"kind"` TargetKey string `json:"targetKey"` Required bool `json:"required"` } type ServerDeploymentEvidence struct { TemplateKey string `json:"templateKey,omitempty"` TemplateVersion string `json:"templateVersion,omitempty"` PreflightState string `json:"preflightState,omitempty"` DiscoveryState string `json:"discoveryState,omitempty"` MappingState string `json:"mappingState,omitempty"` VerificationState string `json:"verificationState,omitempty"` DiscoveredFacts map[string]string `json:"discoveredFacts,omitempty"` MappingResults map[string]string `json:"mappingResults,omitempty"` VerificationResults map[string]string `json:"verificationResults,omitempty"` FailureCode string `json:"failureCode,omitempty"` } // RuntimeDLLExtensionPlan is a Platform-frozen UE4SS DLL release. It is only // accepted as part of a scoped process.start job; Run never fetches a mutable // plugin declaration on its own. type RuntimeDLLExtensionPlan struct { Key string `json:"key"` Version string `json:"version"` ReleaseURL string `json:"releaseUrl"` Checksum string `json:"checksum"` SizeBytes int64 `json:"sizeBytes"` TargetKey string `json:"targetKey"` ModKey string `json:"modKey"` DLLRef string `json:"dllRef"` SCUMExecutableChecksum string `json:"scumExecutableChecksum"` UE4SSABI string `json:"ue4ssAbi"` RCONPort int `json:"rconPort"` } // RuntimeLogSourcePlan is a Platform-frozen, logical file log declaration. It // carries no host paths; Run resolves TargetKey only inside its scoped // workspace for the server instance. type RuntimeLogSourcePlan struct { Key string `json:"key"` Kind string `json:"kind"` TargetKey string `json:"targetKey,omitempty"` StreamKey string `json:"streamKey"` CursorKind string `json:"cursorKind,omitempty"` RetentionDays int `json:"retentionDays,omitempty"` } // RuntimeSourceRCONPlan contains only frozen, non-secret metadata. Run reads // the generated password from the scoped workspace after it consumes the // one-time command input. type RuntimeSourceRCONPlan struct { Protocol string `json:"protocol"` ExtensionKey string `json:"extensionKey"` ModKey string `json:"modKey"` ConfigRef string `json:"configRef"` DeploymentStateRef string `json:"deploymentStateRef"` Port int `json:"port"` } type RunJobExecutionResult struct { Kind string `json:"kind,omitempty"` ProcessState string `json:"processState,omitempty"` ExitClassification string `json:"exitClassification,omitempty"` ExitCode int `json:"exitCode,omitempty"` Version int `json:"version,omitempty"` Checksum string `json:"checksum,omitempty"` SizeBytes int64 `json:"sizeBytes,omitempty"` Summary string `json:"summary,omitempty"` Content string `json:"content,omitempty"` SQLiteSchemaProbe *SQLiteSchemaProbeResult `json:"sqliteSchemaProbe,omitempty"` DeploymentReceipt *ServerDeploymentExecutionReceipt `json:"deploymentReceipt,omitempty"` ServerDeploymentEvidence *ServerDeploymentEvidence `json:"serverDeploymentEvidence,omitempty"` } type ServerDeploymentExecutionReceipt struct { SchemaVersion string `json:"schemaVersion"` Revision int `json:"revision"` Action string `json:"action"` Mode string `json:"mode"` Shell string `json:"shell,omitempty"` UsedServerRoot bool `json:"usedServerRoot"` } type RunJobAssignment struct { JobID string `json:"jobId"` ServerInstanceID string `json:"serverInstanceId,omitempty"` RunEndpointID string `json:"runEndpointId"` Capability string `json:"capability"` TargetKey string `json:"targetKey,omitempty"` InputRef string `json:"inputRef,omitempty"` IdempotencyKey string `json:"idempotencyKey"` State string `json:"state"` Progress RunJobProgressReport `json:"progress"` ResultRef string `json:"resultRef,omitempty"` ExecutionInput RunJobExecutionInput `json:"executionInput,omitempty"` LeaseToken string `json:"leaseToken"` FencingToken uint64 `json:"fencingToken,omitempty"` Attempt int `json:"attempt"` LogSessionID string `json:"logSessionId,omitempty"` SessionStartedAt time.Time `json:"sessionStartedAt,omitempty"` MaxAttempts int `json:"maxAttempts"` AckDeadlineAt time.Time `json:"ackDeadlineAt,omitempty"` LeaseExpiresAt time.Time `json:"leaseExpiresAt,omitempty"` NextAttemptAt time.Time `json:"nextAttemptAt,omitempty"` ProgressSequence uint64 `json:"progressSequence,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } type RunJobClaimRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` Capabilities []string `json:"capabilities"` Capacity RunCapacityReport `json:"capacity"` } type RunJobClaimResponse struct { Accepted bool `json:"accepted"` RunEndpointID string `json:"runEndpointId"` HasJob bool `json:"hasJob"` Job *RunJobAssignment `json:"job,omitempty"` NextPollSeconds int `json:"nextPollSeconds"` ServerTime time.Time `json:"serverTime"` } type RunJobAckRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` Message string `json:"message,omitempty"` } type RunJobAckResponse struct { Accepted bool `json:"accepted"` Job RunJobAssignment `json:"job"` ServerTime time.Time `json:"serverTime"` } type RunJobProgressRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` Progress RunJobProgressReport `json:"progress"` Sequence uint64 `json:"sequence,omitempty"` } type RunJobProgressResponse struct { Accepted bool `json:"accepted"` Job RunJobAssignment `json:"job"` ServerTime time.Time `json:"serverTime"` } type RunJobResultRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` State string `json:"state"` Progress RunJobProgressReport `json:"progress"` ResultRef string `json:"resultRef,omitempty"` Message string `json:"message,omitempty"` ErrorCode string `json:"errorCode,omitempty"` Retryable bool `json:"retryable,omitempty"` ExecutionResult RunJobExecutionResult `json:"executionResult,omitempty"` } type RunJobResultResponse struct { Accepted bool `json:"accepted"` Job RunJobAssignment `json:"job"` ServerTime time.Time `json:"serverTime"` } type DistributionBuildInputRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` } type DistributionBuildInputResponse struct { JobID string `json:"jobId"` ComponentKind string `json:"componentKind"` ServerInstanceID string `json:"serverInstanceId"` PluginID string `json:"pluginId"` RunEndpointID string `json:"runEndpointId"` ProfileKey string `json:"profileKey,omitempty"` TargetOS string `json:"targetOs"` TargetArch string `json:"targetArch"` TargetRelease string `json:"targetRelease"` PlatformURL string `json:"platformUrl,omitempty"` PackageFormat string `json:"packageFormat"` RepositoryURL string `json:"repositoryUrl,omitempty"` SourceRevision string `json:"sourceRevision,omitempty"` ArtifactID string `json:"artifactId"` OutputFilename string `json:"outputFilename"` SecretRef string `json:"secretRef"` KeyGeneration int `json:"keyGeneration"` AuthKey string `json:"authKey"` WorkspaceSeed string `json:"workspaceSeed,omitempty"` } type DependencyExecutionInputRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` } type DependencyProbe struct { Key string `json:"key"` Kind string `json:"kind"` TargetKey string `json:"targetKey"` Required bool `json:"required,omitempty"` MinimumVersion string `json:"minimumVersion,omitempty"` Platforms []string `json:"platforms,omitempty"` } type DependencyInstallStep struct { Type string `json:"type"` TargetKey string `json:"targetKey"` PackageManager string `json:"packageManager,omitempty"` PackageName string `json:"packageName,omitempty"` Version string `json:"version,omitempty"` DownloadRef string `json:"downloadRef,omitempty"` Checksum string `json:"checksum,omitempty"` } type DependencyInstallPlan struct { Key string `json:"key"` Title string `json:"title"` Platforms []string `json:"platforms,omitempty"` Steps []DependencyInstallStep `json:"steps,omitempty"` } type DependencyExecutionInputResponse struct { JobID string `json:"jobId"` ServerInstanceID string `json:"serverInstanceId"` RunEndpointID string `json:"runEndpointId"` PluginID string `json:"pluginId"` PluginVersion string `json:"pluginVersion"` ProfileKey string `json:"profileKey"` TargetOS string `json:"targetOs"` TargetArch string `json:"targetArch"` PlanDigest string `json:"planDigest"` Probe DependencyProbe `json:"probe,omitempty"` Plan DependencyInstallPlan `json:"plan,omitempty"` Bindings map[string]string `json:"bindings"` } type SourceRCONExecutionInputRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` } // SourceRCONExecutionInput is deliberately excluded from assignments and // journals. Command is returned once to the active Run lease only. type SourceRCONExecutionInputResponse struct { JobID string `json:"jobId"` ServerInstanceID string `json:"serverInstanceId"` RunEndpointID string `json:"runEndpointId"` Command string `json:"command"` } // ProtectedRequestExecutionInput is deliberately excluded from assignments and // journals. Platform returns the approved text and its logical binding once to // the active, fenced Run lease; no connection material crosses this channel. type ProtectedRequestExecutionInputRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` FencingToken uint64 `json:"fencingToken"` } type ProtectedRequestExecutionInputResponse struct { JobID string `json:"jobId"` ServerInstanceID string `json:"serverInstanceId"` RunEndpointID string `json:"runEndpointId"` FencingToken uint64 `json:"fencingToken"` Authorized bool `json:"authorized"` ApprovalState string `json:"approvalState"` QueueState string `json:"queueState"` ExpiresAt time.Time `json:"expiresAt"` Kind string `json:"kind"` TransportKey string `json:"transportKey"` TargetKey string `json:"targetKey"` RequestText string `json:"requestText"` } type RunUpdateInputRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` } type RunUpdateInputResponse struct { JobID string `json:"jobId"` ServerInstanceID string `json:"serverInstanceId"` RunEndpointID string `json:"runEndpointId"` ArtifactID string `json:"artifactId"` Checksum string `json:"checksum"` SizeBytes int64 `json:"sizeBytes"` TargetOS string `json:"targetOs"` TargetArch string `json:"targetArch"` PackageFormat string `json:"packageFormat"` ExecutableName string `json:"executableName"` TargetRelease string `json:"targetRelease"` ChunkSizeBytes int `json:"chunkSizeBytes"` } type RunUpdateChunkRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` Offset int64 `json:"offset"` Length int `json:"length"` } type RunUpdateChunkResponse struct { JobID string `json:"jobId"` ArtifactID string `json:"artifactId"` Offset int64 `json:"offset"` TotalBytes int64 `json:"totalBytes"` Checksum string `json:"checksum"` Payload []byte `json:"payload"` Complete bool `json:"complete"` } type RunUpdateHealthRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` Outcome string `json:"outcome"` Version string `json:"version"` } type RunUpdateHealthResponse struct { Accepted bool `json:"accepted"` JobID string `json:"jobId"` Phase string `json:"phase"` ServerTime time.Time `json:"serverTime"` } type DependencyExecutionEvidence struct { ProbeKey string `json:"probeKey"` PlanKey string `json:"planKey,omitempty"` PlanDigest string `json:"planDigest"` State string `json:"state"` Evidence string `json:"evidence,omitempty"` CompletedSteps int `json:"completedSteps,omitempty"` } type RunUpdateExecutionEvidence struct { TargetRelease string `json:"targetRelease"` Phase string `json:"phase"` } type RunJobCancelPollRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` JobID string `json:"jobId,omitempty"` LeaseToken string `json:"leaseToken,omitempty"` Attempt int `json:"attempt"` } type RunJobCancelPollResponse struct { Accepted bool `json:"accepted"` RunEndpointID string `json:"runEndpointId"` HasCancel bool `json:"hasCancel"` JobID string `json:"jobId,omitempty"` Reason string `json:"reason,omitempty"` RequestedAt time.Time `json:"requestedAt,omitempty"` ServerTime time.Time `json:"serverTime"` } type RunJobReconcileEntry struct { JobID string `json:"jobId"` LeaseToken string `json:"leaseToken"` Attempt int `json:"attempt"` } type RunJobReconcileRequest struct { RunEndpointID string `json:"runEndpointId"` SessionToken string `json:"sessionToken"` ActiveJobs []RunJobReconcileEntry `json:"activeJobs"` } type RunJobReconcileResponse struct { Accepted bool `json:"accepted"` RunEndpointID string `json:"runEndpointId"` ConfirmedJobs []RunJobAssignment `json:"confirmedJobs"` DiscardJobIDs []string `json:"discardJobIds"` ServerTime time.Time `json:"serverTime"` }