/**
 * Knowledge storage contract, schema 4: pages, notes, stamps, mentions, body links and pins.
 *
 * The store holds structure and filters by a read scope that core computes from the run's scopes and
 * the Knowledge declarations; it holds no access policy of its own (no grant rows, no roles). Core
 * checks roles before every write, and resolves every write target through the run's read scope first,
 * so a page or note the run can't read behaves exactly like a missing id.
 *
 * Every adapter must implement these semantics; the physical layout (tables, columns, denormalized
 * filter columns, how a large read scope is passed to the database) is the adapter's choice. Any
 * denormalized scope column (a note's page scope, its stamp scopes' addresses, its mentions' home
 * scopes) must be updated in the same transaction as the move or merge that changes it.
 *
 * The body-link table came after schema 4 shipped and is additive: adapters create it with idempotent
 * DDL in `init()` (as the pin-audience index was), without a schema version change, so existing
 * stores keep their data. Links for pages written before it fill in on `knowledge.reindexLinks()` or the
 * page's next write.
 *
 * @experimental Knowledge APIs are experimental and may change without notice.
 */
/**
 * Who changed something, recorded on every page and note change.
 *
 * @experimental
 */
export interface KnowledgeProvenance {
    /** The writer, e.g. `agent:alex` or `host`. */
    author: string;
    /** The thread the change was made from, when there was one. */
    sourceThreadId?: string;
}
/**
 * One prefix entry of a read scope. A scope page matches when it was created from `declaration` and
 * its address starts with `prefix`. Prefix entries let a rule such as "`role:acme:admin` is editor on
 * every `team:$orgId:$teamId`" reach every Acme team without listing them, while template children
 * (`account:acme:1/internal`, declaration `account:$orgId:$accountId/internal`) never match a prefix
 * entry for their parent's declaration.
 *
 * @experimental
 */
export interface KnowledgeScopePrefix {
    /** The declaration key the scope page was materialized from, e.g. `team:$orgId:$teamId`. */
    declaration: string;
    /**
     * Address prefix, e.g. `team:acme:`. Empty matches every scope of the declaration. Core only emits
     * prefixes that end at a segment boundary (empty, or ending in `:`), so `team:acme:` never matches
     * `team:acmecorp:x`.
     */
    prefix: string;
}
/**
 * One tree-parent entry of a read scope, for a rule bound through the target type's `belongsTo`
 * (e.g. `role:$orgId:admin` is viewer on every `resource:$resourceId` that belongs to `org:$orgId`).
 * A scope page matches when it was created from `declaration` and its tree parent is `parentId`.
 *
 * @experimental
 */
export interface KnowledgeScopeChildren {
    declaration: string;
    /** Page id of the scope the rule's params bound (`org:acme`'s page). */
    parentId: string;
}
/**
 * The scopes a read may see, at viewer or above. `'all'` reads without an access filter and is only
 * for host surfaces behind their own auth (Studio); agent runs always pass a computed read scope.
 *
 * A scope page is readable when its address is in `addresses`, or it matches a `prefixes` or
 * `children` entry.
 * Matching is exact and case-sensitive by UTF-16 code unit, as in {@link knowledgeScopeReadable}. SQL
 * adapters must not use `LIKE` for prefixes: `_` and `%` are legal in addresses, and SQLite/MySQL
 * `LIKE` folds ASCII case. Compare a substring (or a binary range) instead.
 *
 * @experimental
 */
export type KnowledgeReadScope = 'all' | {
    addresses: string[];
    prefixes: KnowledgeScopePrefix[];
    children: KnowledgeScopeChildren[];
};
/**
 * A topic or entity. A scope is a page marked as a boundary (`isScope`, with an `address`). Every
 * page belongs to exactly one home scope (`scopeId`, the nearest scope page at or above it); a scope
 * page's `scopeId` is its own id.
 *
 * @experimental
 */
export interface KnowledgePage {
    id: string;
    /** The home scope's page id. Equal to `id` for a scope page. */
    scopeId: string;
    /** Tree parent. `null` only for root scope pages. */
    parentId: string | null;
    isScope: boolean;
    /** Canonical `type:value` address; scope pages only. */
    address?: string;
    /** Declaration key the scope page was materialized from; scope pages only. */
    declaration?: string;
    /**
     * Stable key, unique among its live siblings (the pages sharing its parent); ordinary pages only,
     * optional. Addressed by key path within the home scope: `org:acme#policies/refund`.
     */
    key?: string;
    /** Fractional ordering key among siblings; compare as code-unit strings. */
    position: string;
    name: string;
    /** Bounded synopsis, at most {@link MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS}. */
    description?: string;
    /** Curated long-form body. Unbounded. */
    body?: string;
    version: number;
    /** Set when the page was merged into another page. */
    mergedInto?: string;
    createdBy: KnowledgeProvenance;
    updatedBy: KnowledgeProvenance;
    createdAt: Date;
    updatedAt: Date;
    deletedAt?: Date;
    deletedBy?: string;
}
/**
 * A short, attributed piece of durable knowledge attached to one page. Visible when its page is
 * visible, at least one stamp scope is readable, and every resolved mention's page scope is readable.
 *
 * @experimental
 */
export interface KnowledgeNote {
    id: string;
    pageId: string;
    text: string;
    /** When the fact was true or observed, if the writer gave one. */
    when?: Date;
    /** Scope page ids that narrow who can see the note (OR). Never empty. */
    stampScopeIds: string[];
    /**
     * Page ids resolved from `[[mentions]]` in `text` at write time. A resolved mention hides its note
     * unless the run can read the mentioned page's scope; the mentioned page's deleted or live state
     * doesn't affect visibility. Unresolved mentions have no entry and never hide a note.
     */
    mentions: string[];
    provenance: KnowledgeProvenance;
    version: number;
    createdAt: Date;
    updatedAt: Date;
    deletedAt?: Date;
    deletedBy?: string;
}
/**
 * `page`: the page itself is delivered. `list`: a listing of the pages under it is delivered, like
 * `knowledge_list` from that page.
 *
 * @experimental
 */
export type KnowledgePinKind = 'page' | 'list';
/** Most levels a pinned listing walks below its page. @experimental */
export declare const MAX_KNOWLEDGE_PIN_LIST_DEPTH = 3;
/**
 * The depth a pin of `kind` stores: undefined for `page` pins, `depth` (default 1) for `list` pins.
 * Throws when a `list` depth isn't a whole number from 1 to {@link MAX_KNOWLEDGE_PIN_LIST_DEPTH}.
 *
 * @experimental
 */
export declare function knowledgePinDepth(kind: KnowledgePinKind, depth: number | undefined): number | undefined;
/**
 * A reference to a page plus the run scopes it's delivered to (OR). One pin per page and kind; pinning
 * again adds audience entries.
 *
 * @experimental
 */
export interface KnowledgePin {
    id: string;
    pageId: string;
    kind: KnowledgePinKind;
    /** Levels a `list` pin walks below its page (1 to {@link MAX_KNOWLEDGE_PIN_LIST_DEPTH}). Unset on `page` pins. */
    depth?: number;
    /** Scope addresses; a run holding any of them receives the pin if it can read the page. */
    audience: string[];
    createdBy: string;
    createdAt: Date;
    updatedAt: Date;
}
/**
 * One `[[ref]]` target in a page's body, as core resolved it when the body was written. The store
 * keeps one row per (source page, `ref`); body links are the only links it stores, since note links
 * are the existing note mentions.
 *
 * @experimental
 */
export interface KnowledgePageBodyLink {
    /**
     * The ref's match key from {@link knowledgeLinkRefKey}. When a page is created, moved or renamed,
     * core looks up unresolved links by the keys that page now answers to and re-resolves their sources.
     */
    ref: string;
    /** The page the ref resolved to, or `null` while it names no page. */
    toPageId: string | null;
    /** How many times the body links this ref (at least 1). */
    count: number;
}
/**
 * `body`: a `[[ref]]` in the source page's body. `note`: a `[[mention]]` in a note on the source page.
 *
 * @experimental
 */
export type KnowledgePageLinkKind = 'body' | 'note';
/**
 * One resolved link between two pages. A `note` edge's `count` is how many visible notes on the source
 * page mention the target.
 *
 * @experimental
 */
export interface KnowledgePageLinkEdge {
    fromPageId: string;
    toPageId: string;
    kind: KnowledgePageLinkKind;
    count: number;
}
/**
 * Per-page link totals: how many distinct other pages link to it (`in`) and it links to (`out`).
 *
 * @experimental
 */
export interface KnowledgePageLinkCounts {
    in: number;
    out: number;
}
/**
 * The key a `[[ref]]` is matched by when core looks for links a new or moved page now resolves:
 * `scope#key/key` refs as written (trimmed), every other ref (id, address, name) by
 * {@link canonicalKnowledgeName}. Core computes both sides with this function; a key collision only
 * makes core re-resolve a source page, never links it wrongly.
 *
 * @experimental
 */
export declare function knowledgeLinkRefKey(ref: string): string;
/** A pin as listed, with its page's name. */
export interface KnowledgeListedPin extends KnowledgePin {
    pageName: string;
}
/**
 * Most levels an ordinary page may sit below its home scope page: a page directly under its scope
 * is depth 1. Scope pages (including scopes nested under scopes by `belongsTo` or as template
 * children) don't count and reset the count. Creates and moves past it are refused.
 *
 * @experimental
 */
export declare const MAX_KNOWLEDGE_PAGE_DEPTH = 10;
/**
 * Most pages one move may carry (the page and everything under it). Larger moves are refused with
 * {@link KnowledgeMoveTooLargeError} instead of running in the background.
 *
 * @experimental
 */
export declare const MAX_KNOWLEDGE_MOVE_PAGES = 500;
/** @experimental */
export declare const MAX_KNOWLEDGE_PAGE_LIST_LIMIT = 100;
/** Most edges one {@link KnowledgePageStore.listPageLinks} call returns. @experimental */
export declare const MAX_KNOWLEDGE_PAGE_LINKS = 10000;
/** Distinct `[[refs]]` core indexes per page body; further refs stay plain text. @experimental */
export declare const MAX_KNOWLEDGE_PAGE_BODY_LINKS = 1000;
/** Longest body-link ref key core stores; a longer `[[ref]]` stays plain text. Stores may size the column to it. @experimental */
export declare const MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH = 512;
/**
 * Maximum page description in estimated tokens (tokenx), enforced by every adapter on create and
 * update.
 *
 * @experimental
 */
export declare const MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS = 100;
/**
 * Maximum note text in estimated tokens (tokenx), enforced by every adapter on add. Long-form text
 * belongs in a page body.
 *
 * @experimental
 */
export declare const MAX_KNOWLEDGE_NOTE_TOKENS = 250;
/**
 * Rejects a page description over {@link MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS} before any write.
 * Every adapter calls this so all stores share one estimator and one error.
 *
 * @experimental
 */
export declare function assertKnowledgePageDescriptionWithinBound(description: string | undefined): void;
/**
 * Rejects note text over {@link MAX_KNOWLEDGE_NOTE_TOKENS} before any write.
 *
 * @experimental
 */
export declare function assertKnowledgeNoteTextWithinBound(text: string): void;
/** @experimental */
export declare class KnowledgeMoveTooLargeError extends Error {
    readonly pageId: string;
    readonly pages: number;
    constructor(pageId: string, pages: number);
}
/** @experimental */
export declare class KnowledgePageDepthError extends Error {
    constructor(pageId: string);
}
/**
 * Splits a page reference `<scope>#<key>[/<key>…]` into the scope address and the key path, or
 * returns null when it isn't one (no scope, an empty or invalid key segment, a second `#`).
 * @experimental
 */
export declare function parseKnowledgePageRef(ref: string): {
    scope: string;
    path: string[];
} | null;
/**
 * The keys of a key path. Empty segments are dropped, so a leading, trailing or doubled `/`
 * (`guides/`, `/guides`, `guides//cli`) names the same page as the clean path.
 * @experimental
 */
export declare function knowledgePagePath(path: string): string[];
/** @experimental */
export declare class KnowledgePageKeyConflictError extends Error {
    readonly key: string;
    /** The parent page (or scope page) that already has a live child with this key. */
    readonly parentId: string;
    constructor(key: string, 
    /** The parent page (or scope page) that already has a live child with this key. */
    parentId: string);
}
/** @experimental */
export declare class KnowledgePageHasChildrenError extends Error {
    constructor(pageId: string);
}
/**
 * Canonical form used for exact-name lookup. Computed in JS so every adapter (and SQL collations)
 * agree on non-ASCII names; adapters store it rather than computing `lower()` in SQL.
 *
 * @experimental
 */
export declare function canonicalKnowledgeName(name: string): string;
/**
 * Whether a scope page is readable under `read`. Adapters that filter in memory use this; SQL
 * adapters must match it exactly.
 *
 * @experimental
 */
export declare function knowledgeScopeReadable(scope: Pick<KnowledgePage, 'address' | 'declaration' | 'parentId'>, read: KnowledgeReadScope): boolean;
/**
 * A position key strictly between `before` and `after` (either may be absent), for fractional
 * sibling ordering. Keys are base-36 strings compared by code unit and never end in `0`, so there's
 * always room between two keys. Appends stay short; prepends (no `before`) still halve toward `0`
 * and grow by about a character every few calls, so nothing should prepend in a loop.
 *
 * @experimental
 */
export declare function knowledgePositionBetween(before?: string, after?: string): string;
/**
 * A keyed page a declaration creates with its scope, optionally with keyed child pages (same scope).
 * @experimental
 */
export interface KnowledgePageTemplateInput {
    key: string;
    name: string;
    description?: string;
    pages?: KnowledgePageTemplateInput[];
}
/**
 * A scope to materialize, with the child scopes and keyed pages its declaration creates with it.
 *
 * @experimental
 */
export interface MaterializeKnowledgeScopeInput {
    address: string;
    declaration: string;
    name: string;
    description?: string;
    /**
     * Tree parent from `belongsTo`. Atomically sets the first non-null parent, including for an
     * existing unlinked scope. Once linked, the parent is never replaced; a differing non-null
     * request is reported as `parentConflict`. An absent/null request leaves an existing link alone.
     */
    parentId?: string | null;
    children?: Array<{
        address: string;
        declaration: string;
        name: string;
        description?: string;
    }>;
    pages?: KnowledgePageTemplateInput[];
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface MaterializeKnowledgeScopeResult {
    scope: KnowledgePage;
    /** True when this call created the scope page. */
    created: boolean;
    /** Set when the scope already existed under a different parent than the one requested. */
    parentConflict?: {
        existingParentId: string | null;
        requestedParentId: string | null;
    };
}
/** @experimental */
export interface KnowledgePageListOutput {
    pages: KnowledgePage[];
    nextCursor?: string;
}
/** @experimental */
export interface KnowledgeNoteListOutput {
    notes: KnowledgeNote[];
    nextCursor?: string;
}
/** @experimental */
export interface CreateKnowledgePageInput {
    id?: string;
    /** The tree parent: a scope page for a top-level page, or any page in the same scope. */
    parentId: string;
    /**
     * Unique among the parent's live children ({@link KnowledgePageKeyConflictError} otherwise); must
     * not contain `/`, `#` or `%`.
     */
    key?: string;
    name: string;
    description?: string;
    body?: string;
    /** Defaults to after the last sibling. */
    position?: string;
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface UpdateKnowledgePageInput {
    id: string;
    expectedVersion: number;
    name?: string;
    /** Empty string clears it. */
    description?: string;
    body?: string;
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface MoveKnowledgePageInput {
    id: string;
    expectedVersion: number;
    /** New tree parent. A different scope moves the page and its subtree to that scope. */
    parentId: string;
    /** Defaults to after the last sibling. */
    position?: string;
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface MergeKnowledgePagesInput {
    sourceId: string;
    sourceVersion: number;
    targetId: string;
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface AddKnowledgeNoteInput {
    id?: string;
    pageId: string;
    text: string;
    when?: Date;
    /** Non-empty; scope page ids. */
    stampScopeIds: string[];
    /** Resolved mention targets (page ids). Unresolved mentions stay plain text and aren't passed. */
    mentions: string[];
    provenance: KnowledgeProvenance;
}
/** @experimental */
export interface SearchKnowledgePagesInput {
    query: string;
    read: KnowledgeReadScope;
    /** Narrows to pages (and notes on pages) whose home scope is one of these scope page ids. */
    scopeIds?: string[];
    limit?: number;
}
/** @experimental */
export type KnowledgePageSearchHit = {
    type: 'page';
    page: KnowledgePage;
} | {
    type: 'note';
    note: KnowledgeNote;
    page: KnowledgePage;
};
/** @experimental */
export type KnowledgePageActivityAction = 'scope-created' | 'page-created' | 'page-updated' | 'page-moved' | 'page-merged' | 'page-deleted' | 'note-added' | 'note-restamped' | 'note-removed' | 'note-restored' | 'pin-added' | 'pin-removed';
/** @experimental */
export interface KnowledgePageActivityEvent {
    id: string;
    action: KnowledgePageActivityAction;
    /** The page's home scope at the time of the change (the target scope for a move). */
    scopeId: string;
    pageId: string;
    noteId?: string;
    provenance: KnowledgeProvenance;
    createdAt: Date;
}
/** @experimental */
export interface KnowledgeScopeDeclarationCount {
    declaration: string;
    scopes: number;
}
/** A scope page `renameScopeDeclaration` would re-key. @experimental */
export interface KnowledgeScopeDeclarationRename {
    address: string;
    from: string;
    to: string;
}
/**
 * The schema-4 store surface. Reads take a {@link KnowledgeReadScope} and return only what it can
 * see: a hidden page or note is indistinguishable from a missing one, and filtering happens before
 * ordering, limits and cursors. Writes take ids that core has already resolved through the run's
 * read scope and checked against the run's roles; the store enforces structure (same-scope parents,
 * depth, move size, versions, key uniqueness, token bounds), never access.
 *
 * @experimental
 */
export interface KnowledgePageStore {
    materializeScope(input: MaterializeKnowledgeScopeInput): Promise<MaterializeKnowledgeScopeResult>;
    /** Scope pages by address, unfiltered (names and descriptions are not secret to the host). */
    getScopesByAddress(addresses: string[]): Promise<KnowledgePage[]>;
    /** Every `declaration` key stored on scope pages, with how many scope pages carry it, in key order. */
    listScopeDeclarations(): Promise<KnowledgeScopeDeclarationCount[]>;
    /**
     * Re-keys scope pages created from declaration `from` (and its template children, `from/<name>`)
     * to `to`, atomically. Before writing, calls `check` with every affected scope and its new key;
     * if `check` throws, nothing changes and the error propagates. Returns how many scope pages
     * were re-keyed.
     */
    renameScopeDeclaration(input: {
        from: string;
        to: string;
        check: (scopes: KnowledgeScopeDeclarationRename[]) => void;
    }): Promise<number>;
    /**
     * Scope pages directly under a page (`parentId: null` lists root scopes), by position then id.
     * Without `read` the list is unfiltered and core decides which to list and which as restricted;
     * with `read` only the scopes it can read are listed, filtered before the limit and cursor.
     */
    listChildScopes(input: {
        parentId: string | null;
        read?: KnowledgeReadScope;
        cursor?: string;
        limit?: number;
    }): Promise<KnowledgePageListOutput>;
    /**
     * How many readable child scopes each parent has, keyed by parent id; one call for all the
     * parents. Counts the scopes {@link listChildScopes} would list with the same `read`. Parents with
     * none map to 0; duplicate ids count once.
     */
    countChildScopes(input: {
        parentIds: string[];
        read: KnowledgeReadScope;
    }): Promise<Record<string, number>>;
    getPage(input: {
        id: string;
        read: KnowledgeReadScope;
    }): Promise<KnowledgePage | null>;
    /** Readable live pages among `ids`, in no particular order; missing, deleted or unreadable ids are left out. */
    getPages(input: {
        ids: string[];
        read: KnowledgeReadScope;
    }): Promise<KnowledgePage[]>;
    /**
     * Walks the scope's page tree key by key: `path[0]` is a live child of the scope page with that key,
     * `path[1]` a live child of that page, and so on. Returns the last page, or null when any step is
     * missing, deleted, or unreadable under `read`. An empty path returns null.
     */
    getPageByPath(input: {
        scopeId: string;
        path: string[];
        read: KnowledgeReadScope;
    }): Promise<KnowledgePage | null>;
    /** Exact canonical-name matches among readable live pages, newest first. */
    findPagesByName(input: {
        name: string;
        read: KnowledgeReadScope;
        scopeId?: string;
        limit?: number;
    }): Promise<KnowledgePage[]>;
    /** Readable live ordinary pages under a parent, by position then id. Scope pages are not included. */
    listChildPages(input: {
        parentId: string;
        read: KnowledgeReadScope;
        cursor?: string;
        limit?: number;
    }): Promise<KnowledgePageListOutput>;
    /**
     * How many readable live ordinary child pages each parent has, keyed by parent id; one call for all
     * the parents. Counts the pages {@link listChildPages} would list. Parents with none map to 0;
     * duplicate ids count once.
     */
    countChildPages(input: {
        parentIds: string[];
        read: KnowledgeReadScope;
    }): Promise<Record<string, number>>;
    /**
     * Replaces every body link from `pageId` with `links` in one transaction (an empty list clears
     * them). Rows are keyed by (`pageId`, `ref`); duplicate refs in `links` are a caller error, and no ref
     * is longer than {@link MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH} characters. The store
     * doesn't check the page exists or resolve anything: core resolves refs and calls this on every body
     * write, move, merge and delete. Rows stay when a page is soft-deleted until core clears them, and
     * reads hide them either way.
     */
    replacePageBodyLinks(input: {
        pageId: string;
        links: KnowledgePageBodyLink[];
    }): Promise<void>;
    /**
     * Source page ids (distinct, any order, unfiltered: core-internal) of body links that are
     * unresolved with a `ref` in `refs`, or resolved to a page in `toPageIds`. Core re-resolves these
     * sources after a page is created, moved, renamed, merged or deleted.
     */
    listPageBodyLinkSources(input: {
        refs?: string[];
        toPageIds?: string[];
    }): Promise<string[]>;
    /**
     * For each page id, how many distinct other pages link to it and it links to, keyed by page id;
     * one call for all the pages. Counts only resolved links whose both ends are live and readable
     * under `read`; a `note` link also needs a live note that is visible under `read` (the same rule as
     * {@link listNotes}). Self-links don't count. `kinds` defaults to both. Ids that are missing,
     * deleted or unreadable map to `{ in: 0, out: 0 }`, so a count never reveals a hidden page.
     */
    countPageLinks(input: {
        pageIds: string[];
        read: KnowledgeReadScope;
        kinds?: KnowledgePageLinkKind[];
    }): Promise<Record<string, KnowledgePageLinkCounts>>;
    /**
     * The resolved links touching `pageIds` (`out`: from them, `in`: to them, `both`: either; default
     * `both`), filtered exactly as {@link countPageLinks}: both ends live and readable, note links only
     * through visible notes, no self-links. One edge per (from, to, kind), ordered by `fromPageId`,
     * `toPageId`, then `kind` (`body` first); at most `limit`, a positive integer (default 1,000, capped at
     * {@link MAX_KNOWLEDGE_PAGE_LINKS}).
     */
    listPageLinks(input: {
        pageIds: string[];
        read: KnowledgeReadScope;
        direction?: 'in' | 'out' | 'both';
        kinds?: KnowledgePageLinkKind[];
        limit?: number;
    }): Promise<KnowledgePageLinkEdge[]>;
    /** Readable live ordinary pages, optionally in one scope and by name prefix, by name then id. */
    listPages(input: {
        read: KnowledgeReadScope;
        scopeId?: string;
        namePrefix?: string;
        cursor?: string;
        limit?: number;
    }): Promise<KnowledgePageListOutput>;
    createPage(input: CreateKnowledgePageInput): Promise<KnowledgePage>;
    updatePage(input: UpdateKnowledgePageInput): Promise<KnowledgePage>;
    /**
     * Moves the page and its subtree in one transaction; refuses scope pages, cycles, depth and size,
     * and refuses with {@link KnowledgePageKeyConflictError}, before changing anything, when the moved
     * page's key is already used by a live child of the new parent (descendants keep their parents, so
     * they never clash). Old key paths stop resolving; there are no redirects. Size and depth count live pages only;
     * soft-deleted descendants move with their parents without counting.
     */
    movePage(input: MoveKnowledgePageInput): Promise<KnowledgePage>;
    /**
     * Moves the source's notes, child pages and pin audience to the target, retargets mentions of the
     * source, and soft-deletes the source with `mergedInto`. Notes keep their stamps and text. Refuses
     * scope pages on either side, a target inside the source's subtree (or the source itself), and
     * merges past the depth limit or {@link MAX_KNOWLEDGE_MOVE_PAGES} carried pages, and, with
     * {@link KnowledgePageKeyConflictError}, a live child of the source whose key a live child of the
     * target already uses (the source itself is deleted, so its own key never clashes).
     */
    mergePages(input: MergeKnowledgePagesInput): Promise<KnowledgePage>;
    /** Soft-deletes an ordinary page with no live children and drops its pin; refuses scope pages. */
    deletePage(input: {
        id: string;
        expectedVersion: number;
        deletedBy: string;
    }): Promise<KnowledgePage>;
    getNote(input: {
        id: string;
        read: KnowledgeReadScope;
        includeDeleted?: boolean;
    }): Promise<KnowledgeNote | null>;
    /**
     * How many live notes `read` can see on each page, keyed by page id; one call for all the pages.
     * Pages with no visible notes map to 0. Duplicate ids count once.
     */
    countNotes(input: {
        pageIds: string[];
        read: KnowledgeReadScope;
    }): Promise<Record<string, number>>;
    /** Visible notes on a page, oldest first. */
    listNotes(input: {
        pageId: string;
        read: KnowledgeReadScope;
        cursor?: string;
        limit?: number;
        includeDeleted?: boolean;
    }): Promise<KnowledgeNoteListOutput>;
    /** Visible notes on other pages that mention this page, newest first. */
    listNotesMentioning(input: {
        pageId: string;
        read: KnowledgeReadScope;
        cursor?: string;
        limit?: number;
    }): Promise<KnowledgeNoteListOutput>;
    addNote(input: AddKnowledgeNoteInput): Promise<KnowledgeNote>;
    restampNote(input: {
        id: string;
        expectedVersion: number;
        stampScopeIds: string[];
        provenance: KnowledgeProvenance;
    }): Promise<KnowledgeNote>;
    removeNote(input: {
        id: string;
        deletedBy: string;
        provenance: KnowledgeProvenance;
    }): Promise<KnowledgeNote>;
    restoreNote(input: {
        id: string;
        provenance: KnowledgeProvenance;
    }): Promise<KnowledgeNote>;
    /**
     * Lexical search over page names, descriptions, bodies and note text; access filtered before ranking
     * and the limit. The query is split on whitespace into lowercased, deduplicated words (an empty
     * query returns nothing); each word matches as a case-insensitive substring. A page hits when at
     * least one word appears in its name, description or body; a note hits when at least one word
     * appears in its text. Scope pages are never returned. Pages are ranked by how many query words they contain (anywhere in the name, description or body), then by points (each matched word earns 3 if it is in the name, else 2 if in the description, else 1 if in the body). Results: pages whose canonical name contains the whole query (trimmed, lowercased, whitespace runs collapsed to one space), then the other page hits, each group most words matched first, then highest points, then newest `updatedAt`, then id ascending; then notes (most query words first, then newest `updatedAt`, then id descending), truncated to `limit`. No quoting or operators.
     */
    searchPages(input: SearchKnowledgePagesInput): Promise<KnowledgePageSearchHit[]>;
    /**
     * Events newest first, filtered by the page's and note's state now, not when the event happened:
     * an event is returned only while its page's current home scope is readable under `read` (deleted
     * and merged-away pages included, so a page moved somewhere unreadable takes its whole history with
     * it), and a note event only while the note is also visible (a stamp readable, every resolved
     * mention's page scope readable). The log never reveals a hidden page's or note's id, author or
     * source thread. `scopeId` on an event is the home scope after the change (the target for a move or
     * merge); the `scopeId` filter matches the page's current home scope.
     */
    listPageActivity(input: {
        read: KnowledgeReadScope;
        scopeId?: string;
        pageId?: string;
        cursor?: string;
        limit?: number;
    }): Promise<{
        events: KnowledgePageActivityEvent[];
        nextCursor?: string;
    }>;
    /**
     * Adds audience entries to the page's pin of `kind` (default `page`), creating it if needed. A `list`
     * pin takes `depth` (default 1; core checks it is 1 to {@link MAX_KNOWLEDGE_PIN_LIST_DEPTH} before
     * calling); pinning it again with another depth sets the new depth. `page` pins ignore `depth`.
     */
    addPinAudience(input: {
        pageId: string;
        kind?: KnowledgePinKind;
        depth?: number;
        audience: string[];
        createdBy: string;
    }): Promise<KnowledgePin>;
    /**
     * Removes audience entries from the page's pin of `kind` (default `page`); the pin is deleted when none
     * remain. Returns null when no pin is left.
     */
    removePinAudience(input: {
        pageId: string;
        kind?: KnowledgePinKind;
        audience: string[];
        removedBy: string;
    }): Promise<KnowledgePin | null>;
    /**
     * Pins of both kinds on readable live pages, newest first (`createdAt` desc, then `id` desc): those
     * whose audience intersects `audience`, or every pin for `'all'`. `'all'` is for host surfaces behind
     * their own auth (Studio); runs always pass their own scopes. `pageIds` narrows to those pages and
     * `kind` to that kind. `excludePageIds` leaves out `page` pins on those pages; `withBody` keeps only
     * `page` pins whose page body has a non-whitespace character (neither touches `list` pins). Each pin
     * carries its page's name. `count` adds `total`, the number of matching pins across all pages of the
     * listing.
     */
    listPins(input: {
        audience: string[] | 'all';
        read: KnowledgeReadScope;
        kind?: KnowledgePinKind;
        pageIds?: string[];
        excludePageIds?: string[];
        withBody?: boolean;
        count?: boolean;
        cursor?: string;
        limit?: number;
    }): Promise<{
        pins: KnowledgeListedPin[];
        nextCursor?: string;
        total?: number;
    }>;
}
//# sourceMappingURL=pages.d.ts.map