UNPKG

@mastra/core

Version:
126 lines • 8.53 kB
import type { KnowledgeScopeDeclarations } from '../../../knowledge/declarations.js'; import { StorageDomain } from '../base.js'; import type { KnowledgePageStore } from './pages.js'; /** @experimental Knowledge APIs are experimental and may change without notice. */ export declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 4; /** @experimental Knowledge APIs are experimental and may change without notice. */ export declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 4; /** @experimental Knowledge APIs are experimental and may change without notice. */ export interface KnowledgeStorageCapabilities { contractVersion: typeof KNOWLEDGE_STORAGE_CONTRACT_VERSION; schemaVersion: 1 | typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION; supportsSchemaInspection: boolean; supportsExplicitReset: boolean; /** * The adapter stores a pin `kind` (`page` or `list`) with a list pin's `depth`. Adapters from before * pin kinds don't report it, and core refuses listing pins on them rather than store a page pin. */ supportsPinKinds?: boolean; } /** @experimental Knowledge APIs are experimental and may change without notice. */ export type KnowledgeSchemaInspection = { status: 'compatible'; schemaVersion: typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION; } | { status: 'uninitialized'; schemaVersion: null; } | { status: 'incompatible-reset-required'; schemaVersion: number | null; reason: string; } | { status: 'unavailable'; schemaVersion: null; reason: string; }; /** @experimental Knowledge APIs are experimental and may change without notice. */ export interface KnowledgeSchemaSnapshot { available: boolean; tableNames: readonly string[]; schemaVersion?: number; reason?: string; } /** * Classifies an adapter-provided, read-only schema snapshot. Adapters own the physical probe; this * helper owns version negotiation and never mutates the snapshot or backing store. * * @experimental Knowledge APIs are experimental and may change without notice. */ export declare function inspectKnowledgeSchema(snapshot: KnowledgeSchemaSnapshot): KnowledgeSchemaInspection; /** @experimental Knowledge APIs are experimental and may change without notice. */ export declare class KnowledgeConflictError extends Error { constructor(id: string); } export declare class KnowledgeNotFoundError extends Error { constructor(type: string, id: string); } export declare class KnowledgeSchemaResetRequiredError extends Error { readonly inspection: Extract<KnowledgeSchemaInspection, { status: 'incompatible-reset-required'; }>; constructor(inspection: Extract<KnowledgeSchemaInspection, { status: 'incompatible-reset-required'; }>); } export declare class KnowledgeUnsupportedCapabilityError extends Error { constructor(capability: string); } export declare function assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void; export declare function parseKnowledgeWikilinks(text: string): string[]; export declare function createKnowledgeUlid(now?: number): string; export declare abstract class KnowledgeStorage extends StorageDomain implements KnowledgePageStore { #private; constructor(config?: { storageIsolationKey?: unknown; }); /** Identifies the physical Knowledge backend and namespace used by this domain. */ getStorageIsolationKey(): unknown; getCapabilities(): KnowledgeStorageCapabilities; inspectSchema(): Promise<KnowledgeSchemaInspection>; dangerouslyReset(): Promise<void>; /** * Scope declarations the store supplies itself, such as the scopes a hosted store's importers write * to, with their access rules. Knowledge merges them under its config's, reusing the answer for a * short window, so a declaration the store adds, removes or changes (revoking access included) * applies within it; a key the config declares keeps the config's declaration. None by default. * * @experimental */ getScopeDeclarations(): Promise<KnowledgeScopeDeclarations>; materializeScope(_input: Parameters<KnowledgePageStore['materializeScope']>[0]): ReturnType<KnowledgePageStore['materializeScope']>; getScopesByAddress(_input: Parameters<KnowledgePageStore['getScopesByAddress']>[0]): ReturnType<KnowledgePageStore['getScopesByAddress']>; listScopeDeclarations(): ReturnType<KnowledgePageStore['listScopeDeclarations']>; renameScopeDeclaration(_input: Parameters<KnowledgePageStore['renameScopeDeclaration']>[0]): ReturnType<KnowledgePageStore['renameScopeDeclaration']>; listChildScopes(_input: Parameters<KnowledgePageStore['listChildScopes']>[0]): ReturnType<KnowledgePageStore['listChildScopes']>; countChildScopes(_input: Parameters<KnowledgePageStore['countChildScopes']>[0]): ReturnType<KnowledgePageStore['countChildScopes']>; getPage(_input: Parameters<KnowledgePageStore['getPage']>[0]): ReturnType<KnowledgePageStore['getPage']>; getPages(_input: Parameters<KnowledgePageStore['getPages']>[0]): ReturnType<KnowledgePageStore['getPages']>; getPageByPath(_input: Parameters<KnowledgePageStore['getPageByPath']>[0]): ReturnType<KnowledgePageStore['getPageByPath']>; findPagesByName(_input: Parameters<KnowledgePageStore['findPagesByName']>[0]): ReturnType<KnowledgePageStore['findPagesByName']>; listChildPages(_input: Parameters<KnowledgePageStore['listChildPages']>[0]): ReturnType<KnowledgePageStore['listChildPages']>; listPages(_input: Parameters<KnowledgePageStore['listPages']>[0]): ReturnType<KnowledgePageStore['listPages']>; createPage(_input: Parameters<KnowledgePageStore['createPage']>[0]): ReturnType<KnowledgePageStore['createPage']>; updatePage(_input: Parameters<KnowledgePageStore['updatePage']>[0]): ReturnType<KnowledgePageStore['updatePage']>; movePage(_input: Parameters<KnowledgePageStore['movePage']>[0]): ReturnType<KnowledgePageStore['movePage']>; mergePages(_input: Parameters<KnowledgePageStore['mergePages']>[0]): ReturnType<KnowledgePageStore['mergePages']>; deletePage(_input: Parameters<KnowledgePageStore['deletePage']>[0]): ReturnType<KnowledgePageStore['deletePage']>; getNote(_input: Parameters<KnowledgePageStore['getNote']>[0]): ReturnType<KnowledgePageStore['getNote']>; countChildPages(_input: Parameters<KnowledgePageStore['countChildPages']>[0]): ReturnType<KnowledgePageStore['countChildPages']>; replacePageBodyLinks(_input: Parameters<KnowledgePageStore['replacePageBodyLinks']>[0]): ReturnType<KnowledgePageStore['replacePageBodyLinks']>; listPageBodyLinkSources(_input: Parameters<KnowledgePageStore['listPageBodyLinkSources']>[0]): ReturnType<KnowledgePageStore['listPageBodyLinkSources']>; countPageLinks(_input: Parameters<KnowledgePageStore['countPageLinks']>[0]): ReturnType<KnowledgePageStore['countPageLinks']>; listPageLinks(_input: Parameters<KnowledgePageStore['listPageLinks']>[0]): ReturnType<KnowledgePageStore['listPageLinks']>; countNotes(_input: Parameters<KnowledgePageStore['countNotes']>[0]): ReturnType<KnowledgePageStore['countNotes']>; listNotes(_input: Parameters<KnowledgePageStore['listNotes']>[0]): ReturnType<KnowledgePageStore['listNotes']>; listNotesMentioning(_input: Parameters<KnowledgePageStore['listNotesMentioning']>[0]): ReturnType<KnowledgePageStore['listNotesMentioning']>; addNote(_input: Parameters<KnowledgePageStore['addNote']>[0]): ReturnType<KnowledgePageStore['addNote']>; restampNote(_input: Parameters<KnowledgePageStore['restampNote']>[0]): ReturnType<KnowledgePageStore['restampNote']>; removeNote(_input: Parameters<KnowledgePageStore['removeNote']>[0]): ReturnType<KnowledgePageStore['removeNote']>; restoreNote(_input: Parameters<KnowledgePageStore['restoreNote']>[0]): ReturnType<KnowledgePageStore['restoreNote']>; searchPages(_input: Parameters<KnowledgePageStore['searchPages']>[0]): ReturnType<KnowledgePageStore['searchPages']>; listPageActivity(_input: Parameters<KnowledgePageStore['listPageActivity']>[0]): ReturnType<KnowledgePageStore['listPageActivity']>; addPinAudience(_input: Parameters<KnowledgePageStore['addPinAudience']>[0]): ReturnType<KnowledgePageStore['addPinAudience']>; removePinAudience(_input: Parameters<KnowledgePageStore['removePinAudience']>[0]): ReturnType<KnowledgePageStore['removePinAudience']>; listPins(_input: Parameters<KnowledgePageStore['listPins']>[0]): ReturnType<KnowledgePageStore['listPins']>; } //# sourceMappingURL=base.d.ts.map