import type { Scalars, SeedContainerInput, SeedContainerTypeInput, SeedEdgeInput, SeedFunctionInput, SeedGameModelInput, SeedPropertyDefInput, UpsertAutomationInput, UpsertAutomationTriggerInput } from '../../generated/graphql.js'; /** * A composable invoke-policy rule tree, mirroring the server's authority * rules (see the Game API "Game Models → Authority" guide). Serialized with * {@link kitPolicyJson} into the `invokePolicyJson` a function carries. */ export type KitInvokePolicy = { type: 'allow'; } | { type: 'owner_of_self'; } | { type: 'is_host'; } | { type: 'is_current_turn'; } | { type: 'is_participant'; } | { type: 'is_automation'; } | { type: 'tier_feature'; feature: string; } | { type: 'group_permission'; groupId: string; permission?: string; } | { type: 'grid_permission'; key: string; gridId?: string; } | { type: 'condition'; expression: string; } | { type: 'and'; rules: KitInvokePolicy[]; } | { type: 'or'; rules: KitInvokePolicy[]; } | { type: 'not'; rule: KitInvokePolicy; }; /** Serialize a {@link KitInvokePolicy} tree to the wire `invokePolicyJson`. */ export declare function kitPolicyJson(policy: KitInvokePolicy): string; /** * A grid-permission filter inside a selector: gates selves/candidates by * whether the USER behind each container has/lacks an unexpired runtime grid * permission. Requires a game-api with the permission-read selector support * (v0.13.12+). */ export interface SelectorPermissionPredicate { /** Where the container's user id comes from: its owner, or a property. */ userFrom: 'owner' | { property: string; }; op: 'has' | 'lacks'; /** Runtime permission key (e.g. 'access', 'update_voxel_data'). */ key: string; /** Literal grid id, a property holding one, or omitted for "on ANY grid". */ grid?: number | string | { property: string; }; } /** * Typed automation selector (serialized into `selectorJson` at deploy). * Property predicates (`selfWhere`/`where`) filter on model data; permission * predicates (`selfPermissionWhere`/`candidatePermissionWhere`) filter on the * live grid ACL. Extra fields pass through untouched. */ export interface KitSelectorSpec { selfWhere?: Array<{ key: string; op: string; value: unknown; }>; selfPermissionWhere?: SelectorPermissionPredicate[]; pick?: 'nearest' | 'lowest' | 'highest' | 'random'; ofType?: string; where?: Array<{ key: string; op: string; value: unknown; }>; candidatePermissionWhere?: SelectorPermissionPredicate[]; by?: 'manhattan' | { property: string; }; bindAs?: { ref?: string; x?: string; y?: string; approachX?: string; approachY?: string; approachStop?: number; }; [key: string]: unknown; } /** An automation spec inside a blueprint (the `appId` is bound at deploy). */ export type KitAutomationSpec = Omit; /** An automation event-trigger spec inside a blueprint. */ export type KitAutomationTriggerSpec = Omit; /** * A **blueprint**: a self-contained, declarative bundle of game-model * definitions (container types, property defs, functions), optional seed * instances, and optional automations that together implement one game * concept (an inventory system, a lockable object, an NPC archetype). * * Blueprints are plain data — build them with {@link inventoryBlueprint}, * {@link lockBlueprint}, {@link npcBlueprint}, or by hand — then load them * into an app with `client.kit(appId).deploy([...])` (requires the app-admin * `manage_apps` permission). Deployment is idempotent: seeding upserts * definitions and `upsertAutomation` keys on the automation name. */ export interface KitBlueprint { /** A short identifier used in error messages (e.g. `'inventory'`). */ name: string; containerTypes?: SeedContainerTypeInput[]; propertyDefinitions?: SeedPropertyDefInput[]; functions?: SeedFunctionInput[]; /** Optional shared/world containers to seed (catalog data, world objects). */ containers?: SeedContainerInput[]; /** Optional edges between seeded containers (by `tempId`). */ edges?: SeedEdgeInput[]; /** Server-driven automations to upsert after the seed. */ automations?: KitAutomationSpec[]; /** Event triggers to attach to the automations. */ automationTriggers?: KitAutomationTriggerSpec[]; } /** Convert `PascalCase`/`camelCase` to `snake_case` for derived names. */ export declare function toSnakeCase(name: string): string; /** The wire payloads {@link mergeBlueprints} produces for one deployment. */ export interface MergedBlueprints { seedInput: SeedGameModelInput; automations: UpsertAutomationInput[]; automationTriggers: UpsertAutomationTriggerInput[]; } /** * Merge blueprints into a single `gameModelSeed` payload plus the automation * upserts, rejecting duplicate type, property, function, or automation names * across blueprints (a duplicate almost always means two blueprints need * distinct prefixes/type names). */ export declare function mergeBlueprints(appId: Scalars['BigInt']['input'], blueprints: KitBlueprint[], options?: { sessionId?: string; }): MergedBlueprints; /** * Concatenate several blueprints into ONE composite blueprint (a plain * client-side merge of the definition arrays — no collision checks; those * happen in {@link mergeBlueprints} at deploy). Used by composite builders * such as `guildBlueprint` that bundle other builders' output under a single * name. */ export declare function composeBlueprints(name: string, blueprints: KitBlueprint[]): KitBlueprint; /** * Who may call a **trusted** mutation (XP grants, score submits, loot rolls, * currency mints, …) — the kit-standard authority shape mirroring * `LockAuthority` (Part of the anti-cheat conventions: reward-granting * functions must never be plain player calls): * * - `'server'` — `invokeScope: "server"`: only app admins may invoke (run it * from trusted studio/backend code holding `manage_apps`). * - `'host'` — `is_host` policy: the elected host client may invoke. * - `'automation'` — `autonomousInvocable` + `is_automation` policy: only * server-driven automations may invoke. * - `'owner'` — `owner_of_self`: the owning player (only safe for * self-limiting functions guarded by conditions). * - `{ custom: rule }` — any hand-written policy rule. */ export type KitTrustedAuthority = 'server' | 'host' | 'automation' | 'owner' | { custom: KitInvokePolicy; }; /** * The function-level fields a {@link KitTrustedAuthority} compiles to. * `extraCondition` (when given) is AND'ed into the policy. */ export declare function trustedAuthorityFields(authority: KitTrustedAuthority, extraCondition?: string): Pick<{ invokePolicyJson: string; invokeScope?: string; autonomousInvocable?: boolean; }, 'invokePolicyJson' | 'invokeScope' | 'autonomousInvocable'>; /** * AND extra policy rules into a base policy (skipping empties) — the * composition point for `policyExtra` options such as * `plotBlueprint({ buyPolicyExtra: featureGate('land_owner') })`. */ export declare function andPolicies(base: KitInvokePolicy, ...extra: Array): KitInvokePolicy; /** * A `tier_feature` policy leaf: the caller's access tier must hold `feature` * (defined via `kit.features.define` and granted with * `kit.features.grantToTier`). Pass it to any builder's `*policyExtra` * option to monetization-gate that function. */ export declare function featureGate(feature: string): KitInvokePolicy; /** * How kit types mirror their owner's user id into an `owner_user_id` * property (expressions cannot read container ownership directly). * The kit standard is `'int'`; set `'string'` on a builder only when * integrating with models that mirrored the owner as a string (e.g. Blocks * with Friends) — generated conditions then compare via `to_string(...)`. */ export type KitOwnerIdKind = 'int' | 'string'; /** * Expression fragment asserting that `ownerExpr` (an `owner_user_id`-style * property read) equals a user-id expression (usually the injected * `$caller_user_id` / `$self_owner_id` system params), honoring * {@link KitOwnerIdKind}. */ export declare function ownerEquals(ownerExpr: string, userExpr: string, kind?: KitOwnerIdKind): string; /** * Expression fragment asserting that `ownerExpr` (an `owner_user_id`-style * property read) equals the calling user, honoring {@link KitOwnerIdKind}. */ export declare function ownerEqualsCaller(ownerExpr: string, kind?: KitOwnerIdKind): string; /** The `SeedPropertyDefInput` for a kit-standard owner mirror property. */ export declare function ownerMirrorProperty(containerTypeName: string, kind?: KitOwnerIdKind): { containerTypeName: string; key: string; valueType: string; defaultValueJson: string; description: string; }; //# sourceMappingURL=core.d.ts.map