UNPKG

@promptbook/remote-server

Version:

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

57 lines (56 loc) 2.28 kB
import type { AgentBasicInformation } from '../../../../book-2.0/agent-source/AgentBasicInformation'; import { type AgentVisibility } from '../../../../book-2.0/agent-source/agentSourceVisibility'; import type { string_book } from '../../../../book-2.0/agent-source/string_book'; import type { string_agent_permanent_id } from '../../../../types/string_agent_name'; /** * Options used while preparing a source for persistence. * * @private shared persistence helper for `AgentCollectionInSupabase` */ export type PrepareAgentSourceForPersistenceOptions = { /** * Visibility value that should be written into the book when present. */ readonly visibility?: AgentVisibility | null; /** * Whether `visibility` should replace an existing `META VISIBILITY` commitment. */ readonly isVisibilityOverride?: boolean; }; /** * Prepared agent source payload ready for database persistence. * * The original source may contain `META ID`, which should not be stored verbatim * because clones and imports must receive a fresh local permanent id. * * @private shared persistence helper for `AgentCollectionInSupabase` */ export type PreparedAgentSourceForPersistence = { /** * Parsed profile based on the normalized source that will be stored. */ readonly agentProfile: AgentBasicInformation; /** * Source normalized for persistence, with any `META ID` lines removed. */ readonly agentSource: string_book; /** * Permanent id extracted from the original source before stripping `META ID`. */ readonly permanentId: string_agent_permanent_id | undefined; /** * Visibility parsed from the normalized source. */ readonly visibility: AgentVisibility | undefined; }; /** * Normalizes one agent source before persistence. * * This keeps create/update flows aligned when a source includes `META ID`. * * @param agentSource - Raw agent source about to be stored. * @returns Parsed profile, normalized source, and extracted permanent id. * * @private shared persistence helper for `AgentCollectionInSupabase` */ export declare function prepareAgentSourceForPersistence(agentSource: string_book, options?: PrepareAgentSourceForPersistenceOptions): PreparedAgentSourceForPersistence;