import type { GameModelAPI } from '../domains/gameModel.js'; import type { EngineDetector } from './engine.js'; import type { Scalars } from '../generated/graphql.js'; import { type KitInvokeResult } from './shared.js'; /** Options for {@link DecksKit}. Must match the deployed decks blueprint. */ export interface DecksKitOptions { /** * The compute module holding hidden hands when the app runs a deck * engine. Defaults to `'deck-engine'`. */ engineModuleName?: string; /** The `typePrefix` the decks blueprint was deployed with. */ typePrefix?: string; } /** A parsed view of one card instance, as visible to the CALLER. */ export interface KitCard { containerId: string; displayName: string; ownerUserId: string | null; /** * The hidden identity — non-empty only when the caller may see it (their * own cards, or any revealed card via `revealedCardId`). */ cardId: string; /** The public identity (empty until played/discarded). */ revealedCardId: string; zone: string; position: number; } /** * Runtime helpers for the {@link decksBlueprint} conventions: deal * session-scoped cards, shuffle by dealing random positions (admin-run * automation), and draw/play/discard through the zone-guarded functions. * Hidden information is enforced by property visibility server-side: reads * go through `containerState`, which strips other players' `card_id`. * * Obtained via `client.kit(appId).decks`. */ export declare class DecksKit { private readonly appId; private readonly gameModel; private readonly engines?; private readonly names; constructor(appId: Scalars['BigInt']['input'], gameModel: GameModelAPI, options?: DecksKitOptions, engines?: EngineDetector | undefined); private readonly engineModuleName; /** * Is a deck compute engine deployed + enabled (cached per session)? When * true, hands and deck order live in MODULE state (server-held secrets); * the blueprint's owner-visibility hands remain for model-only apps. */ engineAvailable(): Promise; /** Create an engine table with seeded shuffle + hidden deals (creator seats itself). */ engineNewTable(input: { tableId: string; players: string[]; handSize?: number; deckDef?: string; }): Promise>; /** YOUR hidden hand (the only read path; opponents can never see it). */ engineHand(tableId: string): Promise; /** Draw one card into your hidden hand. */ engineDraw(tableId: string): Promise>; /** Play (reveal) a card from your hand into a public zone. */ enginePlay(tableId: string, card: string, zone?: string): Promise>; /** Collect a public zone to the discard (trick taken). */ engineTakeZone(tableId: string, zone: string): Promise>; /** The public table view (counts + zones — never hidden hands). */ engineTable(tableId: string): Promise>; private engineInvoke; /** * Deal a deck to a player: creates one CardInstance per card id (zone * `deck`), owned by the player. Run {@link shuffle} afterwards to deal * random positions. */ deal(input: { ownerUserId: Scalars['BigInt']['input']; cardIds: string[]; sessionId?: string; }): Promise<{ __typename?: "GmContainer"; containerId: string; appId: string; sessionId: string | null; typeName: string; displayName: string; description: string | null; ownerUserId: string | null; metadataJson: string; }[]>; /** * Shuffle every deck-zone card by running the manual `assign_position` * automation (admin): each card gets a fresh `rand_int` position * server-side. */ shuffle(): Promise<{ __typename?: "GmAutomationRun"; runId: string; appId: string; flowId: string | null; automationId: string | null; automationName: string; triggerSource: string; triggerId: string | null; parentRunId: string | null; cascadeDepth: number; startedAt: string; finishedAt: string | null; durationUs: number; targets: number; invocations: number; mutations: number; fnCalls: number; gasUsed: number; success: boolean; errorMessage: string | null; circuitAction: string | null; computeUnits: number; }>; /** A player's cards in one zone, as visible to the caller. */ cards(ownerUserId: Scalars['BigInt']['input'] | null, options?: { zone?: string; sessionId?: string; }): Promise; /** Your hand (owner-visible card ids included by the server). */ myHand(ownerUserId: Scalars['BigInt']['input'], options?: { sessionId?: string; }): Promise; /** Every card on the board (public: revealed ids). */ board(options?: { sessionId?: string; }): Promise; /** * Draw the top of your deck (lowest position — positions were dealt by * the shuffle automation). The server enforces ownership, turn (when * `turnBased`), and the deck→hand zone transition. */ draw(ownerUserId: Scalars['BigInt']['input'], options?: { sessionId?: string; }): Promise>; /** Draw one specific deck card (prefer {@link draw} for top-of-deck). */ drawCard(cardInstanceId: string, options?: { sessionId?: string; }): Promise>; /** * Play a card from your hand: the zone flip and the public reveal commit * together. Resolves with the revealed card id. */ play(cardInstanceId: string, options?: { sessionId?: string; }): Promise>; /** Discard a card face-up. */ discard(cardInstanceId: string, options?: { sessionId?: string; }): Promise>; private toCard; } //# sourceMappingURL=decks.d.ts.map