@threadplane/angularInterfacev0.3.7

AgentSessionContext

What a session factory is given each time the agent needs a session.

import type { AgentSessionContext } from '@threadplane/angular';

Declaration

export interface AgentSessionContext  {
  readonly clientOptions: object | undefined;
  readonly developmentRuntime: AgentDevelopmentRuntimeFactory;
  readonly onThreadId: (threadId: string) => void;
  readonly reportOperationFailure: AgentOperationFailureReporter | undefined;
  readonly threadId: string | null;
}

Members

clientOptions

The app-wide AGENT_CLIENT_OPTIONS, when provided. Typed object because the shape belongs to the backend, which this package does not import. A first-party createSession takes it as its clientOptions with no cast.

readonly clientOptions: object | undefined;

developmentRuntime

Builds the session's development-install collector. A first-party session takes it as its developmentRuntime option and calls it with what its package knows of its own installation. It is inert unless a host with the collector is loaded (the chat package registers one), and outside a development build in a browser.

readonly developmentRuntime: AgentDevelopmentRuntimeFactory;

onThreadId

Tells the agent the id of a thread the session created, or one the factory chose because none was given. Pass it to the session as its onThreadId. A report from a session the agent has already replaced is ignored.

readonly onThreadId: (threadId: string) => void;

reportOperationFailure

The host's operation failure reporter, when provided. The first-party sessions take it as their reportOperationFailure option, so spreading the context passes it on.

readonly reportOperationFailure: AgentOperationFailureReporter | undefined;

threadId

The thread the new session belongs to, or null for a new empty one.

readonly threadId: string | null;