ohfake

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ohfake is a fake OpenHands Agent Server for tests: the subset of the v1.54.0 API the openhands executor uses, over a real directory standing in for the server's filesystem. It lives outside _test.go files so the executor's tests and the workflow's end-to-end tests share one fake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conv

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

func (*Conv) Emit

func (c *Conv) Emit(ev map[string]any)

emit appends an event and wakes websocket subscribers.

func (*Conv) EventCount

func (c *Conv) EventCount() int

func (*Conv) ID

func (c *Conv) ID() string

ID is the conversation id.

func (*Conv) Messages

func (c *Conv) Messages() []string

Messages returns the user messages sent into the conversation after it started, in order.

func (*Conv) Released

func (c *Conv) Released() <-chan struct{}

Released is closed when the conversation is interrupted, paused or deleted, or the server shuts down: a blocking Agent func should select on it so it never outlives the test.

func (*Conv) Say

func (c *Conv) Say(text string)

func (*Conv) SetStatus

func (c *Conv) SetStatus(s string)

func (*Conv) Status

func (c *Conv) Status() string

type Server

type Server struct {

	// agent is what runs when a conversation starts.
	Agent func(c *Conv, dir string)
	// contains filtered or unexported fields
}

Server implements the subset of the OpenHands Agent Server API (v1.54.0) the executor uses, over a real directory standing in for the server's filesystem. The "agent" is a Go func the test supplies; it runs when the conversation starts and can block on a channel so a test can act mid-run (restart the daemon, cancel, delete the conversation).

func New

func New(t *testing.T, key string) *Server

func (*Server) Conv

func (f *Server) Conv(id string) *Conv

func (*Server) Count

func (f *Server) Count(key string) int

func (*Server) Creates

func (f *Server) Creates() []map[string]any

Creates returns every POST /api/conversations body received.

func (*Server) DeleteConv

func (f *Server) DeleteConv(id string)

func (*Server) Exclude

func (f *Server) Exclude(name string)

Exclude leaves files and directories with this base name out of archives, as the real archive route's default excludes do.

func (*Server) FailNext

func (f *Server) FailNext(key string, n int)

func (*Server) OnlyConv

func (f *Server) OnlyConv(t *testing.T) *Conv

func (*Server) URL

func (f *Server) URL() string

Jump to

Keyboard shortcuts

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