/** * Connector source registry: canonicalizes and classifies the `source` tag * carried on inbound messages (discord, telegram, farcaster,...). Owners * register a canonical source with aliases and metadata (`sourceKind` * active/passive, `isPassive`); lookups normalize a raw source to its canonical * form, expand a source filter across all known aliases, and report whether a * source is passive. * * State is process-global and owner-scoped: registrations accumulate per owner * and merge on read, so plugins can contribute aliases without clobbering each * other, and an owner's contributions can be unregistered wholesale. */ export type ConnectorSourceKind = "passive" | "active"; /** * Connector-owned mapping from flat memory metadata to normalized source identity fields. */ export interface ConnectorIdentityMetadataMapping { /** Flat metadata key holding the stable platform user id (maps to `userId` + `id`). */ userIdField: string; /** Optional flat metadata key holding a display/handle (maps to `name` + `username`). */ nameField?: string; } export interface ConnectorSourceMetadata { aliases?: readonly string[]; sourceKind?: ConnectorSourceKind; isPassive?: boolean; /** * How this connector's flat Memory metadata fields project into the nested * `metadata[source]` identity object used by role resolution. When present, * core reads identity from the declared fields instead of a connector-specific * literal branch. */ identityMetadataMapping?: ConnectorIdentityMetadataMapping; /** * Ordered list of flat Memory metadata keys this connector uses to derive a * world id (first present, non-empty string wins). Replaces connector-specific * literals like `discordServerId`/`discordChannelId` in core. */ worldIdMetadataKeys?: readonly string[]; } export interface ConnectorSourceDefinition extends ConnectorSourceMetadata { source: string; } export declare function registerConnectorSourceAliases(canonical: string, aliases: readonly string[]): void; export declare function registerConnectorSourceMetadata(canonical: string, metadata: ConnectorSourceMetadata, owner?: string): void; export declare function registerConnectorSourceDefinitions(definitions: readonly ConnectorSourceDefinition[] | null | undefined, owner?: string): void; export declare function unregisterConnectorSourceMetadataOwner(owner: string): void; export declare function normalizeConnectorSource(source: string | null | undefined): string; export declare function getConnectorSourceAliases(source: string | null | undefined): string[]; export declare function getConnectorSourceMetadata(source: string | null | undefined): ConnectorSourceMetadata | null; export declare function isPassiveConnectorSource(source: string | null | undefined): boolean; /** * The declared flat-field → nested-identity projection for a connector source, * or `null` if the connector registered none. Lets core read a connector's * identity mapping from the registry instead of a `source === "..."` literal. */ export declare function getConnectorIdentityMetadataMapping(source: string | null | undefined): ConnectorIdentityMetadataMapping | null; /** * The ordered flat metadata keys a connector uses to derive a world id, or an * empty array if none were declared. Replaces connector-specific world-id * literals in core. */ export declare function getConnectorWorldIdMetadataKeys(source: string | null | undefined): string[]; export declare function expandConnectorSourceFilter(sources: Iterable | null | undefined): Set; /** Owner key for the built-in Discord source metadata projection. */ export declare const LEGACY_DISCORD_CONNECTOR_SOURCE_OWNER = "core:legacy-discord-metadata"; /** Discord source-field mappings for identity and world derivation. Core resolves connector metadata through the registry. */ export declare const LEGACY_DISCORD_CONNECTOR_SOURCE_METADATA: ConnectorSourceMetadata;