Skip to content
SegmentStream/ Docs

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu

@segmentstream/ontology/chat-personas

7 public exports from @segmentstream/ontology/chat-personas.

Public exports

ChatPersonaPolicy

Deployed selection policy. The ontology only needs names and conditions.

interface ChatPersonaPolicy {
    readonly channelKinds?: Readonly<Record<string, string>>;
    readonly default?: string;
    readonly available?: readonly string[];
    readonly rules?: readonly PersonaRule[];
}
PersonaContext

Trusted delivery coordinates. The channel is the configured connection's channel name.

interface PersonaContext {
    readonly registeredAt?: string;
    readonly chat?: string;
    readonly provider: string;
    readonly channel: string;
    readonly kind: "private" | "group";
    readonly audience?: "guest" | "member";
}
PersonaRule
interface PersonaRule {
    readonly when: Partial<Omit<PersonaContext, "registeredAt">> & {
        readonly registeredBefore?: string;
    };
    readonly use: string;
}
chatPersona

Resolve once for both routing and answering. An obsolete assignment falls back to current policy.

function chatPersona(settings: ChatPersonaPolicy, context: PersonaContext | undefined, assigned?: string | null): {
    readonly name: string;
    readonly source: "chat";
} | {
    readonly name: string;
    readonly source: "rule";
} | {
    readonly name: string | undefined;
    readonly source: "default";
};
chatPersonaContext

Audience is an attribute of an authenticated web chat address. Shared chats can have mixed audiences.

function chatPersonaContext(address: Omit<PersonaContext, "chat" | "audience" | "registeredAt">, externalId: string, registeredAt?: string | null): PersonaContext;
chatPersonaNames
function chatPersonaNames(settings: ChatPersonaPolicy): readonly string[];
deployedChatPersonas

Set by the deployment bundler for agents using chat routing.

function deployedChatPersonas(): ChatPersonaPolicy | undefined;