import type { ChannelsAPI } from '../domains/channels.js'; import type { GameAppsAPI } from '../domains/gameApps.js'; import type { TeamsAPI } from '../domains/teams.js'; import type { UdpAPI } from '../domains/udp.js'; import type { Scalars } from '../generated/graphql.js'; /** Options for {@link SocialKit}. */ export interface SocialKitOptions { /** * The 32-ASCII-char actor uuid used as the sender id on chat messages. * Defaults to a random uuid per kit instance — set it to YOUR actor uuid * so receivers can attribute messages. */ actorUuid?: string; /** Name prefix for party teams/channels. Defaults to `'party:'`. */ partyPrefix?: string; /** Name prefix for guild teams/channels. Defaults to `'guild:'`. */ guildPrefix?: string; } /** A party or guild: the team plus its paired chat channel. */ export interface KitGroupWithChannel { /** The team's group id (membership/roles live here). */ teamId: string; /** The paired chat channel's group id (may be '' if pairing failed). */ channelId: string; name: string; } /** A decoded chat message from a kit chat room. */ export interface KitChatMessage { channelId: string; /** The sender's actor uuid (attribution is by app convention). */ senderUuid: string; text: string; epochMillis: string; } /** * Runtime **social** helpers — parties, guilds, and chat rooms in familiar * words, wrapped over the platform's teams (membership + roles) and * channels (location-independent messaging) with realtime delivery via the * UDP notification subscription. No model schema needed; the only * deployable is the optional {@link guildBlueprint} composite (guild hall + * bank). * * Conventions: a party is a team named `party:` paired with an * equally-named channel; a guild is `guild:` likewise. Guild * territory = a grid group-grant (`claimTerritory`), enforced by the * replication layer. * * Obtained via `client.kit(appId).social`. */ export declare class SocialKit { private readonly appId; private readonly teams; private readonly channels; private readonly udp; private readonly gameApps; private readonly actorUuid; private readonly partyPrefix; private readonly guildPrefix; constructor(appId: Scalars['BigInt']['input'], teams: TeamsAPI | undefined, channels: ChannelsAPI | undefined, udp: UdpAPI | undefined, gameApps: GameAppsAPI, options?: SocialKitOptions); private requireTeams; private requireChannels; private requireUdp; /** Create a team + equally-named chat channel pair. */ private createPair; /** Find a team + channel pair by its full name. */ private findPair; /** Parties: small invite-based groups with their own chat channel. */ readonly party: { /** Create a party (invite-only by default). The creator becomes leader. */ create: (name: string) => Promise; /** Find a party by name. */ find: (name: string) => Promise; /** * Invite (add) a player to the party — requires the leader's * `manage_members`. Adds them to the chat channel membership too. */ invite: (party: KitGroupWithChannel, userId: Scalars["BigInt"]["input"]) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }>; /** Join an open party (and its chat channel) as the caller. */ join: (party: KitGroupWithChannel) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }>; /** Leave the party (and its chat channel). */ leave: (party: KitGroupWithChannel) => Promise; /** The party roster. */ members: (party: KitGroupWithChannel) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }[]>; }; /** Guilds: persistent role-based organizations with chat + territory. */ readonly guild: { /** Create a guild (request-to-join by default). The creator becomes leader. */ create: (name: string, options?: { membershipPolicy?: string; description?: string; }) => Promise; /** Find a guild by name. */ find: (name: string) => Promise; /** The guild roster (members + pending join requests). */ roster: (guild: KitGroupWithChannel) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }[]>; /** The guild's roles (including the system leader role). */ roles: (guild: KitGroupWithChannel) => Promise<{ __typename?: "GroupRole"; groupRoleId: string; groupId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; createdAt: string; }[]>; /** Create a custom guild role (requires `manage_roles`). */ createRole: (guild: KitGroupWithChannel, input: { roleName: string; permissions?: string[]; rank?: number; }) => Promise<{ __typename?: "GroupRole"; groupRoleId: string; groupId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; createdAt: string; }>; /** * Promote/demote a member: REPLACES their role set (requires * `manage_roles`). */ promote: (guild: KitGroupWithChannel, userId: Scalars["BigInt"]["input"], roleIds: string[]) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }>; /** * Claim territory for the guild: grants runtime permission keys on a * grid to every guild member (optionally one role) — enforced by the * replication layer on movement/voxel writes. Requires grid admin * rights on the app. */ claimTerritory: (guild: KitGroupWithChannel, gridId: Scalars["BigInt"]["input"], options?: { permissionKeys?: string[]; groupRoleId?: string; }) => Promise<{ __typename?: "GridGroupGrant"; appId: string; gridId: string; groupId: string; groupRoleId: string | null; permissionKey: string; expiresAt: string | null; }[]>; }; /** Chat rooms: named channels with realtime text delivery. */ readonly chat: { /** Find-or-create a chat room (an open channel) by name. */ room: (name: string) => Promise<{ __typename?: "Group"; groupId: string; appId: string; groupType: string; name: string; description: string | null; ownerUserId: string | null; membershipPolicy: string; status: string; defaultRoleId: string | null; createdAt: string; }>; /** Join a chat room. */ join: (channelId: Scalars["BigInt"]["input"]) => Promise<{ __typename?: "GroupMember"; groupMemberId: string; groupId: string; userId: string; status: string; createdAt: string; roles: Array<{ __typename?: "GroupRole"; groupRoleId: string; roleName: string; rank: number; isSystem: boolean; permissions: Array; }>; }>; /** * Send a UTF-8 text message to a room (requires channel membership with * `send_messages`). Delivery is fan-out to every active member's * notification subscription, regardless of world location. */ send: (channelId: Scalars["BigInt"]["input"], text: string) => Promise; /** * Listen for messages in one room: decodes each ping's payload as UTF-8 * text. Returns the unsubscribe function. */ onMessage: (channelId: Scalars["BigInt"]["input"], callback: (message: KitChatMessage) => void) => (() => void); }; } //# sourceMappingURL=social.d.ts.map