workerbridge

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package workerbridge adapts the frozen legacy worker WebSocket client to the public workerkit.Wire port, so the shipped products (human local, human worker) can run the web human side against the existing gateway while the caller half of dual-stack convergence is still pending.

The bridge is deliberately thin and deterministic:

  • Legacy assignments have no transport delivery ID; the bridge derives a stable one from the caller/idempotency identity, so gateway redelivery after reconnect deduplicates inside workerkit.
  • The legacy dialect has no assignment ACK; ConfirmAssignment is a no-op and the gateway's redelivery-on-reconnect remains the recovery path.
  • SendEvent binds the event to the remembered legacy assignment and the durable workerclient outbox; the outbox, not workerkit, owns replay.
  • Rejections surface the legacy NACK inbox; ConfirmRejection maps to the durable ConfirmRejectedEvent keyed by the bridged delivery ID, which the bridge sets to the rejected event ID.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

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

Bridge implements workerkit.Wire over the legacy worker WebSocket dialect.

func Dial

func Dial(ctx context.Context, config Config) (*Bridge, error)

Dial connects the legacy worker client and starts the conversion pump. ctx bounds construction only; Close owns the runtime lifetime.

func (*Bridge) Assignments

func (bridge *Bridge) Assignments() <-chan llm.WorkerAssignmentDelivery

func (*Bridge) Close

func (bridge *Bridge) Close() error

Close shuts the underlying legacy client down and ends the pump. Signaling closing first unblocks a pump parked on a full assignments/rejections channel (its consumer may already be gone), so Close cannot deadlock waiting on done.

func (*Bridge) ConfirmAssignment

func (bridge *Bridge) ConfirmAssignment(ctx context.Context, id llm.WorkerDeliveryID) error

ConfirmAssignment maps workerkit's accept to the legacy accepted event: the legacy state machine admits progress/final only after "accepted". The event is sent once per completion; a session that already carried an event (e.g. a rejection sent before confirmation) is left untouched.

func (*Bridge) ConfirmRejection

func (bridge *Bridge) ConfirmRejection(ctx context.Context, id llm.WorkerDeliveryID) error

func (*Bridge) Done

func (bridge *Bridge) Done() <-chan struct{}

func (*Bridge) Err

func (bridge *Bridge) Err() error

func (*Bridge) Notices

func (bridge *Bridge) Notices() <-chan workerkit.Notice

func (*Bridge) Rejections

func (bridge *Bridge) Rejections() <-chan workerkit.Rejection

func (*Bridge) SendEvent

func (bridge *Bridge) SendEvent(ctx context.Context, delivery llm.WorkerEventDelivery) error

type Config

type Config struct {
	URL         string
	Token       string
	OutboxPath  string
	OutboxScope string
}

Config selects the legacy gateway endpoint and the durable outbox identity.

Jump to

Keyboard shortcuts

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