durablechat

package
v0.0.0-...-804b954 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 12 Imported by: 0

README

Durable Chat

Durable Chat is a loopback web UI and terminal UI built only on the public Go SDK/HTTP contract. It creates or resumes a Session, queues Inputs, reconnects from a Product-event cursor, inspects durable state, and cancels a Turn.

It deliberately does not configure, inspect, or impersonate a model provider. Codex subscription support remains blocked pending a production-supported official model surface and a protected canary; this application is not a subscription canary.

Start a local public API role first, then provide that user's public bearer token only to this local example process:

export AGENT_RUNTIME_DEVELOPER_TOKEN='your-local-runtime-bearer'
go run ./examples/durable-chat/cmd/durable-chat \
  --mode=terminal \
  --runtime-url=http://127.0.0.1:8088

Use new <agent-revision> to create a Session. Then use send, resume, events, and cancel as the terminal displays. To run the local web UI use --mode=web --listen=127.0.0.1:8090 and open that loopback address.

The Runtime bearer never reaches the browser: the loopback web server owns the public SDK client. Do not bind the web mode to a non-loopback interface or use it as a hosted multi-user frontend.

Documentation

Overview

Package durablechat is the public-contract Durable Chat example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebHandler

func NewWebHandler(config WebConfig) (http.Handler, error)

NewWebHandler creates the minimal Durable Chat web UI. The UI never receives the runtime bearer credential; its local server owns the public SDK client.

func RunTerminal

func RunTerminal(ctx context.Context, app *App, input io.Reader, output io.Writer) error

RunTerminal runs the Durable Chat terminal UI over the same App controller used by the web UI. It never creates a direct Temporal or provider client.

Types

type App

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

App coordinates Durable Chat commands entirely through the public SDK.

func NewApp

func NewApp(client SessionClient, keys KeySource) (*App, error)

NewApp constructs one Durable Chat application controller.

func (*App) Cancel

func (app *App) Cancel(ctx context.Context, sessionID agentruntime.SessionID, turnID agentruntime.TurnID) (agentruntime.Turn, error)

Cancel records a durable cancellation request for one public Turn.

func (*App) NewSession

func (app *App) NewSession(ctx context.Context, revision agentruntime.AgentRevisionID) (agentruntime.Session, error)

NewSession creates a Session pinned to the requested public Agent revision.

func (*App) Reconnect

func (app *App) Reconnect(ctx context.Context, sessionID agentruntime.SessionID, cursor agentruntime.Cursor) (agentruntime.EventPage, error)

Reconnect resumes Product-event observation from the caller's last opaque Cursor.

func (*App) Resume

func (app *App) Resume(ctx context.Context, sessionID agentruntime.SessionID) (agentruntime.SessionView, error)

Resume reads the durable Session projection after a server or browser restart.

func (*App) Send

func (app *App) Send(ctx context.Context, sessionID agentruntime.SessionID, text string) (agentruntime.SendInputResult, error)

Send queues one bounded text Input behind any active Turn.

type KeySource

type KeySource interface {
	Next(string) (string, error)
}

KeySource creates a bounded idempotency key for one user action.

type RandomKeys

type RandomKeys struct{}

RandomKeys creates opaque idempotency keys without deriving them from chat content.

func (RandomKeys) Next

func (RandomKeys) Next(action string) (string, error)

Next returns one bounded opaque idempotency key.

type SessionClient

SessionClient is the deliberately narrow public SDK surface Durable Chat needs. It keeps the example independent of runtime implementation packages.

type WebConfig

type WebConfig struct {
	App           *App
	ProviderState string
}

WebConfig declares the loopback-only web example presentation.

Directories

Path Synopsis
cmd
durable-chat command
Command durable-chat runs the Durable Chat web or terminal example through Agent Runtime's public Go SDK only.
Command durable-chat runs the Durable Chat web or terminal example through Agent Runtime's public Go SDK only.

Jump to

Keyboard shortcuts

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