/** * Read side of federated procedural memory: the `list_skills` / `get_skill` * payloads. Port of the engine's `core/skill_tools.py` (plan 005, phase 3). * * Two kinds of skill reach a caller: * * - **shared** -- promoted into the library's skill store (`promoteSkill` in * `@getbourdon/participants`). Org tier: readable by every caller allowed to * read the federation, writable only by promotion. Each row carries its * provenance (`source_agent`, `promoted_by`, `version`, `content_sha256`) * and its own `visibility`. * - **advertised** -- a SkillRef an agent lists in its L5 manifest (discovery * only). Refs with the same `content_sha256` are one row naming every agent * that advertises them. * * A body is served only for a shared skill. An advertised skill is never read * from an agent's folder over MCP: {@link getSkillPayload} returns its index * data and says it must be promoted first. * * The functions here are pure over a store and two caller-derived inputs (the * clamped access level and a namespace predicate), so the server's * authorization stays in one place (`server.ts`) and the payloads are testable * without a transport. */ import { type L6Store } from "@getbourdon/federation"; import { type SkillIndexRow } from "@getbourdon/participants"; type Dict = Record; export declare const TIER_SHARED = "shared"; export declare const TIER_ADVERTISED = "advertised"; /** A skill proposed for the shared library and awaiting a person's approval * (plan 005, phase 4). */ export declare const TIER_PROPOSED = "proposed"; /** An advertised copy compared with the shared library: same bytes, or a * different version of a skill that is shared under the same name. */ export declare const STATUS_MATCHES = "matches"; export declare const STATUS_DIVERGED = "diverged"; export declare const MAX_QUERY_CHARS = 200; export declare const PROMOTE_FIRST_MESSAGE: string; export declare const FILES_WITHHELD_MESSAGE = "Reference file contents are not served to quarantined callers."; /** Live, unretired shared rows whose `visibility` is within `accessLevel`. */ export declare function visibleSharedRows(libraryPath: string, accessLevel: string): SkillIndexRow[]; export interface SkillReadScope { accessLevel: string; mayRead: (agentId: string) => boolean; } /** * Advertised refs the caller may read, one row per `content_sha256`. * * Only namespaces `mayRead` admits are read, and each manifest is * visibility-filtered at `accessLevel` before a ref is looked at. A row names * every agent advertising those bytes (`advertised_by`). `shared` (rows the * caller may see) adds a `shared` comparison: `matches` when the bytes equal a * shared version's, `diverged` when a shared skill has the same name but other * bytes. */ export declare function advertisedSkillRows(store: L6Store, scope: SkillReadScope & { shared?: readonly SkillIndexRow[]; }): Dict[]; /** The `list_skills` response: shared rows first, then advertised rows. */ export declare function listSkillsPayload(store: L6Store, options: SkillReadScope & { query?: string | null; includeLocal?: boolean; /** Pending proposal summaries the server already decided this caller may * see; each becomes a `proposed` row. */ proposals?: readonly Dict[]; }): Dict; /** * The `get_skill` response. * * A shared skill the caller may see returns its provenance, its `SKILL.md` * text as `body` and, with `includeFiles`, its reference files (`file` and * size; the text too when `serveFileContents`). The stored bytes are re-hashed * before anything is served, and a version whose bytes do not match its row, * or exceed the store's size caps, is refused. A retired skill is served only * by explicit `version`. * * A name that is not shared but that a readable agent advertises returns the * advertised rows and {@link PROMOTE_FIRST_MESSAGE}, never a body. A name the * caller cannot see is reported exactly like a name that does not exist. */ export declare function getSkillPayload(store: L6Store, name: string, options: SkillReadScope & { version?: number | null; includeFiles?: boolean; serveFileContents?: boolean; }): Dict; export {};