scenario

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 25 Imported by: 1 module, 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 scenario is the end-to-end layer for interaction behaviour.

The suites beside it play a recording somebody else made and score the outcome of a task. That answers "did the work get done" and says nothing about when anybody spoke, which is the entire subject here. A scenario instead scripts a conversation - who says what, and at what moment - so that what is scored is the shape of the exchange rather than its conclusion.

The behaviour it exists to test is behaviour no existing suite can express. Counting out loud while somebody keeps talking, staying quiet through their pauses because they asked to be left alone, pressing a key at a recorded menu, cutting in when what is being said is wrong: each of those is a claim about timing that a transcript comparison cannot make.

Index

Constants

View Source
const (
	ReplayVersion = 1
)
View Source
const ScorerVersion uint64 = 10

ScorerVersion changes whenever the deterministic checks or their matching semantics change. Earlier unversioned results used substring matching and weaker translation requirements. Version 2 added whole-word content checks; version 3 also requires recorded acoustic continuity across acknowledgements. Version 4 supplies refund source content, checks explanation coverage, and retains response-terminal evidence without inferring cancellation from silence. Version 5 also requires attributed audio and rejects responses aborted before the hold ends, even when replacement audio fills the acoustic window. Earlier scores are not evidence for this version. Version 6 resolves speech-triggered diagnostic cues from retained input and independently observed agent PCM, failing missing opportunities explicitly. Version 7 requires the purchase-confirmation detail in both acknowledgement scenarios; mentioning the unrelated return-label email cannot replace it. Version 8 requires a sufficiently long ordered count on both sides of an interruption, within its authored range, and recent captured speech before it. Version 9 includes speech heard during the allowed stopping interval in the resumed prefix and requires captured silence until the request to resume. Version 10 independently recognizes exact event-count content and checks captured silence everywhere outside the authored count-response windows.

View Source
const SpeechAcknowledgementDiagnostic = "acknowledgements during observed speech"

Variables

View Source
var CacheDir = ".runtime/speech-cache"

CacheDir holds synthesised speech between runs.

A benchmark holds its input constant. Re-synthesising every line on every run re-rolls the dice on two things at once: the timing, because a synthesiser does not produce the same durations twice and every check window is anchored to where a line ends, and the recognition, because a slightly different waveform is heard slightly differently - measured, "the build" came back as "the bill" in two runs of five and cost both of them.

That variance is why four scenarios in this suite spanned nearly their whole range across passes on identical code, and why a single pass could not rank two models. The audio is the same audio either way; caching it only stops asking for a new roll.

Functions

func ResampleForTest

func ResampleForTest(samples []int16, from, to int) []int16

ResampleForTest exposes the rate conversion. It is exported for a test rather than tested through the network, because what went wrong was arithmetic and the endpoint had nothing to do with it.

func TaskOutcome

func TaskOutcome(id string, result Result, runErr error) bench.TaskOutcome

TaskOutcome is the shared scenario-to-benchmark projection used by both campaign production and independent replay.

Types

type Check

type Check struct {
	Kind CheckKind
	// Line indexes the script. The window runs from that line's start to its
	// end, extended by AfterMS. Negative means the whole conversation.
	Line int
	// Interrupted indexes the line that cut the agent off, for CheckResumed.
	// The window before it is what the agent had audibly said by the time
	// somebody stopped it.
	Interrupted int
	// Count declares the numeric task and minimum observed sequence lengths
	// for CheckResumed. BeforeMS bounds its acoustic lookback before the
	// interruption, so an already-silent count is not an interruption trial.
	Count *CountRequirement `json:",omitempty"`
	// Events declares the exact audible running counts for CheckEventCounts.
	// Each event owns a bounded response window; all other audio must be quiet.
	Events []CountEvent `json:",omitempty"`
	// Sight indexes Sees instead, when the moment being checked is something
	// the agent saw. It is one-based so that the zero value keeps meaning
	// "use Line", and it can anchor absolutely where a spoken line cannot:
	// a picture arrives when it is sent, while a sentence takes as long as a
	// synthesiser decides to take.
	Sight int
	// DuringTrigger says the answer this check is waiting for is expected
	// while the line is still being spoken, not after it.
	//
	// A latency is normally measured from the moment the trigger stopped,
	// because what a person waits through is the silence after somebody
	// finishes talking. A policy carried out while they keep talking has no
	// such silence: "count the animals out loud as I mention them" is answered
	// mid-sentence by design, and measuring from the end looks past the answer
	// entirely and finds whatever the agent said next. Measured, the agent
	// counted the capybara correctly at 24.2 seconds and the check reported it
	// answered 6.9 seconds late, because the line it was answering ran to
	// 25.4.
	//
	// This is the same fact the Tool case below already relies on - a key
	// pressed while the recording is still reading the options - said once,
	// about when the answer is expected rather than about what kind of thing
	// it is. The deadline still means "not later than AfterMS past the line
	// ending", so a genuinely late answer still fails.
	DuringTrigger bool
	// AfterMS extends the window past the end of the line, which is where the
	// interesting part of a pause lives.
	//
	// Negative pulls the window in short of the line's end, which is how
	// interrupting is distinguished from waiting. Without it a check that only
	// asks whether the agent spoke during a long monologue is satisfied by an
	// agent that waited politely until the end - the exact behaviour the
	// interruption is meant to replace.
	AfterMS int
	// FromMS pushes the start of the window past the end of the line, for a
	// check about what happens later rather than about the moment itself.
	//
	// A policy set out loud is answered with a brief "I will" - the voice is
	// told to do exactly that, and the scenarios beside this one depend on it.
	// So a scenario asking whether the agent then waited has to start its
	// window after that answer, or it measures the acknowledgement it asked
	// for.
	FromMS int
	// BeforeMS and MaxGapMS belong to CheckHeldAcross. The check requires
	// audible activity before, during, and after the named line, allowing no
	// interior pause longer than MaxGapMS on the recorded playout clock.
	BeforeMS int
	MaxGapMS int
	// Tool is the call that must have happened, for CheckToolCalled.
	Tool string
	// Any is a set of whole-word phrases, one of which must appear for
	// CheckSaid and none of which may appear for CheckNotSaid. Matching ignores
	// case and repeated whitespace; punctuation-only assertions remain literal.
	Any  []string
	Note string
}

Check is one claim about what the agent did.

Windows are expressed against lines of the script rather than against the clock, because how long a line takes to say is decided by a speech synthesiser and moves when the voice does. A check pinned to a millisecond would pass or fail on the length of a vowel.

type CheckKind

type CheckKind string

CheckKind names what a check asserts.

const (
	// CheckSilent asserts the agent produced no audio in a window. It is the
	// check most of these scenarios turn on, because the failure it catches -
	// talking over somebody who asked not to be interrupted - is the one that
	// makes a system unpleasant rather than merely wrong.
	CheckSilent CheckKind = "silent"
	// CheckSpoke asserts the agent produced audio in a window.
	CheckSpoke CheckKind = "spoke"
	// CheckHeldAcross requires captured agent audio to continue across a
	// backchannel. This is acoustic continuity; phrase checks and media review
	// separately assess whether the content continues the same explanation.
	CheckHeldAcross CheckKind = "held-across"
	// CheckToolCalled asserts a named tool was called.
	CheckToolCalled CheckKind = "tool"
	// CheckReachedMenu asserts the call ended where it was going.
	//
	// It is the check a fixed recording could not support. Pressing the right
	// key once and pressing it six times sound identical to a script that
	// plays to the end regardless; against a menu that moves, the second lands
	// somewhere with no way back, and the difference is a fact about where the
	// call ended rather than an inference from how many tones went out.
	CheckReachedMenu CheckKind = "reached"
	// CheckAnsweredWithin asserts the agent could be heard within AfterMS of
	// the trigger finishing, in waveform time.
	//
	// It is separate from CheckSpoke because they fail differently and want
	// different windows: speaking at all is a capability, and speaking soon
	// enough is whether anybody would want to use it. A system can pass every
	// other check here and be unbearable.
	CheckAnsweredWithin CheckKind = "answered-within"
	// CheckSaid asserts the agent said one of a set of phrases, inside a
	// window when one is given. The window is what makes it mean anything: a
	// scenario that asks an agent to count out loud is not satisfied by the
	// word "two" turning up somewhere in half a minute of unrelated talk, and
	// the first version of this suite passed exactly that way.
	//
	// The phrases stay loose. The words are the model's to choose, and a
	// scenario that pins them is testing its vocabulary.
	CheckSaid CheckKind = "said"
	// CheckNotSaid asserts the agent said none of a set of phrases in a
	// window. It catches the failure that looks like success: speaking at the
	// right moment, about the wrong thing.
	CheckNotSaid CheckKind = "not-said"
	// CheckResumed asserts the agent carried on from the word the user
	// actually heard.
	//
	// It is the only check here that cannot be scored from the wire. Every
	// other one asks what the agent said, and the transcript of a turn arrives
	// with the turn; this asks what the user heard, and the moment somebody
	// interrupts, those stop being the same thing - the wire carries the whole
	// sentence and the loudspeaker stopped partway through it.
	//
	// So it is scored against the agent's recorded waveform, transcribed by
	// something that had no part in producing it. Scoring it against the
	// runtime's own account of where it got to would mark a runtime correct
	// for carrying on from wherever it believed it had, which is the belief
	// under test.
	CheckResumed CheckKind = "resumed"
	// CheckEventCounts verifies exact count words from independent recognition
	// of captured agent audio, plus silence outside the authored event windows.
	CheckEventCounts CheckKind = "event-counts"
)

type CountEvent

type CountEvent struct {
	Line     int
	Number   int
	WithinMS int
}

CountEvent assigns one expected English count (or recognized digit) to a source line. WithinMS extends the response allowance past that line's end.

type CountRequirement

type CountRequirement struct {
	From          int `json:"from"`
	Through       int `json:"through"`
	MinimumBefore int `json:"minimum_before"`
	MinimumAfter  int `json:"minimum_after"`
	// StopWithinMS allows recognition and playback to stop after the user's
	// interruption finishes. Speech heard during that interval belongs to the
	// pre-resumption prefix, even though the user had already begun speaking.
	StopWithinMS int `json:"stop_within_ms"`
}

CountRequirement makes the interrupted-count experiment's opportunity explicit. Three observed numbers expose progression on either side; a lone "one" followed by "two" cannot distinguish a sustained count from a restart.

type Ears

type Ears interface {
	Hear(ctx context.Context, samples []int16, rateHz int) (string, error)
}

Ears transcribes the agent's own audio.

Reported text alone cannot establish audible content: synthesis can emit different words, and interruption can stop a sentence before it finishes. Event-count and resumed-count checks therefore ask what the user heard in captured agent audio, independently of the generation and playback cursors.

The runtime has its own answer to that question now, and that answer is exactly what is under test. Scoring against it would be scoring the runtime against itself: a runtime that decided it had said everything would be marked correct for carrying on as though it had. So the check is grounded in the waveform the harness recorded, transcribed by something that was not involved in producing it.

A Voice plug-in that can also listen implements this. One that cannot leaves the claim unmade, and a check that needs it fails saying so rather than passing quietly.

type EventCountMeasurement

type EventCountMeasurement struct {
	Events          []EventCountObservation `json:"events"`
	OutsideActiveMS float64                 `json:"outside_active_ms"`
}

type EventCountObservation

type EventCountObservation struct {
	Line        int     `json:"line"`
	Number      int     `json:"number"`
	FromMS      int     `json:"from_ms"`
	ToMS        int     `json:"to_ms"`
	ActiveMS    float64 `json:"active_ms"`
	HeardFromMS int     `json:"heard_from_ms"`
	HeardToMS   int     `json:"heard_to_ms"`
	Heard       string  `json:"heard,omitempty"`
	Error       string  `json:"error,omitempty"`
}

EventCountObservation preserves the external recognition verbatim. A failed recognition is not rewritten using generated text or an expected number.

type FunctionToolDeclaration

type FunctionToolDeclaration struct {
	Type        string          `json:"type"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Parameters  json.RawMessage `json:"parameters"`
}

FunctionToolDeclaration is the protocol declaration shared by profile authoring and the live benchmark client.

type Hearing

type Hearing struct {
	Endpoint string
	Model    string
	Language string
	Client   *http.Client
	// GeminiAPIKey, when set, has Gemini listen to the recording instead of
	// the transcription endpoint. A speech recogniser built for dictation
	// hears a lone "One." as "One eight" and "Eighteen." as "eight teen";
	// a model asked what was said in a short clip does not. GeminiModel
	// defaults to gemini-3.7-flash; GeminiEndpoint to the public API.
	GeminiAPIKey   string
	GeminiModel    string
	GeminiEndpoint string
}

Transcribe is where the harness sends the agent's own audio when a check has to be scored against what a loudspeaker produced.

It is deliberately a second endpoint rather than the session's recogniser. The point of the check it serves is that nothing involved in producing the audio gets to say what was in it, and the session's recogniser is the most involved thing there is.

type HoldMeasurement

type HoldMeasurement struct {
	Line                 int            `json:"line"`
	FromMS               int            `json:"from_ms"`
	TriggerStartMS       int            `json:"trigger_start_ms"`
	TriggerEndMS         int            `json:"trigger_end_ms"`
	ToMS                 int            `json:"to_ms"`
	BeforeActiveMS       float64        `json:"before_active_ms"`
	DuringActiveMS       float64        `json:"during_active_ms"`
	AfterActiveMS        float64        `json:"after_active_ms"`
	LongestGapMS         float64        `json:"longest_gap_ms"`
	GapLimitMS           int            `json:"gap_limit_ms"`
	ResponseEvidence     string         `json:"response_evidence,omitempty"`
	UnattributedActiveMS float64        `json:"unattributed_active_ms,omitempty"`
	Responses            []HoldResponse `json:"responses,omitempty"`
}

HoldMeasurement retains the activity evidence for one acknowledgement. Durations concern the agent channel on the recorded playout clock, never text events or the arrival time of a prefetched audio packet. Activity is an acoustic proxy, not proof that the same semantic explanation continued.

type HoldResponse

type HoldResponse struct {
	ResponseID   string  `json:"response_id"`
	AudioFromMS  float64 `json:"audio_from_ms"`
	AudioToMS    float64 `json:"audio_to_ms"`
	Status       string  `json:"status"`
	TerminalAtMS float64 `json:"terminal_at_ms,omitempty"`
	Reason       string  `json:"reason,omitempty"`
}

HoldResponse records the terminal status of one response whose audio packets overlap the measured playout window. A completed status describes protocol completion, not semantic completeness. A cancelled status does not by itself prove that this acknowledgement caused cancellation. An aborted response cannot earn hold credit when its terminal event is at or before the end of the measured window, even if another response supplies continuous audio.

type Latency

type Latency struct {
	// After names what triggered it: a line of the script, or something seen.
	After string `json:"after"`
	// EndedMS is when that thing finished, in the playback's own clock.
	EndedMS int `json:"ended_ms"`
	// MS is the wait. Negative means the agent was already speaking, which is
	// not a latency and is recorded rather than hidden.
	MS float64 `json:"ms"`
	// Heard is false when the agent never spoke after it at all.
	Heard bool `json:"heard"`
}

Latency is how long after something happened the agent could be heard.

Measured in waveform time: from the last sample of the thing that triggered it to the first sample the agent produced. That is the number a person in the room experiences, and it is not the same as the time from the decision - a decision taken in thirty milliseconds is still half a second of silence if the recogniser, the voice and the synthesiser each take their share.

The arrival of an audio event stands in for the moment it is heard, which is exact enough while playback is realtime and worth naming as a proxy rather than presenting as a measurement of a loudspeaker.

type Line

type Line struct {
	Speaker     string
	Text        string
	AtMS        int
	AfterSpeech *SpeechWindow `json:",omitempty"`
}

Line is one thing somebody says, and when they start saying it.

Speaker names whoever is talking. It exists because the interesting cases have three parties - a user, an agent, and a waiter or a phone menu - and they reach the agent down one microphone, exactly as they would in a room.

type Listener added in v0.2.0

type Listener = heard

Listener answers what the agent was audibly saying in a window of the episode clock. It is what a harness that produced the agent's audio itself supplies in place of a transcription of it.

type Menu struct {
	// States maps a state name to what the menu says on entering it and where
	// each key leads. The zero name "" is where the call starts.
	States map[string]MenuState
	// Goal is the state the call is trying to reach.
	Goal string
	// contains filtered or unexported fields
}

Menu is a recorded phone menu that answers a keypress.

The first version of the phone-menu scenario read a fixed script whatever the agent did, which makes two different behaviours indistinguishable: an agent that presses the right key once and an agent that presses it six times both hear the same recording to the end. Measured, one call took nine presses and the scenario could not see it - a person doing that lands three menus deep and never reaches what they wanted.

So the menu has states. Pressing a key moves it, an unexpected key is refused the way a real one refuses, and what plays next depends on where the agent has got to. That is what makes "pressed into the next option" a thing the harness can observe rather than a sentence in a note.

func OrderStatusMenu

func OrderStatusMenu() *Menu

OrderStatusMenu is the menu the phone scenario dials.

func (menu *Menu) Press(digit string) (says string, moved bool)

Press moves the menu, and reports what it says next.

An unrecognised key leaves the menu where it is and says so, which is what a real one does: the caller has not moved, and pressing again is not the same as pressing correctly the first time.

func (menu *Menu) Presses() int

Presses is how many keys were sent, which is the number that separates an agent that navigated from one that hammered the keypad.

func (menu *Menu) Reached() bool

Reached reports whether the call got where it was going.

func (menu *Menu) Respond(_ string, arguments json.RawMessage) (json.RawMessage, error)

Respond answers a press_key call as the menu would.

func (menu *Menu) Where() string

Where names the state the call ended in, for a failure worth reading.

type MenuState struct {
	// Says is read aloud on entering. Empty means the state is terminal and
	// the scenario's own script carries the audio.
	Says string
	// Keys maps a digit to the state it leads to. A digit not here is refused.
	Keys map[string]string
}

MenuState is one prompt and the keys it accepts.

type ReplayEvidence

type ReplayEvidence struct {
	Version          int             `json:"version"`
	ScenarioSHA256   string          `json:"scenario_sha256"`
	Inputs           []ReplayInput   `json:"inputs"`
	TrailingSamples  int             `json:"trailing_samples"`
	HearingAvailable bool            `json:"hearing_available"`
	Hearings         []ReplayHearing `json:"hearings,omitempty"`
}

ReplayEvidence retains the non-score inputs needed to reproduce a completed attempt. PCM stays in the independently sealed stereo recording. Hearing text is an external recognizer observation, not the runtime's spoken cursor. Replaying it checks the deterministic count decision, not recognizer accuracy.

type ReplayHearing

type ReplayHearing struct {
	FromMS      int    `json:"from_ms"`
	ToMS        int    `json:"to_ms"`
	PCM16SHA256 string `json:"pcm16_sha256"`
	Text        string `json:"text,omitempty"`
	Error       string `json:"error,omitempty"`
}

type ReplayInput

type ReplayInput struct {
	Samples     int    `json:"samples"`
	PCM16SHA256 string `json:"pcm16_sha256"`
}

type Result

type Result struct {
	// ScorerVersion identifies the deterministic scoring semantics. Zero is
	// reserved for historical unversioned results and unscored attempts.
	ScorerVersion uint64                  `json:"scorer_version,omitempty"`
	Scenario      string                  `json:"scenario"`
	Passed        bool                    `json:"passed"`
	Failures      []string                `json:"failures,omitempty"`
	Latencies     []Latency               `json:"latencies,omitempty"`
	Holds         []HoldMeasurement       `json:"holds,omitempty"`
	Resumptions   []ResumeMeasurement     `json:"resumptions,omitempty"`
	EventCounts   []EventCountMeasurement `json:"event_counts,omitempty"`
	Transcript    bench.Transcript        `json:"transcript"`
	Replay        *ReplayEvidence         `json:"replay,omitempty"`
}

Result is one scenario played.

func Play

func Play(ctx context.Context, voice Voice, config bench.SessionConfig, item Scenario) (Result, error)

Play runs one scenario and scores it.

func ReplayRecorded

func ReplayRecorded(ctx context.Context, item Scenario, retained Result, wav []byte) (Result, error)

ReplayRecorded recomputes one current-scorer result using the canonical authored case, exact retained WAV, transcript, and observed hearing windows. It refuses older/missing evidence instead of silently rescoring history. Missing/partly sent cues are retained diagnostics but cannot be reconstructed from the room channel alone and therefore do not pass this verifier.

func Score

func Score(item Scenario, timeline Timeline, transcript bench.Transcript) Result

Score applies checks available from the transcript. Waveform-dependent checks fail as unverified; ScoreWithAudio or Play supplies their evidence.

func ScorePlayed added in v0.2.0

func ScorePlayed(
	item Scenario, timeline Timeline, transcript bench.Transcript, menu *Menu,
	capture bench.SessionAudioCapture, listen Listener,
) Result

ScorePlayed scores a scenario a harness played without the wire.

Play drives a live endpoint and transcribes the recorded loudspeaker; a harness that runs the graph in-process has the same transcript, the same captured playout, the menu it answered the agent's presses with, and its own knowledge of which words the agent's audio carried. This scores those with the same checks Play applies, so an in-process run and a live one are judged by one rule.

func ScoreWithAudio

func ScoreWithAudio(item Scenario, timeline Timeline, transcript bench.Transcript, capture bench.SessionAudioCapture) Result

ScoreWithAudio supplies captured playout for acoustic checks. CheckResumed and CheckEventCounts also need independent transcription and remain unverified here; Play supplies that through the voice's Ears implementation.

type ResumeMeasurement

type ResumeMeasurement struct {
	Line           int     `json:"line"`
	Interrupted    int     `json:"interrupted"`
	BeforeNumbers  []int   `json:"before_numbers,omitempty"`
	AfterNumbers   []int   `json:"after_numbers,omitempty"`
	RecentFromMS   int     `json:"recent_from_ms"`
	RecentToMS     int     `json:"recent_to_ms"`
	RecentActiveMS float64 `json:"recent_active_ms"`
	BeforeToMS     int     `json:"before_to_ms"`
	QuietFromMS    int     `json:"quiet_from_ms"`
	QuietToMS      int     `json:"quiet_to_ms"`
	QuietActiveMS  float64 `json:"quiet_active_ms"`
}

ResumeMeasurement retains the observations that distinguish a sustained interrupted count from short answers or an already-silent agent. Numbers come from the independent recognizer; activity uses the captured PCM grid.

type ReviewAttempt

type ReviewAttempt struct {
	Scenario           string                  `json:"scenario"`
	Trial              int                     `json:"trial"`
	Passed             bool                    `json:"passed"`
	Failures           []string                `json:"failures,omitempty"`
	RunError           string                  `json:"run_error,omitempty"`
	ProtocolError      string                  `json:"protocol_error,omitempty"`
	EvidenceError      string                  `json:"evidence_error,omitempty"`
	EvidenceStatus     string                  `json:"execution_evidence_status"`
	Evidence           *ReviewEvidenceIdentity `json:"execution_evidence,omitempty"`
	Reportable         bool                    `json:"reportable"`
	ReportabilityError string                  `json:"reportability_error,omitempty"`
	Inputs             []ReviewInputUse        `json:"inputs,omitempty"`
	Audio              ReviewMedia             `json:"audio"`
}

ReviewAttempt is one result and the media needed to inspect it.

type ReviewAudioSpec

type ReviewAudioSpec struct {
	Container     string   `json:"container"`
	Encoding      string   `json:"encoding"`
	SampleRateHz  uint32   `json:"sample_rate_hz"`
	Channels      uint16   `json:"channels"`
	ChannelLayout []string `json:"channel_layout"`
	Frames        uint64   `json:"frames"`
	DurationMS    float64  `json:"duration_ms"`
}

ReviewAudioSpec makes channel meaning and exact duration explicit.

type ReviewCase

type ReviewCase struct {
	Ordinal int           `json:"ordinal"`
	Name    string        `json:"name"`
	Inputs  []ReviewMedia `json:"inputs,omitempty"`
}

ReviewCase identifies one authored scenario and immutable input media.

type ReviewEvidenceIdentity

type ReviewEvidenceIdentity struct {
	Kind        bench.ExecutionKind `json:"kind"`
	Scope       string              `json:"scope,omitempty"`
	Fingerprint string              `json:"fingerprint"`
}

ReviewEvidenceIdentity binds an attempt to live execution proof without duplicating the full architecture record or retaining inspection authority.

type ReviewInputUse

type ReviewInputUse struct {
	Path   string `json:"path"`
	Status string `json:"status"`
}

ReviewInputUse records whether the session driver actually submitted an authored input. A copied still is not silently described as transmitted if the attempt failed before its scheduled cue.

type ReviewManifest

type ReviewManifest struct {
	Format               string                      `json:"format"`
	FormatVersion        int                         `json:"format_version"`
	Suite                string                      `json:"suite"`
	Complete             bool                        `json:"complete"`
	Reportable           bool                        `json:"reportable"`
	EvidencePolicy       string                      `json:"execution_evidence_policy"`
	ExecutionRequirement *bench.ExecutionRequirement `json:"execution_requirement,omitempty"`
	ReportabilityErrors  []string                    `json:"reportability_errors,omitempty"`
	Expected             int                         `json:"expected_attempts"`
	Missing              []ReviewMissing             `json:"missing,omitempty"`
	Cases                []ReviewCase                `json:"cases"`
	Attempts             []ReviewAttempt             `json:"attempts"`
}

ReviewManifest is the machine-readable index written as manifest.json. Media is typed so a later video or screen-trace capture can coexist with the stereo audio and still images without changing attempt identity.

type ReviewMedia

type ReviewMedia struct {
	Kind      string           `json:"kind"`
	Role      string           `json:"role"`
	Path      string           `json:"path"`
	SHA256    string           `json:"sha256"`
	MediaType string           `json:"media_type"`
	CueMS     int              `json:"cue_ms,omitempty"`
	Note      string           `json:"note,omitempty"`
	Audio     *ReviewAudioSpec `json:"audio,omitempty"`
}

ReviewMedia identifies a retained review artifact by content, format, and semantic role. Audio and image details are mutually exclusive today; future video capture can add a Video field while keeping the common identity.

type ReviewMissing

type ReviewMissing struct {
	Scenario string `json:"scenario"`
	Trial    int    `json:"trial"`
}

ReviewMissing identifies an expected attempt not retained by the run.

type ReviewOptions

type ReviewOptions struct {
	Directory            string
	Scenarios            []Scenario
	Repeats              int
	ExecutionRequirement bench.ExecutionRequirement
	// Secrets are exact in-memory values to redact from error and transcript
	// prose. They are never serialized into the review bundle.
	Secrets []string
}

ReviewOptions declares a create-only scenario review run. Directory is the final run directory, not a parent into which an implicit timestamped name is invented. That makes the evidence location explicit and lets automation reserve collision-free run identities itself.

type ReviewRun

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

ReviewRun owns one exclusive directory until Close writes its indexes.

func NewReviewRun

func NewReviewRun(options ReviewOptions) (*ReviewRun, error)

NewReviewRun creates Directory exclusively after validating all authored still inputs. Existing paths, symlinked parents, missing parents, traversal, duplicate cases, and unreadable media are rejected before benchmark work.

func (*ReviewRun) Close

func (run *ReviewRun) Close() error

Close writes REVIEW.md first and manifest.json last. The manifest is the create-only commit marker, so a complete manifest is never visible without the required human review. Close is idempotent and returns the first close result on subsequent calls.

func (*ReviewRun) Directory

func (run *ReviewRun) Directory() string

Directory returns the absolute create-only run directory.

func (*ReviewRun) Record

func (run *ReviewRun) Record(
	scenarioName string, trial int, capture bench.SessionAudioCapture, result Result, runErr error,
) error

Record writes one stereo WAV immediately and retains its sanitized result metadata for Close. A failed attempt still gets a valid WAV; when no agent audio arrived its right channel is silent.

type Scenario

type Scenario struct {
	Name         string
	Note         string
	Instructions string
	Tools        []Tool
	Script       []Line
	// Sees are visual events on the same timeline as the speech. A capability
	// that fires with nobody talking cannot be scripted any other way.
	Sees   []Sight
	Checks []Check
	// Menu builds a world that answers, for a scenario where what happens next
	// depends on what the agent did. A phone menu is the case: pressing a key
	// moves the call, and a fixed recording cannot tell an agent that pressed
	// once from one that pressed six times.
	//
	// A constructor rather than a menu, because a scenario is a description
	// and each run needs its own world. Held as a live menu it was built once
	// for the whole suite and every repeat inherited where the last one left
	// the call: one run pressed 1 and reached billing, and the four runs after
	// it pressed 2 correctly and were told 2 was not one of the options,
	// because they were already in billing and billing has no options. Four
	// failures reported against the agent belonged to the harness.
	Menu func() *Menu
	// TrailingMS is quiet held after the last line, so that a scenario about
	// staying silent has somewhere to be silent.
	TrailingMS int
}

Scenario is one scripted conversation and what must be true of it.

func Catalog

func Catalog() []Scenario

Catalog includes the release suite followed by optional diagnostics. Default execution still uses Suite; exact names select entries from this catalog.

func Diagnostics

func Diagnostics() []Scenario

Diagnostics are explicitly selected extensions. They never enter Suite's release population, even when every diagnostic repetition passes.

func SubturnSuite

func SubturnSuite() []Scenario

SubturnSuite is the focused extension for behavior whose correctness depends on a boundary inside the assistant's own speech. It remains a named group so focused diagnostics can select it, but Suite includes it in the reviewed twelve-case acceptance contract and its 180-attempt reportable population.

func Suite

func Suite() []Scenario

Suite is the scripted behaviour an interaction model exists to produce.

Every scenario here is a claim that could not be made by any other suite in this repository, because every one of them is about when somebody speaks rather than about what they conclude. They come from two places: the capabilities a full-duplex model was demonstrated doing, and the cases that turn up in production the moment an agent has to hold a phone call.

The control scenario is not padding. Most of these ask the agent to stay quiet, and a system that had simply stopped talking would pass all of them.

type Sight

type Sight struct {
	AtMS int
	// Path is a PNG on disk.
	Path string
	Note string
}

Sight is something the agent sees, at a moment, with nobody speaking.

It is a file rather than bytes because the point of these scenarios is that a real narrator looks at a real picture: a scenario that handed the runtime a description it had written itself would be testing nothing but whether the runtime can read its own input back.

type Span

type Span struct {
	StartMS, EndMS int
}

Span is when one line of the script was actually spoken.

type SpeechVoice

type SpeechVoice struct {
	Endpoint string
	Model    string
	// Voices maps a speaker name to a backend voice. A speaker with no entry
	// uses Default.
	Voices  map[string]string
	Default string
	Client  *http.Client
	// Listen is the separate endpoint used to score what the agent was
	// audibly saying. Unset leaves that claim unmade rather than assumed.
	Listen Hearing
}

SpeechVoice synthesises through an OpenAI-shaped speech endpoint.

Speakers are given different voices where the backend offers them. A scenario with a waiter or a phone menu in it is not testing anything if the second party is acoustically identical to the first: the agent's job includes telling them apart, and a harness that hands it two copies of one voice has removed the difficulty it meant to pose.

func (SpeechVoice) Hear

func (voice SpeechVoice) Hear(ctx context.Context, samples []int16, rateHz int) (string, error)

Hear transcribes one stretch of the agent's audio.

func (SpeechVoice) Speak

func (voice SpeechVoice) Speak(ctx context.Context, speaker, text string) ([]int16, error)

type SpeechWindow

type SpeechWindow struct {
	LatestMS        int
	LookbackMS      int
	MinimumActiveMS int
	RecentMS        int
}

SpeechWindow makes a line conditional on audible agent output. AtMS remains the earliest input position; LatestMS bounds the opportunity. An unmet opportunity fails the diagnostic instead of silently omitting the line.

type Timeline

type Timeline struct {
	Samples []int16
	Spans   []Span
	// Sights is when each visual event was scheduled.
	Sights  []int
	TotalMS int
	Cues    []bench.SpeechCue `json:",omitempty"`
}

Timeline is where every line of a script landed once it was synthesised.

func Compose

func Compose(ctx context.Context, voice Voice, item Scenario) (Timeline, error)

type Tool

type Tool struct {
	Name        string
	Description string
	Parameters  []string
}

Tool is a capability declared to the session.

func (Tool) FunctionDeclaration

func (tool Tool) FunctionDeclaration() (FunctionToolDeclaration, error)

FunctionDeclaration returns the one canonical Realtime declaration for a scenario tool. Production profile authoring and the live client both consume this value: keeping the parameter schema in one place prevents a reviewed application declaration from drifting from session.update at runtime.

type Voice

type Voice interface {
	Speak(ctx context.Context, speaker, text string) ([]int16, error)
}

Voice synthesises a line of speech as 24 kHz mono samples.

Different speakers get different voices where a backend offers them, because a scenario with a waiter in it is not testing anything if the waiter and the user are indistinguishable to the recogniser.

Directories

Path Synopsis
Package graphnative binds the owned interaction-scenario suite to an exact graph-native Realtime adapter contract.
Package graphnative binds the owned interaction-scenario suite to an exact graph-native Realtime adapter contract.

Jump to

Keyboard shortcuts

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