KletsoFakeScenario class final

Knobs for KletsoFakeBackend: how slow and how unreliable the fake runtime behaves. All defaults are instant and reliable (unit tests); use KletsoFakeScenario.demo for a lifelike example app.

Annotations
  • @immutable

Constructors

KletsoFakeScenario({Duration apiLatency = Duration.zero, Duration thinkingDelay = Duration.zero, Duration deltaDelay = Duration.zero, Duration toolDelay = Duration.zero, int failHandshakes = 0, int? dropSocketAfterEvents, int dropSocketCloseCode = 1001, int? duplicateEveryNth, int? expireTokenAfterEvents, bool rejectToken = false, int? rateLimitEveryNthMessage, bool seedConversationLog = false, bool greeting = true, bool sampleMedia = false, bool voice = true, String voiceTranscript = 'Show me products under 2000'})
Creates a scenario.
const
KletsoFakeScenario.demo({bool seedConversationLog = false, int? dropSocketAfterEvents, int? expireTokenAfterEvents, int? duplicateEveryNth, bool sampleMedia = true, bool voice = true, String voiceTranscript = 'Show me products under 2000'})
Lifelike timings for the example app, no faults.
const

Properties

apiLatency → Duration
Delay of every REST call.
final
deltaDelay → Duration
Delay between streamed text deltas.
final
dropSocketAfterEvents → int?
Close every socket with dropSocketCloseCode after it delivered this many events (deploy-style drop; the client must resume via seq).
final
dropSocketCloseCode → int
Close code for dropSocketAfterEvents.
final
duplicateEveryNth → int?
Send every Nth event twice (the client must dedupe).
final
expireTokenAfterEvents → int?
Close the first socket with 4403 after this many events, once (the client must refresh the token and reconnect).
final
failHandshakes → int
The first N open() calls throw a network error (tests reconnect and the WebSocket → SSE fallback).
final
greeting → bool
Send the agent greeting when a conversation is created.
final
hashCode → int
The hash code for this object.
no setterinherited
rateLimitEveryNthMessage → int?
Answer every Nth user message with a rate_limited error frame instead of a reply.
final
rejectToken → bool
Reject every handshake with 4401 (auth failure path).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sampleMedia → bool
Replace the fixtures' cdn.acme.com media URLs with public sample files so host video/audio players actually play in demos.
final
seedConversationLog → bool
Preload the first conversation with the 20-message fixture log.
final
thinkingDelay → Duration
Delay between receiving a user turn and the first event of the reply.
final
toolDelay → Duration
Duration of a simulated tool call.
final
voice → bool
Whether the fake agent offers voice. When on, about one second of microphone audio counts as the utterance voiceTranscript, which the fake answers aloud (a synthesised tone plus the transcript).
final
voiceTranscript → String
What the fake "hears" the user say.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited