@mastra/core
Version:
90 lines • 4.52 kB
TypeScript
/**
* Schema-2 Knowledge helpers that published packages still import from `@mastra/core/storage`.
* Published Memory, server and store adapters resolve these names when they load, so they stay
* until the next major even though nothing in Knowledge uses them. Do not use them in new code.
*/
/** @deprecated Schema-2 scope tags; Knowledge now uses scope pages. */
export type KnowledgeScope = string[];
/** @deprecated Schema-2 scope levels; Knowledge now uses declared scope types. */
export type KnowledgeScopeLevel = 'org' | 'resource' | 'thread';
/** @deprecated Schema-2 semantic outbox document type. */
export type KnowledgeSemanticDocumentType = 'node' | 'record';
/** @deprecated Schema-2 semantic outbox operation. */
export type KnowledgeSemanticOperation = 'upsert' | 'delete';
/** @deprecated Not enforced. Kept so published packages that import it still load. */
export declare const MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH = 400;
/** @deprecated Not enforced. Kept so published packages that import it still load. */
export declare const MAX_KNOWLEDGE_RECORD_TEXT_LENGTH = 1000;
/**
* Schema-2 node description bound. Published `@mastra/libsql` and `@mastra/pg` look this up before
* they enable Knowledge; without it they fail with a misleading error instead of reporting that
* the adapter lacks the page store.
*
* @deprecated Schema-2 only. Do not use in new code.
*/
export declare function assertKnowledgeDescriptionWithinBound(description: string | undefined): void;
/**
* Schema-2 record text bound. Kept for the same published adapters as
* {@link assertKnowledgeDescriptionWithinBound}.
*
* @deprecated Schema-2 only. Do not use in new code.
*/
export declare function assertKnowledgeRecordTextWithinBound(text: string): void;
/** @deprecated Schema-2 node cursor. */
export interface KnowledgeNodeCursor {
updatedAt: Date;
name: string;
id: string;
}
/** @deprecated Schema-2 node cursor. */
export declare function createKnowledgeNodeCursor(node: {
updatedAt: Date;
name: string;
id: string;
}, filters?: {
namePrefix?: string;
kind?: string;
hasContent?: boolean;
}): string;
/** @deprecated Schema-2 node cursor. */
export declare function parseKnowledgeNodeCursor(cursor: string, filters: {
namePrefix?: string;
kind?: string;
hasContent?: boolean;
}): KnowledgeNodeCursor;
/**
* Most tags one scope may hold. Visible-scope lookup enumerates every subset of the query scope
* (8 tags = 255 keys in one `IN (...)`); past ~30 the subset loop hangs and `1 << n` wraps, so this
* is a storage-safety limit, not a hierarchy rule.
*
* @experimental
*/
export declare const MAX_KNOWLEDGE_SCOPE_TAGS = 8;
/**
* Validates tag shape (`type:value`), dedupes and sorts by whole entry. Any tag type is accepted;
* a value segment may not start with `$`, so a stored scope can never look like a scope pattern.
*/
export declare function canonicalizeKnowledgeScope(scope: KnowledgeScope): KnowledgeScope;
export declare function knowledgeScopeKey(scope: KnowledgeScope): string;
export declare function isKnowledgeScopeVisible(recordScope: KnowledgeScope, queryScope: KnowledgeScope): boolean;
export declare function knowledgeVisibleScopeKeys(scope: KnowledgeScope): string[];
export declare function expandKnowledgeScope(context: KnowledgeScope, level: KnowledgeScopeLevel): KnowledgeScope;
/**
* Knowledge v2 has no record scope ceilings: a write may target any scope level present in the
* conversation. Grant-based write enforcement is not implemented yet. Kept only so published
* `@mastra/memory` versions that import it still load; it never throws.
*
* @deprecated No longer enforced. Remove calls.
*/
export declare function assertKnowledgeScopeWithinCeiling(_scope: KnowledgeScope, _maxScope?: KnowledgeScopeLevel): void;
/**
* Knowledge v2 records have no scope ceiling to raise. Kept only so published store adapters
* that import it still load; it never throws.
*
* @deprecated No longer enforced. Remove calls.
*/
export declare function assertKnowledgeCeilingRaised(_currentMaxScope: KnowledgeScopeLevel | undefined, _maxScope: KnowledgeScopeLevel | undefined): void;
/** @deprecated Schema-2 semantic outbox id. */
export declare function knowledgeSemanticDocumentId(type: KnowledgeSemanticDocumentType, id: string): string;
export declare function knowledgeSemanticIdempotencyKey(documentId: string, operation: KnowledgeSemanticOperation, version: number | string): string;
//# sourceMappingURL=legacy.d.ts.map