durabletest

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package durabletest opens pi-durable Harnesses for the experimental tests: an in-memory one over the faux provider (packages/coding-agent/test/experimental-durable-support.ts openFauxConversation), and a file-backed SQLite one for worker processes. Both are wrapped by durableadapter.Session.

Index

Constants

This section is empty.

Variables

View Source
var ModelRef = services.ModelRef{Provider: "faux", ModelId: "faux-1"}

ModelRef is the faux model the root conversation starts with.

Functions

func ReadAgent

func ReadAgent(path string) (*services.AgentState, error)

ReadAgent reads the root conversation's agent document from a Harness file that no worker has open; it is nil for a file that was never written.

Types

type FauxConversation

type FauxConversation struct {
	Harness      *durableadapter.Session
	Conversation *durableadapter.Session
	// Created reports that OpenFile found no storage, so its root conversation is new.
	Created bool
	// contains filtered or unexported fields
}

FauxConversation is an opened Harness with its root conversation. Harness and Conversation are the same adapter.

func OpenFauxConversation

func OpenFauxConversation(steps ...Step) *FauxConversation

OpenFauxConversation opens an in-memory Harness whose root conversation answers from the given steps in order.

func OpenFile

func OpenFile(path string, steps ...Step) (*FauxConversation, error)

OpenFile opens a Harness over a SQLite file; the root conversation of an absent file starts with the faux model.

func (*FauxConversation) Close

func (opened *FauxConversation) Close(ctx context.Context) error

Close closes the Harness and the faux provider.

type Step

type Step func(ctx context.Context, input string) (string, error)

Step is one faux provider response. It receives the run's context and the text of the last user message, and returns the answer text. A step that waits on ctx ends when the run is aborted.

func Pending

func Pending() (step Step, reached <-chan struct{})

Pending returns a step that never answers: it ends only when its run is aborted. Reached closes when the provider is called.

func Text

func Text(answer string) Step

Text is a step that answers immediately.

Jump to

Keyboard shortcuts

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