FakeAgentSessionInit
Initial snapshot fields, an optional state declaration and an optional submit handler.
import type { FakeAgentSessionInit } from '@threadplane/angular/chat/testing';Declaration
export interface FakeAgentSessionInit<TTools extends {
[K in keyof TTools]: ToolContract;
} = Record<string, ToolContract>, TState = unknown> extends FakeAgentSnapshotPatch<TTools, TState> {
readonly commands?: readonly FakeCommand[];
readonly onCheckStatus?: (fake: FakeAgentSession<TTools, TState>) => void | PromiseLike<void>;
readonly onRegenerate?: FakeCommandHandler<TTools, TState>;
readonly onResume?: FakeResumeHandler<TTools, TState>;
readonly onRetry?: FakeCommandHandler<TTools, TState>;
readonly onRunWithoutMessage?: FakeCommandHandler<TTools, TState>;
readonly onSubmit?: FakeSubmitHandler<TTools, TState>;
readonly stateType?: StateDeclaration<TState>;
}Type parameters
TTools{ [K in keyof TTools]: ToolContract; }Default:Record<string, ToolContract>TStateDefault:unknown
Members
commands
Optional session members to carry; see FakeCommand.
readonly commands?: readonly FakeCommand[];onCheckStatus
Makes checkStatus present and runs when it is called.
readonly onCheckStatus?: (fake: FakeAgentSession<TTools, TState>) => void | PromiseLike<void>;onRegenerate
Makes regenerate present and runs after it removes the old answer.
readonly onRegenerate?: FakeCommandHandler<TTools, TState>;onResume
readonly onResume?: FakeResumeHandler<TTools, TState>;onRetry
Makes retry present and runs in place of the failed call. Without it,
retry calls the handler of the submission, resume, run or regeneration
that last failed again, with the same arguments.
readonly onRetry?: FakeCommandHandler<TTools, TState>;onRunWithoutMessage
Makes runWithoutMessage present and runs after it merges the state it was given.
readonly onRunWithoutMessage?: FakeCommandHandler<TTools, TState>;onSubmit
readonly onSubmit?: FakeSubmitHandler<TTools, TState>;stateType
Types state, the way a real session's stateType does: type<T>() for
the type alone, or a Standard Schema to also check every state a test sets.
readonly stateType?: StateDeclaration<TState>;