livekit

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerURLEnvVar       = workeripc.WorkerURLEnvVar
	WorkerAPIKeyEnvVar    = workeripc.WorkerAPIKeyEnvVar
	WorkerAPISecretEnvVar = workeripc.WorkerAPISecretEnvVar
	ProcessIDEnvVar       = workeripc.ProcessIDEnvVar
	JobJSONEnvVar         = workeripc.JobJSONEnvVar
	RunningJobJSONEnvVar  = workeripc.RunningJobJSONEnvVar
)
View Source
const (
	RoomEventDisconnected                 = "disconnected"
	RoomEventConnectionStateChanged       = "connection_state_changed"
	RoomEventRoomMoved                    = "room_moved"
	RoomEventParticipantConnected         = "participant_connected"
	RoomEventParticipantDisconnected      = "participant_disconnected"
	RoomEventParticipantAttributesChanged = "participant_attributes_changed"
	RoomEventParticipantActive            = "participant_active"
	RoomEventTrackSubscribed              = "track_subscribed"
	RoomEventTrackUnpublished             = "track_unpublished"
	RoomEventTrackPublished               = "track_published"
	RoomEventLocalTrackPublished          = "local_track_published"
	RoomEventSipDTMFReceived              = "sip_dtmf_received"
)
View Source
const DefaultSIPParticipantName = "SIP-participant"
View Source
const ParticipantAttributeAgentName = "lk.agent.name"
View Source
const PreConnectAudioBufferStream = "lk.agent.pre-connect-audio-buffer"
View Source
const RoomIOAgentStateAttribute = "lk.agent.state"
View Source
const RoomIOChatTopic = "lk.chat"
View Source
const RoomIOPublishOnBehalfAttribute = "lk.publish_on_behalf"
View Source
const RoomIOSimulatorAttribute = "lk.simulator"
View Source
const RoomIOTranscriptionFinalAttribute = "lk.transcription_final"
View Source
const RoomIOTranscriptionSegmentIDAttribute = "lk.segment_id"
View Source
const RoomIOTranscriptionTopic = "lk.transcription"
View Source
const RoomIOTranscriptionTrackIDAttribute = "lk.transcribed_track_id"
View Source
const WorkerLogLevelEnvVar = "LIVEKIT_LOG_LEVEL"

Variables

This section is empty.

Functions

func AgentIdentityForJobID

func AgentIdentityForJobID(jobID string) string

func AgentWebSocketURL

func AgentWebSocketURL(rawURL string, workerToken string) (string, error)

func AllRecordingOptions

func AllRecordingOptions() agent.RecordingOptions

func AnswerAvailabilityRequest

func AnswerAvailabilityRequest(opts AvailabilityAnswerOptions)

func AnswerServerAvailabilityRequest

func AnswerServerAvailabilityRequest(opts AvailabilityAnswerOptions)

func ApplyServerConnectionEnv

func ApplyServerConnectionEnv(opts ServerConnectionEnvOptions)

func ApplyWorkerEnv

func ApplyWorkerEnv(opts WorkerEnvOptions)

func AutoSubscribeSDKEnabled

func AutoSubscribeSDKEnabled(mode string) bool

func AvailabilityResponseForAccept

func AvailabilityResponseForAccept(
	req *AvailabilityRequest,
	args AvailabilityAcceptOptions,
	agentName string,
) *lkprotocol.WorkerMessage

func AvailableWorkerStatusMessage

func AvailableWorkerStatusMessage(load float64, jobCount uint32, canAcceptJob bool) *lkprotocol.WorkerMessage

func ConnectFailureError

func ConnectFailureError(agentURL string, attempts int, err error) error

func ConnectInfo

func ConnectInfo(opts ConnectInfoOptions) lksdk.ConnectInfo

func ConnectOptionsForAutoSubscribe

func ConnectOptionsForAutoSubscribe(mode string) []lksdk.ConnectOption

func ConnectRoom

func ConnectRoom(_ context.Context, opts RoomConnectOptions) (*lksdk.Room, error)

func CreateSIPParticipant

func CreateSIPParticipant(
	ctx context.Context,
	api SIPAPI,
	job *lkprotocol.Job,
	callTo string,
	trunkID string,
	identity string,
	name string,
) (*lkprotocol.SIPParticipantInfo, error)

func CreateSIPParticipantRequest

func CreateSIPParticipantRequest(
	roomName string,
	callTo string,
	trunkID string,
	identity string,
	name string,
) *lkprotocol.CreateSIPParticipantRequest

func CreateSIPParticipantWithNames

func CreateSIPParticipantWithNames(
	ctx context.Context,
	api SIPAPI,
	job *lkprotocol.Job,
	callTo string,
	trunkID string,
	identity string,
	names ...string,
) (*lkprotocol.SIPParticipantInfo, error)

func DefaultParticipantKinds

func DefaultParticipantKinds() []lkprotocol.ParticipantInfo_Kind

func DeleteRoomBestEffort

func DeleteRoomBestEffort(ctx context.Context, api DeleteRoomAPI, job *lkprotocol.Job, roomName string) (*lkprotocol.DeleteRoomResponse, error)

func DeleteRoomRequest

func DeleteRoomRequest(job *lkprotocol.Job, roomName string) *lkprotocol.DeleteRoomRequest

func DrainingWorkerStatusMessage

func DrainingWorkerStatusMessage(jobCount uint32) *lkprotocol.WorkerMessage

func ExpirePendingAccept

func ExpirePendingAccept(
	pending map[string]JobAcceptArguments,
	timers map[string]*time.Timer,
	jobID string,
	timer *time.Timer,
) bool

func ExpireServerPendingAccept

func ExpireServerPendingAccept(
	pending map[string]JobAcceptArguments,
	timers map[string]*time.Timer,
	jobID string,
	timer *time.Timer,
) bool

func HasSessionEvaluationReport

func HasSessionEvaluationReport(report *agent.SessionReport) bool

func HasSessionRecordingOption

func HasSessionRecordingOption(options agent.RecordingOptions) bool

func InitialRegisterMessage

func InitialRegisterMessage(binary bool, data []byte) (*lkprotocol.ServerMessage, error)

func InitialRegisterWebSocketMessage

func InitialRegisterWebSocketMessage(msgType int, data []byte) (*lkprotocol.ServerMessage, error)

func IsConnectFailure

func IsConnectFailure(err error) bool

func JobAcceptIdentity

func JobAcceptIdentity(job *lkprotocol.Job, identity string) string

func JobAgentName

func JobAgentName(job *lkprotocol.Job) string

func JobAvatarStartInfo

func JobAvatarStartInfo(job *lkprotocol.Job, url string, token string, agentIdentity string) agent.AvatarStartInfo

func JobConnectInfo

func JobConnectInfo(job *lkprotocol.Job, opts ConnectInfoOptions) lksdk.ConnectInfo

func JobContextAvatarStartInfo

func JobContextAvatarStartInfo(job *Job, url string, token string, agentIdentity string) agent.AvatarStartInfo

func JobContextInferenceHeaders

func JobContextInferenceHeaders(job *Job) map[string]string

func JobContextJobID

func JobContextJobID(job *Job) string

func JobContextJoinPreparedRoom

func JobContextJoinPreparedRoom(ctx context.Context, opts AcceptedJobRoomConnectOptions) error

func JobContextLocalParticipantIdentity

func JobContextLocalParticipantIdentity(token string, fallbackIdentity string) string

func JobContextLogFields

func JobContextLogFields(job *Job) map[string]any

func JobContextMoveParticipant

func JobContextMoveParticipant(ctx context.Context, api MoveParticipantAPI, job *Job, room string, identity string, destinationRoom string) error

func JobContextParticipantIdentity

func JobContextParticipantIdentity(job *Job, fallbackIdentity string) string

func JobContextRoomName

func JobContextRoomName(job *Job) string

func JobContextRoomReadyForRoomIOStart added in v0.1.6

func JobContextRoomReadyForRoomIOStart(room *SDKRoom) bool

func JobContextTransferSIPParticipantByParticipant

func JobContextTransferSIPParticipantByParticipant(ctx context.Context, api SIPAPI, job *Job, participant any, transferTo string, playDialtones ...bool) error

func JobContextWaitForParticipantAttribute

func JobContextWaitForParticipantAttribute(ctx context.Context, room *SDKRoom, identity string, attribute string, value string) error

func JobCreateSIPParticipantRequest

func JobCreateSIPParticipantRequest(
	job *lkprotocol.Job,
	callTo string,
	trunkID string,
	identity string,
	name string,
) *lkprotocol.CreateSIPParticipantRequest

func JobFromIPC

func JobFromIPC(job workeripc.Job) (*lkprotocol.Job, error)

func JobID

func JobID(job *lkprotocol.Job) string

func JobInferenceHeaders

func JobInferenceHeaders(job *lkprotocol.Job) map[string]string

func JobLogContextFields

func JobLogContextFields(job *lkprotocol.Job) map[string]any

func JobParticipantIdentity

func JobParticipantIdentity(job *lkprotocol.Job, acceptedIdentity string) string

func JobPublisher

func JobPublisher(job *lkprotocol.Job) *lkprotocol.ParticipantInfo

func JobRoom

func JobRoom(job *lkprotocol.Job) *lkprotocol.Room

func JobRoomName

func JobRoomName(job *lkprotocol.Job) string

func JobRunningMessage

func JobRunningMessage(jobID string) *lkprotocol.WorkerMessage

func JobStatusForEntrypointResult

func JobStatusForEntrypointResult(err error, recovered any) lkprotocol.JobStatus

func JobStatusMessage

func JobStatusMessage(jobID string, status lkprotocol.JobStatus) *lkprotocol.WorkerMessage

func JobStatusSucceeded

func JobStatusSucceeded(status lkprotocol.JobStatus) bool

func JobTransferSIPParticipantRequest

func JobTransferSIPParticipantRequest(
	job *lkprotocol.Job,
	identity string,
	transferTo string,
	playDialtone bool,
) *lkprotocol.TransferSIPParticipantRequest

func JobTypeForWorkerType

func JobTypeForWorkerType(workerType string) lkprotocol.JobType

func JobTypeNameForWorkerType

func JobTypeNameForWorkerType(workerType string) string

func JoinPreparedRoom

func JoinPreparedRoom(ctx context.Context, opts PreparedRoomConnectOptions) error

func LocalAgentToken

func LocalAgentToken(apiKey string, apiSecret string, identity string, room string, ttl time.Duration) (string, error)

func LocalJobIdentity

func LocalJobIdentity(token string, explicitIdentity string, newIdentity func(string) string) string

func LocalJobParticipantIdentityForRun

func LocalJobParticipantIdentityForRun(token string, participantIdentity string) (string, error)

func LocalJobSessionReportPath

func LocalJobSessionReportPath(opts LocalJobOptions, sessionDirectory string) string

func LocalJobToken

func LocalJobToken(existingToken string, apiKey string, apiSecret string, identity string, room string, ttl time.Duration) (string, error)

func LocalJobTokenIdentity

func LocalJobTokenIdentity(token string) (string, error)

func LocalParticipantIdentity

func LocalParticipantIdentity(token string, fallbackIdentity string) string

func LocalRoomJob

func LocalRoomJob(opts LocalRoomJobOptions) *lkprotocol.Job

func MarshalWorkerMessage

func MarshalWorkerMessage(msg *lkprotocol.WorkerMessage) ([]byte, error)

func MigratableRunningJobIDs

func MigratableRunningJobIDs(jobs []RunningJobInfo) []string

func MigrateJobMessage

func MigrateJobMessage(jobIDs []string) *lkprotocol.WorkerMessage

func MigrateRunningJobsMessage

func MigrateRunningJobsMessage(jobs []RunningJobInfo) *lkprotocol.WorkerMessage

func MoveParticipant

func MoveParticipant(ctx context.Context, api MoveParticipantAPI, job *lkprotocol.Job, room string, identity string, destinationRoom string) error

func MoveParticipantRequest

func MoveParticipantRequest(job *lkprotocol.Job, room string, identity string, destinationRoom string) *lkprotocol.MoveParticipantRequest

func NewJobContextSessionReport

func NewJobContextSessionReport(job *Job) (*agent.SessionReport, *agent.Tagger)

func NewJobSessionReport

func NewJobSessionReport(job *lkprotocol.Job) (*agent.SessionReport, *agent.Tagger)

func NormalizeAutoSubscribeMode

func NormalizeAutoSubscribeMode(mode string) string

func ParticipantInfoFromRemoteParticipant

func ParticipantInfoFromRemoteParticipant(participant RemoteParticipantView) *lkprotocol.ParticipantInfo

func ParticipantInfoKindAllowed

func ParticipantInfoKindAllowed(kinds []lkprotocol.ParticipantInfo_Kind, participant *lkprotocol.ParticipantInfo) bool

func PopulateJobContextSessionReport

func PopulateJobContextSessionReport(report *agent.SessionReport, job *Job)

func PopulateSessionReportWithJobMetadata

func PopulateSessionReportWithJobMetadata(report *agent.SessionReport, job *lkprotocol.Job)

func PrepareLocalJobRunOptions

func PrepareLocalJobRunOptions(participantIdentity string, opts LocalJobOptions) (string, error)

func PrepareServerLocalJobRunOptions

func PrepareServerLocalJobRunOptions(participantIdentity string, opts LocalJobOptions) (string, error)

func ProcessJobEnv

func ProcessJobEnv(baseEnv []string, processID string, info RunningJobInfo) ([]string, error)

func RefreshToken

func RefreshToken(token string, apiSecret string, now time.Time, ttl time.Duration) (string, error)

func RegisterWorkerRequest

func RegisterWorkerRequest(opts RegisterWorkerOptions) *lkprotocol.WorkerMessage

func RetryDelay

func RetryDelay(retryCount int) time.Duration

func RoomCallbackWithHandlers

func RoomCallbackWithHandlers(cb *lksdk.RoomCallback, handlers RoomCallbackHandlers) *lksdk.RoomCallback

func RoomDeleteNotFound

func RoomDeleteNotFound(err error) bool

func RoomLocalParticipant

func RoomLocalParticipant(room *lksdk.Room) *lksdk.LocalParticipant

func RunRunningJobEntrypointLifecycle

func RunRunningJobEntrypointLifecycle(opts RunningJobEntrypointLifecycleOptions) error

func RunServerMessageLoop

func RunServerMessageLoop(ctx context.Context, opts ServerMessageLoopOptions) error

func RunServerRunningJobEntrypointLifecycle

func RunServerRunningJobEntrypointLifecycle(opts RunningJobEntrypointLifecycleOptions) error

func RunWorkerMessageLoop

func RunWorkerMessageLoop(ctx context.Context, opts WorkerMessageLoopOptions) error

func ServerLocalJobSessionReportPath

func ServerLocalJobSessionReportPath(opts LocalJobOptions, sessionDirectory string) string

func ServerLogLevelFromEnv

func ServerLogLevelFromEnv(lookupEnv func(string) string) string

func ServerMessageFrame

func ServerMessageFrame(binary bool, data []byte) (*lkprotocol.ServerMessage, error)

func ServerMessageWebSocketFrame

func ServerMessageWebSocketFrame(msgType int, data []byte) (*lkprotocol.ServerMessage, error)

func ServerMigratableRunningJobIDs

func ServerMigratableRunningJobIDs(jobs []RunningJobInfo) []string

func ServerRecordingOptions

func ServerRecordingOptions() agent.RecordingOptions

func ShouldAutoSubscribeTrack

func ShouldAutoSubscribeTrack(mode string, kind lksdk.TrackKind) bool

func ShouldSkipExternalAPIForFakeJob

func ShouldSkipExternalAPIForFakeJob(fakeJob bool) bool

func ShouldUploadJobSessionReport

func ShouldUploadJobSessionReport(job *lkprotocol.Job, fakeJob bool, report *agent.SessionReport) bool

func StopPendingAssignmentTimer

func StopPendingAssignmentTimer[T PendingAssignmentTimer](pending map[string]T, jobID string)

func StorePendingAccept

func StorePendingAccept(opts PendingAcceptStoreOptions)

func StoreServerPendingAccept

func StoreServerPendingAccept(opts PendingAcceptStoreOptions)

func ToIPCRunningJobInfo

func ToIPCRunningJobInfo(info RunningJobInfo) workeripc.RunningJobInfo

func TokenClaims

func TokenClaims(token string) (*auth.ClaimGrants, error)

func TokenIdentity

func TokenIdentity(token string) (string, error)

func TransferSIPParticipant

func TransferSIPParticipant(
	ctx context.Context,
	api SIPAPI,
	job *lkprotocol.Job,
	identity string,
	transferTo string,
	playDialtone bool,
) error

func TransferSIPParticipantByParticipant

func TransferSIPParticipantByParticipant(
	ctx context.Context,
	api SIPAPI,
	job *lkprotocol.Job,
	participant any,
	transferTo string,
	playDialtones ...bool,
) error

func TransferSIPParticipantIdentity

func TransferSIPParticipantIdentity(participant any) (string, error)

func TransferSIPParticipantRequest

func TransferSIPParticipantRequest(
	roomName string,
	identity string,
	transferTo string,
	playDialtone bool,
) *lkprotocol.TransferSIPParticipantRequest

func UnmarshalServerMessage

func UnmarshalServerMessage(data []byte) (*lkprotocol.ServerMessage, error)

func UpsertParticipantInfo

func UpsertParticipantInfo(participants []*lkprotocol.ParticipantInfo, info *lkprotocol.ParticipantInfo) []*lkprotocol.ParticipantInfo

func ValidateLocalJobRunOptions

func ValidateLocalJobRunOptions(participantIdentity string, opts LocalJobOptions) error

func ValidateServerConnectionOptions

func ValidateServerConnectionOptions(opts ServerConnectionOptions) error

func ValidateWorkerConnectionOptions

func ValidateWorkerConnectionOptions(opts WorkerConnectionOptions) error

func WaitForAgent

func WaitForAgent(ctx context.Context, room *lksdk.Room, agentName ...string) (*lksdk.RemoteParticipant, error)

func WaitForParticipant

func WaitForParticipant(
	ctx context.Context,
	room *lksdk.Room,
	identity string,
	kinds ...lkprotocol.ParticipantInfo_Kind,
) (*lksdk.RemoteParticipant, error)

func WaitForParticipantAttribute

func WaitForParticipantAttribute(
	ctx context.Context,
	room *lksdk.Room,
	identity string,
	attribute string,
	value string,
) error

func WaitForTrackPublication

func WaitForTrackPublication(
	ctx context.Context,
	room *lksdk.Room,
	identity string,
	kinds ...lkprotocol.TrackType,
) (*lksdk.RemoteTrackPublication, error)

func WaitForTrackPublicationWithOptions

func WaitForTrackPublicationWithOptions(
	ctx context.Context,
	room *lksdk.Room,
	options TrackPublicationWaitOptions,
) (*lksdk.RemoteTrackPublication, error)

func WorkerAuthHeader

func WorkerAuthHeader(token string) http.Header

func WorkerAuthToken

func WorkerAuthToken(apiKey string, apiSecret string, ttl time.Duration) (string, error)

func WorkerConnectionFailureMessage

func WorkerConnectionFailureMessage() string

func WorkerLogLevelFromEnv

func WorkerLogLevelFromEnv(getenv func(string) string) string

func WorkerMessageFrame

func WorkerMessageFrame(msg *lkprotocol.WorkerMessage) (bool, []byte, error)

func WorkerMessageWebSocketFrame

func WorkerMessageWebSocketFrame(msg *lkprotocol.WorkerMessage) (int, []byte, error)

func WorkerStatusMessage

func WorkerStatusMessage(status lkprotocol.WorkerStatus, load float64, jobCount uint32) *lkprotocol.WorkerMessage

func WorkerWebSocketDialer

func WorkerWebSocketDialer(httpProxy string) (*websocket.Dialer, error)

func WriteServerWorkerMessageWebSocket

func WriteServerWorkerMessageWebSocket(writer WorkerMessageWebSocketWriter, msg *WorkerMessage) error

func WriteWorkerMessageWebSocket

func WriteWorkerMessageWebSocket(writer WorkerMessageWebSocketWriter, msg *lkprotocol.WorkerMessage) error

func WriteWorkerRuntimeMetadataHTTPResponse

func WriteWorkerRuntimeMetadataHTTPResponse(w http.ResponseWriter, opts WorkerRuntimeMetadataOptions) error

Types

type AcceptedJobRoomConnectOptions

type AcceptedJobRoomConnectOptions struct {
	Room          *lksdk.Room
	URL           string
	Token         string
	Job           *lkprotocol.Job
	APIKey        string
	APISecret     string
	Accept        JobAcceptArguments
	Identity      string
	AutoSubscribe string
	Connector     RoomConnector
}

type AgentNameEnvOptions

type AgentNameEnvOptions struct {
	AgentName      string
	AgentNameIsEnv bool
	LookupEnv      func(string) string
}

type AgentNameEnvResult

type AgentNameEnvResult struct {
	AgentName      string
	AgentNameIsEnv bool
}

func ResolveAgentNameFromEnv

func ResolveAgentNameFromEnv(opts AgentNameEnvOptions) AgentNameEnvResult

func ResolveServerAgentNameFromEnv

func ResolveServerAgentNameFromEnv(opts AgentNameEnvOptions) AgentNameEnvResult

type AssignmentContextValueOptions

type AssignmentContextValueOptions struct {
	Assignment      AssignmentInfo
	AcceptArguments JobAcceptArguments
	WorkerID        string
}

type AssignmentContextValuesResult

type AssignmentContextValuesResult struct {
	Job             *lkprotocol.Job
	JobID           string
	URL             string
	Token           string
	WorkerID        string
	AcceptArguments JobAcceptArguments
	EnableRecording bool
}

type AssignmentInfo

type AssignmentInfo struct {
	Job             *lkprotocol.Job
	JobID           string
	URL             string
	Token           string
	EnableRecording bool
}

func JobAssignmentInfo

func JobAssignmentInfo(req *JobAssignment, defaultURL string) AssignmentInfo

type AudioDecoder

type AudioDecoder interface {
	Decode(data []byte) ([]byte, error)
	Close() error
}

type AudioEncoder

type AudioEncoder interface {
	Encode(pcm []byte) ([]byte, error)
	Close() error
}

type AutoSubscribe

type AutoSubscribe string
const (
	AutoSubscribeSubscribeAll  AutoSubscribe = "subscribe_all"
	AutoSubscribeSubscribeNone AutoSubscribe = "subscribe_none"
	AutoSubscribeAudioOnly     AutoSubscribe = "audio_only"
	AutoSubscribeVideoOnly     AutoSubscribe = "video_only"
)

type AvailabilityAcceptOptions

type AvailabilityAcceptOptions = JobAcceptArguments

type AvailabilityAnswerOptions

type AvailabilityAnswerOptions struct {
	Request                  *AvailabilityRequest
	AgentName                string
	AvailableForJob          func() bool
	ReserveSlot              func()
	ReleaseSlot              func()
	StoreAccept              func(jobID string, args JobAcceptArguments)
	Send                     func(*lkprotocol.WorkerMessage) error
	HandleRequest            func(*JobRequest) error
	OnRequestError           func(error, string)
	OnUnavailableRejectError func(error, string)
}

type AvailabilityRejectOptions

type AvailabilityRejectOptions = JobRejectArguments

type AvailabilityRequest

type AvailabilityRequest = lkprotocol.AvailabilityRequest

type AvailabilityRequestInfo

type AvailabilityRequestInfo struct {
	Job   *lkprotocol.Job
	JobID string
}

type AvailabilityResponder

type AvailabilityResponder struct {
	// contains filtered or unexported fields
}

func (*AvailabilityResponder) Accept

func (*AvailabilityResponder) Answered

func (r *AvailabilityResponder) Answered() bool

func (*AvailabilityResponder) JobRequest

func (r *AvailabilityResponder) JobRequest() *JobRequest

func (*AvailabilityResponder) Reject

func (*AvailabilityResponder) RejectIfUnanswered

func (r *AvailabilityResponder) RejectIfUnanswered(args JobRejectArguments) error

type AvailabilityResponderOptions

type AvailabilityResponderOptions struct {
	Request     *AvailabilityRequest
	AgentName   string
	StoreAccept func(jobID string, args JobAcceptArguments)
	Send        func(*lkprotocol.WorkerMessage) error
}

type AvatarStartInfoOptions

type AvatarStartInfoOptions struct {
	URL           string
	Token         string
	RoomName      string
	AgentIdentity string
}

type ClaimGrants

type ClaimGrants = auth.ClaimGrants

func JobContextTokenClaims

func JobContextTokenClaims(token string) (*ClaimGrants, error)

type ConnectInfoOptions

type ConnectInfoOptions struct {
	APIKey                string
	APISecret             string
	RoomName              string
	ParticipantName       string
	ParticipantIdentity   string
	ParticipantMetadata   string
	ParticipantAttributes map[string]string
}

type ConnectOptions

type ConnectOptions struct {
	AutoSubscribe AutoSubscribe
}

func JobContextNormalizeConnectOptions

func JobContextNormalizeConnectOptions(options ...ConnectOptions) ConnectOptions

func NormalizeConnectOptions

func NormalizeConnectOptions(options ...ConnectOptions) ConnectOptions

type DeleteRoomAPI

type DeleteRoomAPI interface {
	DeleteRoom(context.Context, *lkprotocol.DeleteRoomRequest) (*lkprotocol.DeleteRoomResponse, error)
}

type DeleteRoomPlanResult

type DeleteRoomPlanResult struct {
	Skip     bool
	Response *lkprotocol.DeleteRoomResponse
}

func DeleteRoomPlan

func DeleteRoomPlan(fakeJob bool) DeleteRoomPlanResult

func JobContextDeleteRoomPlan

func JobContextDeleteRoomPlan(fakeJob bool) DeleteRoomPlanResult

type DeleteRoomResponse

type DeleteRoomResponse = lkprotocol.DeleteRoomResponse

func JobContextDeleteRoomBestEffort

func JobContextDeleteRoomBestEffort(ctx context.Context, api DeleteRoomAPI, job *Job, roomName string) (*DeleteRoomResponse, error)

type EntrypointResult

type EntrypointResult struct {
	Status    lkprotocol.JobStatus
	Err       error
	Recovered any
}

func RunEntrypoint

func RunEntrypoint(entrypoint func() error) (result EntrypointResult)

func RunServerJobEntrypointLifecycle

func RunServerJobEntrypointLifecycle(opts JobEntrypointLifecycleOptions) EntrypointResult

type Job

type Job = lkprotocol.Job

type JobAPI

type JobAPI struct {
	RoomService JobRoomServiceAPI
	SIP         JobSIPAPI
}

func NewJobAPI

func NewJobAPI(url string, apiKey string, apiSecret string) *JobAPI

func NewJobContextAPI

func NewJobContextAPI(url string, apiKey string, apiSecret string) *JobAPI

type JobAcceptArguments

type JobAcceptArguments struct {
	Name       string            `json:"name"`
	Identity   string            `json:"identity"`
	Metadata   string            `json:"metadata"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

func AcceptPendingAssignment

func AcceptPendingAssignment[T PendingAssignmentTimer](
	pending map[string]JobAcceptArguments,
	timers map[string]T,
	jobID string,
) (JobAcceptArguments, bool)

func AcceptServerPendingAssignment

func AcceptServerPendingAssignment[T PendingAssignmentTimer](
	pending map[string]JobAcceptArguments,
	timers map[string]T,
	jobID string,
) (JobAcceptArguments, bool)

func CloneJobAcceptArguments

func CloneJobAcceptArguments(args JobAcceptArguments) JobAcceptArguments

func FromIPCJobAcceptArguments

func FromIPCJobAcceptArguments(args workeripc.JobAcceptArguments) JobAcceptArguments

func JobAcceptArgumentsForJob

func JobAcceptArgumentsForJob(job *lkprotocol.Job, args JobAcceptArguments) JobAcceptArguments

func PopPendingAccept

func PopPendingAccept(pending map[string]JobAcceptArguments, jobID string) (JobAcceptArguments, bool)

type JobAssignment

type JobAssignment = lkprotocol.JobAssignment

type JobCompletionPlan

type JobCompletionPlan struct {
	Finish          bool
	WaitForShutdown bool
	SendStatus      bool
	SendAfterFinish bool
}

func JobCompletionPlanForEntrypoint

func JobCompletionPlanForEntrypoint(status lkprotocol.JobStatus, terminated bool) JobCompletionPlan

type JobEntrypointLifecycleOptions

type JobEntrypointLifecycleOptions struct {
	Context      context.Context
	Entrypoint   func() error
	MarkDone     func()
	OnResult     func(EntrypointResult)
	Terminated   func() bool
	ShutdownDone <-chan struct{}
	Shutdown     func(string)
	Finish       func() bool
	SendStatus   func(lkprotocol.JobStatus) error
}

type JobFinishPlanResult

type JobFinishPlanResult struct {
	Finish bool
	JobID  string
}

func JobFinishPlan

func JobFinishPlan(job *lkprotocol.Job) JobFinishPlanResult

func ServerJobFinishPlan

func ServerJobFinishPlan(job *lkprotocol.Job) JobFinishPlanResult

type JobRejectArguments

type JobRejectArguments struct {
	Terminate bool
}

func DefaultJobRejectArguments

func DefaultJobRejectArguments() JobRejectArguments

type JobRequest

type JobRequest struct {
	Job *lkprotocol.Job
	// contains filtered or unexported fields
}

func NewJobRequest

func NewJobRequest(
	job *lkprotocol.Job,
	accept func(JobAcceptArguments) error,
	reject func(JobRejectArguments) error,
) *JobRequest

func (*JobRequest) Accept

func (r *JobRequest) Accept(args ...JobAcceptArguments) error

func (*JobRequest) AgentName

func (r *JobRequest) AgentName() string

func (*JobRequest) ID

func (r *JobRequest) ID() string

func (*JobRequest) Publisher

func (r *JobRequest) Publisher() *lkprotocol.ParticipantInfo

func (*JobRequest) Reject

func (r *JobRequest) Reject(args ...JobRejectArguments) error

func (*JobRequest) Room

func (r *JobRequest) Room() *lkprotocol.Room

type JobSessionEndPlanOptions

type JobSessionEndPlanOptions struct {
	Job            *lkprotocol.Job
	TimeoutSeconds float64
}

type JobSessionEndPlanResult

type JobSessionEndPlanResult struct {
	JobID   string
	Timeout time.Duration
}

type JobSessionReportUploadPlanOptions

type JobSessionReportUploadPlanOptions struct {
	Job       *lkprotocol.Job
	FakeJob   bool
	Report    *agent.SessionReport
	URL       string
	APIKey    string
	APISecret string
	AgentName string
}

type JobSessionReportUploadPlanResult

type JobSessionReportUploadPlanResult struct {
	Upload    bool
	JobID     string
	Report    *agent.SessionReport
	URL       string
	APIKey    string
	APISecret string
	AgentName string
}

type JobStatus

type JobStatus = lkprotocol.JobStatus

type JobTermination

type JobTermination = lkprotocol.JobTermination

type JobTerminationPlan

type JobTerminationPlan struct {
	MarkTerminated bool
	Shutdown       bool
	WaitEntrypoint bool
	Finish         bool
}

func JobTerminationPlanForActiveJob

func JobTerminationPlanForActiveJob(exists bool) JobTerminationPlan

func ServerJobTerminationPlanForActiveJob

func ServerJobTerminationPlanForActiveJob(exists bool) JobTerminationPlan

type LocalJobContextSetupPlanOptions

type LocalJobContextSetupPlanOptions = LocalJobContextValueOptions

type LocalJobContextSetupPlanResult

type LocalJobContextSetupPlanResult struct {
	Job              *lkprotocol.Job
	AcceptIdentity   string
	Token            string
	FakeJob          bool
	InitRecording    bool
	RecordingOptions agent.RecordingOptions
	SessionDirectory string
}

type LocalJobContextValueOptions

type LocalJobContextValueOptions struct {
	RoomName            string
	ParticipantIdentity string
	APIKey              string
	APISecret           string
	TTL                 time.Duration
	Options             LocalJobOptions
	NewIdentity         func(string) string
}

type LocalJobContextValuesResult

type LocalJobContextValuesResult struct {
	Job                 *lkprotocol.Job
	ParticipantIdentity string
	Token               string
}

type LocalJobExecutorPlanResult

type LocalJobExecutorPlanResult = LocalJobRuntimeInfo

func LocalJobExecutorPlan

func LocalJobExecutorPlan(job *lkprotocol.Job) LocalJobExecutorPlanResult

func ServerLocalJobExecutorPlan

func ServerLocalJobExecutorPlan(job *lkprotocol.Job) LocalJobExecutorPlanResult

type LocalJobOptions

type LocalJobOptions struct {
	FakeJob           bool
	RoomInfo          *lkprotocol.Room
	Token             string
	RecordingOptions  agent.RecordingOptions
	SessionReportPath string
	SessionDirectory  string
}

func DefaultFakeLocalJobOptions

func DefaultFakeLocalJobOptions() LocalJobOptions

func DefaultServerFakeLocalJobOptions

func DefaultServerFakeLocalJobOptions() LocalJobOptions

type LocalJobRuntimeInfo

type LocalJobRuntimeInfo struct {
	JobID      string
	ExecutorID string
}

func LocalJobInfo

func LocalJobInfo(job *lkprotocol.Job) LocalJobRuntimeInfo

type LocalParticipant

type LocalParticipant = lksdk.LocalParticipant

func JobContextLocalParticipant

func JobContextLocalParticipant(room *SDKRoom) *LocalParticipant

type LocalRoomJobOptions

type LocalRoomJobOptions struct {
	RoomName string
	RoomInfo *lkprotocol.Room
	FakeJob  bool
	NewID    func(prefix string) string
}

type MetricInfo

type MetricInfo struct {
	RoomName string
}

func JobMetricInfo

func JobMetricInfo(job *lkprotocol.Job) MetricInfo

type MoveParticipantAPI

type MoveParticipantAPI interface {
	MoveParticipant(context.Context, *lkprotocol.MoveParticipantRequest) (*lkprotocol.MoveParticipantResponse, error)
}

type MoveParticipantPlanResult

type MoveParticipantPlanResult struct {
	Skip bool
}

func JobContextMoveParticipantPlan

func JobContextMoveParticipantPlan(fakeJob bool) MoveParticipantPlanResult

func MoveParticipantPlan

func MoveParticipantPlan(fakeJob bool) MoveParticipantPlanResult

type ParticipantDetails

type ParticipantDetails struct {
	Identity string
	Kind     lkprotocol.ParticipantInfo_Kind
}

func ParticipantInfoDetails

func ParticipantInfoDetails(participant *lkprotocol.ParticipantInfo) ParticipantDetails

type ParticipantEntrypointRegistrationOptions

type ParticipantEntrypointRegistrationOptions struct {
	Entrypoint            uintptr
	RegisteredEntrypoints []uintptr
	Kinds                 []lkprotocol.ParticipantInfo_Kind
}

type ParticipantEntrypointTaskPlanResult

type ParticipantEntrypointTaskPlanResult struct {
	Schedule    bool
	Participant ParticipantDetails
	TaskKey     ParticipantTaskKey
}

func JobContextParticipantEntrypointTaskPlan

func JobContextParticipantEntrypointTaskPlan(participant *ParticipantInfo, kinds []ParticipantInfoKind, entrypoint uintptr) ParticipantEntrypointTaskPlanResult

type ParticipantInfo

type ParticipantInfo = lkprotocol.ParticipantInfo

func JobContextParticipantInfoFromRemoteParticipant

func JobContextParticipantInfoFromRemoteParticipant(participant RemoteParticipantView) *ParticipantInfo

func JobContextPublisher

func JobContextPublisher(job *Job) *ParticipantInfo

func JobContextUpsertParticipantInfo

func JobContextUpsertParticipantInfo(participants []*ParticipantInfo, participant *ParticipantInfo) []*ParticipantInfo

type ParticipantInfoKind

type ParticipantInfoKind = lkprotocol.ParticipantInfo_Kind

type ParticipantTaskKey

type ParticipantTaskKey struct {
	Identity   string
	Entrypoint uintptr
}

func ParticipantEntrypointTaskKey

func ParticipantEntrypointTaskKey(participant *lkprotocol.ParticipantInfo, entrypoint uintptr) ParticipantTaskKey

type PendingAcceptStoreOptions

type PendingAcceptStoreOptions struct {
	Pending   map[string]JobAcceptArguments
	Timers    map[string]*time.Timer
	JobID     string
	Args      JobAcceptArguments
	Timeout   time.Duration
	OnTimeout func(jobID string, timer *time.Timer)
}

type PendingAssignmentTimer

type PendingAssignmentTimer interface {
	Stop() bool
}

type PlaybackFinishedEvent

type PlaybackFinishedEvent struct {
	PlaybackPosition          time.Duration
	Interrupted               bool
	SynchronizedTranscript    string
	HasSynchronizedTranscript bool
	AudioFrames               int
	AudioBytes                int
	AudioEncodedFrames        int
	AudioSampleRate           uint32
	AudioChannels             uint32
	AudioLastError            string
}

type PlaybackStartedEvent

type PlaybackStartedEvent struct {
	CreatedAt time.Time
}

type PreConnectAudioBuffer

type PreConnectAudioBuffer struct {
	Timestamp time.Time
	Frames    []*model.AudioFrame
}

type PreConnectAudioHandler

type PreConnectAudioHandler struct {
	// contains filtered or unexported fields
}

func NewPreConnectAudioHandler

func NewPreConnectAudioHandler(room *lksdk.Room, timeout time.Duration) *PreConnectAudioHandler

func (*PreConnectAudioHandler) Close

func (h *PreConnectAudioHandler) Close()

func (*PreConnectAudioHandler) Register

func (h *PreConnectAudioHandler) Register()

func (*PreConnectAudioHandler) WaitForData

func (h *PreConnectAudioHandler) WaitForData(ctx context.Context, trackID string) []*model.AudioFrame

type PreparedRoomConnectOptions

type PreparedRoomConnectOptions struct {
	Room          *lksdk.Room
	URL           string
	Token         string
	Job           *lkprotocol.Job
	APIKey        string
	APISecret     string
	Accept        ConnectInfoOptions
	AutoSubscribe string
	Connector     RoomConnector
}

type RecorderIO

type RecorderIO struct {
	Session *agent.AgentSession

	InputStartTime  *time.Time
	OutputStartTime *time.Time
	// contains filtered or unexported fields
}

func NewRecorderIO

func NewRecorderIO(session *agent.AgentSession) *RecorderIO

func (*RecorderIO) OutputPath

func (r *RecorderIO) OutputPath() string

func (*RecorderIO) PopulateSessionReport

func (r *RecorderIO) PopulateSessionReport(report *agent.SessionReport)

func (*RecorderIO) RecordInput

func (r *RecorderIO) RecordInput(frame *model.AudioFrame)

func (*RecorderIO) RecordOutput

func (r *RecorderIO) RecordOutput(frame *model.AudioFrame)

func (*RecorderIO) Recording

func (r *RecorderIO) Recording() bool

func (*RecorderIO) RecordingStartedAt

func (r *RecorderIO) RecordingStartedAt() *time.Time

func (*RecorderIO) Start

func (r *RecorderIO) Start(outputPath string, sampleRate int) error

func (*RecorderIO) Stop

func (r *RecorderIO) Stop() error

type RegisterMessageInfo

type RegisterMessageInfo struct {
	WorkerID   string
	ServerInfo *lkprotocol.ServerInfo
}

type RegisterWorkerOptions

type RegisterWorkerOptions struct {
	JobType     lkprotocol.JobType
	AgentName   string
	Version     string
	Permissions WorkerPermissions
}

type ReloadedJobContextValueOptions

type ReloadedJobContextValueOptions = RunningJobContextValueOptions

type ReloadedJobEntrypointLifecycleOptions

type ReloadedJobEntrypointLifecycleOptions struct {
	Context         context.Context
	Entrypoint      func() error
	MarkDone        func()
	OnResult        func(EntrypointResult)
	ShutdownDone    <-chan struct{}
	Shutdown        func(string)
	Finish          func() bool
	SendStatus      func(lkprotocol.JobStatus) error
	OnStatusSkipped func()
}

type RemoteParticipant

type RemoteParticipant = lksdk.RemoteParticipant

func JobContextWaitForAgent

func JobContextWaitForAgent(ctx context.Context, room *SDKRoom, agentName ...string) (*RemoteParticipant, error)

func JobContextWaitForParticipant

func JobContextWaitForParticipant(ctx context.Context, room *SDKRoom, identity string, kinds ...ParticipantInfoKind) (*RemoteParticipant, error)

type RemoteParticipantView

type RemoteParticipantView interface {
	SID() string
	Identity() string
	Name() string
	Kind() lksdk.ParticipantKind
	Metadata() string
	Attributes() map[string]string
}

func JobContextRemoteParticipantViews

func JobContextRemoteParticipantViews(room *SDKRoom) []RemoteParticipantView

func RemoteParticipantViews

func RemoteParticipantViews(participants []*lksdk.RemoteParticipant) []RemoteParticipantView

func RoomRemoteParticipantViews

func RoomRemoteParticipantViews(room *lksdk.Room) []RemoteParticipantView

type RemoteTrackPublication

type RemoteTrackPublication = lksdk.RemoteTrackPublication

func JobContextWaitForTrackPublication

func JobContextWaitForTrackPublication(ctx context.Context, room *SDKRoom, identity string, kinds ...TrackType) (*RemoteTrackPublication, error)

func JobContextWaitForTrackPublicationWithOptions

func JobContextWaitForTrackPublicationWithOptions(ctx context.Context, room *SDKRoom, options TrackPublicationWaitOptions) (*RemoteTrackPublication, error)

type RemoteTrackPublicationView

type RemoteTrackPublicationView interface {
	SID() string
	Kind() lksdk.TrackKind
	SetSubscribed(bool) error
}

type RemoteTrackSubscriptionResult

type RemoteTrackSubscriptionResult struct {
	Attempted bool
	TrackSID  string
	Err       error
}

func ApplyAutoSubscribeToRoom

func ApplyAutoSubscribeToRoom(room *lksdk.Room, mode string) []RemoteTrackSubscriptionResult

func JobContextApplyAutoSubscribeToRoom

func JobContextApplyAutoSubscribeToRoom(room *SDKRoom, mode string) []RemoteTrackSubscriptionResult

func SubscribeRemoteTrackIfAllowed

func SubscribeRemoteTrackIfAllowed(mode string, publication RemoteTrackPublicationView) RemoteTrackSubscriptionResult

type Room

type Room = lkprotocol.Room

func JobContextRoom

func JobContextRoom(job *Job) *Room

type RoomCallback

type RoomCallback = lksdk.RoomCallback

func JobContextRoomCallbackWithHandlers

func JobContextRoomCallbackWithHandlers(cb *RoomCallback, handlers RoomCallbackHandlers) *RoomCallback

type RoomCallbackHandlers

type RoomCallbackHandlers struct {
	AutoSubscribe             string
	OnDisconnected            func()
	OnDisconnectedWithReason  func(lksdk.DisconnectionReason)
	OnReconnecting            func()
	OnReconnected             func()
	OnRoomMoved               func(roomName string, token string)
	OnParticipantConnected    func(RemoteParticipantView)
	OnParticipantDisconnected func(RemoteParticipantView)
	OnLocalTrackPublished     func(*lksdk.LocalTrackPublication, *lksdk.LocalParticipant)
	OnLocalTrackSubscribed    func(*lksdk.LocalTrackPublication, *lksdk.LocalParticipant)
	OnTrackSubscribed         func(*webrtc.TrackRemote, *lksdk.RemoteTrackPublication, *lksdk.RemoteParticipant)
	OnTrackUnpublished        func(*lksdk.RemoteTrackPublication, *lksdk.RemoteParticipant)
	OnTrackPublishedEvent     func(*lksdk.RemoteTrackPublication, *lksdk.RemoteParticipant)
	OnAttributesChanged       func(map[string]string, lksdk.Participant)
	OnIsSpeakingChanged       func(lksdk.Participant)
	OnDataPacket              func(lksdk.DataPacket, lksdk.DataReceiveParams)
	OnTrackSubscribeError     func(RemoteTrackSubscriptionResult)
}

type RoomConnectOptions

type RoomConnectOptions struct {
	URL           string
	Token         string
	Job           *lkprotocol.Job
	APIKey        string
	APISecret     string
	Accept        ConnectInfoOptions
	AutoSubscribe string
	Callback      *lksdk.RoomCallback
	Connector     RoomConnector
}

type RoomConnectionStateChangedEvent added in v0.1.6

type RoomConnectionStateChangedEvent struct {
	State string
}

func (*RoomConnectionStateChangedEvent) Type added in v0.1.6

type RoomConnector

type RoomConnector struct {
	ConnectWithToken func(string, string, *lksdk.RoomCallback, ...lksdk.ConnectOption) (*lksdk.Room, error)
	Connect          func(string, lksdk.ConnectInfo, *lksdk.RoomCallback, ...lksdk.ConnectOption) (*lksdk.Room, error)
	JoinWithToken    func(context.Context, *lksdk.Room, string, string, ...lksdk.ConnectOption) error
	Join             func(context.Context, *lksdk.Room, string, lksdk.ConnectInfo, ...lksdk.ConnectOption) error
}

type RoomDisconnectedEvent added in v0.1.6

type RoomDisconnectedEvent struct{}

func (*RoomDisconnectedEvent) Type added in v0.1.6

func (*RoomDisconnectedEvent) Type() string

type RoomEvent added in v0.1.6

type RoomEvent interface {
	Type() string
}

type RoomIO

type RoomIO struct {
	Room         *lksdk.Room
	AgentSession *agent.AgentSession
	Options      RoomOptions
	Recorder     *RecorderIO
	// contains filtered or unexported fields
}

func NewRoomIO

func NewRoomIO(room *lksdk.Room, session *agent.AgentSession, opts RoomOptions) *RoomIO

func (*RoomIO) AttachRoom

func (rio *RoomIO) AttachRoom(room *lksdk.Room)

func (*RoomIO) AudioOutputDiagnostics

func (rio *RoomIO) AudioOutputDiagnostics() RoomIOAudioOutputDiagnostics

func (*RoomIO) CanPauseAudioOutput

func (rio *RoomIO) CanPauseAudioOutput() bool

func (*RoomIO) ClearBuffer

func (rio *RoomIO) ClearBuffer()

func (*RoomIO) Close

func (rio *RoomIO) Close() error

func (*RoomIO) Flush

func (rio *RoomIO) Flush()

func (*RoomIO) GetCallback

func (rio *RoomIO) GetCallback() *lksdk.RoomCallback

func (*RoomIO) LinkedParticipant

func (rio *RoomIO) LinkedParticipant() (string, bool)

func (*RoomIO) OffPlaybackFinished

func (rio *RoomIO) OffPlaybackFinished(callback func(PlaybackFinishedEvent))

func (*RoomIO) OffPlaybackStarted

func (rio *RoomIO) OffPlaybackStarted(callback func(PlaybackStartedEvent))

func (*RoomIO) On added in v0.1.6

func (rio *RoomIO) On(eventType string, callback func(RoomEvent)) func()

func (*RoomIO) OnPlaybackFinished

func (rio *RoomIO) OnPlaybackFinished(callback func(PlaybackFinishedEvent))

func (*RoomIO) OnPlaybackStarted

func (rio *RoomIO) OnPlaybackStarted(callback func(PlaybackStartedEvent))

func (*RoomIO) PauseAudioOutput

func (rio *RoomIO) PauseAudioOutput()

func (*RoomIO) PublishAudio

func (rio *RoomIO) PublishAudio(ctx context.Context, frame *model.AudioFrame) error

func (*RoomIO) PublishDTMF

func (rio *RoomIO) PublishDTMF(code int32, digit string) error

func (*RoomIO) ResumeAudioOutput

func (rio *RoomIO) ResumeAudioOutput()

func (*RoomIO) SetParticipant

func (rio *RoomIO) SetParticipant(participantIdentity string)

func (*RoomIO) Start

func (rio *RoomIO) Start(ctx context.Context) error

func (*RoomIO) UnsetParticipant

func (rio *RoomIO) UnsetParticipant()

func (*RoomIO) WaitForPlayout

func (rio *RoomIO) WaitForPlayout(ctx context.Context) (PlaybackFinishedEvent, error)

func (*RoomIO) WithCallback added in v0.1.6

func (rio *RoomIO) WithCallback(cb *lksdk.RoomCallback) *lksdk.RoomCallback

type RoomIOAudioOutputDiagnostics

type RoomIOAudioOutputDiagnostics struct {
	TrackID                     string
	TrackPublished              bool
	TrackSubscribed             bool
	FramesReceived              int
	FramesPublished             int
	BytesReceived               int
	BytesPublished              int
	EncodedFramesPublished      int
	LastInputSampleRate         uint32
	LastInputSamplesPerChannel  uint32
	LastInputChannels           uint32
	LastPublishedSampleRate     uint32
	LastPublishedSamplesPerChan uint32
	LastPublishedChannels       uint32
	LastFrameAt                 time.Time
	LastPublishedAt             time.Time
	LastError                   string
	LastErrorAt                 time.Time
}

type RoomLocalTrackPublishedEvent added in v0.1.6

type RoomLocalTrackPublishedEvent struct {
	Publication *lksdk.LocalTrackPublication
	Participant *lksdk.LocalParticipant
}

func (*RoomLocalTrackPublishedEvent) Type added in v0.1.6

type RoomMovedEvent added in v0.1.6

type RoomMovedEvent struct {
	RoomName string
	Token    string
}

func (*RoomMovedEvent) Type added in v0.1.6

func (*RoomMovedEvent) Type() string

type RoomOptions

type RoomOptions struct {
	AudioTrackName             string
	AudioSubscriptionTimeout   time.Duration
	PreConnectAudioTimeout     time.Duration
	DisablePreConnectAudio     bool
	DisableAudioInput          bool
	DisableTextInput           bool
	DisableAudioOutput         bool
	DisableTranscriptionOutput bool
	TranscriptionJSONFormat    bool
	TranscriptionNextOutput    TranscriptionTextOutput
	DisableCloseOnDisconnect   bool
	DeleteRoomOnClose          bool
	DeleteRoom                 func(context.Context, string) error
	TextInputCallback          TextInputCallback
	ParticipantIdentity        string
	ParticipantKinds           []lksdk.ParticipantKind
}

type RoomParticipantActiveEvent added in v0.1.6

type RoomParticipantActiveEvent struct {
	Participant lksdk.Participant
}

func (*RoomParticipantActiveEvent) Type added in v0.1.6

type RoomParticipantAttributesChangedEvent added in v0.1.6

type RoomParticipantAttributesChangedEvent struct {
	Changed     map[string]string
	Participant lksdk.Participant
}

func (*RoomParticipantAttributesChangedEvent) Type added in v0.1.6

type RoomParticipantConnectedEvent added in v0.1.6

type RoomParticipantConnectedEvent struct {
	Participant *lksdk.RemoteParticipant
}

func (*RoomParticipantConnectedEvent) Type added in v0.1.6

type RoomParticipantDisconnectedEvent added in v0.1.6

type RoomParticipantDisconnectedEvent struct {
	Participant *lksdk.RemoteParticipant
}

func (*RoomParticipantDisconnectedEvent) Type added in v0.1.6

type RoomSipDTMFReceivedEvent added in v0.1.6

type RoomSipDTMFReceivedEvent struct {
	Event  *livekit.SipDTMF
	Params lksdk.DataReceiveParams
}

func (*RoomSipDTMFReceivedEvent) Type added in v0.1.6

type RoomTrackPublishedEvent added in v0.1.6

type RoomTrackPublishedEvent struct {
	Publication *lksdk.RemoteTrackPublication
	Participant *lksdk.RemoteParticipant
}

func (*RoomTrackPublishedEvent) Type added in v0.1.6

type RoomTrackSubscribedEvent added in v0.1.6

type RoomTrackSubscribedEvent struct {
	Track       *webrtc.TrackRemote
	Publication *lksdk.RemoteTrackPublication
	Participant *lksdk.RemoteParticipant
}

func (*RoomTrackSubscribedEvent) Type added in v0.1.6

type RoomTrackUnpublishedEvent added in v0.1.6

type RoomTrackUnpublishedEvent struct {
	Publication *lksdk.RemoteTrackPublication
	Participant *lksdk.RemoteParticipant
}

func (*RoomTrackUnpublishedEvent) Type added in v0.1.6

type RunningJobContextValueOptions

type RunningJobContextValueOptions struct {
	Info            RunningJobInfo
	OverrideURL     string
	DefaultWorkerID string
}

type RunningJobContextValuesResult

type RunningJobContextValuesResult struct {
	Job             *lkprotocol.Job
	JobID           string
	URL             string
	Token           string
	WorkerID        string
	AcceptArguments JobAcceptArguments
	FakeJob         bool
	EnableRecording bool
}

type RunningJobEntrypointLifecycleOptions

type RunningJobEntrypointLifecycleOptions struct {
	Context            context.Context
	Entrypoint         func() error
	MarkStarted        func()
	MarkDone           func()
	ShutdownDone       <-chan struct{}
	Shutdown           func(string)
	WaitEntrypointDone func(time.Duration) bool
	CloseWait          time.Duration
	Finish             func() bool
	OnPanic            func(any)
	OnError            func(error)
	OnCancelTimeout    func()
}

type RunningJobInfo

type RunningJobInfo struct {
	AcceptArguments JobAcceptArguments `json:"accept_arguments"`
	Job             *lkprotocol.Job    `json:"job"`
	URL             string             `json:"url"`
	Token           string             `json:"token"`
	WorkerID        string             `json:"worker_id"`
	FakeJob         bool               `json:"fake_job"`
}

func CloneRunningJobInfo

func CloneRunningJobInfo(info RunningJobInfo) RunningJobInfo

func FromIPCRunningJobInfo

func FromIPCRunningJobInfo(info workeripc.RunningJobInfo) (RunningJobInfo, error)

func FromIPCRunningJobInfos

func FromIPCRunningJobInfos(infos []workeripc.RunningJobInfo) ([]RunningJobInfo, error)

func RefreshRunningJobTokenForReload

func RefreshRunningJobTokenForReload(info RunningJobInfo, apiSecret string, now time.Time) (RunningJobInfo, error)

func RefreshRunningJobsForReload

func RefreshRunningJobsForReload(jobs []RunningJobInfo, apiSecret string, now time.Time) ([]RunningJobInfo, error)

func RefreshServerRunningJobsForReload

func RefreshServerRunningJobsForReload(jobs []RunningJobInfo, apiSecret string, now time.Time) ([]RunningJobInfo, error)

func RunningJobInfoFromEnv

func RunningJobInfoFromEnv(env map[string]string) (RunningJobInfo, error)

func RunningJobInfoSnapshot

func RunningJobInfoSnapshot(opts RunningJobInfoOptions) RunningJobInfo

func ServerRunningJobInfoSnapshot

func ServerRunningJobInfoSnapshot(opts RunningJobInfoOptions) RunningJobInfo

type RunningJobInfoOptions

type RunningJobInfoOptions struct {
	AcceptArguments JobAcceptArguments
	Job             *lkprotocol.Job
	URL             string
	Token           string
	WorkerID        string
	FakeJob         bool
}

type RuntimeJobInfo

type RuntimeJobInfo struct {
	JobID           string
	EnableRecording bool
}

func JobRuntimeInfo

func JobRuntimeInfo(job *lkprotocol.Job) RuntimeJobInfo

type SDKRoom

type SDKRoom = lksdk.Room

func NewJobContextRoom

func NewJobContextRoom(cb *RoomCallback) *SDKRoom

func NewRoom

func NewRoom(cb *RoomCallback) *SDKRoom

type SIPCreateParticipantPlanResult

type SIPCreateParticipantPlanResult struct {
	Skip bool
	Info *lkprotocol.SIPParticipantInfo
}

func JobContextSIPCreateParticipantPlan

func JobContextSIPCreateParticipantPlan(fakeJob bool) SIPCreateParticipantPlanResult

func SIPCreateParticipantPlan

func SIPCreateParticipantPlan(fakeJob bool) SIPCreateParticipantPlanResult

type SIPCreateParticipantRequest

type SIPCreateParticipantRequest = lkprotocol.CreateSIPParticipantRequest

type SIPParticipantInfo

type SIPParticipantInfo = lkprotocol.SIPParticipantInfo

func JobContextCreateSIPParticipantWithNames

func JobContextCreateSIPParticipantWithNames(ctx context.Context, api SIPAPI, job *Job, callTo string, trunkID string, identity string, names ...string) (*SIPParticipantInfo, error)

func JobContextCreateSIPParticipantWithRequest

func JobContextCreateSIPParticipantWithRequest(ctx context.Context, api SIPAPI, req *SIPCreateParticipantRequest) (*SIPParticipantInfo, error)

type SIPTransferParticipantPlanResult

type SIPTransferParticipantPlanResult struct {
	Skip bool
}

func JobContextSIPTransferParticipantPlan

func JobContextSIPTransferParticipantPlan(fakeJob bool) SIPTransferParticipantPlanResult

func SIPTransferParticipantPlan

func SIPTransferParticipantPlan(fakeJob bool) SIPTransferParticipantPlanResult

type ServerAvailableWorkerStatusMessageOptions

type ServerAvailableWorkerStatusMessageOptions struct {
	Load         float64
	JobCount     uint32
	CanAcceptJob bool
}

type ServerConnectionEnvOptions

type ServerConnectionEnvOptions struct {
	ServerConnectionOptions
	Setenv func(string, string) error
}

type ServerConnectionOptions

type ServerConnectionOptions struct {
	WSURL     string
	APIKey    string
	APISecret string
}

type ServerConnectionResolveOptions

type ServerConnectionResolveOptions = WorkerConnectionOptions

type ServerInfo

type ServerInfo = lkprotocol.ServerInfo

type ServerMessage

type ServerMessage = lkprotocol.ServerMessage

func ExchangeInitialServerRegisterWebSocket

func ExchangeInitialServerRegisterWebSocket(conn WorkerRegisterWebSocket, msg *WorkerMessage) (*ServerMessage, error)

type ServerMessageDispatchInfo

type ServerMessageDispatchInfo struct {
	Kind         ServerMessageKind
	Register     RegisterMessageInfo
	Availability *lkprotocol.AvailabilityRequest
	Assignment   *JobAssignment
	Termination  *JobTermination
}

type ServerMessageKind

type ServerMessageKind string
const (
	ServerMessageKindUnknown      ServerMessageKind = "unknown"
	ServerMessageKindRegister     ServerMessageKind = "register"
	ServerMessageKindAvailability ServerMessageKind = "availability"
	ServerMessageKindAssignment   ServerMessageKind = "assignment"
	ServerMessageKindTermination  ServerMessageKind = "termination"
)

func RouteServerWorkerMessage

func RouteServerWorkerMessage(opts ServerMessageRouteOptions) ServerMessageKind

type ServerMessageLoopOptions

type ServerMessageLoopOptions struct {
	ReadMessage   func() (int, []byte, error)
	Close         func() error
	Handle        func(*ServerMessage)
	OnDecodeError func(error)
}

type ServerMessageRouteOptions

type ServerMessageRouteOptions struct {
	Message        *lkprotocol.ServerMessage
	OnRegister     func(WorkerRegisteredEvent)
	OnAvailability func(*lkprotocol.AvailabilityRequest)
	OnAssignment   func(*JobAssignment)
	OnTermination  func(*JobTermination)
	OnUnknown      func()
}

type ServerRegisterWorkerMessageOptions

type ServerRegisterWorkerMessageOptions struct {
	WorkerType  WorkerType
	AgentName   string
	Version     string
	Permissions *WorkerPermissions
}

type SessionReportInfo

type SessionReportInfo struct {
	JobID  string
	RoomID string
	Room   string
}

func JobSessionReportInfo

func JobSessionReportInfo(job *lkprotocol.Job) SessionReportInfo

type TerminationInfo

type TerminationInfo struct {
	JobID string
}

func JobTerminationInfo

func JobTerminationInfo(req *JobTermination) TerminationInfo

type TextInputCallback

type TextInputCallback func(context.Context, *agent.AgentSession, TextInputEvent) error

type TextInputEvent

type TextInputEvent struct {
	Text                string
	Info                lksdk.TextStreamInfo
	ParticipantIdentity string
}

type TrackPublicationWaitOptions

type TrackPublicationWaitOptions = utils.TrackPublicationWaitOptions

type TrackType

type TrackType = lkprotocol.TrackType

type TranscriptionTextOutput added in v0.1.6

type TranscriptionTextOutput interface {
	CaptureText(context.Context, string) error
	Flush()
}

type WorkerConnect

type WorkerConnect struct {
	URL    string
	Header http.Header
}

func WorkerConnectInfo

func WorkerConnectInfo(opts WorkerConnectOptions) (WorkerConnect, error)

type WorkerConnectOptions

type WorkerConnectOptions struct {
	WSURL       string
	WorkerToken string
	APIKey      string
	APISecret   string
	TTL         time.Duration
}

type WorkerConnectionOptions

type WorkerConnectionOptions struct {
	WSURL          string
	LegacyWSURL    string
	APIKey         string
	APISecret      string
	WorkerToken    string
	AgentName      string
	AgentNameIsEnv bool
	Getenv         func(string) string
}

func ResolveWorkerConnectionOptions

func ResolveWorkerConnectionOptions(opts WorkerConnectionOptions) WorkerConnectionOptions

type WorkerEnvOptions

type WorkerEnvOptions struct {
	URL       string
	APIKey    string
	APISecret string
	Setenv    func(string, string) error
}

type WorkerMessage

type WorkerMessage = lkprotocol.WorkerMessage

func ServerDrainingWorkerStatusMessage

func ServerDrainingWorkerStatusMessage(jobCount uint32) *WorkerMessage

func ServerJobRunningMessage

func ServerJobRunningMessage(jobID string) *WorkerMessage

func ServerJobStatusMessage

func ServerJobStatusMessage(jobID string, status JobStatus) *WorkerMessage

func ServerMigrateRunningJobsMessage

func ServerMigrateRunningJobsMessage(jobs []RunningJobInfo) *WorkerMessage

type WorkerMessageLoopOptions

type WorkerMessageLoopOptions struct {
	Reader        WorkerWebSocketReader
	Close         func() error
	Handle        func(*lkprotocol.ServerMessage)
	OnDecodeError func(error)
}

type WorkerMessageWebSocketWriter

type WorkerMessageWebSocketWriter interface {
	WriteMessage(int, []byte) error
}

type WorkerMetadataOptions

type WorkerMetadataOptions struct {
	AgentName       string
	AgentNameIsEnv  bool
	WorkerType      string
	WorkerLoad      float64
	ActiveJobs      int
	SDKVersion      string
	ProtocolVersion int
	NodeName        string
	Hosted          bool
}

type WorkerMetadataResponse

type WorkerMetadataResponse struct {
	AgentName       string  `json:"agent_name"`
	AgentNameIsEnv  bool    `json:"agent_name_is_env"`
	WorkerType      string  `json:"worker_type"`
	WorkerLoad      float64 `json:"worker_load"`
	ActiveJobs      int     `json:"active_jobs"`
	SDKVersion      string  `json:"sdk_version"`
	ProtocolVersion int     `json:"protocol_version"`
	ProjectType     string  `json:"project_type"`
	NodeName        string  `json:"node_name"`
	Hosted          bool    `json:"hosted"`
}

type WorkerPermissions

type WorkerPermissions struct {
	CanPublish        bool
	CanSubscribe      bool
	CanPublishData    bool
	CanUpdateMetadata bool
	CanPublishSources []lkprotocol.TrackSource
	Hidden            bool
}

func DefaultServerWorkerPermissions

func DefaultServerWorkerPermissions() *WorkerPermissions

func DefaultWorkerPermissions

func DefaultWorkerPermissions() *WorkerPermissions

func ResolveWorkerPermissions

func ResolveWorkerPermissions(permissions *WorkerPermissions) WorkerPermissions

type WorkerRegisterWebSocket

type WorkerRegisterWebSocket interface {
	WorkerMessageWebSocketWriter
	ReadMessage() (int, []byte, error)
}

type WorkerRegisteredEvent

type WorkerRegisteredEvent struct {
	WorkerID   string
	ServerInfo *ServerInfo
}

func WorkerRegisteredEventFromRegisterDispatch

func WorkerRegisteredEventFromRegisterDispatch(info RegisterMessageInfo) WorkerRegisteredEvent

type WorkerRegisteredHandler

type WorkerRegisteredHandler func(workerID string, serverInfo *ServerInfo)

type WorkerRegistrationOptions

type WorkerRegistrationOptions struct {
	WorkerType  string
	AgentName   string
	Version     string
	Permissions *WorkerPermissions
}

type WorkerRuntimeMetadataOptions

type WorkerRuntimeMetadataOptions struct {
	AgentName       string
	AgentNameIsEnv  bool
	WorkerType      string
	WorkerLoad      float64
	ActiveJobs      int
	SDKVersion      string
	ProtocolVersion int
	NodeName        func() string
	IsHosted        func() bool
}

type WorkerStatusUpdateOptions

type WorkerStatusUpdateOptions struct {
	Draining     bool
	Load         float64
	JobCount     uint32
	CanAcceptJob bool
}

type WorkerType

type WorkerType string
const (
	WorkerTypeRoom      WorkerType = "room"
	WorkerTypePublisher WorkerType = "publisher"
)

type WorkerWebSocketConnectOptions

type WorkerWebSocketConnectOptions struct {
	Dialer   *websocket.Dialer
	URL      string
	Headers  http.Header
	MaxRetry int
	Dial     WorkerWebSocketDialFunc
	Sleep    WorkerWebSocketSleepFunc
}

type WorkerWebSocketOpenOptions

type WorkerWebSocketOpenOptions struct {
	WSURL       string
	WorkerToken string
	APIKey      string
	APISecret   string
	TTL         time.Duration
	HTTPProxy   string
	MaxRetry    int
	Dial        WorkerWebSocketDialFunc
	Sleep       WorkerWebSocketSleepFunc
}

type WorkerWebSocketOpenResult

type WorkerWebSocketOpenResult struct {
	Conn          *websocket.Conn
	Response      *http.Response
	ConnectFailed bool
}

type WorkerWebSocketReadFunc

type WorkerWebSocketReadFunc func() (int, []byte, error)

func (WorkerWebSocketReadFunc) ReadMessage

func (fn WorkerWebSocketReadFunc) ReadMessage() (int, []byte, error)

type WorkerWebSocketReader

type WorkerWebSocketReader interface {
	ReadMessage() (int, []byte, error)
}

type WorkerWebSocketSleepFunc

type WorkerWebSocketSleepFunc func(context.Context, time.Duration) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL