UNPKG

@promptbook/azure-openai

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

98 lines (97 loc) 3.44 kB
import type { string_book } from './string_book'; /** * Supported visibility states for persisted agents. * * @public exported from `@promptbook/core` */ export declare const AGENT_VISIBILITY_VALUES: readonly ["PRIVATE", "UNLISTED", "PUBLIC"]; /** * Canonical visibility union for agents. * * @public exported from `@promptbook/core` */ export type AgentVisibility = (typeof AGENT_VISIBILITY_VALUES)[number]; /** * Fallback visibility used when no valid value is configured. * * @public exported from `@promptbook/core` */ export declare const DEFAULT_AGENT_VISIBILITY: AgentVisibility; /** * Returns `true` when the value is one of supported visibility states. * * @param value - Raw value to validate. * @returns Whether the value is a valid `AgentVisibility`. * * @public exported from `@promptbook/core` */ export declare function isAgentVisibility(value: unknown): value is AgentVisibility; /** * Normalizes raw visibility text into a supported value. * * @param value - Raw visibility value. * @returns Normalized visibility, or `null` when invalid. * * @public exported from `@promptbook/core` */ export declare function normalizeAgentVisibility(value: unknown): AgentVisibility | null; /** * Parses visibility from an unknown value with a safe fallback. * * @param value - Raw visibility value. * @param fallback - Fallback when the value is invalid. * @returns Parsed visibility. * * @public exported from `@promptbook/core` */ export declare function parseAgentVisibility(value: unknown, fallback?: AgentVisibility): AgentVisibility; /** * Parses visibility and throws when the value is not supported. * * @param value - Raw visibility value. * @param sourceLabel - Human-readable source used in the error message. * @returns Parsed visibility. * * @public exported from `@promptbook/core` */ export declare function parseAgentVisibilityStrict(value: unknown, sourceLabel?: string): AgentVisibility; /** * Extracts the last `META VISIBILITY` value from an agent source. * * @param agentSource - Raw book source. * @param options - Strict parsing options. * @returns Normalized visibility, or `null` when no commitment is present. * * @public exported from `@promptbook/core` */ export declare function parseAgentSourceVisibility(agentSource: string_book, options?: { readonly isStrict?: boolean; }): AgentVisibility | null; /** * Returns whether an agent should be listed publicly in anonymous views. * * @param visibility - Agent visibility to evaluate. * @returns `true` for publicly listed agents. * * @public exported from `@promptbook/core` */ export declare function isPublicAgentVisibility(visibility: AgentVisibility | null | undefined): boolean; /** * Returns the next visibility in UI rotation order. * * @param visibility - Current visibility. * @returns Next visibility value. * * @public exported from `@promptbook/core` */ export declare function getNextAgentVisibility(visibility: AgentVisibility | null | undefined): AgentVisibility; /** * Inserts or replaces the `META VISIBILITY` commitment in a book source. * * @param agentSource - Raw book source. * @param visibility - Visibility to persist. * @returns Source with exactly one normalized `META VISIBILITY` line. * * @public exported from `@promptbook/core` */ export declare function setAgentSourceVisibility(agentSource: string_book, visibility: AgentVisibility): string_book;